nodecore-cd2025/mods/nc_tree/leafdecay.lua

33 lines
796 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)
2019-02-09 23:00:38 -05:00
local n = minetest.get_node(p).name
if n == modname .. ":tree"
2020-01-15 22:38:33 -05:00
or n == modname .. ":tree_bud"
2019-02-09 23:00:38 -05:00
or n == "ignore" then
2019-01-05 23:11:38 -05:00
return true
end
2019-02-09 23:00:38 -05:00
if n == modname .. ":leaves" then
2019-01-05 23:11:38 -05:00
return
end
return false
end
) then
2019-01-05 23:11:38 -05:00
nodecore.leaf_decay(pos)
end
end
})