void CASW_Spawner::InputSpawnAlien( inputdata_t &inputdata ) { if (m_SpawnerState == SST_WaitForInputs) { if ( ASWDirector() && ASWDirector()->CanSpawnAlien( this ) ) { SpawnOneAlien(); } } }
void CASW_Button_Area::MarineStartedUsing(CASW_Marine* pMarine) { m_bIsInUse = true; UpdateWaitingForInput(); if ( ASWDirector() && m_bIsLocked ) { ASWDirector()->OnMarineStartedHack( pMarine, this ); } }
void CASW_Spawn_Manager::Update() { if ( m_iHordeToSpawn > 0 ) { if ( m_vecHordePosition != vec3_origin && ( !m_batchInterval.HasStarted() || m_batchInterval.IsElapsed() ) ) { int iToSpawn = MIN( m_iHordeToSpawn, asw_max_alien_batch.GetInt() ); int iSpawned = SpawnAlienBatch( asw_horde_class.GetString(), iToSpawn, m_vecHordePosition, m_angHordeAngle, 0 ); m_iHordeToSpawn -= iSpawned; if ( m_iHordeToSpawn <= 0 ) { ASWDirector()->OnHordeFinishedSpawning(); m_vecHordePosition = vec3_origin; } else if ( iSpawned == 0 ) // if we failed to spawn any aliens, then try to find a new horde location { if ( asw_director_debug.GetBool() ) { Msg( "Horde failed to spawn any aliens, trying new horde position.\n" ); } if ( !FindHordePosition() ) // if we failed to find a new location, just abort this horde { m_iHordeToSpawn = 0; ASWDirector()->OnHordeFinishedSpawning(); m_vecHordePosition = vec3_origin; } } m_batchInterval.Start( asw_batch_interval.GetFloat() ); } else if ( m_vecHordePosition == vec3_origin ) { Msg( "Warning: Had horde to spawn but no position, clearing.\n" ); m_iHordeToSpawn = 0; ASWDirector()->OnHordeFinishedSpawning(); } } if ( asw_director_debug.GetBool() ) { engine->Con_NPrintf( 14, "SM: Batch interval: %f pos = %f %f %f\n", m_batchInterval.HasStarted() ? m_batchInterval.GetRemainingTime() : -1, VectorExpand( m_vecHordePosition ) ); } if ( m_iAliensToSpawn > 0 ) { if (wandererSize() < WANDERER_QUEUE_SIZE-1) { queueWanderers(); m_iAliensToSpawn--; } } if (wandererQueueStart != wandererQueueEnd) { while ( wandererQueueStart != wandererQueueEnd && SpawnAlientAtRandomNode()); } }
void CASW_Spawner::SpawnerThink() { // calculate jitter float fInterval = random->RandomFloat(1.0f - m_flSpawnIntervalJitter, 1.0f + m_flSpawnIntervalJitter) * m_flSpawnInterval; SetNextThink( gpGlobals->curtime + fInterval ); if ( ASWDirector() && ASWDirector()->CanSpawnAlien( this ) ) { SpawnAlien( STRING( m_AlienClassName ), GetAlienMins(), GetAlienMaxs() ); } }
//------------------------------------------------------------------------------ // Purpose: // Input : // Output : //------------------------------------------------------------------------------ void CAI_ASW_FlickBehavior::Flick( ) { #if 0 for( int i = 0; i < ASWDirector()->GetNPCListCount(); i++ ) { CASW_Alien *pAlien = ASWDirector()->GetNPCFromList( i ); if ( !pAlien || !pAlien->IsAlive() ) { continue; } if ( GetOuter() != pAlien ) { TryFlicking( pAlien ); } } for ( int i = 0; i < ASW_MAX_READY_PLAYERS; i++ ) { // found a connected player? CASW_Player *pOtherPlayer = dynamic_cast< CASW_Player * >( UTIL_PlayerByIndex( i + 1 ) ); // if they're not connected, skip them if ( !pOtherPlayer || !pOtherPlayer->IsConnected() ) { continue; } TryFlicking( pOtherPlayer ); } #else AIEnemiesIter_t iter; for( AI_EnemyInfo_t *pEMemory = GetEnemies()->GetFirst( &iter ); pEMemory != NULL; pEMemory = GetEnemies()->GetNext( &iter ) ) { CBaseEntity *pEntity = pEMemory->hEnemy; if ( pEntity->IsAlive() && GetOuter() != pEntity ) { TryFlicking( pEntity ); } } #endif // turn this into an area of affect // reverse his velocity - if he is coming towards the shield bug, add that back into his outgoing to increase it }