Add protection check when placing twigs from trunks mod

这个提交包含在:
Sys Quatre 2020-07-24 23:14:34 +02:00
父节点 031260a62d
当前提交 5b66d54632
共有 1 个文件被更改,包括 8 次插入6 次删除

查看文件

@ -44,13 +44,15 @@ for i in pairs(NoDe) do
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
local direction = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.get_node(pt.above).name=="air" then
minetest.swap_node(pt.above, {name="trunks:twig_"..random(1,4), param2=direction})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
if not minetest.is_protected(pt.above, placer:get_player_name()) then
local direction = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.get_node(pt.above).name=="air" then
minetest.swap_node(pt.above, {name="trunks:twig_"..random(1,4), param2=direction})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
return itemstack
end
end,
})