summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2016-07-14 09:34:59 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2016-07-14 09:34:59 +0100
commit28985b46c63b146b368c7d0d1a4a3ba1326302a2 (patch)
treec2c94fd2a2f8b7768e206d61e69a3661c8c1716c
parent5ad189430f8dad109d2d5e72a7ddf7577eef8bd2 (diff)
Updated bonemeal and sapling growth with height check
-rw-r--r--README.md6
-rw-r--r--bonemeal.lua62
-rw-r--r--sapling.lua33
3 files changed, 74 insertions, 27 deletions
diff --git a/README.md b/README.md
index 01295c9..8cfbd27 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,12 @@ Ethereal v7 Mapgen mod for Minetest
## Changelog
+### 1.21
+
+ - Saplings need clear space above to grow (depending on height of tree)
+ - Bonemeal changes to suit new sapling growth
+ - Fixed and tweaks
+
### 1.20
- Tweaked Ethereal to work with new features and nodes in Minetest 0.4.14
diff --git a/bonemeal.lua b/bonemeal.lua
index 90a8bec..d53b886 100644
--- a/bonemeal.lua
+++ b/bonemeal.lua
@@ -69,6 +69,20 @@ local crops = {
{"farming:barley_", 7},
}
+-- check if sapling has enough height room to grow
+local function enough_height(pos, height)
+
+ local nod = minetest.line_of_sight(
+ {x = pos.x, y = pos.y + 1, z = pos.z},
+ {x = pos.x, y = pos.y + height, z = pos.z})
+
+ if not nod then
+ return false -- obstructed
+ else
+ return true -- can grow
+ end
+end
+
-- growing routine
local function growth(pointed_thing)
@@ -121,47 +135,61 @@ local function growth(pointed_thing)
end
-- grow ethereal tree
- if node.name == "ethereal:palm_sapling" then
+ if node.name == "ethereal:palm_sapling"
+ and enough_height(pos, 9) then
ethereal.grow_palm_tree(pos)
- elseif node.name == "ethereal:yellow_tree_sapling" then
+ elseif node.name == "ethereal:yellow_tree_sapling"
+ and enough_height(pos, 19) then
ethereal.grow_yellow_tree(pos)
- elseif node.name == "ethereal:big_tree_sapling" then
+ elseif node.name == "ethereal:big_tree_sapling"
+ and enough_height(pos, 7) then
ethereal.grow_big_tree(pos)
- elseif node.name == "ethereal:banana_tree_sapling" then
+ elseif node.name == "ethereal:banana_tree_sapling"
+ and enough_height(pos, 8) then
ethereal.grow_banana_tree(pos)
- elseif node.name == "ethereal:frost_tree_sapling" then
+ elseif node.name == "ethereal:frost_tree_sapling"
+ and enough_height(pos, 19) then
ethereal.grow_frost_tree(pos)
- elseif node.name == "ethereal:mushroom_sapling" then
+ elseif node.name == "ethereal:mushroom_sapling"
+ and enough_height(pos, 11) then
ethereal.grow_mushroom_tree(pos)
- elseif node.name == "ethereal:willow_sapling" then
+ elseif node.name == "ethereal:willow_sapling"
+ and enough_height(pos, 14) then
ethereal.grow_willow_tree(pos)
- elseif node.name == "ethereal:redwood_sapling" then
+ elseif node.name == "ethereal:redwood_sapling"
+ and enough_height(pos, 31) then
ethereal.grow_redwood_tree(pos)
- elseif node.name == "ethereal:orange_tree_sapling" then
+ elseif node.name == "ethereal:orange_tree_sapling"
+ and enough_height(pos, 6) then
ethereal.grow_orange_tree(pos)
- elseif node.name == "ethereal:bamboo_sprout" then
+ elseif node.name == "ethereal:bamboo_sprout"
+ and enough_height(pos, 18) then
ethereal.grow_bamboo_tree(pos)
- elseif node.name == "ethereal:birch_sapling" then
+ elseif node.name == "ethereal:birch_sapling"
+ and enough_height(pos, 7) then
ethereal.grow_birch_tree(pos)
-- grow default tree
- elseif node.name == "default:sapling" then
+ elseif node.name == "default:sapling"
+ and enough_height(pos, 7) then
default.grow_new_apple_tree(pos)
- elseif node.name == "default:junglesapling" then
+ elseif node.name == "default:junglesapling"
+ and enough_height(pos, 15) then
default.grow_new_jungle_tree(pos)
- elseif node.name == "default:pine_sapling" then
+ elseif node.name == "default:pine_sapling"
+ and enough_height(pos, 11) then
if #minetest.find_nodes_in_area(
{x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
@@ -173,10 +201,12 @@ local function growth(pointed_thing)
default.grow_new_pine_tree(pos)
end
- elseif node.name == "default:acacia_sapling" then
+ elseif node.name == "default:acacia_sapling"
+ and enough_height(pos, 7) then
default.grow_new_acacia_tree(pos)
- elseif node.name == "default:aspen_sapling" then
+ elseif node.name == "default:aspen_sapling"
+ and enough_height(pos, 11) then
default.grow_new_aspen_tree(pos)
end
diff --git a/sapling.lua b/sapling.lua
index ceee452..d328a9b 100644
--- a/sapling.lua
+++ b/sapling.lua
@@ -134,47 +134,58 @@ ethereal.grow_sapling = function (pos, node)
-- Check if Ethereal Sapling is growing on correct substrate
if node.name == "ethereal:yellow_tree_sapling"
- and under == "default:dirt_with_snow" then
+ and under == "default:dirt_with_snow"
+ and enough_height(pos, 19) then
ethereal.grow_yellow_tree(pos)
elseif node.name == "ethereal:big_tree_sapling"
- and under == "ethereal:green_dirt" then
+ and under == "ethereal:green_dirt"
+ and enough_height(pos, 7) then
ethereal.grow_big_tree(pos)
elseif node.name == "ethereal:banana_tree_sapling"
- and under == "ethereal:grove_dirt" then
+ and under == "ethereal:grove_dirt"
+ and enough_height(pos, 8) then
ethereal.grow_banana_tree(pos)
elseif node.name == "ethereal:frost_tree_sapling"
- and under == "ethereal:crystal_dirt" then
+ and under == "ethereal:crystal_dirt"
+ and enough_height(pos, 19) then
ethereal.grow_frost_tree(pos)
elseif node.name == "ethereal:mushroom_sapling"
- and under == "ethereal:mushroom_dirt" then
+ and under == "ethereal:mushroom_dirt"
+ and enough_height(pos, 11) then
ethereal.grow_mushroom_tree(pos)
elseif node.name == "ethereal:palm_sapling"
- and under == "default:sand" then
+ and under == "default:sand"
+ and enough_height(pos, 9) then
ethereal.grow_palm_tree(pos)
elseif node.name == "ethereal:willow_sapling"
- and under == "ethereal:gray_dirt" then
+ and under == "ethereal:gray_dirt"
+ and enough_height(pos, 14) then
ethereal.grow_willow_tree(pos)
elseif node.name == "ethereal:redwood_sapling"
- and under == "bakedclay:red" then
+ and under == "bakedclay:red"
+ and enough_height(pos, 31) then
ethereal.grow_redwood_tree(pos)
elseif node.name == "ethereal:orange_tree_sapling"
- and under == "ethereal:prairie_dirt" then
+ and under == "ethereal:prairie_dirt"
+ and enough_height(pos, 6) then
ethereal.grow_orange_tree(pos)
elseif node.name == "ethereal:bamboo_sprout"
- and under == "ethereal:bamboo_dirt" then
+ and under == "ethereal:bamboo_dirt"
+ and enough_height(pos, 18) then
ethereal.grow_bamboo_tree(pos)
elseif node.name == "ethereal:birch_sapling"
- and under == "ethereal:green_dirt" then
+ and under == "ethereal:green_dirt"
+ and enough_height(pos, 7) then
ethereal.grow_birch_tree(pos)
end