aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui
diff options
context:
space:
mode:
authorWilliam Miller <william-millennium@hotmail.com>2024-11-22 11:23:21 -0300
committerGitHub <noreply@github.com>2024-11-22 15:23:21 +0100
commit13211e9037d3c2d6bf5e0c1c2ff00fb9a7b3c36b (patch)
tree5ddf9d64e60d67d1b59e0cc591ecdaff52c3392f /Northstar.Client/mod/scripts/vscripts/ui
parentaba62bfaf4556c3b6285066b43a6063976a8d4f9 (diff)
downloadNorthstarMods-13211e9037d3c2d6bf5e0c1c2ff00fb9a7b3c36b.tar.gz
NorthstarMods-13211e9037d3c2d6bf5e0c1c2ff00fb9a7b3c36b.zip
Add button to allow players to change teams (#872)
Adds button and logic to allow players to switch teams. This is a feature used in FSU and popular on many servers. Team switch is disabled via script for some gamemodes where switching teams does not make sense.
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ingame.nut21
1 files changed, 21 insertions, 0 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ingame.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ingame.nut
index 35c9e9ba..ac617a9c 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ingame.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ingame.nut
@@ -85,6 +85,9 @@ void function InitInGameMPMenu()
var gameHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_GAME" )
var leaveButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#LEAVE_MATCH" )
Hud_AddEventHandler( leaveButton, UIE_CLICK, OnLeaveButton_Activate )
+ var teamChangeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#SWITCH_TEAMS" )
+ Hud_AddEventHandler( teamChangeButton, UIE_CLICK, OnRequestTeamSwitch )
+ thread UpdateTeamSwitchButton_Threaded( teamChangeButton )
#if DEV
var devButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "Dev" )
Hud_AddEventHandler( devButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "DevMenu" ) ) )
@@ -700,3 +703,21 @@ void function SetTitanSelectButtonVisibleState( bool state )
Hud_Hide( file.titanSelectButton )
}
}
+
+void function UpdateTeamSwitchButton_Threaded( var button )
+{
+ while ( true )
+ {
+ Hud_SetLocked( button, !GetConVarBool( "ns_allow_team_change" ) )
+ wait 0.5
+ }
+}
+
+void function OnRequestTeamSwitch( var button )
+{
+ if ( !Hud_IsLocked( button ) )
+ {
+ ClientCommand( "changeteam" )
+ CloseAllMenus()
+ }
+}