//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool GetEMPDamage() { C_BaseTFPlayer *pPlayer; pPlayer = C_BaseTFPlayer::GetLocalPlayer(); if ( !pPlayer ) return false; return pPlayer->HasPowerup(POWERUP_EMP) ? true : false; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void C_WeaponMortar::HandleInput( void ) { // If it's being carried, ignore input if ( m_bCarried ) return; // If the player's dead, ignore input C_BaseTFPlayer *pPlayer = C_BaseTFPlayer::GetLocalPlayer(); if ( pPlayer == NULL ) return; if ( pPlayer->GetHealth() < 1 ) return; // Ignore input if it's reloading if ( m_bMortarReloading ) return; // Secondary fire rotates the mortar if ( gHUD.m_iKeyBits & IN_ATTACK2 ) { if ( pPlayer->HasPowerup(POWERUP_EMP) ) { CLocalPlayerFilter filter; EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, "WeaponMortar.EMPed" ); return; } m_bRotating = true; gHUD.m_iKeyBits &= ~IN_ATTACK2; // Prevent firing while rotating m_pPowerBar->SetParent( (vgui::Panel *)NULL ); return; } else { if ( m_bRotating ) { // Bring up the firing bar again vgui::Panel *pParent = GetClientModeNormal()->GetViewport(); m_pPowerBar->SetParent(pParent); m_bRotating = false; } } // Primary fire launches mortars if (gHUD.m_iKeyBits & IN_ATTACK) { if ( pPlayer->HasPowerup(POWERUP_EMP) ) { CLocalPlayerFilter filter; EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, "WeaponMortar.EMPed" ); return; } if ( m_flNextClick <= gpGlobals->curtime ) { // Play click animation // SendWeaponAnim( ACT_SLAM_DETONATOR_DETONATE ); // Switch states switch( m_iFiringState ) { case MORTAR_IDLE: m_iFiringState = MORTAR_CHARGING_POWER; break; case MORTAR_CHARGING_POWER: m_pPowerBar->m_flFiringPower = m_pPowerBar->m_flPower; m_iFiringState = MORTAR_CHARGING_ACCURACY; break; case MORTAR_CHARGING_ACCURACY: m_pPowerBar->m_flFiringAccuracy = m_pPowerBar->m_flPower; m_iFiringState = MORTAR_IDLE; FireMortar(); break; default: break; } input->ClearInputButton( IN_ATTACK ); gHUD.m_iKeyBits &= ~IN_ATTACK; m_flNextClick = gpGlobals->curtime + 0.05; } } }