diff options
author | Barichello <artur@barichello.me> | 2022-02-19 03:29:04 -0300 |
---|---|---|
committer | Barichello <artur@barichello.me> | 2022-02-19 03:29:04 -0300 |
commit | c82027ae6408f36673f41e11391f90a8ac921510 (patch) | |
tree | df49661f547951f79f15753c9fd16d95d2d73878 /Northstar.CustomServers/mod | |
parent | 76abcfb875ac230893043261d43d39f46df2140e (diff) | |
download | NorthstarMods-c82027ae6408f36673f41e11391f90a8ac921510.tar.gz NorthstarMods-c82027ae6408f36673f41e11391f90a8ac921510.zip |
Refactor hardpoint chevron logic
Diffstat (limited to 'Northstar.CustomServers/mod')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | 25 |
1 files changed, 9 insertions, 16 deletions
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 <int, int> 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() } |