forked from mtcontrib/plantlife_modpack
Add protection check when placing twigs from trunks mod
This commit is contained in:
parent
031260a62d
commit
5b66d54632
@ -44,13 +44,15 @@ for i in pairs(NoDe) do
|
|||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local pt = pointed_thing
|
local pt = pointed_thing
|
||||||
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
if not minetest.is_protected(pt.above, placer:get_player_name()) then
|
||||||
if minetest.get_node(pt.above).name=="air" then
|
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
minetest.swap_node(pt.above, {name="trunks:twig_"..random(1,4), param2=direction})
|
if minetest.get_node(pt.above).name=="air" then
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
minetest.swap_node(pt.above, {name="trunks:twig_"..random(1,4), param2=direction})
|
||||||
itemstack:take_item()
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
end
|
end
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user