diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2016-07-14 13:40:49 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2016-07-14 13:40:49 +0100 |
commit | f092e5fcb25f1d19317fa9903f400b76f18929fc (patch) | |
tree | d193db647357e811ae6b30befb3645d295b76b4e | |
parent | eecf187cc28b0e7e1178c0d302ecfa09b93fa3be (diff) |
Redone enough_height changes to use node setting
-rw-r--r-- | bonemeal.lua | 40 | ||||
-rw-r--r-- | sapling.lua | 38 |
2 files changed, 34 insertions, 44 deletions
diff --git a/bonemeal.lua b/bonemeal.lua index d53b886..07f6ec1 100644 --- a/bonemeal.lua +++ b/bonemeal.lua @@ -122,6 +122,13 @@ local function growth(pointed_thing) z = pos.z
})
+ local height = minetest.registered_nodes[node.name].grown_height
+
+ -- do we have enough height to grow sapling into tree?
+ if height and not enough_height(pos, height) then
+ return
+ end
+
-- specific check for palm tree's, so they grow on sand
if node.name == "ethereal:palm_sapling"
and under.name == "default:sand" then
@@ -135,48 +142,37 @@ local function growth(pointed_thing) end
-- grow ethereal tree
- if node.name == "ethereal:palm_sapling"
- and enough_height(pos, 9) then
+ if node.name == "ethereal:palm_sapling" then
ethereal.grow_palm_tree(pos)
- elseif node.name == "ethereal:yellow_tree_sapling"
- and enough_height(pos, 19) then
+ elseif node.name == "ethereal:yellow_tree_sapling" then
ethereal.grow_yellow_tree(pos)
- elseif node.name == "ethereal:big_tree_sapling"
- and enough_height(pos, 7) then
+ elseif node.name == "ethereal:big_tree_sapling" then
ethereal.grow_big_tree(pos)
- elseif node.name == "ethereal:banana_tree_sapling"
- and enough_height(pos, 8) then
+ elseif node.name == "ethereal:banana_tree_sapling" then
ethereal.grow_banana_tree(pos)
- elseif node.name == "ethereal:frost_tree_sapling"
- and enough_height(pos, 19) then
+ elseif node.name == "ethereal:frost_tree_sapling" then
ethereal.grow_frost_tree(pos)
- elseif node.name == "ethereal:mushroom_sapling"
- and enough_height(pos, 11) then
+ elseif node.name == "ethereal:mushroom_sapling" then
ethereal.grow_mushroom_tree(pos)
- elseif node.name == "ethereal:willow_sapling"
- and enough_height(pos, 14) then
+ elseif node.name == "ethereal:willow_sapling" then
ethereal.grow_willow_tree(pos)
- elseif node.name == "ethereal:redwood_sapling"
- and enough_height(pos, 31) then
+ elseif node.name == "ethereal:redwood_sapling" then
ethereal.grow_redwood_tree(pos)
- elseif node.name == "ethereal:orange_tree_sapling"
- and enough_height(pos, 6) then
+ elseif node.name == "ethereal:orange_tree_sapling" then
ethereal.grow_orange_tree(pos)
- elseif node.name == "ethereal:bamboo_sprout"
- and enough_height(pos, 18) then
+ elseif node.name == "ethereal:bamboo_sprout" then
ethereal.grow_bamboo_tree(pos)
- elseif node.name == "ethereal:birch_sapling"
- and enough_height(pos, 7) then
+ elseif node.name == "ethereal:birch_sapling" then
ethereal.grow_birch_tree(pos)
-- grow default tree
diff --git a/sapling.lua b/sapling.lua index e309302..2cf34b8 100644 --- a/sapling.lua +++ b/sapling.lua @@ -154,60 +154,54 @@ ethereal.grow_sapling = function (pos, node) local height = minetest.registered_nodes[node.name].grown_height + -- do we have enough height to grow sapling into tree? + if not height or not enough_height(pos, height) then + return + end + -- Check if Ethereal Sapling is growing on correct substrate if node.name == "ethereal:yellow_tree_sapling" - and under == "default:dirt_with_snow" - and enough_height(pos, height) then + and under == "default:dirt_with_snow" then ethereal.grow_yellow_tree(pos) elseif node.name == "ethereal:big_tree_sapling" - and under == "ethereal:green_dirt" - and enough_height(pos, height) then + and under == "ethereal:green_dirt" then ethereal.grow_big_tree(pos) elseif node.name == "ethereal:banana_tree_sapling" - and under == "ethereal:grove_dirt" - and enough_height(pos, height) then + and under == "ethereal:grove_dirt" then ethereal.grow_banana_tree(pos) elseif node.name == "ethereal:frost_tree_sapling" - and under == "ethereal:crystal_dirt" - and enough_height(pos, height) then + and under == "ethereal:crystal_dirt" then ethereal.grow_frost_tree(pos) elseif node.name == "ethereal:mushroom_sapling" - and under == "ethereal:mushroom_dirt" - and enough_height(pos, height) then + and under == "ethereal:mushroom_dirt" then ethereal.grow_mushroom_tree(pos) elseif node.name == "ethereal:palm_sapling" - and under == "default:sand" - and enough_height(pos, height) then + and under == "default:sand" then ethereal.grow_palm_tree(pos) elseif node.name == "ethereal:willow_sapling" - and under == "ethereal:gray_dirt" - and enough_height(pos, height) then + and under == "ethereal:gray_dirt" then ethereal.grow_willow_tree(pos) elseif node.name == "ethereal:redwood_sapling" - and under == "bakedclay:red" - and enough_height(pos, height) then + and under == "bakedclay:red" then ethereal.grow_redwood_tree(pos) elseif node.name == "ethereal:orange_tree_sapling" - and under == "ethereal:prairie_dirt" - and enough_height(pos, height) then + and under == "ethereal:prairie_dirt" then ethereal.grow_orange_tree(pos) elseif node.name == "ethereal:bamboo_sprout" - and under == "ethereal:bamboo_dirt" - and enough_height(pos, height) then + and under == "ethereal:bamboo_dirt" then ethereal.grow_bamboo_tree(pos) elseif node.name == "ethereal:birch_sapling" - and under == "ethereal:green_dirt" - and enough_height(pos, height) then + and under == "ethereal:green_dirt" then ethereal.grow_birch_tree(pos) end |