allow "air" to be set in expand.top/forward/right to allow for better handled multinode meshnodes

master
Tim 2015-01-23 00:08:06 +01:00 committed by Vanessa Ezekowitz
parent d6ce145f9c
commit b87ce2d2a7
2 changed files with 5 additions and 4 deletions

View File

@ -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 if is_buildable_to(placer_name, pos, def, pos2) then
local fdir = fdir or minetest.dir_to_facedir(placer:get_look_dir()) local fdir = fdir or minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, { name = node1, param2 = fdir }) 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 -- temporary check if this is a locked node to set its infotext
local nodename = itemstack:get_name() local nodename = itemstack:get_name()

View File

@ -93,7 +93,7 @@ function homedecor.register(name, def)
end end
end end
def.after_dig_node = def.after_dig_node or function(pos, oldnode, oldmetadata, digger) 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 } local top_pos = { x=pos.x, y=pos.y+1, z=pos.z }
if minetest.get_node(top_pos).name == expand.top then if minetest.get_node(top_pos).name == expand.top then
minetest.remove_node(top_pos) minetest.remove_node(top_pos)
@ -103,13 +103,13 @@ function homedecor.register(name, def)
local fdir = oldnode.param2 local fdir = oldnode.param2
if not fdir or fdir > 3 then return end 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] } 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 if minetest.get_node(right_pos).name == expand.right then
minetest.remove_node(right_pos) minetest.remove_node(right_pos)
end end
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] } 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 if minetest.get_node(forward_pos).name == expand.forward then
minetest.remove_node(forward_pos) minetest.remove_node(forward_pos)