mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2026-10-12 02:38:00 +08:00
Sync with upstream (Issue #30).
Recompiled tier1 and mathlib for all platforms will come in next commit.
This commit is contained in:
1 parent
98fe5b5a34
commit
3957adff10
491 files changed
+29846
-10698
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user