update decomposition to use increasing ABM:s.
This commit is contained in:
parent
453add021d
commit
dcb0eb257e
|
@ -9,26 +9,40 @@ local leaves_decomposing = modname .. ":leaves_decomposing"
|
|||
|
||||
-- END OF NODE NAMES
|
||||
|
||||
-- TODO: replace these with over-time thing when that's added.
|
||||
|
||||
blockgame.register_abm({
|
||||
blockgame.register_increasing_abm({
|
||||
id = "bg_tree:begin_decompose",
|
||||
label = "decompose leaves",
|
||||
nodenames = {leaves},
|
||||
neighbors = {"group:dirty"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
action = function (pos, node)
|
||||
rate = function (pos, node, data)
|
||||
return data.value + math.random(4, 6)
|
||||
end,
|
||||
check = function (pos, node, data)
|
||||
return data.value >= 20
|
||||
end,
|
||||
action = function (pos, node, data)
|
||||
minetest.set_node(pos, {name = leaves_decomposing})
|
||||
end,
|
||||
})
|
||||
|
||||
blockgame.register_abm({
|
||||
blockgame.register_increasing_abm({
|
||||
id = "bg_tree:decompose",
|
||||
label = "decompose leaves",
|
||||
nodenames = {leaves_decomposing},
|
||||
neighbors = {"group:dirty"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
action = function (pos, node)
|
||||
interval = 30,
|
||||
chance = 10,
|
||||
rate = function (pos, node, data)
|
||||
-- TODO: decompose faster depending on surrounding dirty nodes & other decomposing leaves.
|
||||
-- can probably do that with a flood fill that counts up a "score" depending on the nodes it encounters.
|
||||
return data.value + math.random(1, 9)
|
||||
end,
|
||||
check = function (pos, node, data)
|
||||
return data.value >= 30
|
||||
end,
|
||||
action = function (pos, node, data)
|
||||
minetest.set_node(pos, {name = "bg_terrain:dirt"})
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue