diff options
author | Will Castro <39478251+VITALISED@users.noreply.github.com> | 2022-01-14 15:00:47 +1100 |
---|---|---|
committer | Will Castro <39478251+VITALISED@users.noreply.github.com> | 2022-01-14 15:00:47 +1100 |
commit | 358b243fe65cd319fb871c331fb359437ad1d395 (patch) | |
tree | 46366554d271a1852db18200c922c33f8926c0bc /Northstar.CustomServers/mod/scripts/vscripts | |
parent | 8411bb9079593827b532461d205676c35fefb394 (diff) | |
download | NorthstarMods-358b243fe65cd319fb871c331fb359437ad1d395.tar.gz NorthstarMods-358b243fe65cd319fb871c331fb359437ad1d395.zip |
Fixes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
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 ) } } |