Skip to content

Commit

Permalink
Merge pull request #73 from BSVino/no-non-superfall-damage-worthit
Browse files Browse the repository at this point in the history
Don't give out "Worth it!" if it wasn't worth it
  • Loading branch information
TomyLobo authored Jun 19, 2016
2 parents 83e669b + 76de3e3 commit 38ceae2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
22 changes: 18 additions & 4 deletions mp/src/game/server/sdk/sdk_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ int CSDKPlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info )

// we'll keep track of this in case the dive kills him, but not if we're on the same team!
if ( SDKGameRules()->PlayerRelationship(this, pAttackerSDK) != GR_TEAMMATE )
pAttackerSDK->m_bDamagedEnemyDuringFall = true;
pAttackerSDK->m_bDamagedEnemyDuringSuperFall = true;
}

if (m_Shared.m_iStyleSkill != SKILL_RESILIENT)
Expand Down Expand Up @@ -1755,6 +1755,15 @@ void CSDKPlayer::Event_Killed( const CTakeDamageInfo &info )
m_vecKillingExplosionPosition = m_hInflictor->GetAbsOrigin();
}

if( m_hKiller && m_hKiller->IsPlayer() )
{
CSDKPlayer* pAttackerSDK = ToSDKPlayer(m_hKiller);

// we'll keep track of this in case the dive kills him, but not if we're on the same team!
if ( SDKGameRules()->PlayerRelationship(this, pAttackerSDK) != GR_TEAMMATE )
pAttackerSDK->m_bKilledEnemyDuringFall = true;
}

if (dynamic_cast<CBaseGrenadeProjectile*>(m_hInflictor.Get()))
m_bWasKilledByGrenade = true;

Expand All @@ -1769,7 +1778,7 @@ void CSDKPlayer::Event_Killed( const CTakeDamageInfo &info )
else if (info.GetInflictor() && (FStrEq(info.GetInflictor()->GetClassname(), "trigger_kill") || FStrEq(info.GetInflictor()->GetClassname(), "trigger_hurt")))
bEligible = true;

if (bEligible && (m_bDamagedEnemyDuringFall || (m_hKiller.Get() && m_hKiller->IsPlayer() && m_hKiller.Get() != this)))
if (bEligible && (m_bKilledEnemyDuringFall || m_bDamagedEnemyDuringSuperFall))
{
AddStylePoints(10, STYLE_SOUND_LARGE, ANNOUNCEMENT_STYLISH, STYLE_POINT_LARGE);
// Send "Worth it!" after the style points so that if the player gets their skill activated because of it, that message won't override the "Worth it!" message.
Expand Down Expand Up @@ -3756,8 +3765,13 @@ void CSDKPlayer::State_PreThink_ACTIVE()
SwitchToNextBestWeapon( NULL );
}

if (IsAlive() && !m_Shared.m_bSuperFalling && (GetFlags() & FL_ONGROUND))
m_bDamagedEnemyDuringFall = false;
if (IsAlive() && !m_Shared.m_bSuperFalling)
{
if (GetFlags() & FL_ONGROUND)
m_bKilledEnemyDuringFall = false;

m_bDamagedEnemyDuringSuperFall = false;
}
}

void CSDKPlayer::NoteWeaponFired( void )
Expand Down
3 changes: 2 additions & 1 deletion mp/src/game/server/sdk/sdk_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ class CSDKPlayer : public CBaseMultiplayerPlayer

Vector m_vecTotalBulletForce; //Accumulator for bullet force in a single frame

bool m_bDamagedEnemyDuringFall;
bool m_bKilledEnemyDuringFall;
bool m_bDamagedEnemyDuringSuperFall;

public:
#if defined ( SDK_USE_PRONE )
Expand Down

0 comments on commit 38ceae2

Please sign in to comment.