mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 02:04:04 +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:
@@ -19,7 +19,7 @@ void NtCombatChallengeServer::OnDie(Entity* self, Entity* killer) {
|
||||
void NtCombatChallengeServer::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -69,7 +69,7 @@ void NtCombatChallengeServer::OnMessageBoxResponse(Entity* self, Entity* sender,
|
||||
void NtCombatChallengeServer::SpawnTargetDummy(Entity* self) {
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -91,11 +91,11 @@ void NtCombatChallengeServer::SpawnTargetDummy(Entity* self) {
|
||||
info.rot = self->GetRotation();
|
||||
info.settings = { new LDFData<std::string>(u"custom_script_server", "scripts\\02_server\\Map\\NT\\L_NT_COMBAT_CHALLENGE_DUMMY.lua") };
|
||||
|
||||
auto* dummy = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* dummy = Game::entityManager->CreateEntity(info);
|
||||
|
||||
dummy->SetVar(u"challengeObjectID", self->GetObjectID());
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(dummy);
|
||||
Game::entityManager->ConstructEntity(dummy);
|
||||
|
||||
self->SetVar(u"currentDummy", dummy->GetObjectID());
|
||||
}
|
||||
@@ -111,7 +111,7 @@ void NtCombatChallengeServer::OnChildLoaded(Entity* self, Entity* child) {
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -121,7 +121,7 @@ void NtCombatChallengeServer::OnChildLoaded(Entity* self, Entity* child) {
|
||||
|
||||
self->SetVar(u"currentTargetID", child->GetObjectID());
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(child);
|
||||
Game::entityManager->SerializeEntity(child);
|
||||
|
||||
child->GetGroups().push_back("targets_" + std::to_string(self->GetObjectID()));
|
||||
}
|
||||
@@ -130,7 +130,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) {
|
||||
const auto totalDmg = self->GetVar<int32_t>(u"totalDmg");
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player != nullptr) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
@@ -150,7 +150,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) {
|
||||
self->SetNetworkVar(u"totalDmg", false);
|
||||
self->SetNetworkVar(u"update_time", 0);
|
||||
|
||||
const auto& targetObjs = EntityManager::Instance()->GetEntitiesInGroup("targets_" + std::to_string(self->GetObjectID()));
|
||||
const auto& targetObjs = Game::entityManager->GetEntitiesInGroup("targets_" + std::to_string(self->GetObjectID()));
|
||||
|
||||
for (auto* target : targetObjs) {
|
||||
target->Smash(self->GetObjectID());
|
||||
@@ -158,7 +158,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) {
|
||||
|
||||
const auto currentID = self->GetVar<LWOOBJID>(u"currentDummy");
|
||||
|
||||
auto* current = EntityManager::Instance()->GetEntity(currentID);
|
||||
auto* current = Game::entityManager->GetEntity(currentID);
|
||||
|
||||
if (current != nullptr) {
|
||||
current->Smash(self->GetObjectID());
|
||||
|
Reference in New Issue
Block a user