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
This commit is contained in:
Jack 2023-10-17 14:27:37 +01:00 committed by GitHub
parent 6df399f251
commit 327e40edf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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