summaryrefslogtreecommitdiff
path: root/node_defs.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-02-11 22:07:40 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-02-11 22:07:40 -0500
commit6da6bda95e57ebf217b943fd134823d95a6e6465 (patch)
tree53a2a3948108747b3f0fb4ba65f2492932cf99b8 /node_defs.lua
parenta0af3f26de0028e832eac202d3fd9ce93d68f65d (diff)
made leaves depend on the trunks they spawn with to avoid decaying
rather than just any trunk being enough to stop just any leaves from decaying. Re-tuned the leaf decay interval/chance values accordingly. Changed a few variables to avoid possible conflicts. Added a setting to allow one to disable the new leaf decay code. Moved sapling growth code into its own file. Minor changes to comments here and there. Got rid of simple trees list (made the code do various checks in realtime instead, since it's just startup code anyway). Fixed messed-up crafting for jungle trees; condensed most of the crafting code into main craft registry loop. Mostly fixed broken aliases of default jungletrees.
Diffstat (limited to 'node_defs.lua')
-rw-r--r--node_defs.lua53
1 files changed, 22 insertions, 31 deletions
diff --git a/node_defs.lua b/node_defs.lua
index 858f5af..1f14f4e 100644
--- a/node_defs.lua
+++ b/node_defs.lua
@@ -1,15 +1,6 @@
moretrees.avoidnodes = {}
-
-table.insert(moretrees.avoidnodes, "default:jungletree")
-table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk")
-table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_red")
-table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_green")
-table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_yellow")
-table.insert(moretrees.avoidnodes, "moretrees:fir_trunk")
-table.insert(moretrees.avoidnodes, "moretrees:fir_leaves")
-table.insert(moretrees.avoidnodes, "moretrees:fir_leaves_bright")
-trees = {
+moretrees.treelist = {
{"beech", "Beech Tree"},
{"apple_tree", "Apple Tree"},
{"oak", "Oak Tree", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
@@ -24,18 +15,13 @@ trees = {
{"fir", "Douglas Fir", "fir_cone", "Fir Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
}
-moretrees.simple_trees = { "beech", "apple_tree", "oak", "sequoia", "palm", "pine", "willow", "rubber_tree"}
-
-moretrees.leaves_list = {}
-moretrees.trunks_list = {}
-
-for i in ipairs(trees) do
- local treename = trees[i][1]
- local treedesc = trees[i][2]
- local fruit = trees[i][3]
- local fruitdesc = trees[i][4]
- local selbox = trees[i][5]
- local vscale = trees[i][6]
+for i in ipairs(moretrees.treelist) do
+ local treename = moretrees.treelist[i][1]
+ local treedesc = moretrees.treelist[i][2]
+ local fruit = moretrees.treelist[i][3]
+ local fruitdesc = moretrees.treelist[i][4]
+ local selbox = moretrees.treelist[i][5]
+ local vscale = moretrees.treelist[i][6]
minetest.register_node("moretrees:"..treename.."_trunk", {
@@ -134,13 +120,7 @@ for i in ipairs(trees) do
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk")
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_leaves")
- table.insert(moretrees.trunks_list, "moretrees:"..treename.."_trunk")
- if treename ~= "palm" then
- table.insert(moretrees.leaves_list, "moretrees:"..treename.."_leaves")
- end
-
end
-table.insert(moretrees.trunks_list, "default:jungletree")
-- Extra leaves for jungle trees:
@@ -163,7 +143,6 @@ for color = 1, 3 do
},
sounds = default.node_sound_leaves_defaults(),
})
- table.insert(moretrees.leaves_list, "moretrees:jungletree_leaves_"..jungleleaves[color])
end
-- Extra needles for firs
@@ -184,7 +163,6 @@ minetest.register_node("moretrees:fir_leaves_bright", {
},
sounds = default.node_sound_leaves_defaults()
})
-table.insert(moretrees.leaves_list, "moretrees:fir_leaves_bright")
if moretrees.enable_redefine_apple then
minetest.register_node(":default:apple", {
@@ -206,11 +184,24 @@ if moretrees.enable_redefine_apple then
})
end
-
+table.insert(moretrees.avoidnodes, "default:jungletree")
+table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk")
+table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_red")
+table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_green")
+table.insert(moretrees.avoidnodes, "moretrees:jungletree_leaves_yellow")
+table.insert(moretrees.avoidnodes, "moretrees:fir_trunk")
+table.insert(moretrees.avoidnodes, "moretrees:fir_leaves")
+table.insert(moretrees.avoidnodes, "moretrees:fir_leaves_bright")
-- Backward compatbility with old mods/nodes:
+minetest.registered_items["jungletree"] = nil
+minetest.registered_aliases["jungletree"] = nil
+minetest.registered_items["default:jungletree"] = nil
+minetest.registered_aliases["default:jungletree"] = nil
+minetest.register_alias("jungletree", "moretrees:jungletree_trunk")
minetest.register_alias("default:jungletree", "moretrees:jungletree_trunk")
+
minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green")
minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red")
minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow")