Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 37 additions & 34 deletions src/game/shared/tf/tf_player_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7340,41 +7340,41 @@ void CTFPlayerShared::OnAddOverhealed( void )
//-----------------------------------------------------------------------------
void CTFPlayerShared::OnAddStunned( void )
{
if ( IsControlStunned() || IsLoserStateStunned() )
if ( GetActiveStunInfo() )
{
#ifdef CLIENT_DLL
if ( GetActiveStunInfo() )
int iStunFlags = GetStunFlags();
if ( !m_pOuter->m_pStunnedEffect && !( iStunFlags & TF_STUN_NO_EFFECTS ) )
{
if ( !m_pOuter->m_pStunnedEffect && !( GetActiveStunInfo()->iStunFlags & TF_STUN_NO_EFFECTS ) )
if ( ( iStunFlags & TF_STUN_BY_TRIGGER ) || InCond( TF_COND_HALLOWEEN_BOMB_HEAD ) )
{
if ( ( GetActiveStunInfo()->iStunFlags & TF_STUN_BY_TRIGGER ) || InCond( TF_COND_HALLOWEEN_BOMB_HEAD ) )
{
const char* pEffectName = "yikes_fx";
m_pOuter->m_pStunnedEffect = m_pOuter->ParticleProp()->Create( pEffectName, PATTACH_POINT_FOLLOW, "head" );
}
else
{
const char* pEffectName = "conc_stars";
m_pOuter->m_pStunnedEffect = m_pOuter->ParticleProp()->Create( pEffectName, PATTACH_POINT_FOLLOW, "head" );
}
const char* pEffectName = "yikes_fx";
m_pOuter->m_pStunnedEffect = m_pOuter->ParticleProp()->Create( pEffectName, PATTACH_POINT_FOLLOW, "head" );
}
else if ( iStunFlags & ( TF_STUN_CONTROLS | TF_STUN_LOSER_STATE | TF_STUN_STUNBALL ) )
{
const char* pEffectName = "conc_stars";
m_pOuter->m_pStunnedEffect = m_pOuter->ParticleProp()->Create( pEffectName, PATTACH_POINT_FOLLOW, "head" );
}
}
#endif

// Notify our weapon that we have been stunned.
CTFWeaponBase* pWpn = m_pOuter->GetActiveTFWeapon();
if ( pWpn )
if ( IsControlStunned() || IsLoserStateStunned() )
{
pWpn->OnControlStunned();
}
// Notify our weapon that we have been stunned.
CTFWeaponBase* pWpn = m_pOuter->GetActiveTFWeapon();
if ( pWpn )
{
pWpn->OnControlStunned();
}

if ( InCond( TF_COND_SHIELD_CHARGE ) )
{
SetDemomanChargeMeter( 0 );
RemoveCond( TF_COND_SHIELD_CHARGE );
}
if ( InCond( TF_COND_SHIELD_CHARGE ) )
{
SetDemomanChargeMeter( 0 );
RemoveCond( TF_COND_SHIELD_CHARGE );
}

m_pOuter->TeamFortress_SetSpeed();
m_pOuter->TeamFortress_SetSpeed();
}
}
}

Expand Down Expand Up @@ -9857,8 +9857,10 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
}

#ifdef GAME_DLL
int iActiveStunFlags = GetActiveStunInfo()->iStunFlags;

// Add in extra time when TF_STUN_CONTROLS
if ( GetActiveStunInfo()->iStunFlags & TF_STUN_CONTROLS )
if ( iActiveStunFlags & TF_STUN_CONTROLS )
{
if ( !InCond( TF_COND_HALLOWEEN_KART ) )
{
Expand All @@ -9871,22 +9873,23 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
// Update old system for networking
UpdateLegacyStunSystem();

if ( GetActiveStunInfo()->iStunFlags & TF_STUN_CONTROLS || GetActiveStunInfo()->iStunFlags & TF_STUN_LOSER_STATE )
if ( iActiveStunFlags & ( TF_STUN_CONTROLS | TF_STUN_LOSER_STATE ) )
{
m_pOuter->m_angTauntCamera = m_pOuter->EyeAngles();
}

if ( iActiveStunFlags & ( TF_STUN_CONTROLS | TF_STUN_LOSER_STATE | TF_STUN_STUNBALL ) )
{
m_pOuter->SpeakConceptIfAllowed( MP_CONCEPT_STUNNED );
if ( pAttacker )
{
pAttacker->SpeakConceptIfAllowed( MP_CONCEPT_STUNNED_TARGET );
}
}

if ( ( GetActiveStunInfo()->iStunFlags & TF_STUN_SOUND ) ||
( GetActiveStunInfo()->iStunFlags & TF_STUN_SPECIAL_SOUND ) ||
( GetActiveStunInfo()->iStunFlags & TF_STUN_CONTROLS ) ||
( GetActiveStunInfo()->iStunFlags & TF_STUN_LOSER_STATE ) )
if ( iActiveStunFlags & ( TF_STUN_SOUND | TF_STUN_SPECIAL_SOUND | TF_STUN_CONTROLS | TF_STUN_LOSER_STATE ) )
{
m_pOuter->StunSound( pAttacker, GetActiveStunInfo()->iStunFlags, iOldStunFlags );
m_pOuter->StunSound( pAttacker, iActiveStunFlags, iOldStunFlags );
}

// Event for achievements.
Expand All @@ -9899,12 +9902,12 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt
}
event->SetInt( "victim", m_pOuter->GetUserID() );
event->SetBool( "victim_capping", m_pOuter->IsCapturingPoint() );
event->SetBool( "big_stun", ( GetActiveStunInfo()->iStunFlags & TF_STUN_SPECIAL_SOUND ) != 0 );
event->SetBool( "big_stun", ( iActiveStunFlags & TF_STUN_SPECIAL_SOUND ) != 0 );
gameeventmanager->FireEvent( event );
}

// Clear off all taunts, expressions, and scenes.
if ( ( GetActiveStunInfo()->iStunFlags & TF_STUN_CONTROLS) == TF_STUN_CONTROLS || ( GetActiveStunInfo()->iStunFlags & TF_STUN_LOSER_STATE) == TF_STUN_LOSER_STATE )
if ( iActiveStunFlags & ( TF_STUN_CONTROLS | TF_STUN_LOSER_STATE ) )
{
m_pOuter->StopTaunt();
m_pOuter->ClearExpression();
Expand Down
2 changes: 1 addition & 1 deletion src/game/shared/tf/tf_shareddefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ enum
#define TF_STUN_BY_TRIGGER (1<<7)
#define TF_STUN_BOTH TF_STUN_MOVEMENT | TF_STUN_CONTROLS
#define TF_STUN_SOUND (1<<8)

#define TF_STUN_STUNBALL (1<<9)

//-----------------
// TF Objects Info
Expand Down
3 changes: 2 additions & 1 deletion src/game/shared/tf/tf_weapon_bat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,12 +732,13 @@ void CTFStunBall::ApplyBallImpactEffectOnVictim( CBaseEntity *pOther )
if ( flLifeTimeRatio > 0.1f )
{
bool bMax = flLifeTimeRatio >= 1.f;
int iStunFlags = ( bMax ) ? TF_STUN_SPECIAL_SOUND | TF_STUN_MOVEMENT : TF_STUN_SOUND | TF_STUN_MOVEMENT;
int iStunFlags = TF_STUN_MOVEMENT | TF_STUN_SOUND | TF_STUN_STUNBALL;
float flStunAmount = 0.5f;
float flStunDuration = Max( 2.f, tf_scout_stunball_base_duration.GetFloat() * flLifeTimeRatio );
if ( bMax )
{
flStunDuration += 1.0;
iStunFlags |= TF_STUN_SPECIAL_SOUND;
Comment on lines -735 to +741
Copy link
Copy Markdown
Contributor

@FlaminSarge FlaminSarge Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting for future readers that SPECIAL_SOUND fully overrides the regular sound in StunSound, so having both flags here won't be an issue.

}

// MvM bots
Expand Down