Fix peat auto-fermenting bug

Peat should never ferment on its own, it should require face
contact with some kind of soil.  Unifying it with tree growth rate
code caused it to ferment on its own because the assumption that
tree roots contain their own soil and base moisture.  Peat should
only have its own moisture but not its own soil.

This also allows peat to be used as an emergency "moist" node on
its own in e.g. skyrealms for cultivating flora, as long as it's
contained so that only its moisture can leak out but it cannot
be exposed to fermenting microorganisms from nearby soil.
This commit is contained in:
Aaron Suen 2023-05-06 19:48:28 -04:00
parent e75aa98b35
commit eaa1f34c3f
2 changed files with 6 additions and 4 deletions

View File

@ -10,9 +10,9 @@ local modname = minetest.get_current_modname()
nodecore.register_leaf_drops, nodecore.registered_leaf_drops
= nodecore.mkreg()
function nodecore.tree_soil_rate(pos)
local d = 1
local w = 1
function nodecore.tree_soil_rate(pos, d, w)
d = d or 1
w = w or 1
nodecore.scan_flood(pos, 3, function(p, r)
if r < 1 then return end
local nn = minetest.get_node(p).name

View File

@ -88,7 +88,9 @@ nodecore.register_soaking_abm({
fieldname = "compost",
nodenames = {modname .. ":peat"},
interval = 10,
soakrate = nodecore.tree_soil_rate,
soakrate = function(pos)
return nodecore.tree_soil_rate(pos, 0, 1)
end,
soakcheck = function(data, pos)
if data.total < compostcost then return end
minetest.get_meta(pos):from_table({})