void Castle::draw(){ if(IsActive()){ gout<<move_to(X,Y)<<color(P->Color()[0], P->Color()[1], P->Color()[2])<<box(W, H); gout<<move_to(620, YY-98)<<color(200,200,200)<<box(70,18)<<move_to(625, YY-83)<<color(black)<<text("Warrior"); gout<<move_to(620, YY-78)<<color(200,200,200)<<box(70,18)<<move_to(625, YY-63)<<color(black)<<text("Archer"); gout<<move_to(620, YY-58)<<color(200,200,200)<<box(70,18)<<move_to(625, YY-43)<<color(black)<<text("Merchant"); Unit* W=new Unit("w"); Unit* A=new Unit("a"); if(!CanSpawn() || !CanSpawnC(W)){ gout<<move_to(622,YY-96)<<color(black)<<line(66,14)<<move_to(688,YY-96)<<line(-66,14); } if(!CanSpawn() || !CanSpawnC(A)){ gout<<move_to(622,YY-76)<<color(black)<<line(66,14)<<move_to(688,YY-76)<<line(-66,14); } if(!CanSpawn() || this->Owner()->Wealth()<this->Owner()->Merchant_Cost()){ gout<<move_to(622,YY-56)<<color(black)<<line(66,14)<<move_to(688,YY-56)<<line(-66,14); } } gout<<move_to(X,Y); for (int i=0; i<W; i++){ for (int j=0; j<H; j++){ if(looks[i][j][0]==255 && looks[i][j][1]==255 && looks[i][j][2]==255) continue; if(looks[i][j][0]==0 && looks[i][j][1]==0 && looks[i][j][2]==255) gout<<color(P->Color()[0], P->Color()[1], P->Color()[2])<< move_to(X+i,Y+j)<<dot; else gout<<color(looks[i][j][0],looks[i][j][1],looks[i][j][2])<< move_to(X+i,Y+j)<<dot; } } }
// Function to check if a passive spawning condition is met bool CreatureLinkingHolder::CanSpawn(Creature* pCreature) const { CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature); if (!pInfo) return true; float sx, sy, sz; pCreature->GetRespawnCoord(sx, sy, sz); return CanSpawn(0, pCreature->GetMap(), pInfo, sx, sy); }
void Castle::draw(){ if(IsActive()){ gout<<move_to(X,Y)<<color(red)<<box(W, H); gout<<move_to(620, YY-98)<<color(200,200,200)<<box(70,18)<<move_to(625, YY-83)<<color(black)<<text("Warrior"); gout<<move_to(620, YY-78)<<color(200,200,200)<<box(70,18)<<move_to(625, YY-63)<<color(black)<<text("Archer"); if(!CanSpawn()){ gout<<move_to(622,YY-96)<<color(black)<<line(66,14)<<move_to(688,YY-96)<<line(-66,14); gout<<move_to(622,YY-76)<<color(black)<<line(66,14)<<move_to(688,YY-76)<<line(-66,14); } } gout<<move_to(X,Y); for (int i=0; i<W; i++){ for (int j=0; j<H; j++){ if(looks[i][j][0]==255 && looks[i][j][1]==255 && looks[i][j][2]==255) continue; if(looks[i][j][0]==0 && looks[i][j][1]==0 && looks[i][j][2]==255) gout<<color(red)<< move_to(X+i,Y+j)<<dot; else gout<<color(looks[i][j][0],looks[i][j][1],looks[i][j][2])<< move_to(X+i,Y+j)<<dot; } } }
//========================================================= //========================================================= void CDirectorBatterySpawn::Make() { // Desactivado. if ( Disabled ) return; if ( !MaySpawn() ) return; // Creamos la bateria. CItem *pItem = (CItem *)CreateEntityByName("item_battery"); // Hubo un problema al crear el objeto. if ( !pItem ) { DevWarning("[DIRECTOR BATTERY MAKER] Ha ocurrido un problema al crear la bateria."); return; } Vector origin; if ( !CanSpawn(pItem, &origin) ) return; QAngle angles = GetAbsAngles(); // Lugar de creación. pItem->SetAbsOrigin(origin); // Nombre de la entidad. pItem->SetName(MAKE_STRING(ITEM_NAME)); pItem->SetAbsAngles(angles); // Creamos la bateria, le decimos quien es su dios (creador) y lo activamos. DispatchSpawn(pItem); pItem->SetOwnerEntity(this); pItem->Activate(); }
// helper function to check if a lowguid can respawn bool CreatureLinkingHolder::IsRespawnReady(uint32 dbLowGuid, Map* _map) const { time_t respawnTime = _map->GetPersistentState()->GetCreatureRespawnTime(dbLowGuid); return (!respawnTime || respawnTime <= time(NULL)) && CanSpawn(dbLowGuid, _map, NULL, 0.0f, 0.0f); }
IASW_Spawnable_NPC* CASW_Base_Spawner::SpawnAlien( const char *szAlienClassName, const Vector &vecHullMins, const Vector &vecHullMaxs ) { if ( !IsValidOnThisSkillLevel() ) { UTIL_Remove(this); // delete ourself if this spawner isn't valid on this difficulty level return NULL; } if ( !CanSpawn( vecHullMins, vecHullMaxs ) ) // this may turn off m_bCurrentlySpawningUber if there's no room return NULL; CBaseEntity *pEntity = CreateEntityByName( szAlienClassName ); if ( !pEntity ) { Msg( "Failed to spawn %s\n", szAlienClassName ); return NULL; } CAI_BaseNPC *pNPC = pEntity->MyNPCPointer(); if ( pNPC ) { pNPC->AddSpawnFlags( SF_NPC_FALL_TO_GROUND ); } // check if he can see far if ( m_bLongRangeNPC ) pEntity->AddSpawnFlags( SF_NPC_LONG_RANGE ); if ( HasSpawnFlags( ASW_SF_NEVER_SLEEP ) ) pEntity->AddSpawnFlags( SF_NPC_ALWAYSTHINK ); // Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC. QAngle angles = GetAbsAngles(); angles.x = 0.0; angles.z = 0.0; pEntity->SetAbsOrigin( GetAbsOrigin() ); pEntity->SetAbsAngles( angles ); IASW_Spawnable_NPC* pSpawnable = dynamic_cast<IASW_Spawnable_NPC*>(pEntity); Assert( pSpawnable ); if ( !pSpawnable ) { Warning( "NULL Spawnable Ent in asw_spawner! AlienClass = %s\n", szAlienClassName ); UTIL_Remove( pEntity ); return NULL; } m_flLastSpawnTime = gpGlobals->curtime; if ( m_bStartBurrowed ) { pSpawnable->StartBurrowed(); } if ( m_bStartBurrowed ) { pSpawnable->SetUnburrowIdleActivity( m_UnburrowIdleActivity ); pSpawnable->SetUnburrowActivity( m_UnburrowActivity ); } DispatchSpawn( pEntity ); pEntity->SetOwnerEntity( this ); pEntity->Activate(); if ( m_AlienName != NULL_STRING ) { pEntity->SetName( m_AlienName ); } pSpawnable->SetSpawner( this ); RemoveObstructingProps( pEntity ); // give our aliens the orders pSpawnable->SetAlienOrders( m_AlienOrders, vec3_origin, GetOrderTarget() ); m_OnSpawned.FireOutput(pEntity, this); return pSpawnable; }