forked from mtcontrib/plantlife_modpack
improve air detection for tree and giant tree ferns
This commit is contained in:
parent
b7450d3ad1
commit
c43375ff7a
@ -61,9 +61,15 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
|
||||
}
|
||||
}
|
||||
|
||||
local brk = false
|
||||
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"})
|
||||
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-1, z = pos.z}, {name="ferns:tree_fern_leaves_giant"})
|
||||
|
||||
@ -90,6 +96,7 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- GIANT TREE FERN LEAVES
|
||||
|
@ -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 i = 1
|
||||
while (i < size-1) do
|
||||
if minetest.get_node({x = pos.x, y = pos.y + i + 1, z = pos.z}).name ~= "air" then
|
||||
local brk = false
|
||||
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
|
||||
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" })
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, { name = crown })
|
||||
if not brk then
|
||||
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
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user