blockgame/mods/bg_tree/decompose.lua
trans_soup d04e92a15c add decomposition of leaves into dirt.
make leaves decompose over time into dirt when near dirty nodes. also
remove placeholder pummel recipe that turns leaves into dirt.
2023-10-16 20:41:09 +02:00

34 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,
})