diff --git a/src/game/shared/tf/tf_player_shared.cpp b/src/game/shared/tf/tf_player_shared.cpp index 42d0b829b55..b3af45d2c58 100644 --- a/src/game/shared/tf/tf_player_shared.cpp +++ b/src/game/shared/tf/tf_player_shared.cpp @@ -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(); + } } } @@ -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 ) ) { @@ -9871,9 +9873,13 @@ 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 ) { @@ -9881,12 +9887,9 @@ void CTFPlayerShared::StunPlayer( float flTime, float flReductionAmount, int iSt } } - 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. @@ -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(); diff --git a/src/game/shared/tf/tf_shareddefs.h b/src/game/shared/tf/tf_shareddefs.h index f3b5a91a61f..34ca891ce6c 100644 --- a/src/game/shared/tf/tf_shareddefs.h +++ b/src/game/shared/tf/tf_shareddefs.h @@ -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 diff --git a/src/game/shared/tf/tf_weapon_bat.cpp b/src/game/shared/tf/tf_weapon_bat.cpp index f4452d28ad0..bcc0d12b01f 100644 --- a/src/game/shared/tf/tf_weapon_bat.cpp +++ b/src/game/shared/tf/tf_weapon_bat.cpp @@ -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; } // MvM bots