aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-10-17 14:27:37 +0100
committerGitHub <noreply@github.com>2023-10-17 15:27:37 +0200
commit327e40edf85e9ad12b85256382123049d55fd07f (patch)
tree79dd3ed9c4360cde31e2a49b6233c15ee044fb90
parent6df399f251bbaf8b43629ba023061eea67a37656 (diff)
downloadNorthstarMods-327e40edf85e9ad12b85256382123049d55fd07f.tar.gz
NorthstarMods-327e40edf85e9ad12b85256382123049d55fd07f.zip
Award titan assist stats based on titan soul damage history (#746)
Titans stores damage history in their Soul component, not the NPC itself, probably due to how game handles pilot/auto-titan interaction with the Titan entities. This means that we weren't awarding assist stats properly for titan assists
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut6
1 files changed, 4 insertions, 2 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut
index 208e6da12..dbfcea61b 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut
@@ -571,9 +571,11 @@ void function HandleKillStats( entity victim, entity attacker, var damageInfo )
// assistsTotal ( weapon_kill_stats )
// note: eww
table<int, bool> alreadyAssisted
- foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
+ // titans store their recentDamageHistory in the soul
+ entity assistVictim = ( victim.IsTitan() && IsValid( victim.GetTitanSoul() ) ) ? victim.GetTitanSoul() : victim
+ foreach( DamageHistoryStruct attackerInfo in assistVictim.e.recentDamageHistory )
{
- if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == victim )
+ if ( !IsValid( attackerInfo.attacker ) || !attackerInfo.attacker.IsPlayer() || attackerInfo.attacker == assistVictim )
continue
bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false