tweak decomposition rng.

leaves now have a higher chance of turning into dirt, the higher they're
piled within the node. full stacks (taking up an entire node) always
turn into dirt.
This commit is contained in:
trans_soup 2023-10-19 12:58:31 +02:00
parent 4b408d9943
commit 5014254c91
1 changed files with 6 additions and 3 deletions

View File

@ -36,8 +36,6 @@ local decompose_group_scores = {
local decompose_cost = 2000
local average_leaves_per_dirt = 4
blockgame.register_increasing_abm({
id = modname .. ":decompose",
label = "decompose leaves",
@ -80,7 +78,12 @@ blockgame.register_increasing_abm({
return data.value >= decompose_cost
end,
action = function (pos, node, data)
if blockgame.chance(average_leaves_per_dirt) then
-- currently, larger leaf piles have a greater chance of turning into dirt instead of disappearing.
-- might wanna make it so that instead, dirt is layered as well?
local def = minetest.registered_nodes[node.name]
local dirt_chance = def.level_max - def.level + 1
if blockgame.chance(dirt_chance) then
minetest.set_node(pos, {name = "bg_terrain:dirt"})
else
minetest.remove_node(pos)