From 40431fc05045224cf9b69a901a34624b34f2dfa7 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 10 Sep 2015 09:39:58 +0200 Subject: [PATCH] fix fence_with_signs check for content_ignore, prevent it to destroy unknown_nodes and always return the itemstack --- signs_lib/init.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/signs_lib/init.lua b/signs_lib/init.lua index a93fba6d..ce3e37a1 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -858,21 +858,21 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname) fences_with_sign[fencename] = fencewithsignname def_sign.on_place = function(itemstack, placer, pointed_thing, ...) - local node_above = minetest.get_node(pointed_thing.above) - local node_under = minetest.get_node(pointed_thing.under) - local def_above = minetest.registered_nodes[node_above.name] - local def_under = minetest.registered_nodes[node_under.name] + local node_above = minetest.get_node_or_nil(pointed_thing.above) + local node_under = minetest.get_node_or_nil(pointed_thing.under) + local def_above = node_above and minetest.registered_nodes[node_above.name] + local def_under = node_under and minetest.registered_nodes[node_under.name] local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local playername = placer:get_player_name() if minetest.is_protected(pointed_thing.under, playername) then minetest.record_protection_violation(pointed_thing.under, playername) - return + return itemstack end if minetest.is_protected(pointed_thing.above, playername) then minetest.record_protection_violation(pointed_thing.above, playername) - return + return itemstack end if def_under and def_under.on_rightclick then @@ -883,15 +883,14 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname) itemstack:take_item() end placer:set_wielded_item(itemstack) - return itemstack - elseif not def_above or def_above.buildable_to then + elseif def_above and def_above.buildable_to then minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir}) if not signs_lib.expect_infinite_stacks then itemstack:take_item() end placer:set_wielded_item(itemstack) - return itemstack end + return itemstack end def_sign.on_construct = function(pos, ...) signs_lib.construct_sign(pos)