Limiting tree growth [solved]
I have an idea: remove all trunks and leaves 8 nodes above the dirt. I wrote simple code but I've done something wrong and all trees disappearing. Could you help me?
Thanks in advance
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_abm({
nodenames = {"default:tree", "default:leaves"},
interval = 0,
chance = 1,
action = function(pos)
for r = -8, 0 do
local current_node = {
x = pos.x,
y = pos.y + r,
z = pos.z
}
if(minetest.env:get_node(current_node).name ~= "default:dirt") then
minetest.env:remove_node(pos)
end
end
end
})
Thanks in advance