mod-cleaner/init.lua

49 lines
821 B
Lua
Raw Permalink Normal View History

2017-08-30 15:15:03 -07:00
cleaner = {}
2021-05-18 18:04:33 -07:00
cleaner.modname = core.get_current_modname()
cleaner.modpath = core.get_modpath(cleaner.modname)
2021-05-18 18:04:33 -07:00
local cleaner_debug = core.settings:get_bool("enable_debug_mods", false)
2021-05-18 18:04:33 -07:00
function cleaner.log(lvl, msg)
if lvl == "debug" and not cleaner_debug then return end
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
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
end
local aux = dofile(cleaner.modpath .. "/misc_functions.lua")
-- initialize world file
aux.update_world_data()
local scripts = {
"settings",
2021-07-12 08:40:45 -07:00
"api",
2021-07-12 15:39:25 -07:00
"chat",
2021-07-29 13:38:10 -07:00
"tools",
"entities",
"nodes",
"items",
"ores",
}
for _, script in ipairs(scripts) do
dofile(cleaner.modpath .. "/" .. script .. ".lua")
end