aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts
diff options
context:
space:
mode:
authorBarichello <artur@barichello.me>2022-02-19 03:29:04 -0300
committerBarichello <artur@barichello.me>2022-02-19 03:29:04 -0300
commitc82027ae6408f36673f41e11391f90a8ac921510 (patch)
treedf49661f547951f79f15753c9fd16d95d2d73878 /Northstar.CustomServers/mod/scripts
parent76abcfb875ac230893043261d43d39f46df2140e (diff)
downloadNorthstarMods-c82027ae6408f36673f41e11391f90a8ac921510.tar.gz
NorthstarMods-c82027ae6408f36673f41e11391f90a8ac921510.zip
Refactor hardpoint chevron logic
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut25
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 5746fe773..11cb30d63 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()
}