summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-01-11 11:54:41 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-01-11 11:54:41 -0500
commitf05480d78d5ef362ff44200bdba680836cfd1350 (patch)
tree4451e6f8b2f5a391d1342203f0baa63b97d7334c /init.lua
parentc679cf94b797e58531d1da80f2ee49c7cebdc5d2 (diff)
Added feature to check for air surrounding a tree's target spawn location, so
that trees won't grow on top of stuff line rails, other plants, etc. Also helps keep them from growing half-way into a wall.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 16161f8..39249bf 100644
--- a/init.lua
+++ b/init.lua
@@ -75,7 +75,9 @@ spawn_on_surfaces(
15, -- but no higher than 15m
{"default:water_source"}, -- Jungle trees must be near water
JT_WATER_RADIUS, -- within this radius of it (default 25)
- JT_WATER_COUNT -- with this many water nodes in the area
+ JT_WATER_COUNT, -- with this many water nodes in the area
+ 1, -- air size area of 1 (+/- 1 node in X and Z directions)
+ 9 -- there must be 9 air nodes in the area
)
spawn_on_surfaces(
@@ -93,7 +95,9 @@ spawn_on_surfaces(
nil,
nil,
CONIFERS_ALTITUDE,
- nil
+ nil,
+ 1,
+ 9
)
-- growing functions
@@ -209,7 +213,6 @@ function grow_jungletree(pos, noise)
minetest.env:remove_node(pos)
local leaves = minetest.env:find_nodes_in_area({x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1}, "default:leaves")
-
for leaf in ipairs(leaves) do
minetest.env:remove_node(leaves[leaf])
end
@@ -232,7 +235,6 @@ function grow_conifer(pos, noise)
minetest.env:remove_node(pos)
local leaves = minetest.env:find_nodes_in_area({x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, "default:leaves")
-
for leaf in ipairs(leaves) do
minetest.env:remove_node(leaves[leaf])
end