From 4542b97a96d77de09d9517097e7a4af788ec3ef3 Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Thu, 10 Nov 2022 20:45:19 +0100 Subject: [PATCH] Small fix --- data/cdata/ui_scripts/patches/__init__.lua | 20 +++++++------- data/cdata/ui_scripts/patches/gamemodes.lua | 29 -------------------- data/cdata/ui_scripts/patches/scoreboard.lua | 24 ++++++++++++++++ 3 files changed, 34 insertions(+), 39 deletions(-) create mode 100644 data/cdata/ui_scripts/patches/scoreboard.lua diff --git a/data/cdata/ui_scripts/patches/__init__.lua b/data/cdata/ui_scripts/patches/__init__.lua index 705a70dc..0265a4d0 100644 --- a/data/cdata/ui_scripts/patches/__init__.lua +++ b/data/cdata/ui_scripts/patches/__init__.lua @@ -1,22 +1,22 @@ -require("language") - if (game:issingleplayer()) then - return + return end if (Engine.InFrontend()) then - require("shader_dialog") - require("gamemodes") - require("no_mode_switch") - require("disable_useless_things") + require("shader_dialog") + require("gamemodes") + require("no_mode_switch") + require("disable_useless_things") +else + require("scoreboard") end -- defined in mp_hud/hudutils.lua function GetGameModeName() - return Engine.Localize(Engine.TableLookup(GameTypesTable.File, GameTypesTable.Cols.Ref, GameX.GetGameMode(), - GameTypesTable.Cols.Name)) + return Engine.Localize(Engine.TableLookup(GameTypesTable.File, + GameTypesTable.Cols.Ref, GameX.GetGameMode(), GameTypesTable.Cols.Name)) end function NeverAllowChangeTeams() - return false + return false end diff --git a/data/cdata/ui_scripts/patches/gamemodes.lua b/data/cdata/ui_scripts/patches/gamemodes.lua index 5e269750..6bdadc82 100644 --- a/data/cdata/ui_scripts/patches/gamemodes.lua +++ b/data/cdata/ui_scripts/patches/gamemodes.lua @@ -9,32 +9,3 @@ Cac.GameModes.Data = { } } } - -if (Engine.InFrontend()) then - return -end - -local gametypes = { - ["dm"] = true, - ["dom"] = true, - ["sd"] = true, - ["war"] = true, - ["conf"] = true, - ["vlobby"] = true, - ["koth"] = true, - ["sab"] = true, - ["ctf"] = true, - ["dd"] = true, - ["hp"] = true, - ["gun"] = true, -} - -local func = LUI.mp_hud.Scoreboard.DetermineIfSingleTeamGameType -LUI.mp_hud.Scoreboard.DetermineIfSingleTeamGameType = function() - local gametype = Engine.GetDvarString("ui_gametype") - if (gametypes[gametype]) then - return func() - end - - return Game.GetPlayerTeam() == Teams.free -end diff --git a/data/cdata/ui_scripts/patches/scoreboard.lua b/data/cdata/ui_scripts/patches/scoreboard.lua new file mode 100644 index 00000000..1913ca4a --- /dev/null +++ b/data/cdata/ui_scripts/patches/scoreboard.lua @@ -0,0 +1,24 @@ +local gametypes = { + ["dm"] = true, + ["dom"] = true, + ["sd"] = true, + ["war"] = true, + ["conf"] = true, + ["vlobby"] = true, + ["koth"] = true, + ["sab"] = true, + ["ctf"] = true, + ["dd"] = true, + ["hp"] = true, + ["gun"] = true, +} + +local func = LUI.mp_hud.Scoreboard.DetermineIfSingleTeamGameType +LUI.mp_hud.Scoreboard.DetermineIfSingleTeamGameType = function() + local gametype = Engine.GetDvarString("ui_gametype") + if (gametypes[gametype]) then + return func() + end + + return Game.GetPlayerTeam() == Teams.free +end