Update mod_loader for 1.0.40

This commit is contained in:
Aussiemon 2023-03-23 12:49:59 -06:00
parent 130407d342
commit a9d32a2950

View file

@ -322,14 +322,10 @@ local ParameterResolver = require("scripts/foundation/utilities/parameters/param
local StateBoot = require("scripts/game_states/state_boot") local StateBoot = require("scripts/game_states/state_boot")
local StateLoadAudioSettings = require("scripts/game_states/boot/state_load_audio_settings") local StateLoadAudioSettings = require("scripts/game_states/boot/state_load_audio_settings")
local StateLoadBootAssets = require("scripts/game_states/boot/state_load_boot_assets") local StateLoadBootAssets = require("scripts/game_states/boot/state_load_boot_assets")
-- Unused right now, but might be useful in case we want to re-add the state at some point
local StateLoadMods = require("scripts/game_states/boot/state_load_mods")
local StateLoadRenderSettings = require("scripts/game_states/boot/state_load_render_settings") local StateLoadRenderSettings = require("scripts/game_states/boot/state_load_render_settings")
local StateRequireScripts = require("scripts/game_states/boot/state_require_scripts") local StateRequireScripts = require("scripts/game_states/boot/state_require_scripts")
Main.init = function (self) function Main:init()
Script.configure_garbage_collection(Script.ACCEPTABLE_GARBAGE, 0.1, Script.MAXIMUM_GARBAGE, 0.5, Script.FORCE_FULL_COLLECT_GARBAGE_LEVEL, 1, Script.MINIMUM_COLLECT_TIME_MS, 0.1, Script.MAXIMUM_COLLECT_TIME_MS, 0.5) Script.configure_garbage_collection(Script.ACCEPTABLE_GARBAGE, 0.1, Script.MAXIMUM_GARBAGE, 0.5, Script.FORCE_FULL_COLLECT_GARBAGE_LEVEL, 1, Script.MINIMUM_COLLECT_TIME_MS, 0.1, Script.MAXIMUM_COLLECT_TIME_MS, 0.5)
ParameterResolver.resolve_command_line() ParameterResolver.resolve_command_line()
ParameterResolver.resolve_game_parameters() ParameterResolver.resolve_game_parameters()
@ -380,7 +376,7 @@ Main.init = function (self)
end end
self._package_manager = package_manager self._package_manager = package_manager
self._sm = GameStateMachine:new(nil, StateBoot, params) self._sm = GameStateMachine:new(nil, StateBoot, params, nil, nil, "Main")
-- ####################### -- #######################
-- ## Mod intialization ## -- ## Mod intialization ##
@ -388,26 +384,27 @@ Main.init = function (self)
-- ####################### -- #######################
end end
Main.update = function (self, dt) function Main:update(dt)
self._sm:update(dt) self._sm:update(dt)
end end
Main.render = function (self) function Main:render()
self._sm:render() self._sm:render()
end end
Main.on_reload = function (self, refreshed_resources) function Main:on_reload(refreshed_resources)
self._sm:on_reload(refreshed_resources) self._sm:on_reload(refreshed_resources)
end end
Main.on_close = function (self) function Main:on_close()
local should_close = self._sm:on_close() local should_close = self._sm:on_close()
return should_close return should_close
end end
Main.shutdown = function (self) function Main:shutdown()
Application.force_silent_exit_policy() Application.force_silent_exit_policy()
if rawget(_G, "Crashify") then if rawget(_G, "Crashify") then
Crashify.print_property("shutdown", true) Crashify.print_property("shutdown", true)
end end
@ -420,7 +417,9 @@ Main.shutdown = function (self)
owns_package_manager = false owns_package_manager = false
end end
self._sm:destroy() local on_shutdown = true
self._sm:destroy(on_shutdown)
if owns_package_manager then if owns_package_manager then
self._package_manager:delete() self._package_manager:delete()
@ -446,8 +445,14 @@ end
function on_activate(active) function on_activate(active)
print("LUA window => " .. (active and "ACTIVATED" or "DEACTIVATED")) print("LUA window => " .. (active and "ACTIVATED" or "DEACTIVATED"))
if active and rawget(_G, "Managers") and Managers.dlc then if active and rawget(_G, "Managers") then
Managers.dlc:evaluate_consumables() if Managers.dlc then
Managers.dlc:evaluate_consumables()
end
if Managers.account then
Managers.account:refresh_communication_restrictions()
end
end end
end end