diff options
4 files changed, 21 insertions, 15 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut index cb11618a..9551e1cd 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut @@ -33,11 +33,14 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() || GetGameState() != eGameState.Playing )
AddTeamScore( attacker.GetTeam(), 1 )
- var existingAttackers = []
- foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
+ table<int, bool> alreadyAssisted
+ foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory )
{
- if( attackerInfo.attacker != attacker && !( attackerInfo.attacker in existingAttackers ) )
+ if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] )
+ {
+ alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 )
+ }
}
}
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut index ae5cb5e6..5aab3bf3 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut @@ -13,11 +13,14 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() || GetGameState() != eGameState.Playing )
AddTeamScore( attacker.GetTeam(), 1 )
- var existingAttackers = []
- foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
+ table<int, bool> alreadyAssisted
+ foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory )
{
- if( attackerInfo.attacker != attacker && !( attackerInfo.attacker in existingAttackers ) )
+ if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] )
+ {
+ alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 )
+ }
}
}
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut index 809c8886..d3fc4c95 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -281,14 +281,14 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga entity attacker = DamageInfo_GetAttacker( damageInfo ) int methodOfDeath = DamageInfo_GetDamageSourceIdentifier( damageInfo ) - var existingAttackers = [] - foreach(DamageHistoryStruct attackerInfo in player.e.recentDamageHistory) + table<int, bool> alreadyAssisted + foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory ) { - if( attackerInfo.attacker != attacker && !(attackerInfo.attacker in existingAttackers) ) + if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] ) { - AddPlayerScore(attackerInfo.attacker, "PilotAssist" ) - existingAttackers.append(attackerInfo.attacker) + alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), player.GetEncodedEHandle(), attackerInfo.time ) + AddPlayerScore(attackerInfo.attacker, "PilotAssist" ) } } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut index 19d58a17..40300b11 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut @@ -191,13 +191,13 @@ void function ScoreEvent_TitanKilled( entity victim, entity attacker, var damage else AddPlayerScore( attacker, "KillTitan", victim.GetTitanSoul().GetOwner() ) - var existingAttackers = [] - foreach(DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory) + table<int, bool> alreadyAssisted + foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory ) { - if( attackerInfo.attacker != attacker && !(attackerInfo.attacker in existingAttackers) ) + if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] ) { + alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true AddPlayerScore(attackerInfo.attacker, "TitanAssist" ) - existingAttackers.append(attackerInfo.attacker) Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), attackerInfo.time ) } } |