From 72a8666a86b43f35685e4136754df6130a2fd92c Mon Sep 17 00:00:00 2001 From: trans_soup <> Date: Thu, 19 Oct 2023 13:10:49 +0200 Subject: [PATCH] leaves decomposition tweaks. make decomposing leaves account for the pile size of nearby decomposing leaves when determining their decomposition rate. --- mods/bg_tree/decompose.lua | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/mods/bg_tree/decompose.lua b/mods/bg_tree/decompose.lua index 4bc970e..84a882a 100644 --- a/mods/bg_tree/decompose.lua +++ b/mods/bg_tree/decompose.lua @@ -27,11 +27,9 @@ blockgame.register_increasing_abm({ end, }) -local decompose_node_scores = { - [leaves_decomposing] = 30, -} -local decompose_group_scores = { +local decompose_scores = { dirty = 50, + leaves_decomposing = 30, } local decompose_cost = 2000 @@ -53,9 +51,10 @@ blockgame.register_increasing_abm({ local name = minetest.get_node(pos).name local gain = 0 - for group, value in pairs(decompose_group_scores) do - if minetest.get_item_group(name, group) > 0 then - gain = math.max(gain, value) + for group, value in pairs(decompose_scores) do + local group = minetest.get_item_group(name, group) + if group > 0 then + gain = math.max(gain, value * group) end end @@ -65,11 +64,6 @@ blockgame.register_increasing_abm({ score = score + gain return true end - - if decompose_node_scores[name] then - score = score + math.floor(decompose_node_scores[name] / distance) - return true - end end, 4) return data.value + score