Default: Add biome API tree schematics and enable growing by sapling ABMs
authorparamat <mat.gregory@virginmedia.com>
Mon, 20 Jul 2015 01:33:30 +0000 (02:33 +0100)
committerparamat <mat.gregory@virginmedia.com>
Mon, 20 Jul 2015 21:56:35 +0000 (22:56 +0100)
mods/default/schematics/acacia_tree.mts [new file with mode: 0644]
mods/default/schematics/apple_tree.mts [new file with mode: 0644]
mods/default/schematics/jungle_tree.mts [new file with mode: 0644]
mods/default/schematics/large_cactus.mts [new file with mode: 0644]
mods/default/schematics/pine_tree.mts [new file with mode: 0644]
mods/default/trees.lua

diff --git a/mods/default/schematics/acacia_tree.mts b/mods/default/schematics/acacia_tree.mts
new file mode 100644 (file)
index 0000000..c9bd2d8
Binary files /dev/null and b/mods/default/schematics/acacia_tree.mts differ
diff --git a/mods/default/schematics/apple_tree.mts b/mods/default/schematics/apple_tree.mts
new file mode 100644 (file)
index 0000000..07c3e7a
Binary files /dev/null and b/mods/default/schematics/apple_tree.mts differ
diff --git a/mods/default/schematics/jungle_tree.mts b/mods/default/schematics/jungle_tree.mts
new file mode 100644 (file)
index 0000000..39cbcbf
Binary files /dev/null and b/mods/default/schematics/jungle_tree.mts differ
diff --git a/mods/default/schematics/large_cactus.mts b/mods/default/schematics/large_cactus.mts
new file mode 100644 (file)
index 0000000..b71077b
Binary files /dev/null and b/mods/default/schematics/large_cactus.mts differ
diff --git a/mods/default/schematics/pine_tree.mts b/mods/default/schematics/pine_tree.mts
new file mode 100644 (file)
index 0000000..0266875
Binary files /dev/null and b/mods/default/schematics/pine_tree.mts differ
index 8e503556f089a2f0e641abfb5af689a3cb5d6b57..b5b20ec53b584ae2ce569990fd669402ec77a7e3 100644 (file)
@@ -29,8 +29,12 @@ minetest.register_abm({
                end
 
                minetest.log("action", "A sapling grows into a tree at "..
-                               minetest.pos_to_string(pos))
-               default.grow_tree(pos, random(1, 4) == 1)
+                       minetest.pos_to_string(pos))
+               if minetest.get_mapgen_params().mgname == "v6" then
+                       default.grow_tree(pos, random(1, 4) == 1)
+               else
+                       default.grow_new_apple_tree(pos)
+               end
        end
 })
 
@@ -44,8 +48,12 @@ minetest.register_abm({
                end
 
                minetest.log("action", "A jungle sapling grows into a tree at "..
-                               minetest.pos_to_string(pos))
-               default.grow_jungle_tree(pos)
+                       minetest.pos_to_string(pos))
+               if minetest.get_mapgen_params().mgname == "v6" then
+                       default.grow_jungle_tree(pos)
+               else
+                       default.grow_new_jungle_tree(pos)
+               end
        end
 })
 
@@ -59,8 +67,27 @@ minetest.register_abm({
                end
 
                minetest.log("action", "A pine sapling grows into a tree at "..
-                               minetest.pos_to_string(pos))
-               default.grow_pine_tree(pos)
+                       minetest.pos_to_string(pos))
+               if minetest.get_mapgen_params().mgname == "v6" then
+                       default.grow_pine_tree(pos)
+               else
+                       default.grow_new_pine_tree(pos)
+               end
+       end
+})
+
+minetest.register_abm({
+       nodenames = {"default:acacia_sapling"},
+       interval = 13,
+       chance = 50,
+       action = function(pos, node)
+               if not can_grow(pos) then
+                       return
+               end
+
+               minetest.log("action", "An acacia sapling grows into a tree at "..
+                       minetest.pos_to_string(pos))
+               default.grow_new_acacia_tree(pos)
        end
 })
 
@@ -346,3 +373,34 @@ function default.grow_pine_tree(pos)
        vm:update_map()
 end
 
+-- New tree
+
+function default.grow_new_apple_tree(pos)
+       local path = minetest.get_modpath("default") .. "/schematics/apple_tree.mts"
+       minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
+               path, 0, nil, false)
+end
+
+-- New jungle tree
+
+function default.grow_new_jungle_tree(pos)
+       local path = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts"
+       minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
+               path, 0, nil, false)
+end
+
+-- New pine tree
+
+function default.grow_new_pine_tree(pos)
+       local path = minetest.get_modpath("default") .. "/schematics/pine_tree.mts"
+       minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
+               path, 0, nil, false)
+end
+
+-- New acacia tree
+
+function default.grow_new_acacia_tree(pos)
+       local path = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts"
+       minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4},
+               path, random, nil, false)
+end