nodecore-cd2025/mods/nc_tree/leafdecay.lua
Aaron Suen fe2c153f9e Clean up all lua code style.
Formatting rules based on Paul Kulchenko's perl-based formatter...
http://notebook.kulchenko.com/programming/lua-beautifier-in-55-lines-of-perl
...using a single tab for indent.

Mostly pure whitespace changes.
2019-08-27 19:14:51 -04:00

32 lines
760 B
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
nodecore.register_limited_abm({
label = "Leaf Decay",
interval = 1,
chance = 10,
limited_max = 100,
limited_alert = 1000,
nodenames = {modname .. ":leaves"},
action = function(pos)
if not nodecore.scan_flood(pos, 5, function(p)
local n = minetest.get_node(p).name
if n == modname .. ":tree"
or n == "ignore" then
return true
end
if n == modname .. ":leaves" then
return
end
return false
end
) then
nodecore.leaf_decay(pos)
end
end
})