mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +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:
@@ -44,7 +44,7 @@ Entity* AmSkullkinDrill::GetStandObj(Entity* self) {
|
||||
|
||||
groupName.push_back(myGroup[0][myGroup[0].size() - 1]);
|
||||
|
||||
const auto standObjs = EntityManager::Instance()->GetEntitiesInGroup(groupName);
|
||||
const auto standObjs = Game::entityManager->GetEntitiesInGroup(groupName);
|
||||
|
||||
if (standObjs.empty()) {
|
||||
return nullptr;
|
||||
@@ -105,16 +105,16 @@ void AmSkullkinDrill::OnWaypointReached(Entity* self, uint32_t waypointIndex) {
|
||||
info.scale = 3; // Needs the scale, otherwise attacks fail
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* child = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(child);
|
||||
Game::entityManager->ConstructEntity(child);
|
||||
|
||||
self->SetVar(u"ChildSmash", child->GetObjectID());
|
||||
|
||||
child->AddDieCallback([this, self]() {
|
||||
const auto& userID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(userID);
|
||||
auto* player = Game::entityManager->GetEntity(userID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -180,7 +180,7 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player != nullptr) {
|
||||
PlayAnim(self, player, "spinjitzu-staff-end");
|
||||
@@ -199,7 +199,7 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::PlayCinematic(Entity* self) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"userID"));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"userID"));
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -235,7 +235,7 @@ void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
|
||||
|
||||
const auto activaterID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
|
||||
auto* activator = EntityManager::Instance()->GetEntity(activaterID);
|
||||
auto* activator = Game::entityManager->GetEntity(activaterID);
|
||||
|
||||
// TODO: Missions
|
||||
if (activator != nullptr) {
|
||||
@@ -263,7 +263,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "killDrill") {
|
||||
const auto childID = self->GetVar<LWOOBJID>(u"ChildSmash");
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(childID);
|
||||
auto* child = Game::entityManager->GetEntity(childID);
|
||||
|
||||
if (child != nullptr) {
|
||||
child->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
@@ -301,7 +301,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user