From c82027ae6408f36673f41e11391f90a8ac921510 Mon Sep 17 00:00:00 2001 From: Barichello Date: Sat, 19 Feb 2022 03:29:04 -0300 Subject: Refactor hardpoint chevron logic --- .../scripts/vscripts/gamemodes/_gamemode_cp.nut | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'Northstar.CustomServers/mod') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 5746fe77..11cb30d6 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -602,29 +602,22 @@ void function TrackChevronStates() while ( true ) { - int imcChevron - int militiaChevron + table chevrons = { + [TEAM_IMC] = 0, + [TEAM_MILITIA] = 0, + } foreach ( HardpointStruct hardpoint in file.hardpoints ) { - if ( hardpoint.hardpoint.GetTeam() == TEAM_IMC ) - { - if ( hardpoint.hardpoint.GetHardpointState() == CAPTURE_POINT_STATE_AMPED ) - imcChevron += 4 - else - imcChevron++ - } - else if ( hardpoint.hardpoint.GetTeam() == TEAM_MILITIA ) + foreach ( k, v in chevrons ) { - if ( hardpoint.hardpoint.GetHardpointState() == CAPTURE_POINT_STATE_AMPED ) - militiaChevron += 4 - else - militiaChevron++ + if ( k == hardpoint.hardpoint.GetTeam() ) + chevrons[k] += ( hardpoint.hardpoint.GetHardpointState() == CAPTURE_POINT_STATE_AMPED ) ? 4 : 1 } } - SetGlobalNetInt( "imcChevronState", imcChevron ) - SetGlobalNetInt( "milChevronState", militiaChevron ) + SetGlobalNetInt( "imcChevronState", chevrons[TEAM_IMC] ) + SetGlobalNetInt( "milChevronState", chevrons[TEAM_MILITIA] ) WaitFrame() } -- cgit v1.2.3