2019-01-05 23:11:38 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-01-06 12:02:37 -05:00
|
|
|
local minetest, nodecore
|
|
|
|
= minetest, nodecore
|
2019-01-05 23:11:38 -05:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
2019-01-06 12:02:37 -05:00
|
|
|
nodecore.register_limited_abm({
|
2019-01-05 23:11:38 -05:00
|
|
|
label = "Leaf Decay",
|
|
|
|
interval = 1,
|
|
|
|
chance = 10,
|
2019-01-08 02:03:18 -05:00
|
|
|
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-01-06 12:02:37 -05:00
|
|
|
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
|
2019-01-06 12:02:37 -05:00
|
|
|
})
|