aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut20
1 files changed, 20 insertions, 0 deletions
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