forked from mtcontrib/homedecor_modpack
fix fence_with_signs check for content_ignore, prevent it to destroy unknown_nodes and always return the itemstack
This commit is contained in:
parent
d763840b47
commit
40431fc050
@ -858,21 +858,21 @@ function signs_lib.register_fence_with_sign(fencename, fencewithsignname)
|
|||||||
fences_with_sign[fencename] = fencewithsignname
|
fences_with_sign[fencename] = fencewithsignname
|
||||||
|
|
||||||
def_sign.on_place = function(itemstack, placer, pointed_thing, ...)
|
def_sign.on_place = function(itemstack, placer, pointed_thing, ...)
|
||||||
local node_above = minetest.get_node(pointed_thing.above)
|
local node_above = minetest.get_node_or_nil(pointed_thing.above)
|
||||||
local node_under = minetest.get_node(pointed_thing.under)
|
local node_under = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
local def_above = minetest.registered_nodes[node_above.name]
|
local def_above = node_above and minetest.registered_nodes[node_above.name]
|
||||||
local def_under = minetest.registered_nodes[node_under.name]
|
local def_under = node_under and minetest.registered_nodes[node_under.name]
|
||||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
local playername = placer:get_player_name()
|
local playername = placer:get_player_name()
|
||||||
|
|
||||||
if minetest.is_protected(pointed_thing.under, playername) then
|
if minetest.is_protected(pointed_thing.under, playername) then
|
||||||
minetest.record_protection_violation(pointed_thing.under, playername)
|
minetest.record_protection_violation(pointed_thing.under, playername)
|
||||||
return
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.is_protected(pointed_thing.above, playername) then
|
if minetest.is_protected(pointed_thing.above, playername) then
|
||||||
minetest.record_protection_violation(pointed_thing.above, playername)
|
minetest.record_protection_violation(pointed_thing.above, playername)
|
||||||
return
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
if def_under and def_under.on_rightclick then
|
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()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
placer:set_wielded_item(itemstack)
|
placer:set_wielded_item(itemstack)
|
||||||
return itemstack
|
elseif def_above and def_above.buildable_to then
|
||||||
elseif not def_above or def_above.buildable_to then
|
|
||||||
minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir})
|
minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir})
|
||||||
if not signs_lib.expect_infinite_stacks then
|
if not signs_lib.expect_infinite_stacks then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
placer:set_wielded_item(itemstack)
|
placer:set_wielded_item(itemstack)
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
|
return itemstack
|
||||||
end
|
end
|
||||||
def_sign.on_construct = function(pos, ...)
|
def_sign.on_construct = function(pos, ...)
|
||||||
signs_lib.construct_sign(pos)
|
signs_lib.construct_sign(pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user