Darktide-Mod-Loader/scripts/mods/dml/init.lua
Lucas Schwiderski a36e6f4adb
feat: Implement mod loader
Co-authored-by: Aussiemon <mattrohrlach+github@gmail.com>
2023-05-07 00:15:19 +02:00

32 lines
752 B
Lua

-- The loader object that is used during game boot
-- to initialize the modding environment.
local loader = {}
Mods = {
hook = {},
lua = setmetatable({}, {
__index = { debug = debug, io = io, ffi = ffi, os = os },
}),
}
dofile("scripts/mods/dml/require")
dofile("scripts/mods/dml/class")
dofile("scripts/mods/dml/hook")
function loader:init(boot_gui, mod_data)
local ModLoader = dofile("scripts/mods/dml/mod_loader")
local mod_loader = ModLoader:init(boot_gui, mod_data)
self._mod_loader = mod_loader
Mods.hook.set(StateGame, "update", function(func, dt, ...)
mod_loader:update(dt)
return func(dt, ...)
end)
end
function loader:update(dt)
self._mod_loader:update(dt)
end
return loader