The nodebox drawtype has a subtype called "connected" which allows a single node definition to connect to it's neighbors visually. You define a normal nodebox for the "fixed" portion which is the default look if the nodebox has no valid nodes that it can connect to. You can then define additional nodeboxes, that get added to the fixed one, for each of 6 directions that there is a valid block. Any of these can be left off without causng errors; the block will just not react when a valid block is in that direction.
(this is what I missed) To define what a valid connecting block is you must define the "connected_to" table and add a list of full block names. (mod_name:block_name)
here is a quick example (not tested, made changes from what I was testing so generally it should be right)
Code: Select all
minetest.register_node("frame:frame2", {
description = "Spacestation Frame",
paramtype = "light",
drop = "frame:frame2",
--These 3 are needed for it to work
drawtype = "nodebox",
node_box = {
type ="connected",
--default look with no valid connectable ajacent nodes
fixed = frame.frame_nodebox.frame_fixed,
--You can leave out any of the following and it should still work it just will not connect in that direction.
connect_top = frame.frame_nodebox.frame_top_connect,
connect_bottom = frame.frame_nodebox.frame_bottom_connect,
connect_front = frame.frame_nodebox.frame_front_connect,
connect_left = frame.frame_nodebox.frame_left_connect,
connect_back =frame.frame_nodebox.frame_back_connect,
connect_right = frame.frame_nodebox.frame_right_connect
},
connects_to = { "frame:frame2" }, --needed to know what blocks are valid connectable blocks. Without it none of the extra nodeboxes will be used
})