1
0
mirror of https://github.com/mt-mods/plantlife_modpack.git synced 2024-11-05 18:00:28 +01:00

improve air detection for tree and giant tree ferns

This commit is contained in:
Vanessa Ezekowitz 2017-03-14 21:23:33 -04:00
parent b7450d3ad1
commit c43375ff7a
2 changed files with 40 additions and 24 deletions

View File

@ -61,9 +61,15 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
} }
} }
local brk = false
for i = 1, size-3 do for i = 1, size-3 do
if minetest.get_node({x = pos.x, y = pos.y + i, z = pos.z}).name ~= "air" then
brk = true
break
end
minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, {name="ferns:fern_trunk_big"}) minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, {name="ferns:fern_trunk_big"})
end end
if not brk then
minetest.set_node({x = pos.x, y = pos.y + size-2, z = pos.z}, {name="ferns:fern_trunk_big_top"}) minetest.set_node({x = pos.x, y = pos.y + size-2, z = pos.z}, {name="ferns:fern_trunk_big_top"})
minetest.set_node({x = pos.x, y = pos.y + size-1, z = pos.z}, {name="ferns:tree_fern_leaves_giant"}) minetest.set_node({x = pos.x, y = pos.y + size-1, z = pos.z}, {name="ferns:tree_fern_leaves_giant"})
@ -89,6 +95,7 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
minetest.set_node(positions[endpos], {name="ferns:tree_fern_leave_big_end", param2=rot}) minetest.set_node(positions[endpos], {name="ferns:tree_fern_leave_big_end", param2=rot})
end end
end end
end
end end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------

View File

@ -26,15 +26,24 @@ abstract_ferns.grow_tree_fern = function(pos)
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[math.random(1, 2)] local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[math.random(1, 2)]
local i = 1 local i = 1
while (i < size-1) do local brk = false
if minetest.get_node({x = pos.x, y = pos.y + i + 1, z = pos.z}).name ~= "air" then while (i < size) do
print(minetest.get_node({x = pos.x, y = pos.y + i, z = pos.z}).name)
if minetest.get_node({x = pos.x, y = pos.y + i, z = pos.z}).name ~= "air" then
brk = true
print("break!")
break break
end end
print("set trunk node at:")
print(dump({x = pos.x, y = pos.y + i, z = pos.z}))
minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, { name = "ferns:fern_trunk" }) minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, { name = "ferns:fern_trunk" })
i = i + 1 i = i + 1
end end
if not brk then
minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, { name = crown }) print("set crown node at:")
print(dump({x = pos.x, y = pos.y + i, z = pos.z}))
minetest.set_node({x = pos.x, y = pos.y + i - 1, z = pos.z}, { name = crown })
end
end end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------