make leaves get a random level when they start decomposing.

This commit is contained in:
trans_soup 2023-10-19 15:59:11 +02:00
parent 7493d9771c
commit 737afdfcc9
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ blockgame.register_increasing_abm({
return data.value >= 80
end,
action = function (pos, node, data)
minetest.set_node(pos, {name = leaves_decomposing})
-- NOTE: might wanna access the 4 from somewhere, instead of directly knowing it.
-- that way this won't have to change if decomposing leaves max levels change.
local level = math.random(1, 4)
minetest.set_node(pos, {name = leaves_decomposing .. "_" .. level})
end,
})