Rainforest: Add emergent jungle tree and sapling
authorparamat <mat.gregory@virginmedia.com>
Wed, 10 May 2017 07:23:26 +0000 (08:23 +0100)
committerparamat <mat.gregory@virginmedia.com>
Mon, 19 Feb 2018 07:16:16 +0000 (07:16 +0000)
Height 20 to 32 nodes.
Dependent on chunksize >= 5.
Base limited to maximum altitude y = 32.
Craft sapling from 9 jungle saplings.

mods/default/README.txt
mods/default/crafting.lua
mods/default/mapgen.lua
mods/default/nodes.lua
mods/default/schematics/emergent_jungle_tree.mts [new file with mode: 0644]
mods/default/schematics/emergent_jungle_tree_from_sapling.mts [new file with mode: 0644]
mods/default/textures/default_emergent_jungle_sapling.png [new file with mode: 0644]
mods/default/trees.lua

index 3861eddd7db26570ac9af6c2f640221db88c9962..cd4e768cf35a1ddf4d5f1816404e805aa52c2a2a 100644 (file)
@@ -115,6 +115,7 @@ paramat (CC BY-SA 3.0):
   default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
   default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
   default_marram_grass_*.png -- Derived from textures by TumeniNodes (CC-BY-SA 3.0)
+  default_emergent_jungle_sapling.png
 
 TumeniNodes (CC BY-SA 3.0):
   default_desert_cobble.png -- Derived from a texture by brunob.santos (CC BY-SA 3.0)
index 847f188f9b716cb3a48c2847398e0e8727875e5e..428c0f456220a545636977f2aabc8ebf262da952 100644 (file)
@@ -763,14 +763,26 @@ minetest.register_craft({
        }
 })
 
+minetest.register_craft({
+       output = "default:emergent_jungle_sapling",
+       recipe = {
+               {"default:junglesapling", "default:junglesapling", "default:junglesapling"},
+               {"default:junglesapling", "default:junglesapling", "default:junglesapling"},
+               {"default:junglesapling", "default:junglesapling", "default:junglesapling"},
+       }
+})
+
+
 --
 -- Crafting (tool repair)
 --
+
 minetest.register_craft({
        type = "toolrepair",
        additional_wear = -0.02,
 })
 
+
 --
 -- Cooking recipes
 --
@@ -849,6 +861,7 @@ minetest.register_craft({
        cooktime = 5,
 })
 
+
 --
 -- Fuels
 --
@@ -964,6 +977,12 @@ minetest.register_craft({
        burntime = 6,
 })
 
+minetest.register_craft({
+       type = "fuel",
+       recipe = "default:emergent_jungle_sapling",
+       burntime = 7,
+})
+
 
 minetest.register_craft({
        type = "fuel",
index 243d1ed76356e6f488592775e0f53b8dc7858980..e3684c000205b6e7b74f19f8b4ac0b2477a0830b 100644 (file)
@@ -1705,6 +1705,34 @@ function default.register_decorations()
                rotation = "random",
        })
 
