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)
|
||||
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.save_unsaved_settings_to_file()
|
||||
dmf.apply_delayed_hooks()
|
||||
|
|
|
@ -170,11 +170,13 @@ function dmf.initialize_mod_data(mod, mod_data)
|
|||
|
||||
-- Mod's options initialization
|
||||
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)
|
||||
if not success then
|
||||
mod:error(ERRORS.REGULAR.mod_options_initializing_failed, error_message)
|
||||
return
|
||||
end
|
||||
dmf.safe_call(
|
||||
dmf,
|
||||
ERRORS.REGULAR.mod_options_initializing_failed,
|
||||
dmf.initialize_mod_options,
|
||||
mod,
|
||||
mod_data.options
|
||||
)
|
||||
end
|
||||
|
||||
-- Textures initialization @TODO: move to a separate function
|
||||
|
|
|
@ -257,24 +257,26 @@ end
|
|||
-- ##### Script #######################################################################################################
|
||||
-- ####################################################################################################################
|
||||
|
||||
dmf.initialize_mod_data(dmf, dmf_mod_data)
|
||||
dmf.initialize_options = function()
|
||||
dmf.initialize_mod_data(dmf, dmf_mod_data)
|
||||
|
||||
-- first DMF initialization
|
||||
-- it will be run only 1 time, when the player launch the game with DMF for the first time
|
||||
if not dmf:get("dmf_initialized") then
|
||||
-- first DMF initialization
|
||||
-- it will be run only 1 time, when the player launch the game with DMF for the first time
|
||||
if not dmf:get("dmf_initialized") then
|
||||
|
||||
dmf.load_logging_settings()
|
||||
dmf.load_developer_mode_settings()
|
||||
dmf.load_network_settings()
|
||||
dmf.load_custom_textures_settings()
|
||||
dmf.load_dev_console_settings()
|
||||
dmf.load_chat_history_settings()
|
||||
dmf.load_logging_settings()
|
||||
dmf.load_developer_mode_settings()
|
||||
dmf.load_network_settings()
|
||||
dmf.load_custom_textures_settings()
|
||||
dmf.load_dev_console_settings()
|
||||
dmf.load_chat_history_settings()
|
||||
|
||||
-- Not necessary until the view is loaded
|
||||
if dmf.load_dmf_options_view_settings then
|
||||
dmf.load_dmf_options_view_settings()
|
||||
-- Not necessary until the view is loaded
|
||||
if dmf.load_dmf_options_view_settings then
|
||||
dmf.load_dmf_options_view_settings()
|
||||
end
|
||||
|
||||
dmf:notify(dmf:localize("dmf_first_run_notification"))
|
||||
dmf:set("dmf_initialized", true)
|
||||
end
|
||||
|
||||
dmf:notify(dmf:localize("dmf_first_run_notification"))
|
||||
dmf:set("dmf_initialized", true)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue