Skip to content

Commit

Permalink
Fix dead ongen saplings due to biome_lib secession (#35)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
debagos and Niklp09 authored Jan 12, 2024
1 parent 5d7c46c commit 9a6c64d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
4 changes: 4 additions & 0 deletions default_settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
15 changes: 14 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
10 changes: 9 additions & 1 deletion node_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9a6c64d

Please sign in to comment.