leaves decomposition tweaks.

make decomposing leaves account for the pile size of nearby decomposing
leaves when determining their decomposition rate.
This commit is contained in:
trans_soup 2023-10-19 13:10:49 +02:00
parent 5014254c91
commit 72a8666a86

View file

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