From a6906c51f6891f351f603d9edc0f51f883e6966d Mon Sep 17 00:00:00 2001 From: Jari van der Kaap Date: Sun, 26 Feb 2023 00:20:39 +0100 Subject: [PATCH 1/2] fix: added hook to load new lua scripts after all stock lua scripts are executed --- src/client/component/ui_scripting.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index bc4f574c..0c9a9388 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -21,6 +21,7 @@ namespace ui_scripting utils::hook::detour ui_cod_init_hook; utils::hook::detour ui_cod_lobbyui_init_hook; + utils::hook::detour cl_first_snapshot_hook; utils::hook::detour ui_shutdown_hook; utils::hook::detour hks_package_require_hook; utils::hook::detour lua_cod_getrawfile_hook; @@ -245,6 +246,18 @@ namespace ui_scripting const auto _0 = utils::finally(&try_start); } + void cl_first_snapshot_stub(int a1) + { + cl_first_snapshot_hook.invoke(a1); + + if (game::Com_IsRunningUILevel()) + { + return; + } + + const auto _0 = utils::finally(&try_start); + } + void ui_shutdown_stub() { converted_functions.clear(); @@ -392,6 +405,8 @@ namespace ui_scripting return; } + cl_first_snapshot_hook.create(0x141320E60_g, cl_first_snapshot_stub); + dvar_cg_enable_unsafe_lua_functions = game::Dvar_RegisterBool( game::Dvar_GenerateHash("cg_enable_unsafe_lua_functions"), "cg_enable_unsafe_lua_functions", false, static_cast(0x1000), "Enables the use of unsafe lua functions"); From f90c15bd5e2def502396ea4e814c5a39477a21f4 Mon Sep 17 00:00:00 2001 From: Jari van der Kaap Date: Sun, 26 Feb 2023 00:21:35 +0100 Subject: [PATCH 2/2] feat: added lui to always show change teams button on teams gamemode --- data/ui_scripts/party/__init__.lua | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 data/ui_scripts/party/__init__.lua diff --git a/data/ui_scripts/party/__init__.lua b/data/ui_scripts/party/__init__.lua new file mode 100644 index 00000000..5416f138 --- /dev/null +++ b/data/ui_scripts/party/__init__.lua @@ -0,0 +1,9 @@ + +-- Removed check for public matches to allow team change in ranked matches +CoD.IsTeamChangeAllowed = function() + if Engine.GetGametypeSetting( "allowInGameTeamChange" ) == 1 then + return true + else + return false + end +end \ No newline at end of file