From eaa1f34c3f8aed4689c5a7683373996d87971e53 Mon Sep 17 00:00:00 2001 From: Aaron Suen Date: Sat, 6 May 2023 19:48:28 -0400 Subject: [PATCH] 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. --- mods/nc_tree/api.lua | 6 +++--- mods/nc_tree/compost.lua | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mods/nc_tree/api.lua b/mods/nc_tree/api.lua index 7c2cc27d..0370a3b4 100644 --- a/mods/nc_tree/api.lua +++ b/mods/nc_tree/api.lua @@ -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 diff --git a/mods/nc_tree/compost.lua b/mods/nc_tree/compost.lua index a789c054..5f4a8a19 100644 --- a/mods/nc_tree/compost.lua +++ b/mods/nc_tree/compost.lua @@ -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({})