void DroneEntity::Killed(Damage &fatal_blow) { m_destiny->Stop(); DynamicSystemEntity::Killed(fatal_blow); SystemEntity *killer = fatal_blow.source; Client* client = m_services.entity_list.FindByShip( killer->Item()->ownerID() ); if( !killer->IsClient() ) { if( client != NULL ) { killer = static_cast<SystemEntity*>(client); } } else { client = killer->CastToClient(); } //TODO: award status changes. (entitySecurityStatusKillBonus) client->GetChar()->addSecurityRating( m_self->GetAttribute(AttrEntitySecurityStatusKillBonus).get_float() ); m_system->RemoveEntity(this); }
SystemManager::~SystemManager() { //we mustn't delete clients because they are owned by the entity list. std::map<uint32, SystemEntity *>::iterator cur, end, tmp; cur = m_entities.begin(); end = m_entities.end(); while(cur != end) { SystemEntity *se = cur->second; cur++; if(!se->IsClient()) delete se; } //must be deleted AFTER all the NPCs which it spawn have been, since //they will call back to their spawning spawn entries. delete m_spawnManager; bubbles.clear(); }
void AsteroidEntity::Killed(Damage &fatal_blow) { m_destiny->Stop(); DynamicSystemEntity::Killed(fatal_blow); SystemEntity *killer = fatal_blow.source; Client* client = m_services.entity_list.FindByShip( killer->Item()->ownerID() ); if( !killer->IsClient() ) { if( client != NULL ) { killer = static_cast<SystemEntity*>(client); } } else { client = killer->CastToClient(); } m_system->RemoveEntity(this); }
SystemManager::~SystemManager() { //we mustn't delete clients because they are owned by the entity list. std::map<uint32, SystemEntity *>::iterator cur, end, tmp; cur = m_entities.begin(); end = m_entities.end(); while(cur != end) { SystemEntity *se = cur->second; cur++; // If entity is an NPC, save its data to DB for persietence across server restarts: if(se->IsNPC()) se->CastToNPC()->SaveNPC(); if(!se->IsClient()) delete se; } //must be deleted AFTER all the NPCs which it spawn have been, since //they will call back to their spawning spawn entries. delete m_spawnManager; bubbles.clear(); }
void NPC::Killed(Damage &fatal_blow) { m_destiny->Stop(); DynamicSystemEntity::Killed(fatal_blow); SystemEntity *killer = fatal_blow.source; Client* client = m_services.entity_list.FindByShip( killer->Item()->ownerID() ); if( !killer->IsClient() ) { if( client != NULL ) { killer = static_cast<SystemEntity*>(client); } } else { client = killer->CastToClient(); } //TODO: drop loot. //_DropLoot(fatal_blow.source); _DropLoot(killer); //award kill bounty. //_AwardBounty(fatal_blow.source); _AwardBounty(killer); //TODO: award status changes. (entitySecurityStatusKillBonus) client->GetChar()->addSecurityRating( m_self->GetAttribute(AttrEntitySecurityStatusKillBonus).get_float() ); //notify our spawner that we are gone. if(m_spawner != NULL) { m_spawner->SpawnDepoped(m_self->itemID()); } m_system->RemoveNPC(this); }