forked from AntumLuanti/mod-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
56 lines (44 loc) · 966 Bytes
/
Copy pathinit.lua
File metadata and controls
56 lines (44 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
skeleton = {}
skeleton.modname = core.get_current_modname()
skeleton.modpath = core.get_modpath(skeleton.modname)
function skeleton.log(lvl, msg)
if not msg then
msg = lvl
lvl = nil
end
msg = "[" .. skeleton.modname .. "] " .. msg
if not lvl then
core.log(msg)
else
core.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 = {
"settings",
"entity",
}
for _, script in ipairs(scripts) do
dofile(skeleton.modpath .. "/" .. script .. ".lua")
end