First, I tried using add_luaentity like so:
Code: Select all
minetest.env:add_luaentity(new_p, "leaf_decay:sapling")
Code: Select all
minetest.env:add_luaentity(new_p, "leaf_decay:sapling")
The second problem is that the following code doesn't work as expected:
Code: Select all
DISTANCE = 3
found_tree = 1
for x=-DISTANCE,DISTANCE do
for y=-DISTANCE,DISTANCE do
for z=-DISTANCE,DISTANCE do
local test_p = {pos.x+x, pos.y+y, pos.z+z}
local test_node = minetest.env:get_node(test_p)
if test_node.name == "default:tree" or test_node.name == "default:jungletree" then
found_tree = 2
break
end
end
if found_tree == 2 then break end
end
if found_tree == 2 then break end
end
if found_tree == 1 then
minetest.env:remove_node(pos)
end
Thanks a bunch, guys.