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 <nik@niklp.net>
This commit is contained in:
debagos 2024-01-12 18:08:54 +01:00 committed by GitHub
parent 5d7c46c4cf
commit 9a6c64d163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 2 deletions

View File

@ -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.

View File

@ -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")

View File

@ -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

View File

@ -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)