nodecore-cd2025/mods/nc_tree/leafdecay.lua

30 lines
764 B
Lua
Raw Normal View History

2019-01-05 23:11:38 -05:00
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
2019-01-05 23:11:38 -05:00
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
nodecore.register_limited_abm({
2019-01-05 23:11:38 -05:00
label = "Leaf Decay",
interval = 1,
chance = 10,
limited_max = 100,
2019-01-12 20:53:02 -05:00
limited_alert = 1000,
2019-01-05 23:11:38 -05:00
nodenames = {modname .. ":leaves"},
action = function(pos)
if not nodecore.scan_flood(pos, 5, function(p)
if nodecore.node_is(p, modname .. ":tree")
or nodecore.node_is(p, "ignore") then
2019-01-05 23:11:38 -05:00
return true
end
if nodecore.node_is(p, modname .. ":leaves") then
return
end
return false
end) then
nodecore.leaf_decay(pos)
end
end
})