35 lines
774 B
Lua
35 lines
774 B
Lua
|
local modname = minetest.get_current_modname()
|
||
|
local api = blockgame.tree
|
||
|
local vec = blockgame.vector
|
||
|
|
||
|
-- NODE NAMES
|
||
|
|
||
|
local leaves = modname .. ":leaves"
|
||
|
local leaves_decomposing = modname .. ":leaves_decomposing"
|
||
|
|
||
|
-- END OF NODE NAMES
|
||
|
|
||
|
-- TODO: replace these with over-time thing when that's added.
|
||
|
|
||
|
blockgame.register_abm({
|
||
|
label = "decompose leaves",
|
||
|
nodenames = {leaves},
|
||
|
neighbors = {"group:dirty"},
|
||
|
interval = 15,
|
||
|
chance = 4,
|
||
|
action = function (pos, node)
|
||
|
minetest.set_node(pos, {name = leaves_decomposing})
|
||
|
end,
|
||
|
})
|
||
|
|
||
|
blockgame.register_abm({
|
||
|
label = "decompose leaves",
|
||
|
nodenames = {leaves_decomposing},
|
||
|
neighbors = {"group:dirty"},
|
||
|
interval = 15,
|
||
|
chance = 4,
|
||
|
action = function (pos, node)
|
||
|
minetest.set_node(pos, {name = "bg_terrain:dirt"})
|
||
|
end,
|
||
|
})
|