Don't shut down completely if compatible mob library not found
parent
e007af1dd0
commit
da5e16d685
1
TODO.txt
1
TODO.txt
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- port to mobkit
|
- port to mobkit
|
||||||
- don't shut down completely if compatible mob library not found
|
|
||||||
- add setting to change mob library preference order
|
- add setting to change mob library preference order
|
||||||
|
|
51
init.lua
51
init.lua
|
@ -3,30 +3,6 @@ skeleton = {}
|
||||||
skeleton.modname = core.get_current_modname()
|
skeleton.modname = core.get_current_modname()
|
||||||
skeleton.modpath = core.get_modpath(skeleton.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)
|
function skeleton.log(lvl, msg)
|
||||||
if not msg then
|
if not msg then
|
||||||
msg = lvl
|
msg = lvl
|
||||||
|
@ -43,6 +19,33 @@ function skeleton.log(lvl, msg)
|
||||||
end
|
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 = {
|
local scripts = {
|
||||||
"settings",
|
"settings",
|
||||||
"entity",
|
"entity",
|
||||||
|
|
Loading…
Reference in New Issue