From 1cd2f6c991fdf3586b12feb58ff9204731b8da5a Mon Sep 17 00:00:00 2001 From: x3Karma Date: Wed, 1 Jun 2022 07:23:15 +0800 Subject: Fixed Auto-Titan deaths not showing up in Obituary (#371) * fixed not showing Auto-Titans death in killfeed --- .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 5d5742c3..64245977 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -35,6 +35,8 @@ void function BaseGametype_Init_MPSP() AddPostDamageCallback( "player", AddToTitanDamageStat ) AddPostDamageCallback( "npc_titan", AddToTitanDamageStat ) + AddCallback_OnNPCKilled( CheckForAutoTitanDeath ) + AddCallback_OnPlayerKilled( CheckForAutoTitanDeath ) RegisterSignal( "PlayerRespawnStarted" ) RegisterSignal( "KillCamOver" ) } @@ -532,6 +534,24 @@ void function AddToTitanDamageStat( entity victim, var damageInfo ) attacker.AddToPlayerGameStat( file.titanDamageGameStat, amount ) // titan damage on } +void function CheckForAutoTitanDeath( entity victim, entity attacker, var damageInfo ) +{ + if( !IsValid(victim) || !victim.IsTitan() ) + return + + if( !victim.IsPlayer() ) + { + if (GetPetTitanOwner(victim) && GetPetTitanOwner(victim) != attacker) + foreach(player in GetPlayerArray()) + Remote_CallFunction_NonReplay( player, "ServerCallback_OnTitanKilled", attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), DamageInfo_GetCustomDamageType( damageInfo ), DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) + } + else + { + if (victim != attacker) + foreach(player in GetPlayerArray()) + Remote_CallFunction_NonReplay( player, "ServerCallback_OnTitanKilled", attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), DamageInfo_GetCustomDamageType( damageInfo ), DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) + } +} // stuff to change later -- cgit v1.2.3