added leafdecay, fixed broken birch sideways trunk recipe, made all cones +
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 11 Feb 2013 05:09:53 +0000 (00:09 -0500)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 11 Feb 2013 05:09:53 +0000 (00:09 -0500)
apple fall when they have nothing to hang onto.

crafts.lua
init.lua
node_defs.lua

index d32f86e49f4826209fca05c36e8082e8d905b8b2..58f41fc290c4dc7230c2c6fb5e9c14333d8334a4 100644 (file)
@@ -1,33 +1,33 @@
 
-for i in ipairs(simple_trees) do
+for i in ipairs(moretrees.simple_trees) do
        minetest.register_craft({
-               output = "moretrees:"..simple_trees[i].."_trunk_sideways 2",
+               output = "moretrees:"..moretrees.simple_trees[i].."_trunk_sideways 2",
                recipe = {
-                       {"moretrees:"..simple_trees[i].."_trunk", "moretrees:"..simple_trees[i].."_trunk"}
+                       {"moretrees:"..moretrees.simple_trees[i].."_trunk", "moretrees:"..moretrees.simple_trees[i].."_trunk"}
                }
        })
 
        minetest.register_craft({
-               output = "moretrees:"..simple_trees[i].."_trunk 2",
+               output = "moretrees:"..moretrees.simple_trees[i].."_trunk 2",
                recipe = {
-                       {"moretrees:"..simple_trees[i].."_trunk_sideways"},
-                       {"moretrees:"..simple_trees[i].."_trunk_sideways"}
+                       {"moretrees:"..moretrees.simple_trees[i].."_trunk_sideways"},
+                       {"moretrees:"..moretrees.simple_trees[i].."_trunk_sideways"}
                }
        })
 
        minetest.register_craft({
                type = "shapeless",
-               output = "moretrees:"..simple_trees[i].."_planks 4",
+               output = "moretrees:"..moretrees.simple_trees[i].."_planks 4",
                recipe = {
-                       "moretrees:"..simple_trees[i].."_trunk"
+                       "moretrees:"..moretrees.simple_trees[i].."_trunk"
                }
        })
 
        minetest.register_craft({
                type = "shapeless",
-               output = "moretrees:"..simple_trees[i].."_planks 4",
+               output = "moretrees:"..moretrees.simple_trees[i].."_planks 4",
                recipe = {
-                       "moretrees:"..simple_trees[i].."_trunk_sideways"
+                       "moretrees:"..moretrees.simple_trees[i].."_trunk_sideways"
                }
        })
 end
@@ -130,7 +130,7 @@ minetest.register_craft({
 minetest.register_craft({
        output = "moretrees:birch_trunk_sideways 2",
        recipe = {
-               {"moretrees:birch_trunk", "moretrees:spruce_trunk"},
+               {"moretrees:birch_trunk", "moretrees:birch_trunk"},
        }
 })
 
index fbd2c6cf24b8c1714dc7b4a1fa57c5f837687501..2dfd61809cd03f55d637c661bb1369f1368e0c77 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -64,7 +64,7 @@ plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model)
 local sapling_interval = 500
 local sapling_chance = 20
 
-for i in ipairs(simple_trees) do
+for i in ipairs(moretrees.simple_trees) do
        local tree_name = trees[i][1]
        local tree_model = tree_name.."_model"
        local tree_biome = tree_name.."_biome"
@@ -233,4 +233,23 @@ if CONIFERS_REMOVE_TREES == true then
        })
 end
 
+-- leaf decay
+
+
+local leafdecay_delay = 2
+local leafdecay_chance = 150
+local leafdecay_radius = 5
+
+minetest.register_abm({
+       nodenames = moretrees.leaves_list,
+       interval = leafdecay_delay,
+       chance = leafdecay_chance,
+       action = function(pos, node, active_object_count, active_object_count_wider)
+               if not minetest.env:find_node_near(pos, leafdecay_radius, moretrees.trunks_list) then
+                       minetest.env:remove_node(pos)
+                       minetest.env:dig_node(pos)
+               end
+       end
+})
+
 print("[Moretrees] Loaded (2013-01-18)")
