mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Move EntityManager to Game namespace (#1140)
* Move EntityManager to Game namespace * move initialization to later Need to wait for dZoneManager to be initialized. * Fix bugs - Cannot delete from a RandomAccessIterator while in a range based for loop. Touchup zone manager initialize replace magic numbers with better named constants replace magic zonecontrol id with a more readable hex alternative condense stack variables move initializers closer to their use initialize entity manager with zone control change initialize timings If zone is not zero we expect to initialize the entity manager during zone manager initialization Add constexpr for zone control LOT * Add proper error handling * revert vanity changes * Update WorldServer.cpp * Update dZoneManager.cpp
This commit is contained in:
@@ -22,13 +22,13 @@ void EnemyRoninSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* spawnedEntity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* spawnedEntity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
if (spawnedEntity == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(spawnedEntity);
|
||||
Game::entityManager->ConstructEntity(spawnedEntity);
|
||||
|
||||
spawnedEntity->AddCallbackTimer(60, [spawnedEntity]() {
|
||||
spawnedEntity->Smash(spawnedEntity->GetObjectID());
|
||||
|
@@ -33,7 +33,7 @@ FvHorsemenTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
|
||||
|
||||
if (args == "HorsemenDeath") {
|
||||
for (const auto& playerId : self->GetVar<std::vector<LWOOBJID>>(u"players")) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
auto* player = Game::entityManager->GetEntity(playerId);
|
||||
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
|
@@ -23,7 +23,7 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
if (!self->GetNetworkVar<bool>(u"used")) {
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
|
||||
|
||||
auto bothBuilt = false;
|
||||
|
||||
@@ -59,7 +59,7 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
|
||||
onFX = 2779;
|
||||
}
|
||||
|
||||
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
|
||||
const auto& facility = Game::entityManager->GetEntitiesInGroup("FacilityPipes");
|
||||
|
||||
if (!facility.empty()) {
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeEnergy");
|
||||
@@ -106,13 +106,13 @@ void ImgBrickConsoleQB::SpawnBrick(Entity* self) {
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::SmashCanister(Entity* self) {
|
||||
const auto brick = EntityManager::Instance()->GetEntitiesInGroup("Imagination");
|
||||
const auto brick = Game::entityManager->GetEntitiesInGroup("Imagination");
|
||||
if (!brick.empty()) {
|
||||
GameMessages::SendPlayFXEffect(brick[0]->GetObjectID(), 122, u"create", "bluebrick");
|
||||
GameMessages::SendPlayFXEffect(brick[0]->GetObjectID(), 1034, u"cast", "imaginationexplosion");
|
||||
}
|
||||
|
||||
const auto canisters = EntityManager::Instance()->GetEntitiesInGroup("Canister");
|
||||
const auto canisters = Game::entityManager->GetEntitiesInGroup("Canister");
|
||||
for (auto* canister : canisters) {
|
||||
canister->Smash(canister->GetObjectID(), eKillType::VIOLENT);
|
||||
}
|
||||
@@ -135,14 +135,14 @@ void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
energyFX = 2778;
|
||||
}
|
||||
|
||||
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
|
||||
const auto& facility = Game::entityManager->GetEntitiesInGroup("FacilityPipes");
|
||||
|
||||
if (!facility.empty()) {
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeOff");
|
||||
GameMessages::SendPlayFXEffect(facility[0]->GetObjectID(), energyFX, u"create", location + "PipeEnergy");
|
||||
}
|
||||
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
|
||||
|
||||
for (auto* console : consoles) {
|
||||
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
|
||||
@@ -179,7 +179,7 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
|
||||
offFX = 2777;
|
||||
}
|
||||
|
||||
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
|
||||
const auto& facility = Game::entityManager->GetEntitiesInGroup("FacilityPipes");
|
||||
|
||||
if (!facility.empty()) {
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeEnergy");
|
||||
@@ -233,7 +233,7 @@ void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
} else if (timerName == "Die") {
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
|
||||
|
||||
for (auto* console : consoles) {
|
||||
console->Smash(console->GetObjectID(), eKillType::VIOLENT);
|
||||
|
@@ -29,7 +29,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
|
||||
Entity* player;
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
player = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -43,7 +43,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
|
||||
|
||||
if (vehicle == nullptr) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user