fix decomposition starting level.

leaves now preserve their level when they start decomposing.
This commit is contained in:
trans_soup 2023-10-22 21:16:26 +02:00
parent 4c21d9a015
commit f3d46e4d71
1 changed files with 2 additions and 3 deletions

View File

@ -64,9 +64,8 @@ blockgame.register_increasing_abm({
return data.value >= start_decompose_cost
end,
action = function (pos, node, data)
-- 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)
local def = minetest.registered_nodes[node.name]
local level = def.level
minetest.set_node(pos, {name = leaves_decomposing .. "_" .. level})
end,
})