Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give an assist to the top damager of a player that kills themselves #360

Merged
merged 2 commits into from Nov 2, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 14 additions & 28 deletions game_shared/multiplay_gamerules.cpp
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,23 +551,7 @@ 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 );
}
else
Expand All @@ -590,6 +563,19 @@ bool CMultiplayRules::IsMultiplayer( void )
// Players lose a frag for letting the world kill them
pVictim->IncrementFragCount( -1 );
}

// 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