Skip to content

Commit

Permalink
Give an assist to the top damager of a player that kills themselves (#…
Browse files Browse the repository at this point in the history
…360)

Note: this won't show up in the death notices, but it will be highlighted for the assister and the assister will get the points

Addresses #340
  • Loading branch information
squeek502 committed Nov 2, 2018
1 parent d16d785 commit 1400229
Showing 1 changed file with 15 additions and 29 deletions.
44 changes: 15 additions & 29 deletions game_shared/multiplay_gamerules.cpp
@@ -1,4 +1,4 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Contains the implementation of game rules for multiplayer.
//
Expand Down Expand Up @@ -533,20 +533,9 @@ bool CMultiplayRules::IsMultiplayer( void )
if( pVictim->GetTeam() )
pVictim->GetTeam()->AddDeaths( 1 );

// dvsents2: uncomment when removing all FireTargets
// variant_t value;
// g_EventQueue.AddEvent( "game_playerdie", "Use", value, 0, pVictim, pVictim );
FireTargets( "game_playerdie", pVictim, pVictim, USE_TOGGLE, 0 );

// Did the player kill himself?
if ( pVictim == pScorer )
{
// Players lose a frag for killing themselves
//Commenting this out so players dont actually lose stuff on suicides
//pVictim->IncrementFragCount( -1 );
//pScorer->AddFortPoints( -100, "#FF_FORTPOINTS_SUICIDE" );
}
else if ( pScorer )
if ( pScorer && pVictim != pScorer )
{
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
pScorer->IncrementFragCount( IPointsForKill( pScorer, pVictim ) );
Expand All @@ -562,25 +551,22 @@ bool CMultiplayRules::IsMultiplayer( void )

// Allow the scorer to immediately paint a decal
pScorer->AllowImmediateDecalPainting();

// if there was a kill assister, give them some fort point as long as they're not a teammate from prior team dmg
CFFPlayer *pFFPlayer = ToFFPlayer( pVictim );
if ( pFFPlayer )
{
// if we have a top assister give em some fort points
RecentAttackerInfo *pTopAssister = pFFPlayer->GetTopKillAssister( pScorer );
if ( pTopAssister && pTopAssister->hPlayer.Get() )
{
pTopAssister->hPlayer->AddFortPoints( 25, "#FF_FORTPOINTS_ASSIST" );
pTopAssister->hPlayer->IncrementAssistsCount( 1 );
}
}

// dvsents2: uncomment when removing all FireTargets
//variant_t value;
//g_EventQueue.AddEvent( "game_playerkill", "Use", value, 0, pScorer, pScorer );
FireTargets( "game_playerkill", pScorer, pScorer, USE_TOGGLE, 0 );
}

// if there was a kill assister, give them some fort point as long as they're not a teammate from prior team dmg
CFFPlayer *pFFPlayer = ToFFPlayer( pVictim );
if ( pFFPlayer )
{
// if we have a top assister give em some fort points
RecentAttackerInfo *pTopAssister = pFFPlayer->GetTopKillAssister( pScorer );
if ( pTopAssister && pTopAssister->hPlayer.Get() )
{
pTopAssister->hPlayer->AddFortPoints( 25, "#FF_FORTPOINTS_ASSIST" );
pTopAssister->hPlayer->IncrementAssistsCount( 1 );
}
}
}

//=========================================================
Expand Down

0 comments on commit 1400229

Please sign in to comment.