From b2fadb9d06ad8e8126c0f0724e0b58710a2f2101 Mon Sep 17 00:00:00 2001 From: efinst0rm Date: Tue, 24 Jan 2023 08:50:12 -0600 Subject: [PATCH] fix: allow players to change teams in game (#589) Co-authored-by: Edo --- data/ui_scripts/patches/__init__.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/ui_scripts/patches/__init__.lua b/data/ui_scripts/patches/__init__.lua index 9326ee1..d0f4ffc 100644 --- a/data/ui_scripts/patches/__init__.lua +++ b/data/ui_scripts/patches/__init__.lua @@ -5,3 +5,15 @@ end function GetGameModeName() return Engine.Localize(Engine.TableLookup(GameTypesTable.File, GameTypesTable.Cols.Ref, GameX.GetGameMode(), GameTypesTable.Cols.Name)) end + +-- Allow players to change teams in game. +function CanChangeTeam() + local f9_local0 = GameX.GetGameMode() + local f9_local1 + if f9_local0 ~= "aliens" and Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f9_local0, GameTypesTable.Cols.TeamChoice ) == "1" then + f9_local1 = not MLG.IsMLGSpectator() + else + f9_local1 = false + end + return f9_local1 +end