feat(dtmm): Provide dt for loading state

Apparently Fatshark does not proxy `dt` in their boot loading sub
states. But we do need that for the mod manager.
This commit is contained in:
Lucas Schwiderski 2023-02-25 18:27:32 +01:00
parent 1d12099448
commit 22d8ab05ab
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -15,7 +15,31 @@ local libs = {
require("scripts/main")
print("[mod_main] 'scripts/main' loaded")
require("scripts/game_states/boot/state_boot_sub_state_base")
local StateBootSubStateBase = require("scripts/game_states/boot/state_boot_sub_state_base")
-- A necessary override.
-- The original does not proxy `dt` to `_state_update`, but we need that.
StateBootSubStateBase.update = function (self, dt)
local done, error = self:_state_update(dt)
local params = self._params
if error then
return StateError, {
error
}
elseif done then
local next_index = params.sub_state_index + 1
params.sub_state_index = next_index
local next_state_data = params.states[next_index]
if next_state_data then
return next_state_data[1], self._params
else
self._parent:sub_states_done()
end
end
end
local StateBootLoadMods = class("StateBootLoadMods", "StateBootSubStateBase")
StateBootLoadMods.on_enter = function (self, parent, params)