Don't shut down completely if compatible mob library not found

master
Jordan Irwin 2021-08-12 23:25:39 -07:00
parent e007af1dd0
commit da5e16d685
2 changed files with 27 additions and 25 deletions

View File

@ -1,5 +1,4 @@
TODO:
- port to mobkit
- don't shut down completely if compatible mob library not found
- add setting to change mob library preference order

View File

@ -3,30 +3,6 @@ skeleton = {}
skeleton.modname = core.get_current_modname()
skeleton.modpath = core.get_modpath(skeleton.modname)
-- support mob libraries in order of preference
local mob_libs = {
"mobs",
"cmer",
"creatures",
}
for _, ml in ipairs(mob_libs) do
if core.get_modpath(ml) then
skeleton.lib = ml
break
end
end
-- check for compatible library
if not skeleton.lib then
error("a compatible mob library was not found, please install one of the following: "
.. table.concat(mob_libs, ", "))
end
if skeleton.lib == "creatures" then
skeleton.lib = "cmer"
end
function skeleton.log(lvl, msg)
if not msg then
msg = lvl
@ -43,6 +19,33 @@ function skeleton.log(lvl, msg)
end
-- support mob libraries in order of preference
local mob_libs = {
"mobs",
"cmer",
"creatures",
}
for _, ml in ipairs(mob_libs) do
if core.get_modpath(ml) then
skeleton.lib = ml
break
end
end
-- check for compatible library
if not skeleton.lib then
skeleton.log("error", "Could not load. A compatible mob library was not found. Please install one of the following: "
.. table.concat(mob_libs, ", "))
skeleton = nil
do return end
end
if skeleton.lib == "creatures" then
skeleton.lib = "cmer"
end
local scripts = {
"settings",
"entity",