Fix mod options not loading
The initialization for the options view happened before a few necessary systems where setup by the game.
This commit is contained in:
parent
108696135d
commit
e4a2ecdd4b
3 changed files with 32 additions and 21 deletions
|
@ -97,6 +97,13 @@ end
|
||||||
|
|
||||||
function dmf_mod_object:on_game_state_changed(status, state)
|
function dmf_mod_object:on_game_state_changed(status, state)
|
||||||
print("DMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
print("DMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
||||||
|
|
||||||
|
-- Certain intialization procedures need to be delayed until the game's core systems are
|
||||||
|
-- fully initialized and running
|
||||||
|
if status == "enter" and state == "StateTitle" then
|
||||||
|
dmf.initialize_options()
|
||||||
|
end
|
||||||
|
|
||||||
dmf.mods_game_state_changed_event(status, state)
|
dmf.mods_game_state_changed_event(status, state)
|
||||||
dmf.save_unsaved_settings_to_file()
|
dmf.save_unsaved_settings_to_file()
|
||||||
dmf.apply_delayed_hooks()
|
dmf.apply_delayed_hooks()
|
||||||
|
|
|
@ -170,11 +170,13 @@ function dmf.initialize_mod_data(mod, mod_data)
|
||||||
|
|
||||||
-- Mod's options initialization
|
-- Mod's options initialization
|
||||||
if mod_data.options or (not mod_data.is_mutator and not mod_data.options_widgets) then
|
if mod_data.options or (not mod_data.is_mutator and not mod_data.options_widgets) then
|
||||||
local success, error_message = pcall(dmf.initialize_mod_options, mod, mod_data.options)
|
dmf.safe_call(
|
||||||
if not success then
|
dmf,
|
||||||
mod:error(ERRORS.REGULAR.mod_options_initializing_failed, error_message)
|
ERRORS.REGULAR.mod_options_initializing_failed,
|
||||||
return
|
dmf.initialize_mod_options,
|
||||||
end
|
mod,
|
||||||
|
mod_data.options
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Textures initialization @TODO: move to a separate function
|
-- Textures initialization @TODO: move to a separate function
|
||||||
|
|
|
@ -257,6 +257,7 @@ end
|
||||||
-- ##### Script #######################################################################################################
|
-- ##### Script #######################################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
|
dmf.initialize_options = function()
|
||||||
dmf.initialize_mod_data(dmf, dmf_mod_data)
|
dmf.initialize_mod_data(dmf, dmf_mod_data)
|
||||||
|
|
||||||
-- first DMF initialization
|
-- first DMF initialization
|
||||||
|
@ -278,3 +279,4 @@ if not dmf:get("dmf_initialized") then
|
||||||
dmf:notify(dmf:localize("dmf_first_run_notification"))
|
dmf:notify(dmf:localize("dmf_first_run_notification"))
|
||||||
dmf:set("dmf_initialized", true)
|
dmf:set("dmf_initialized", true)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue