summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-14 21:24:35 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-14 21:24:35 -0400
commit6c701f9b7cf88fcb026a8f38d8852bd8a54412c7 (patch)
treefea375cbf160bd4e42792257947373b3e6345898
parentb627f5dbf691c2d478d620e38e8ce1823289866e (diff)
downloaddreambuilder_modpack-6c701f9b7cf88fcb026a8f38d8852bd8a54412c7.tar
dreambuilder_modpack-6c701f9b7cf88fcb026a8f38d8852bd8a54412c7.tar.gz
dreambuilder_modpack-6c701f9b7cf88fcb026a8f38d8852bd8a54412c7.tar.bz2
dreambuilder_modpack-6c701f9b7cf88fcb026a8f38d8852bd8a54412c7.tar.xz
dreambuilder_modpack-6c701f9b7cf88fcb026a8f38d8852bd8a54412c7.zip
update plantlife modpack (ferns)
-rw-r--r--ferns/gianttreefern.lua47
-rw-r--r--ferns/treefern.lua17
2 files changed, 40 insertions, 24 deletions
diff --git a/ferns/gianttreefern.lua b/ferns/gianttreefern.lua
index bc6516b..f6ef9f3 100644
--- a/ferns/gianttreefern.lua
+++ b/ferns/gianttreefern.lua
@@ -61,32 +61,39 @@ 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
- 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"})
+ 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"})
- -- all the checking for air below is to prevent some ugly bugs (incomplete trunks of neighbouring trees), it's a bit slower, but worth the result
+ -- all the checking for air below is to prevent some ugly bugs (incomplete trunks of neighbouring trees), it's a bit slower, but worth the result
- -- assert(#leafchecks == 4)
- for i = 1, 4 do
- local positions = leafchecks[i].positions
- local rot = leafchecks[i].direction
- local endpos = 4 -- If the loop below adds all intermediate leaves then the "terminating" leaf will be at positions[4]
- -- assert(#positions == 4)
- -- add leaves so long as the destination nodes are air
- for j = 1, 3 do
- if minetest.get_node(positions[j]).name == "air" then
- minetest.set_node(positions[j], {name="ferns:tree_fern_leave_big"})
- else
- endpos = j
- break
+ -- assert(#leafchecks == 4)
+ for i = 1, 4 do
+ local positions = leafchecks[i].positions
+ local rot = leafchecks[i].direction
+ local endpos = 4 -- If the loop below adds all intermediate leaves then the "terminating" leaf will be at positions[4]
+ -- assert(#positions == 4)
+ -- add leaves so long as the destination nodes are air
+ for j = 1, 3 do
+ if minetest.get_node(positions[j]).name == "air" then
+ minetest.set_node(positions[j], {name="ferns:tree_fern_leave_big"})
+ else
+ endpos = j
+ break
+ end
+ end
+ -- add the terminating leaf if required and possible
+ if endpos == 4 and minetest.get_node(positions[endpos]).name == "air" then
+ minetest.set_node(positions[endpos], {name="ferns:tree_fern_leave_big_end", param2=rot})
end
- end
- -- add the terminating leaf if required and possible
- if endpos == 4 and minetest.get_node(positions[endpos]).name == "air" then
- minetest.set_node(positions[endpos], {name="ferns:tree_fern_leave_big_end", param2=rot})
end
end
end
diff --git a/ferns/treefern.lua b/ferns/treefern.lua
index 4ba502b..7ba44d5 100644
--- a/ferns/treefern.lua
+++ b/ferns/treefern.lua
@@ -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
-----------------------------------------------------------------------------------------------