2017-08-30 15:15:03 -07:00
|
|
|
--[[ Cleaner mod
|
2021-05-18 17:46:18 -07:00
|
|
|
License: MIT
|
2017-08-30 14:38:48 -07:00
|
|
|
]]
|
|
|
|
|
|
|
|
|
2017-08-30 15:15:03 -07:00
|
|
|
cleaner = {}
|
2021-05-18 18:04:33 -07:00
|
|
|
cleaner.modname = core.get_current_modname()
|
2021-05-18 18:11:24 -07:00
|
|
|
cleaner.modpath = core.get_modpath(cleaner.modname)
|
2017-08-30 14:38:48 -07:00
|
|
|
|
2021-05-18 18:04:33 -07:00
|
|
|
local cleaner_debug = core.settings:get_bool("enable_debug_mods", false)
|
2017-08-30 14:38:48 -07:00
|
|
|
|
2021-05-18 18:04:33 -07:00
|
|
|
function cleaner.log(lvl, msg)
|
|
|
|
if lvl == "debug" and not cleaner_debug then return end
|
2017-08-30 14:38:48 -07:00
|
|
|
|
2021-05-18 19:57:24 -07:00
|
|
|
if lvl and not msg then
|
|
|
|
msg = lvl
|
|
|
|
lvl = nil
|
|
|
|
end
|
|
|
|
|
2021-05-18 18:04:33 -07:00
|
|
|
msg = "[" .. cleaner.modname .. "] " .. msg
|
|
|
|
if lvl == "debug" then
|
|
|
|
msg = "[DEBUG] " .. msg
|
|
|
|
lvl = nil
|
2017-08-30 14:38:48 -07:00
|
|
|
end
|
2021-05-18 18:04:33 -07:00
|
|
|
|
2021-05-18 19:57:24 -07:00
|
|
|
if not lvl then
|
|
|
|
core.log(msg)
|
|
|
|
else
|
|
|
|
core.log(lvl, msg)
|
|
|
|
end
|
2017-08-30 14:38:48 -07:00
|
|
|
end
|
|
|
|
|
2017-05-18 15:06:02 -07:00
|
|
|
|
2021-05-18 18:11:24 -07:00
|
|
|
local scripts = {
|
|
|
|
"entities",
|
|
|
|
"nodes",
|
|
|
|
}
|
2017-08-30 15:26:59 -07:00
|
|
|
|
2021-05-18 18:11:24 -07:00
|
|
|
for _, script in ipairs(scripts) do
|
|
|
|
dofile(cleaner.modpath .. "/" .. script .. ".lua")
|
2017-08-30 14:39:12 -07:00
|
|
|
end
|