forked from mtcontrib/plantlife_modpack
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
86896848d5
@ -44,15 +44,20 @@ 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
|
||||||
if not minetest.is_protected(pt.above, placer:get_player_name()) then
|
|
||||||
|
if not placer then return end
|
||||||
|
local playername = placer:get_player_name()
|
||||||
|
if minetest.is_protected(pt.above, playername) then
|
||||||
|
minetest.record_protection_violation(pt.above, playername)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
if minetest.get_node(pt.above).name=="air" then
|
if minetest.get_node(pt.above).name=="air" then
|
||||||
minetest.swap_node(pt.above, {name="trunks:twig_"..random(1,4), param2=direction})
|
minetest.swap_node(pt.above, {name="trunks:twig_"..math.random(1,4), param2=direction})
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user