diff options
Diffstat (limited to 'sapling.lua')
-rw-r--r-- | sapling.lua | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/sapling.lua b/sapling.lua index 1ed8d4b..58fb9fb 100644 --- a/sapling.lua +++ b/sapling.lua @@ -25,7 +25,7 @@ minetest.register_node("ethereal:bamboo_sprout", { }) -- Register Saplings -ethereal.register_sapling = function(name, desc, texture, height) +local register_sapling = function(name, desc, texture, height) minetest.register_node(name .. "_sapling", { description = S(desc .. " Tree Sapling"), @@ -50,18 +50,18 @@ ethereal.register_sapling = function(name, desc, texture, height) }) end -ethereal.register_sapling("ethereal:willow", "Willow", "willow_sapling", 14) -ethereal.register_sapling("ethereal:yellow_tree", "Healing", "yellow_tree_sapling", 19) -ethereal.register_sapling("ethereal:big_tree", "Big", "ethereal_big_tree_sapling", 7) -ethereal.register_sapling("ethereal:banana_tree", "Banana", "banana_tree_sapling", 8) -ethereal.register_sapling("ethereal:frost_tree", "Frost", "ethereal_frost_tree_sapling", 19) -ethereal.register_sapling("ethereal:mushroom", "Mushroom", "ethereal_mushroom_sapling", 11) -ethereal.register_sapling("ethereal:palm", "Palm", "moretrees_palm_sapling", 9) -ethereal.register_sapling("ethereal:redwood", "Redwood", "redwood_sapling", 31) -ethereal.register_sapling("ethereal:orange_tree", "Orange", "orange_tree_sapling", 6) -ethereal.register_sapling("ethereal:birch", "Birch", "moretrees_birch_sapling", 7) - -ethereal.add_tree = function (pos, ofx, ofy, ofz, schem) +register_sapling("ethereal:willow", "Willow", "willow_sapling", 14) +register_sapling("ethereal:yellow_tree", "Healing", "yellow_tree_sapling", 19) +register_sapling("ethereal:big_tree", "Big", "ethereal_big_tree_sapling", 7) +register_sapling("ethereal:banana_tree", "Banana", "banana_tree_sapling", 8) +register_sapling("ethereal:frost_tree", "Frost", "ethereal_frost_tree_sapling", 19) +register_sapling("ethereal:mushroom", "Mushroom", "ethereal_mushroom_sapling", 11) +register_sapling("ethereal:palm", "Palm", "moretrees_palm_sapling", 9) +register_sapling("ethereal:redwood", "Redwood", "redwood_sapling", 31) +register_sapling("ethereal:orange_tree", "Orange", "orange_tree_sapling", 6) +register_sapling("ethereal:birch", "Birch", "moretrees_birch_sapling", 7) + +local add_tree = function (pos, ofx, ofy, ofz, schem) -- check for schematic if not schem then print (S("Schematic not found")) @@ -74,55 +74,55 @@ ethereal.add_tree = function (pos, ofx, ofy, ofz, schem) schem, 0, nil, false) end -local path = minetest.get_modpath("ethereal").."/schematics/" +local path = minetest.get_modpath("ethereal") .. "/schematics/" -- grow tree functions function ethereal.grow_yellow_tree(pos) - ethereal.add_tree(pos, 4, 0, 4, ethereal.yellowtree) + add_tree(pos, 4, 0, 4, ethereal.yellowtree) end function ethereal.grow_big_tree(pos) - ethereal.add_tree(pos, 4, 0, 4, ethereal.bigtree) + add_tree(pos, 4, 0, 4, ethereal.bigtree) end function ethereal.grow_banana_tree(pos) - ethereal.add_tree(pos, 3, 0, 3, ethereal.bananatree) + add_tree(pos, 3, 0, 3, ethereal.bananatree) end function ethereal.grow_frost_tree(pos) - ethereal.add_tree(pos, 4, 0, 4, ethereal.frosttrees) + add_tree(pos, 4, 0, 4, ethereal.frosttrees) end function ethereal.grow_mushroom_tree(pos) - ethereal.add_tree(pos, 4, 0, 4, ethereal.mushroomone) + add_tree(pos, 4, 0, 4, ethereal.mushroomone) end function ethereal.grow_palm_tree(pos) - ethereal.add_tree(pos, 4, 0, 4, ethereal.palmtree) + add_tree(pos, 4, 0, 4, ethereal.palmtree) end function ethereal.grow_willow_tree(pos) - ethereal.add_tree(pos, 5, 0, 5, ethereal.willow) + add_tree(pos, 5, 0, 5, ethereal.willow) end function ethereal.grow_redwood_tree(pos) - ethereal.add_tree(pos, 7, 0, 7, ethereal.redwood_tree) + add_tree(pos, 7, 0, 7, ethereal.redwood_tree) end function ethereal.grow_orange_tree(pos) - ethereal.add_tree(pos, 1, 0, 1, ethereal.orangetree) + add_tree(pos, 1, 0, 1, ethereal.orangetree) end function ethereal.grow_bamboo_tree(pos) - ethereal.add_tree(pos, 1, 0, 1, ethereal.bambootree) + add_tree(pos, 1, 0, 1, ethereal.bambootree) end function ethereal.grow_birch_tree(pos) - ethereal.add_tree(pos, 2, 0, 2, ethereal.birchtree) + add_tree(pos, 2, 0, 2, ethereal.birchtree) end -- check if sapling has enough height room to grow -local function enough_height(pos, height) +local enough_height = function(pos, height) local nod = minetest.line_of_sight( {x = pos.x, y = pos.y + 1, z = pos.z}, @@ -135,7 +135,7 @@ local function enough_height(pos, height) end end -ethereal.grow_sapling = function (pos, node) +local grow_sapling = function(pos, node) local under = minetest.get_node({ x = pos.x, @@ -211,12 +211,12 @@ minetest.register_abm({ catch_up = false, action = function(pos, node) - local light_level = minetest.get_node_light(pos) + local light_level = minetest.get_node_light(pos) or 0 - if not light_level or light_level < 13 then + if light_level < 13 then return end - ethereal.grow_sapling(pos, node) + grow_sapling(pos, node) end, }) |