diff --git a/src/game/shared/tf/tf_weapon_buff_item.cpp b/src/game/shared/tf/tf_weapon_buff_item.cpp index 747a1a6316b..39c5fc1e3d8 100644 --- a/src/game/shared/tf/tf_weapon_buff_item.cpp +++ b/src/game/shared/tf/tf_weapon_buff_item.cpp @@ -272,6 +272,14 @@ bool CTFBuffItem::Holster( CBaseCombatWeapon *pSwitchingTo ) } } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTFBuffItem::CanInspect() const +{ + return BaseClass::CanInspect() && !m_bPlayingHorn; +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- diff --git a/src/game/shared/tf/tf_weapon_buff_item.h b/src/game/shared/tf/tf_weapon_buff_item.h index a0a0ad0aaab..15e9ea6b972 100644 --- a/src/game/shared/tf/tf_weapon_buff_item.h +++ b/src/game/shared/tf/tf_weapon_buff_item.h @@ -71,6 +71,8 @@ class CTFBuffItem : public CTFWeaponBaseMelee void RaiseFlag( void ); virtual bool Holster( CBaseCombatWeapon *pSwitchingTo ); + + virtual bool CanInspect() const OVERRIDE; virtual bool CanReload( void ); diff --git a/src/game/shared/tf/tf_weapon_dragons_fury.cpp b/src/game/shared/tf/tf_weapon_dragons_fury.cpp index c5d50367197..ae6b929a479 100644 --- a/src/game/shared/tf/tf_weapon_dragons_fury.cpp +++ b/src/game/shared/tf/tf_weapon_dragons_fury.cpp @@ -245,6 +245,11 @@ bool CTFWeaponFlameBall::HasFullCharge() const return pOwner->m_Shared.GetItemChargeMeter( LOADOUT_POSITION_PRIMARY) >= 100.f; } +bool CTFWeaponFlameBall::CanInspect() const +{ + return BaseClass::CanInspect() && HasFullCharge(); +} + void CTFWeaponFlameBall::ItemPostFrame( void ) { CTFPlayer *pOwner = ToTFPlayer( GetPlayerOwner() ); diff --git a/src/game/shared/tf/tf_weapon_dragons_fury.h b/src/game/shared/tf/tf_weapon_dragons_fury.h index 539f8cbe523..5dcfa668b38 100644 --- a/src/game/shared/tf/tf_weapon_dragons_fury.h +++ b/src/game/shared/tf/tf_weapon_dragons_fury.h @@ -54,6 +54,8 @@ class CTFWeaponFlameBall : public CTFFlameThrower virtual void OnResourceMeterFilled() OVERRIDE; virtual float GetMeterMultiplier() const OVERRIDE; + + virtual bool CanInspect() const OVERRIDE; #ifdef GAME_DLL virtual float GetInitialAfterburnDuration() const OVERRIDE { return 0.f; } diff --git a/src/game/shared/tf/tf_weapon_flamethrower.cpp b/src/game/shared/tf/tf_weapon_flamethrower.cpp index 28e51555383..57214287427 100644 --- a/src/game/shared/tf/tf_weapon_flamethrower.cpp +++ b/src/game/shared/tf/tf_weapon_flamethrower.cpp @@ -509,6 +509,14 @@ void CTFFlameThrower::UpdateOnRemove( void ) BaseClass::UpdateOnRemove(); } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTFFlameThrower::CanInspect() const +{ + return BaseClass::CanInspect() && !IsFiring(); +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- diff --git a/src/game/shared/tf/tf_weapon_flamethrower.h b/src/game/shared/tf/tf_weapon_flamethrower.h index 96f7344e599..07ab11b9ef1 100644 --- a/src/game/shared/tf/tf_weapon_flamethrower.h +++ b/src/game/shared/tf/tf_weapon_flamethrower.h @@ -111,6 +111,8 @@ class CTFFlameThrower : public CTFWeaponBaseGun bool EffectMeterShouldFlash( void ); virtual bool Deploy( void ) OVERRIDE; + + virtual bool CanInspect() const OVERRIDE; #if defined( CLIENT_DLL ) diff --git a/src/game/shared/tf/tf_weapon_grenadelauncher.cpp b/src/game/shared/tf/tf_weapon_grenadelauncher.cpp index b81b9b29372..c79e1b29280 100644 --- a/src/game/shared/tf/tf_weapon_grenadelauncher.cpp +++ b/src/game/shared/tf/tf_weapon_grenadelauncher.cpp @@ -545,6 +545,16 @@ float CTFGrenadeLauncher::GetChargeMaxTime( void ) return GetMortarDetonateTimeLength(); } +bool CTFGrenadeLauncher::CanInspect() const +{ + // we are charging a ball, so don't inspect + if ( m_flDetonateTime > gpGlobals->curtime ) + { + return false; + } + + return BaseClass::CanInspect(); +} void CTFGrenadeLauncher::ResetDetonateTime() { diff --git a/src/game/shared/tf/tf_weapon_grenadelauncher.h b/src/game/shared/tf/tf_weapon_grenadelauncher.h index 6bf5b606e0a..468de71ccc2 100644 --- a/src/game/shared/tf/tf_weapon_grenadelauncher.h +++ b/src/game/shared/tf/tf_weapon_grenadelauncher.h @@ -69,6 +69,8 @@ class CTFGrenadeLauncher : public CTFWeaponBaseGun, public ITFChargeUpWeapon virtual bool CanCharge( void ); virtual float GetChargeBeginTime( void ); virtual float GetChargeMaxTime( void ); + + virtual bool CanInspect() const OVERRIDE; void LaunchGrenade( void ); diff --git a/src/game/shared/tf/tf_weaponbase.cpp b/src/game/shared/tf/tf_weaponbase.cpp index 4a9ca46aef6..22e667af6f8 100644 --- a/src/game/shared/tf/tf_weaponbase.cpp +++ b/src/game/shared/tf/tf_weaponbase.cpp @@ -2047,6 +2047,7 @@ bool CTFWeaponBase::ReloadSingly( void ) { if ( SendWeaponAnim( ACT_RELOAD_FINISH ) ) { + m_flTimeFinishReloadSingly = gpGlobals->curtime + SequenceDuration(); // We're done, allow primary attack as soon as we like unless we're an energy weapon. // if ( IsEnergyWeapon() ) // { @@ -2549,6 +2550,24 @@ void CTFWeaponBase::HandleInspect() // first time pressing inspecting key if ( !m_bInspecting && pPlayer->IsInspecting() ) { + // Don't inspect while reloading or zooming. TF_COND_ZOOMED for the Classic + if ( IsReloading() || pPlayer->m_Shared.InCond( TF_COND_AIMING ) || pPlayer->m_Shared.InCond( TF_COND_ZOOMED ) ) + { + return; + } + + // Don't inspect if the player has just fired + if ( gpGlobals->curtime < m_flNextPrimaryAttack ) + { + return; + } + + // Don't inspect if the weapon isn't idle after reloading last bullet + if ( gpGlobals->curtime < m_flTimeFinishReloadSingly ) + { + return; + } + m_nInspectStage = INSPECT_INVALID; m_flInspectAnimEndTime = -1.f; if ( SendWeaponAnim( GetInspectActivity( INSPECT_START ) ) ) diff --git a/src/game/shared/tf/tf_weaponbase.h b/src/game/shared/tf/tf_weaponbase.h index bdf09634381..813e34b5aa5 100644 --- a/src/game/shared/tf/tf_weaponbase.h +++ b/src/game/shared/tf/tf_weaponbase.h @@ -704,6 +704,8 @@ class CTFWeaponBase : public CBaseCombatWeapon, public IHasOwner, public IHasGen int m_iLastCritCheckFrame; int m_iCurrentSeed; float m_flLastRapidFireCritCheckTime; + + float m_flTimeFinishReloadSingly; float m_flLastDeployTime;