fix: unpausing game doesn't cause reloading of lua files anymore

This commit is contained in:
Jari van der Kaap 2023-03-11 23:31:13 +01:00
parent df857f7aef
commit 22f8b4b1d3

View File

@ -223,6 +223,8 @@ namespace ui_scripting
} }
} }
bool doneFirstSnapshot = false;
void ui_cod_init_stub(const bool frontend) void ui_cod_init_stub(const bool frontend)
{ {
ui_cod_init_hook.invoke(frontend); ui_cod_init_hook.invoke(frontend);
@ -232,30 +234,31 @@ namespace ui_scripting
// Fetch the names of the local files so file overrides are already handled // Fetch the names of the local files so file overrides are already handled
globals = {}; globals = {};
const utils::nt::library host{}; const utils::nt::library host{};
doneFirstSnapshot = false;
load_local_script_files((game::get_appdata_path() / "data/ui_scripts/").string()); load_local_script_files((game::get_appdata_path() / "data/ui_scripts/").string());
load_local_script_files((host.get_folder() / "boiii/ui_scripts/").string()); load_local_script_files((host.get_folder() / "boiii/ui_scripts/").string());
return; return;
} }
const auto _0 = utils::finally(&try_start); try_start();
} }
void ui_cod_lobbyui_init_stub() void ui_cod_lobbyui_init_stub()
{ {
ui_cod_lobbyui_init_hook.invoke(); ui_cod_lobbyui_init_hook.invoke();
const auto _0 = utils::finally(&try_start); try_start();
} }
void cl_first_snapshot_stub(int a1) void cl_first_snapshot_stub(int a1)
{ {
cl_first_snapshot_hook.invoke(a1); cl_first_snapshot_hook.invoke(a1);
if (game::Com_IsRunningUILevel()) if (game::Com_IsRunningUILevel() || doneFirstSnapshot)
{ {
return; return;
} }
doneFirstSnapshot = true;
const auto _0 = utils::finally(&try_start); try_start();
} }
void ui_shutdown_stub() void ui_shutdown_stub()