Skip to content

Commit

Permalink
Add assist callback logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanieon committed Nov 24, 2024
1 parent a422da8 commit 4c04ed5
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,26 @@ bool function PlayerOrNPCKilled( entity ent, var damageInfo )
ScoreEvent_TitanKilled( ent, attacker, damageInfo )
else
ScoreEvent_NPCKilled( ent, attacker, damageInfo )

entity victim = ent.IsTitan() ? ent.GetTitanSoul() : ent
if ( IsValid( victim ) )
{
table<int, bool> alreadyAssisted

foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory )
{
if ( !IsValidPlayer( attackerInfo.attacker ) || attackerInfo.attacker == victim )
continue

bool exists = attackerInfo.attacker.GetEncodedEHandle() in alreadyAssisted ? true : false
if( attackerInfo.attacker != attacker && !exists )
{
alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true
foreach ( callback in svGlobal.onPlayerAssistCallbacks )
callback( attackerInfo.attacker, victim )
}
}
}
}
PostScoreEventUpdateStats( attacker, ent )

Expand Down

0 comments on commit 4c04ed5

Please sign in to comment.