Here is the tree growth that seems to cause a problem when I add it to the code.

- Code: Select all
`llocal generate_birch_tree = function(pos)`

node = {name = ""}

for dy=1,4 do

pos.y = pos.y+dy

if minetest.env:get_node(pos).name ~= "air" then

return

end

pos.y = pos.y-dy

end

node.name = "birch:tree"

for dy=0,4 do

pos.y = pos.y+dy

minetest.env:set_node(pos, node)

pos.y = pos.y-dy

end

node.name = "birch:leaves"

pos.y = pos.y+3

for dx=-2,2 do

for dz=-2,2 do

for dy=0,3 do

pos.x = pos.x+dx

pos.y = pos.y+dy

pos.z = pos.z+dz

if dx == 0 and dz == 0 and dy==3 then

if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then

minetest.env:set_node(pos, node)

end

elseif dx == 0 and dz == 0 and dy==4 then

if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then

minetest.env:set_node(pos, node)

end

elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then

if minetest.env:get_node(pos).name == "air" then

minetest.env:set_node(pos, node)

end

else

if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then

if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then

minetest.env:set_node(pos, node)

end

end

end

pos.x = pos.x-dx

pos.y = pos.y-dy

pos.z = pos.z-dz

end

end

end

end

I get a ModError when I add this to the code. PS. The name of the mod is birch.