From b87ce2d2a7adb5e5bd4f9417d4cc2011382ea6b9 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 23 Jan 2015 00:08:06 +0100 Subject: [PATCH] allow "air" to be set in expand.top/forward/right to allow for better handled multinode meshnodes --- homedecor/expansion.lua | 3 ++- homedecor/registration_handler.lua | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/homedecor/expansion.lua b/homedecor/expansion.lua index 28044fa7..dbe9b92b 100644 --- a/homedecor/expansion.lua +++ b/homedecor/expansion.lua @@ -26,7 +26,8 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2) if is_buildable_to(placer_name, pos, def, pos2) then local fdir = fdir or minetest.dir_to_facedir(placer:get_look_dir()) minetest.set_node(pos, { name = node1, param2 = fdir }) - minetest.set_node(pos2, { name = node2 or "air", param2 = node2 and fdir or nil }) + node2 = node2 or "air" -- this can be used to clear buildable_to nodes even though we are using a multinode mesh + minetest.set_node(pos2, { name = node2, param2 = (node2 ~= "air" and fdir) or nil }) -- temporary check if this is a locked node to set its infotext local nodename = itemstack:get_name() diff --git a/homedecor/registration_handler.lua b/homedecor/registration_handler.lua index b503994d..46ff950e 100644 --- a/homedecor/registration_handler.lua +++ b/homedecor/registration_handler.lua @@ -93,7 +93,7 @@ function homedecor.register(name, def) end end def.after_dig_node = def.after_dig_node or function(pos, oldnode, oldmetadata, digger) - if expand.top then + if expand.top and expand.forward ~= "air" then local top_pos = { x=pos.x, y=pos.y+1, z=pos.z } if minetest.get_node(top_pos).name == expand.top then minetest.remove_node(top_pos) @@ -103,13 +103,13 @@ function homedecor.register(name, def) local fdir = oldnode.param2 if not fdir or fdir > 3 then return end - if expand.right then + if expand.right and expand.forward ~= "air" then local right_pos = { x=pos.x+homedecor.fdir_to_right[fdir+1][1], y=pos.y, z=pos.z+homedecor.fdir_to_right[fdir+1][2] } if minetest.get_node(right_pos).name == expand.right then minetest.remove_node(right_pos) end end - if expand.forward then + if expand.forward and expand.forward ~= "air" then local forward_pos = { x=pos.x+homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+homedecor.fdir_to_fwd[fdir+1][2] } if minetest.get_node(forward_pos).name == expand.forward then minetest.remove_node(forward_pos)