From 4a0eddef029045510fe648ae78d86177817b73f2 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 1 Jul 2022 14:36:36 +0100 Subject: [PATCH] add df_primordial_items saplings --- depends.txt | 1 + init.lua | 8 +++----- mod.conf | 2 +- mods.lua | 26 ++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/depends.txt b/depends.txt index b1e1dee..2bdb578 100644 --- a/depends.txt +++ b/depends.txt @@ -11,3 +11,4 @@ ferns? dryplants? df_trees? df_farming? +df_primordial_items? diff --git a/init.lua b/init.lua index 03dce23..9e6e673 100644 --- a/init.lua +++ b/init.lua @@ -493,11 +493,9 @@ function bonemeal:on_use(pos, strength, node) light_ok = nil end - -- check for tree growth if pointing at sapling - if (minetest.get_item_group(node.name, "sapling") > 0 - or node.name == "default:large_cactus_seedling") - and random(5 - strength) == 1 then - check_sapling(pos, node.name, light_ok) + -- check for sapling growth + if random(5 - strength) == 1 + and check_sapling(pos, node.name, light_ok) then return true end diff --git a/mod.conf b/mod.conf index 8865483..7a3948b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = bonemeal depends = default -optional_depends = intllib, lucky_block, farming, ethereal, moretrees, technic_worldgen, flowers, dye, ferns, dryplants, df_trees, df_farming +optional_depends = intllib, lucky_block, farming, ethereal, moretrees, technic_worldgen, flowers, dye, ferns, dryplants, df_trees, df_farming, df_primordial_items description = Adds bone and bonemeal giving the ability to quickly grow plants and saplings. diff --git a/mods.lua b/mods.lua index cd9c470..bd4f69e 100644 --- a/mods.lua +++ b/mods.lua @@ -228,3 +228,29 @@ if minetest.get_modpath("df_farming") then {"df_farming:sweet_pod_", 6, "df_farming:sweet_pod_seed", true} }) end + + +if minetest.get_modpath("df_primordial_items") then + + local function mush_fix(pos) + minetest.set_node(pos, {name = "air"}) + mapgen_helper.place_schematic(pos, + df_primordial_items.get_primordial_mushroom(), (math.random(1,4)-1)*90) + end + + local function fern_fix(pos) + minetest.set_node(pos, {name = "air"}) + local rotations = {0, 90, 180, 270} + mapgen_helper.place_schematic(pos, + df_primordial_items.get_fern_schematic(), rotations[math.random(1,#rotations)]) + end + + bonemeal:add_sapling({ + {"df_primordial_items:jungle_mushroom_sapling", + df_primordial_items.spawn_jungle_mushroom, "soil", true}, + {"df_primordial_items:jungletree_sapling", + df_primordial_items.spawn_jungle_tree, "soil", true}, + {"df_primordial_items:mush_sapling", mush_fix, "soil", true}, + {"df_primordial_items:fern_sapling", fern_fix, "soil", true} + }) +end