bool CHudMenuEngyBuild::SendDestroyMessage( int iSlot ) { C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer(); if ( !pLocalPlayer ) return false; bool bSuccess = false; int iBuilding = GetBuildingIDFromSlot( iSlot ); C_BaseObject *pObj = pLocalPlayer->GetObjectOfType( iBuilding ); if ( pObj != NULL ) { char szCmd[128]; Q_snprintf( szCmd, sizeof(szCmd), "destroy %d", iBuilding ); engine->ClientCmd( szCmd ); bSuccess = true; } else { pLocalPlayer->EmitSound( "Player.DenyWeaponSelection" ); } return bSuccess; }
void CHudBuildingStatusContainer::OnTick( void ) { if ( m_AlertLevel >= BUILDING_HUD_ALERT_VERY_LOW_AMMO && gpGlobals->curtime >= m_flNextBeep && m_iNumBeepsToBeep > 0 ) { C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer(); if ( !pLocalPlayer ) return; pLocalPlayer->EmitSound( "Hud.Warning" ); switch( m_AlertLevel ) { case BUILDING_HUD_ALERT_VERY_LOW_AMMO: case BUILDING_HUD_ALERT_VERY_LOW_HEALTH: m_flNextBeep = gpGlobals->curtime + 2.0f; m_iNumBeepsToBeep--; break; case BUILDING_HUD_ALERT_SAPPER: m_flNextBeep = gpGlobals->curtime + 1.0f; // don't decrement beeps, we want them to go on forever break; } } }
void CHudMenuEngyBuild::SendBuildMessage( int iSlot ) { C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer(); if ( !pLocalPlayer ) return; int iBuilding = GetBuildingIDFromSlot( iSlot ); C_BaseObject *pObj = pLocalPlayer->GetObjectOfType( iBuilding ); int iCost = GetObjectInfo( iBuilding )->m_Cost; if ( pObj == NULL && pLocalPlayer->GetAmmoCount( TF_AMMO_METAL ) >= iCost ) { char szCmd[128]; Q_snprintf( szCmd, sizeof(szCmd), "build %d", iBuilding ); engine->ClientCmd( szCmd ); } else { pLocalPlayer->EmitSound( "Player.DenyWeaponSelection" ); } }