diff options
Diffstat (limited to 'mp/src/game/shared/basecombatcharacter_shared.cpp')
| -rw-r--r-- | mp/src/game/shared/basecombatcharacter_shared.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/mp/src/game/shared/basecombatcharacter_shared.cpp b/mp/src/game/shared/basecombatcharacter_shared.cpp index c032cd54..32e823fa 100644 --- a/mp/src/game/shared/basecombatcharacter_shared.cpp +++ b/mp/src/game/shared/basecombatcharacter_shared.cpp @@ -90,8 +90,23 @@ bool CBaseCombatCharacter::Weapon_CanSwitchTo( CBaseCombatWeapon *pWeapon ) if ( m_hActiveWeapon ) { - if ( !m_hActiveWeapon->CanHolster() ) + if ( !m_hActiveWeapon->CanHolster() && !pWeapon->ForceWeaponSwitch() ) return false; + + if ( IsPlayer() ) + { + CBasePlayer *pPlayer = (CBasePlayer *)this; + // check if active weapon force the last weapon to switch + if ( m_hActiveWeapon->ForceWeaponSwitch() ) + { + // last weapon wasn't allowed to switch, don't allow to switch to new weapon + CBaseCombatWeapon *pLastWeapon = pPlayer->GetLastWeapon(); + if ( pLastWeapon && pWeapon != pLastWeapon && !pLastWeapon->CanHolster() && !pWeapon->ForceWeaponSwitch() ) + { + return false; + } + } + } } return true; |