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:
@@ -8,7 +8,7 @@
|
||||
|
||||
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
|
||||
//Tell the client to spawn the baby spiderling:
|
||||
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("cagedSpider");
|
||||
auto spooders = Game::entityManager->GetEntitiesInGroup("cagedSpider");
|
||||
for (auto spodder : spooders) {
|
||||
GameMessages::SendFireEventClientSide(spodder->GetObjectID(), user->GetSystemAddress(), u"toggle", LWOOBJID_EMPTY, 0, 0, user->GetObjectID());
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::str
|
||||
void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != "killBird") return;
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
|
||||
if (player == nullptr) return;
|
||||
|
||||
|
@@ -2,14 +2,14 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgMonumentLaserServer::OnStartup(Entity* self) {
|
||||
auto lasers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
|
||||
auto lasers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
|
||||
for (auto laser : lasers) {
|
||||
if (laser) laser->SetBoolean(u"active", true);
|
||||
}
|
||||
}
|
||||
|
||||
void AgMonumentLaserServer::OnDie(Entity* self, Entity* killer) {
|
||||
auto lasers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
|
||||
auto lasers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
|
||||
for (auto laser : lasers) {
|
||||
if (laser) laser->SetBoolean(u"active", false);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
|
||||
auto managers = Game::entityManager->GetEntitiesInGroup("race_manager");
|
||||
if (!managers.empty()) {
|
||||
managers[0]->OnFireEventServerSide(target, "course_cancel");
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ void AgMonumentRaceGoal::OnStartup(Entity* self) {
|
||||
|
||||
void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (name == "RaceGoal" && entering && entering->IsPlayer() && status == "ENTER") {
|
||||
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
|
||||
auto managers = Game::entityManager->GetEntitiesInGroup("race_manager");
|
||||
if (managers.empty() || !managers.at(0)) return;
|
||||
managers.at(0)->OnFireEventServerSide(entering, "course_finish");
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
} else if (identifier == u"player_dialog_start_course" && button == 1) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
@@ -54,7 +54,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
|
||||
|
||||
data->values[1] = *(float*)&startTime;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
} else if (identifier == u"FootRaceCancel") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
@@ -95,7 +95,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
"performact_time");
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(),
|
||||
0, (uint32_t)finish);
|
||||
|
||||
|
@@ -35,7 +35,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
|
||||
|
||||
for (const auto& group : groups) {
|
||||
auto samples = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
auto samples = Game::entityManager->GetEntitiesInGroup(group);
|
||||
for (auto* sample : samples) {
|
||||
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
|
Reference in New Issue
Block a user