//----------------------------------------------------------------------------- // Purpose: Switch to next best weapon // Input : // Output : //----------------------------------------------------------------------------- void CWeapon_SLAM::Weapon_Switch( void ) { // Note that we may pick the SLAM again, when we switch // weapons, in which case we have to save and restore the // detonator armed state. // The SLAMs may be about to blow up, but haven't done so yet // and the deploy function will find the undetonated charges // and we are armed bool saveState = m_bDetonatorArmed; CBaseCombatCharacter *pOwner = GetOwner(); pOwner->SwitchToNextBestWeapon( pOwner->GetActiveWeapon() ); if (pOwner->GetActiveWeapon() == this) { m_bDetonatorArmed = saveState; } #ifndef CLIENT_DLL // If not armed and have no ammo if (!m_bDetonatorArmed && pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0) { pOwner->ClearActiveWeapon(); } #endif }
void CWeapon_Manhack::WeaponSwitch( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (pOwner==NULL) return; pOwner->SwitchToNextBestWeapon( pOwner->GetActiveWeapon() ); if (CPropVehicleManhack::GetManhackVehicle() == NULL && pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) { pOwner->ClearActiveWeapon(); } }