+       -- Emergent jungle tree
+       -- Due to 32 node height, altitude is limited and prescence depends on chunksize
+
+       local chunksize = tonumber(minetest.get_mapgen_setting("chunksize"))
+       if chunksize >= 5 then
+               minetest.register_decoration({
+                       deco_type = "schematic",
+                       place_on = {"default:dirt_with_rainforest_litter"},
+                       sidelen = 80,
+                       noise_params = {
+                               offset = 0.0,
+                               scale = 0.0025,
+                               spread = {x = 250, y = 250, z = 250},
+                               seed = 2685,
+                               octaves = 3,
+                               persist = 0.7
+                       },
+                       biomes = {"rainforest"},
+                       y_min = 1,
+                       y_max = 32,
+                       schematic = minetest.get_modpath("default") ..
+                                       "/schematics/emergent_jungle_tree.mts",
+                       flags = "place_center_x, place_center_z",
+                       rotation = "random",
+                       place_offset_y = -4,
+               })
+       end
+
        -- Jungle tree and log
 
        minetest.register_decoration({
index a2ce299390fb2bfd33903575fd201a7994844527..3de6f2e45c7bc565b9d39991475b9fdade316ddc 100644 (file)
@@ -80,6 +80,7 @@ default:jungletree
 default:junglewood
 default:jungleleaves
 default:junglesapling
+default:emergent_jungle_sapling
 
 default:pine_tree
 default:pine_wood
@@ -775,6 +776,41 @@ minetest.register_node("default:junglesapling", {
        end,
 })
 
+minetest.register_node("default:emergent_jungle_sapling", {
+       description = "Emergent Jungle Tree Sapling",
+       drawtype = "plantlike",
+       tiles = {"default_emergent_jungle_sapling.png"},
+       inventory_image = "default_emergent_jungle_sapling.png",
+       wield_image = "default_emergent_jungle_sapling.png",
+       paramtype = "light",
+       sunlight_propagates = true,
+       walkable = false,
+       on_timer = default.grow_sapling,
+       selection_box = {
+               type = "fixed",
+               fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
+       },
+       groups = {snappy = 2, dig_immediate = 3, flammable = 2,
+               attached_node = 1, sapling = 1},
+       sounds = default.node_sound_leaves_defaults(),
+
+       on_construct = function(pos)
+               minetest.get_node_timer(pos):start(math.random(300, 1500))
+       end,
+
+       on_place = function(itemstack, placer, pointed_thing)
+               itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
+                       "default:emergent_jungle_sapling",
+                       -- minp, maxp to be checked, relative to sapling pos
+                       {x = -3, y = -5, z = -3},
+                       {x = 3, y = 31, z = 3},
+                       -- maximum interval of interior volume check
+                       4)
+
+               return itemstack
+       end,
+})
+
 
 minetest.register_node("default:pine_tree", {
        description = "Pine Tree",
diff --git a/mods/default/schematics/emergent_jungle_tree.mts b/mods/default/schematics/emergent_jungle_tree.mts
new file mode 100644 (file)
index 0000000..b526430
Binary files /dev/null and b/mods/default/schematics/emergent_jungle_tree.mts differ
diff --git a/mods/default/schematics/emergent_jungle_tree_from_sapling.mts b/mods/default/schematics/emergent_jungle_tree_from_sapling.mts
new file mode 100644 (file)
index 0000000..cb4e4e9
Binary files /dev/null and b/mods/default/schematics/emergent_jungle_tree_from_sapling.mts differ
diff --git a/mods/default/textures/default_emergent_jungle_sapling.png b/mods/default/textures/default_emergent_jungle_sapling.png
new file mode 100644 (file)
index 0000000..b363b3c
Binary files /dev/null and b/mods/default/textures/default_emergent_jungle_sapling.png differ
index 2934330d6eadf6bb1805ba8e49503583702602b4..f5ee8ca3c26a3598ff65d89372556ed4d1eae474 100644 (file)
@@ -85,6 +85,10 @@ function default.grow_sapling(pos)
                minetest.log("action", "An acacia bush sapling grows into a bush at "..
                        minetest.pos_to_string(pos))
                default.grow_acacia_bush(pos)
+       elseif node.name == "default:emergent_jungle_sapling" then
+               minetest.log("action", "An emergent jungle sapling grows into a tree at "..
+                       minetest.pos_to_string(pos))
+               default.grow_new_emergent_jungle_tree(pos)
        end
 end
 
@@ -394,6 +398,16 @@ function default.grow_new_jungle_tree(pos)
 end
 
 
+-- New emergent jungle tree
+
+function default.grow_new_emergent_jungle_tree(pos)
+       local path = minetest.get_modpath("default") ..
+               "/schematics/emergent_jungle_tree_from_sapling.mts"
+       minetest.place_schematic({x = pos.x - 3, y = pos.y - 5, z = pos.z - 3},
+               path, "random", nil, false)
+end
+
+
 -- New pine tree
 
 function default.grow_new_pine_tree(pos)