index 84eac02cfcac59e5cdc91c9bb6c50b6e7f415bda..c832b6dab9be487a29ecca71394284c41a44d941 100644 (file)
@@ -10,30 +10,33 @@ table.insert(moretrees.avoidnodes, "moretrees:fir_leaves")
 table.insert(moretrees.avoidnodes, "moretrees:fir_leaves_bright")
        
 trees = {
-       {"beech",       "Beech Tree",    4 },
-       {"apple_tree",  "Apple Tree",   10 },
-       {"oak",         "Oak Tree",     10,     "acorn",        "Acorn",        {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
-       {"sequoia",     "Giant Sequoia", 7 },
-       {"birch",       "Birch Tree",   10 },
-       {"palm",        "Palm Tree",    15,     "coconut",      "Coconut",      {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 },
-       {"spruce",      "Spruce Tree",  10,     "spruce_cone",  "Spruce Cone",  {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
-       {"pine",        "Pine Tree",    10,     "pine_cone",    "Pine Cone",    {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
-       {"willow",      "Willow Tree",  15 },
-       {"rubber_tree", "Rubber Tree",   7 },
+       {"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 },
+       {"sequoia",     "Giant Sequoia"},
+       {"birch",       "Birch Tree"},
+       {"palm",        "Palm Tree",            "coconut",      "Coconut",      {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 },
+       {"spruce",      "Spruce Tree",          "spruce_cone",  "Spruce Cone",  {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
+       {"pine",        "Pine Tree",            "pine_cone",    "Pine Cone",    {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
+       {"willow",      "Willow Tree"},
+       {"rubber_tree", "Rubber Tree"},
        {"jungletree",  "Jungle Tree"},
-       {"fir",         "Douglas Fir",  15,     "fir_cone",     "Fir Cone",     {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
+       {"fir",         "Douglas Fir",          "fir_cone",     "Fir Cone",     {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
 }
 
-simple_trees = { "beech", "apple_tree", "oak", "sequoia", "palm", "pine", "willow", "rubber_tree"}
+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 leafdecayradius = trees[i][3]  -- future use, not yet implemented.
-       local fruit = trees[i][4]
-       local fruitdesc = trees[i][5]
-       local selbox = trees[i][6]
-       local vscale = trees[i][7]
+       local fruit = trees[i][3]
+       local fruitdesc = trees[i][4]
+       local selbox = trees[i][5]
+       local vscale = trees[i][6]
+
 
        minetest.register_node("moretrees:"..treename.."_trunk", {
                description = treedesc.." Trunk",
@@ -101,7 +104,7 @@ for i in ipairs(trees) do
                                type = "fixed",
                                        fixed = selbox
                                },
-                       groups = {fleshy=3,dig_immediate=3,flammable=2},
+                       groups = {fleshy=3,dig_immediate=3,flammable=2, attached_node=1},
                        sounds = default.node_sound_defaults(),
                })
        end
@@ -116,7 +119,7 @@ for i in ipairs(trees) do
                        drawtype = "allfaces_optional",
                        tiles = { "moretrees_"..treename.."_leaves.png" },
                        paramtype = "light",
-                       groups = {tree=1, snappy=3, flammable=2 },
+                       groups = {tree=1, snappy=3, flammable=2},
                        sounds = default.node_sound_leaves_defaults(),
 
                        drop = {
@@ -131,6 +134,8 @@ for i in ipairs(trees) do
 
        table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk")
        table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_leaves")
+       table.insert(moretrees.leaves_list, "moretrees:"..treename.."_leaves")
+       table.insert(moretrees.trunks_list, "moretrees:"..treename.."_trunk")
 end
 
 -- Extra leaves for jungle trees:
@@ -154,6 +159,7 @@ 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
@@ -174,7 +180,7 @@ minetest.register_node("moretrees:fir_leaves_bright", {
        },
        sounds = default.node_sound_leaves_defaults()
 })
-
+table.insert(moretrees.leaves_list, "moretrees:fir_leaves_bright")
 
 
 -- Backward compatbility with old mods/nodes: