Skip to content

Commit

Permalink
Move OnPlayerKilled function
Browse files Browse the repository at this point in the history
as part of the refactoring effort in #830
  • Loading branch information
Zanieon committed Aug 30, 2024
1 parent bd77a93 commit 8b34689
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@ bool function VerifyCTFSpawnpoint( entity spawnpoint, int team )
return true
}

void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
{
if ( !IsValid( GetFlagForTeam( GetOtherTeam( victim.GetTeam() ) ) ) ) // getting a crash idk
return
if ( GetFlagForTeam( GetOtherTeam( victim.GetTeam() ) ).GetParent() == victim )
{
if ( victim != attacker && attacker.IsPlayer() )
AddPlayerScore( attacker, "FlagCarrierKill", victim )

DropFlag( victim )
}
}

void function CreateFlags()
{
if ( IsValid( file.imcFlagSpawn ) )
Expand Down Expand Up @@ -236,6 +223,19 @@ void function CTFInitPlayer( entity player )
Remote_CallFunction_NonReplay( player, "ServerCallback_SetFlagHomeOrigin", TEAM_MILITIA, militiaSpawn.x, militiaSpawn.y, militiaSpawn.z )
}

void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
{
if ( !IsValid( GetFlagForTeam( GetOtherTeam( victim.GetTeam() ) ) ) ) // getting a crash idk
return
if ( GetFlagForTeam( GetOtherTeam( victim.GetTeam() ) ).GetParent() == victim )
{
if ( victim != attacker && attacker.IsPlayer() )
AddPlayerScore( attacker, "FlagCarrierKill", victim )

DropFlag( victim )
}
}

void function TrackFlagReturnTrigger( entity flag, entity returnTrigger )
{
// this is a bit of a hack, it seems parenting the return trigger to the flag actually sets the pickup radius of the flag to be the same as the trigger
Expand Down

0 comments on commit 8b34689

Please sign in to comment.