From 8ee837d158428b0294be6087c4aaa775b9cbc256 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 31 Aug 2017 22:16:08 +0200 Subject: [PATCH] Make huge spruce trees growable by sapling --- mods/ITEMS/mcl_core/functions.lua | 11 ++++++----- mods/ITEMS/mcl_core/nodes_trees.lua | 2 +- .../schematics/mcl_core_spruce_huge_1.mts | Bin 0 -> 256 bytes .../schematics/mcl_core_spruce_huge_2.mts | Bin 0 -> 208 bytes 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 mods/ITEMS/mcl_core/schematics/mcl_core_spruce_huge_1.mts create mode 100644 mods/ITEMS/mcl_core/schematics/mcl_core_spruce_huge_2.mts diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 6645399179..4e97835e1b 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -450,9 +450,11 @@ function mcl_core.generate_spruce_tree(pos) vm:update_map() end --- Now this just generates a “boring” 1×1 spruce tree. --- TODO: Generate huge spruce tree with 2×2 trunk. -mcl_core.generate_huge_spruce_tree = mcl_core.generate_spruce_tree +mcl_core.generate_huge_spruce_tree = function(pos) + local r = math.random(1, 2) + local path = minetest.get_modpath("mcl_core") .. "/schematics/mcl_core_spruce_huge_"..r..".mts" + minetest.place_schematic({ x = pos.x - 4, y = pos.y - 1, z = pos.z - 5 }, path, "0", nil, false) +end -- END of spruce tree functions -- @@ -803,8 +805,7 @@ local grow_oak = sapling_grow_action(1, 1, true, false) local grow_dark_oak = sapling_grow_action(2, 2, false, true, "mcl_core:darksapling") local grow_jungle_tree = sapling_grow_action(5, 1, true, true, "mcl_core:junglesapling") local grow_acacia = sapling_grow_action(4, 2, true, false) --- TODO: Activate 2×2 mode for spruce when 2×2 spruce schematic is available -local grow_spruce = sapling_grow_action(3, 1, true, false, "mcl_core:sprucesapling") +local grow_spruce = sapling_grow_action(3, 1, true, true, "mcl_core:sprucesapling") local grow_birch = sapling_grow_action(6, 1, true, false) -- Attempts to grow the sapling at the specified position diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index f8cd1f4d80..cdcb041aa4 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -167,7 +167,7 @@ register_sapling("sapling", "Oak Sapling", "When placed on soil (such as dirt) a register_sapling("darksapling", "Dark Oak Sapling", "Dark oak saplings can grow into dark oaks, but only in groups. A lonely dark oak sapling won't grow. A group of four dark oak saplings grows into a dark oak after some time when they are placed on soil (such as dirt) in a 2×2 square and exposed to light.", "mcl_core_sapling_big_oak.png", {-5.5/16, -0.5, -5.5/16, 5.5/16, 0.5, 5.5/16}) register_sapling("junglesapling", "Jungle Sapling", "When placed on soil (such as dirt) and exposed to light, a jungle sapling will grow into a jungle tree after some time. When there are 4 jungle saplings in a 2×2 square, they will grow to a huge jungle tree.", "default_junglesapling.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16}) register_sapling("acaciasapling", "Acacia Sapling", "When placed on soil (such as dirt) and exposed to light, an acacia sapling will grow into an acacia after some time.", "default_acacia_sapling.png", {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}) -register_sapling("sprucesapling", "Spruce Sapling", "When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce after some time.", "mcl_core_sapling_spruce.png", {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}) +register_sapling("sprucesapling", "Spruce Sapling", "When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce after some time. When there are 4 spruce saplings in a 2×2 square, they will grow to a huge spruce.", "mcl_core_sapling_spruce.png", {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}) register_sapling("birchsapling", "Birch Sapling", "When placed on soil (such as dirt) and exposed to light, a birch sapling will grow into a birch after some time.", "mcl_core_sapling_birch.png", {-6/16, -0.5, -6/16, 6/16, 0.5, 6/16}) diff --git a/mods/ITEMS/mcl_core/schematics/mcl_core_spruce_huge_1.mts b/mods/ITEMS/mcl_core/schematics/mcl_core_spruce_huge_1.mts new file mode 100644 index 0000000000000000000000000000000000000000..c7d220deedfa737b85f080fc4f1fb6ca730aedb8 GIT binary patch literal 256 zcmeYb3HD`RVc=qrWZ6O)AswSKZ=TBYReff^CcXho2HWezWU>tdZg7&wD?eT{7eD#p=I&y+)@uOB(l|uPA-C`QhEX@4rm1^+fsIU3|U! eVtPxu!Qxe{3=9mHU;gFgWMF70%P$hRl?ni1CVMCV literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/schematics/mcl_core_spruce_huge_2.mts b/mods/ITEMS/mcl_core/schematics/mcl_core_spruce_huge_2.mts new file mode 100644 index 0000000000000000000000000000000000000000..272354e6581631c94ed26b98858863a3bea79f90 GIT binary patch literal 208 zcmeYb3HD`RVc=pAWZPyG50rP9etftz>lm3?#2IdF+{$y{r`oJV0*Gv{nBv;D4q zDNL&OdB*#|