From 9a6c64d163dfa04eb3c2eba403c3db389994a237 Mon Sep 17 00:00:00 2001 From: debagos Date: Fri, 12 Jan 2024 18:08:54 +0100 Subject: [PATCH] Fix dead ongen saplings due to biome_lib secession (#35) * Replaced print with minetest.log in init.lua * Added moretrees_ongen group to ongen saplings * Added LBM and setting to enable it for non-functional ongen saplings due to biome_lib secession * Changed LBM run_at_every_load to true * Fixed luacheck warnings * Using random interval for node timer, like in the on_generated timer interval * Update init.lua * Update node_defs.lua --------- Co-authored-by: Niklp --- default_settings.txt | 4 ++++ init.lua | 15 ++++++++++++++- node_defs.lua | 10 +++++++++- settings.lua | 4 ++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/default_settings.txt b/default_settings.txt index 9f8fc3c..55de6a7 100644 --- a/default_settings.txt +++ b/default_settings.txt @@ -130,6 +130,10 @@ moretrees.dates_item_drop_ichance = 10 -- inverse probability of ripe dates dr moretrees.sapling_interval = 100 moretrees.sapling_chance = 5 +-- Enable this only if you have used an old moretrees version which was using biome_lib +-- and when you notice large areas with ongen saplings that don't grow +moretrees.grow_legacy_saplings = false + -- If this variable is set to true, drop leaves out as entities during leaf -- decay, rather than just disappearing them. diff --git a/init.lua b/init.lua index 86bf1a6..851c0de 100644 --- a/init.lua +++ b/init.lua @@ -383,4 +383,17 @@ function moretrees.grow_fir_snow(pos) minetest.spawn_tree(pos,moretrees.fir_model) end -print("[Moretrees] Loaded (2013-02-11)") +if moretrees.grow_legacy_saplings then + minetest.register_lbm({ + name = "moretrees:grow_ongen_saplings", + label = "Grow legacy ongen saplings", + nodenames = {"group:moretrees_ongen"}, + run_at_every_load = true, + action = function(pos) + minetest.log("info", "[moretrees] Starting growth timer for legacy ongen sapling at "..minetest.pos_to_string(pos, 0)) + minetest.get_node_timer(pos):start(math.random(2, 10)) + end + }) +end + +minetest.log("info", "[moretrees] Loading done") diff --git a/node_defs.lua b/node_defs.lua index 8d452a8..4387148 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -471,7 +471,15 @@ for i in ipairs(moretrees.treelist) do }) end - local ongen_groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1,not_in_creative_inventory=1} + local ongen_groups = { + snappy = 2, + dig_immediate = 3, + flammable = 2, + attached_node = 1, + sapling = 1, + moretrees_ongen = 1, + not_in_creative_inventory = 1 + } if minetest.settings:get_bool("creative_mode", false) then ongen_groups["not_in_creative_inventory"]=nil end diff --git a/settings.lua b/settings.lua index 1eca07b..b7d83ef 100644 --- a/settings.lua +++ b/settings.lua @@ -74,6 +74,10 @@ moretrees.dates_item_drop_ichance = tonumber(stg:get("moretrees.dates_item_drop_ moretrees.sapling_interval = 100 moretrees.sapling_chance = 5 +-- Enable this only if you have used an old moretrees version which was using biome_lib +-- and when you notice large areas with ongen saplings that don't grow +moretrees.grow_legacy_saplings = stg:get_bool("moretrees.grow_legacy_saplings", false) + -- If this variable is set to true, drop leaves out as entities during leaf -- decay, rather than just disappearing them. moretrees.decay_leaves_as_items = stg:get_bool("moretrees.decay_leaves_as_items", false)