Darktide Mod Manager #39

Merged
lucas merged 91 commits from feat/dtmm into master 2023-03-01 22:27:42 +01:00
Showing only changes of commit d6ee6e9a10 - Show all commits

View file

@ -56,28 +56,32 @@ end
-- Patch `GameStateMachine.init` to add our own state for loading mods. -- Patch `GameStateMachine.init` to add our own state for loading mods.
-- In the future, Fatshark might provide us with a dedicated way to do this. -- In the future, Fatshark might provide us with a dedicated way to do this.
local function patch_mod_loading_state() local function patch_mod_loading_state()
print("[mod_main] Adding mod loading state") print("[mod_main] Adding mod loading state")
local GameStateMachine = require("scripts/foundation/utilities/game_state_machine") local GameStateMachine = require("scripts/foundation/utilities/game_state_machine")
local patched = false
local GameStateMachine_init = GameStateMachine.init local GameStateMachine_init = GameStateMachine.init
GameStateMachine.init = function(self, parent, start_state, params, ...) GameStateMachine.init = function(self, parent, start_state, params, ...)
-- Hardcoded position after `StateRequireScripts`. if not patched then
-- We do want to wait until then, so that most of the game's core patched = true
-- systems are at least loaded and can be hooked, even if they aren't
-- running, yet.
local pos = 4
table.insert(params.states, pos, {
StateBootLoadMods,
{
package_manager = params.package_manager,
},
})
-- Clean up after us -- Hardcoded position after `StateRequireScripts`.
GameStateMachine.init = GameStateMachine_init -- We do want to wait until then, so that most of the game's core
-- systems are at least loaded and can be hooked, even if they aren't
-- running, yet.
local pos = 4
table.insert(params.states, pos, {
StateBootLoadMods,
{
package_manager = params.package_manager,
},
})
end
return GameStateMachine_init(self, parent, start_state, params, ...) GameStateMachine_init(self, parent, start_state, params, ...)
end end
print("[mod_main] Mod patching complete")
end end
function init() function init()