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());
|
||||
|
@@ -63,7 +63,7 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
|
||||
return;
|
||||
|
||||
if (timerName == "killSpider") {
|
||||
auto spawnTargets = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup));
|
||||
auto spawnTargets = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup));
|
||||
for (auto* spawnTarget : spawnTargets) {
|
||||
EntityInfo info{};
|
||||
|
||||
@@ -75,8 +75,8 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
|
||||
new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID())
|
||||
};
|
||||
|
||||
auto* chest = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(chest);
|
||||
auto* chest = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(chest);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,16 +27,16 @@ void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string&
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* fxObject = EntityManager::Instance()->CreateEntity(info, nullptr, self);
|
||||
EntityManager::Instance()->ConstructEntity(fxObject);
|
||||
auto* fxObject = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
Game::entityManager->ConstructEntity(fxObject);
|
||||
|
||||
auto fxObjectID = fxObject->GetObjectID();
|
||||
auto playerID = caster->GetObjectID();
|
||||
|
||||
// Add a callback for the bomb to explode
|
||||
self->AddCallbackTimer(m_BombTime, [this, self, fxObjectID, playerID]() {
|
||||
auto* fxObject = EntityManager::Instance()->GetEntity(fxObjectID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* fxObject = Game::entityManager->GetEntity(fxObjectID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
|
@@ -6,7 +6,7 @@ void AmBridge::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmBridge::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
|
||||
|
||||
if (consoles.empty()) {
|
||||
return;
|
||||
|
@@ -68,7 +68,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
Game::entityManager->SerializeEntity(bridge);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(forwardVect);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
Game::entityManager->SerializeEntity(bridge);
|
||||
|
||||
self->AddTimer("rotateBridgeDown", travelTime);
|
||||
}
|
||||
@@ -118,5 +118,5 @@ void AmDrawBridge::NotifyDie(Entity* self, Entity* other) {
|
||||
Entity* AmDrawBridge::GetBridge(Entity* self) {
|
||||
const auto bridgeID = self->GetVar<LWOOBJID>(u"BridgeID");
|
||||
|
||||
return EntityManager::Instance()->GetEntity(bridgeID);
|
||||
return Game::entityManager->GetEntity(bridgeID);
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::s
|
||||
void AmShieldGenerator::OnDie(Entity* self, Entity* killer) {
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
auto* child = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
|
||||
if (child != nullptr) {
|
||||
child->Kill();
|
||||
@@ -69,7 +69,7 @@ void AmShieldGenerator::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
auto* enemy = Game::entityManager->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr) {
|
||||
EnemyEnteredShield(self, enemy);
|
||||
@@ -94,7 +94,7 @@ void AmShieldGenerator::StartShield(Entity* self) {
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* child = Game::entityManager->CreateEntity(info);
|
||||
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
|
||||
@@ -111,7 +111,7 @@ void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
|
@@ -69,7 +69,7 @@ void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* enteri
|
||||
void AmShieldGeneratorQuickbuild::OnDie(Entity* self, Entity* killer) {
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
auto* child = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
|
||||
if (child != nullptr) {
|
||||
child->Kill();
|
||||
@@ -89,7 +89,7 @@ void AmShieldGeneratorQuickbuild::OnTimerDone(Entity* self, std::string timerNam
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
auto* enemy = Game::entityManager->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr) {
|
||||
EnemyEnteredShield(self, enemy);
|
||||
@@ -106,7 +106,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
auto* enemy = Game::entityManager->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr) {
|
||||
enemy->Smash();
|
||||
@@ -116,7 +116,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
@@ -146,7 +146,7 @@ void AmShieldGeneratorQuickbuild::StartShield(Entity* self) {
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* child = Game::entityManager->CreateEntity(info);
|
||||
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
|
||||
@@ -163,7 +163,7 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
|
@@ -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;
|
||||
|
@@ -64,9 +64,9 @@ void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc) {
|
||||
|
||||
info.rot = NiQuaternion::LookAt(info.pos, self->GetPosition());
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
|
||||
OnChildLoaded(self, entity);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child) {
|
||||
const auto selfID = self->GetObjectID();
|
||||
|
||||
child->AddDieCallback([this, selfID, child]() {
|
||||
auto* self = EntityManager::Instance()->GetEntity(selfID);
|
||||
auto* self = Game::entityManager->GetEntity(selfID);
|
||||
auto* destroyableComponent = child->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || self == nullptr) {
|
||||
@@ -157,7 +157,7 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
|
||||
const auto& players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto& playerID : players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
@@ -233,9 +233,9 @@ void AmSkullkinTower::OnTimerDone(Entity* self, std::string timerName) {
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
info.pos.x += i * 2; // Just to set the apart a bit
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
}
|
||||
|
||||
self->AddTimer("killTower", 0.7f);
|
||||
|
@@ -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;
|
||||
|
@@ -40,7 +40,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
|
||||
void GfCaptainsCannon::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) {
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
@@ -56,7 +56,7 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
self->AddTimer("cinematicTimer", cinematicTime);
|
||||
|
||||
const auto sharkObjects = EntityManager::Instance()->GetEntitiesInGroup("SharkCannon");
|
||||
const auto sharkObjects = Game::entityManager->GetEntitiesInGroup("SharkCannon");
|
||||
|
||||
for (auto* shark : sharkObjects) {
|
||||
if (shark->GetLOT() != m_SharkItemID) continue;
|
||||
|
@@ -32,7 +32,7 @@ void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "Relight") {
|
||||
LightTorch(self);
|
||||
} else if (timerName == "InteractionCooldown") {
|
||||
Entity* player = EntityManager::Instance()->GetEntity(self->GetI64(u"userID"));
|
||||
Entity* player = Game::entityManager->GetEntity(self->GetI64(u"userID"));
|
||||
|
||||
if (player != nullptr && player->GetCharacter()) {
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
|
@@ -33,7 +33,7 @@ void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void MastTeleport::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;
|
||||
|
||||
@@ -88,6 +88,6 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
|
||||
);
|
||||
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::POP, true, true, true, true, true, false, false, true, true);
|
||||
EntityManager::Instance()->SerializeEntity(player);
|
||||
Game::entityManager->SerializeEntity(player);
|
||||
}
|
||||
}
|
||||
|
@@ -18,5 +18,5 @@ void ForceVolumeServer::OnStartup(Entity* self) {
|
||||
phantomPhysicsComponent->SetDirection({ forceX, forceY, forceZ });
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
}
|
||||
|
@@ -10,13 +10,13 @@ void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const
|
||||
if (breakPoint == waypoint) {
|
||||
const auto& blockGroup = self->GetVar<std::u16string>(BlockGroupVariable);
|
||||
|
||||
for (auto* block : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) {
|
||||
for (auto* block : Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) {
|
||||
RenderComponent::PlayAnimation(block, u"explode");
|
||||
|
||||
const auto blockID = block->GetObjectID();
|
||||
|
||||
self->AddCallbackTimer(1.0f, [self, blockID]() {
|
||||
auto* block = EntityManager::Instance()->GetEntity(blockID);
|
||||
auto* block = Game::entityManager->GetEntity(blockID);
|
||||
|
||||
if (block != nullptr) {
|
||||
block->Kill(self);
|
||||
|
@@ -42,7 +42,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
Entity* NjRailPostServer::GetRelatedRail(Entity* self) {
|
||||
const auto& railGroup = self->GetVar<std::u16string>(RailGroupVariable);
|
||||
if (!railGroup.empty()) {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(railGroup))) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(railGroup))) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
@@ -95,7 +95,7 @@ void PetDigServer::OnDie(Entity* self, Entity* killer) {
|
||||
// TODO: Reset other pets
|
||||
|
||||
// Handles smashing leftovers (edge case for the AG X)
|
||||
auto* xObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"X"));
|
||||
auto* xObject = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"X"));
|
||||
if (xObject != nullptr) {
|
||||
xObject->Smash(xObject->GetObjectID(), eKillType::VIOLENT);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
|
||||
if (playerID == LWOOBJID_EMPTY || playerID != owner->GetObjectID())
|
||||
return;
|
||||
|
||||
auto* playerEntity = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* playerEntity = Game::entityManager->GetEntity(playerID);
|
||||
if (!playerEntity || !playerEntity->GetParentUser() || !playerEntity->GetParentUser()->GetLastUsedChar())
|
||||
return;
|
||||
|
||||
@@ -134,7 +134,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
|
||||
player->SetPlayerFlag(playerFlag, true);
|
||||
}
|
||||
|
||||
auto* xObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"X"));
|
||||
auto* xObject = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"X"));
|
||||
if (xObject != nullptr) {
|
||||
xObject->Smash(xObject->GetObjectID(), eKillType::VIOLENT);
|
||||
}
|
||||
@@ -211,8 +211,8 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
|
||||
new LDFData<float>(u"spawnTimer", 1.0)
|
||||
};
|
||||
|
||||
auto* spawnedPet = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(spawnedPet);
|
||||
auto* spawnedPet = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(spawnedPet);
|
||||
}
|
||||
|
||||
Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
|
||||
@@ -220,7 +220,7 @@ Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
|
||||
Entity* closest = nullptr;
|
||||
|
||||
for (const auto tresureId : treasures) {
|
||||
auto* tresure = EntityManager::Instance()->GetEntity(tresureId);
|
||||
auto* tresure = Game::entityManager->GetEntity(tresureId);
|
||||
|
||||
if (tresure == nullptr) continue;
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "eMissionState.h"
|
||||
|
||||
void PropertyDevice::OnStartup(Entity* self) {
|
||||
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
auto* zoneControl = Game::entityManager->GetZoneControlEntity();
|
||||
if (zoneControl != nullptr) {
|
||||
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ void QbSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto gateObjID = self->GetVar<LWOOBJID>(u"gateObj");
|
||||
if (!gateObjID) return;
|
||||
|
||||
auto* gate = EntityManager::Instance()->GetEntity(gateObjID);
|
||||
auto* gate = Game::entityManager->GetEntity(gateObjID);
|
||||
if (!gate) return;
|
||||
|
||||
auto oPos = gate->GetPosition();
|
||||
@@ -75,12 +75,12 @@ void QbSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
new LDFData<int>(u"mobTableLoc", i)
|
||||
};
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info, nullptr, self);
|
||||
EntityManager::Instance()->ConstructEntity(child);
|
||||
auto* child = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
Game::entityManager->ConstructEntity(child);
|
||||
|
||||
OnChildLoaded(self, child);
|
||||
} else {
|
||||
auto* mob = EntityManager::Instance()->GetEntity(mobTable[i]);
|
||||
auto* mob = Game::entityManager->GetEntity(mobTable[i]);
|
||||
AggroTargetObject(self, mob);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void QbSpawner::OnChildLoaded(Entity* self, Entity* child) {
|
||||
const auto selfID = self->GetObjectID();
|
||||
|
||||
child->AddDieCallback([this, selfID, child]() {
|
||||
auto* self = EntityManager::Instance()->GetEntity(selfID);
|
||||
auto* self = Game::entityManager->GetEntity(selfID);
|
||||
OnChildRemoved(self, child);
|
||||
}
|
||||
);
|
||||
@@ -120,7 +120,7 @@ void QbSpawner::AggroTargetObject(Entity* self, Entity* enemy) {
|
||||
|
||||
auto gateObjID = self->GetVar<LWOOBJID>(u"gateObj");
|
||||
if (gateObjID) {
|
||||
auto* gate = EntityManager::Instance()->GetEntity(gateObjID);
|
||||
auto* gate = Game::entityManager->GetEntity(gateObjID);
|
||||
if (gate) {
|
||||
auto* movementAIComponent = enemy->GetComponent<MovementAIComponent>();
|
||||
if (movementAIComponent) movementAIComponent->SetDestination(gate->GetPosition());
|
||||
|
@@ -33,7 +33,7 @@ void WishingWellServer::OnUse(Entity* self, Entity* user) {
|
||||
const auto userID = user->GetObjectID();
|
||||
|
||||
self->AddCallbackTimer(10, [self, userID]() {
|
||||
auto* user = EntityManager::Instance()->GetEntity(userID);
|
||||
auto* user = Game::entityManager->GetEntity(userID);
|
||||
|
||||
if (user == nullptr) return;
|
||||
|
||||
|
@@ -40,8 +40,8 @@ void NsConcertChoiceBuildManager::SpawnCrate(Entity* self) {
|
||||
new LDFData<float>(u"crateTime", crate.time),
|
||||
};
|
||||
|
||||
auto* spawnedCrate = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(spawnedCrate);
|
||||
auto* spawnedCrate = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(spawnedCrate);
|
||||
|
||||
spawnedCrate->AddDieCallback([self]() {
|
||||
self->CancelAllTimers(); // Don't switch if the crate was smashed
|
||||
@@ -56,7 +56,7 @@ void NsConcertChoiceBuildManager::SpawnCrate(Entity* self) {
|
||||
self->AddCallbackTimer(crate.time, [self]() {
|
||||
auto crateID = self->GetVar<LWOOBJID>(u"currentCrate");
|
||||
if (crateID != LWOOBJID_EMPTY) {
|
||||
EntityManager::Instance()->DestroyEntity(crateID);
|
||||
Game::entityManager->DestroyEntity(crateID);
|
||||
self->SetVar<LWOOBJID>(u"currentCrate", LWOOBJID_EMPTY);
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ void NtAssemblyTubeServer::RunAssemblyTube(Entity* self, Entity* player) {
|
||||
const auto animTime = 3;
|
||||
|
||||
self->AddCallbackTimer(animTime, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -73,7 +73,7 @@ void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
|
||||
auto* destination = self;
|
||||
|
||||
if (!destinationGroup.empty()) {
|
||||
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
|
||||
const auto& groupObjs = Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
|
||||
|
||||
if (!groupObjs.empty()) {
|
||||
destination = groupObjs[0];
|
||||
@@ -92,7 +92,7 @@ void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
|
||||
const auto playerID = player->GetObjectID();
|
||||
|
||||
self->AddCallbackTimer(animTime, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
|
||||
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
|
||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||
|
||||
if (challengeObject != nullptr) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
|
||||
@@ -16,7 +16,7 @@ void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
|
||||
void NtCombatChallengeDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
|
||||
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
|
||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||
|
||||
if (challengeObject != nullptr) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
|
||||
|
@@ -5,7 +5,7 @@
|
||||
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
|
||||
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
|
||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||
|
||||
if (challengeObject != nullptr) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
|
||||
@@ -17,7 +17,7 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
|
||||
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
|
||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||
|
||||
if (challengeObject != nullptr) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
|
||||
|
@@ -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());
|
||||
|
@@ -40,7 +40,7 @@ void NtImagBeamBuffer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
}
|
||||
|
||||
for (const auto entityID : m_EntitiesInProximity) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(entityID);
|
||||
auto* entity = Game::entityManager->GetEntity(entityID);
|
||||
|
||||
if (entity == nullptr) {
|
||||
continue;
|
||||
|
@@ -21,7 +21,7 @@ void NtOverbuildServer::SetVariables(Entity* self) {
|
||||
|
||||
// Find the second object Dr. Overbuild interacts with
|
||||
LWOOBJID otherConvoObjectID = LWOOBJID_EMPTY;
|
||||
for (auto* otherConvoObject : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(m_OtherEntitiesGroupVariable)))) {
|
||||
for (auto* otherConvoObject : Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(m_OtherEntitiesGroupVariable)))) {
|
||||
otherConvoObjectID = otherConvoObject->GetObjectID();
|
||||
break;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
|
||||
}
|
||||
|
||||
self->AddCallbackTimer(2, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -55,7 +55,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendPlayFXEffect(self, 6432, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true);
|
||||
|
||||
self->AddCallbackTimer(2, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
|
@@ -33,7 +33,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
|
||||
if (animTime == 0.0f) animTime = 2.0f;
|
||||
|
||||
self->AddCallbackTimer(animTime, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -55,7 +55,7 @@ void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
|
||||
auto* destination = self;
|
||||
|
||||
if (!destinationGroup.empty()) {
|
||||
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
|
||||
const auto& groupObjs = Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
|
||||
|
||||
if (!groupObjs.empty()) {
|
||||
destination = groupObjs[0];
|
||||
@@ -81,7 +81,7 @@ void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
|
||||
const auto playerID = player->GetObjectID();
|
||||
|
||||
self->AddCallbackTimer(animTime, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
|
@@ -25,7 +25,7 @@ void NtSentinelWalkwayServer::OnStartup(Entity* self) {
|
||||
phantomPhysicsComponent->SetDirection(forward);
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
|
||||
self->SetProximityRadius(3, "speedboost");
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
|
||||
});
|
||||
|
||||
self->AddCallbackTimer(1.5f, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -57,7 +57,7 @@ void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
|
||||
void NtVentureCannonServer::EnterCannonEnded(Entity* self, Entity* player) {
|
||||
const auto playerID = player->GetObjectID();
|
||||
|
||||
const auto& cannonEffectGroup = EntityManager::Instance()->GetEntitiesInGroup("cannonEffect");
|
||||
const auto& cannonEffectGroup = Game::entityManager->GetEntitiesInGroup("cannonEffect");
|
||||
|
||||
if (!cannonEffectGroup.empty()) {
|
||||
auto* cannonEffect = cannonEffectGroup[0];
|
||||
@@ -83,7 +83,7 @@ void NtVentureCannonServer::EnterCannonEnded(Entity* self, Entity* player) {
|
||||
);
|
||||
|
||||
self->AddCallbackTimer(1.5f, [this, self, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -112,7 +112,7 @@ void NtVentureCannonServer::FirePlayer(Entity* self, Entity* player) {
|
||||
auto* destination = self;
|
||||
|
||||
if (!destinationGroup.empty()) {
|
||||
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
|
||||
const auto& groupObjs = Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
|
||||
|
||||
if (!groupObjs.empty()) {
|
||||
destination = groupObjs[0];
|
||||
|
@@ -7,7 +7,7 @@ void HydrantBroken::OnStartup(Entity* self) {
|
||||
|
||||
const auto hydrant = "hydrant" + self->GetVar<std::string>(u"hydrant");
|
||||
|
||||
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
||||
const auto bouncers = Game::entityManager->GetEntitiesInGroup(hydrant);
|
||||
|
||||
for (auto* bouncer : bouncers) {
|
||||
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
||||
@@ -22,7 +22,7 @@ void HydrantBroken::OnStartup(Entity* self) {
|
||||
|
||||
void HydrantBroken::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "KillBroken") {
|
||||
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
|
||||
auto* bouncer = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
|
||||
|
||||
if (bouncer != nullptr) {
|
||||
GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
@@ -19,7 +19,7 @@ void EnemySpiderSpawner::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
if (dest) {
|
||||
dest->SetFaction(-1);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
|
||||
// Keep track of who prepped me
|
||||
self->SetI64(u"SpawnOwner", sender->GetObjectID());
|
||||
@@ -48,9 +48,9 @@ void EnemySpiderSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
info.spawnerID = self->GetI64(u"SpawnOwner");
|
||||
info.spawnerNodeID = 0;
|
||||
|
||||
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
||||
Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
|
||||
if (newEntity) {
|
||||
EntityManager::Instance()->ConstructEntity(newEntity);
|
||||
Game::entityManager->ConstructEntity(newEntity);
|
||||
newEntity->GetGroups().push_back("BabySpider");
|
||||
|
||||
/*
|
||||
|
@@ -128,13 +128,13 @@ void ZoneAgProperty::KillSpots(Entity* self) {
|
||||
}
|
||||
|
||||
for (const auto& groupName : self->GetVar<std::vector<std::string>>(ROFTargetsGroup)) {
|
||||
for (auto* spot : EntityManager::Instance()->GetEntitiesInGroup(groupName)) {
|
||||
for (auto* spot : Game::entityManager->GetEntitiesInGroup(groupName)) {
|
||||
spot->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
DeactivateSpawner(self->GetVar<std::string>(LandTargetSpawner));
|
||||
for (auto* landTarget : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetSpawner))) {
|
||||
for (auto* landTarget : Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetSpawner))) {
|
||||
landTarget->Kill();
|
||||
}
|
||||
}
|
||||
@@ -197,20 +197,20 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
if (zoneId != 1150)
|
||||
return;
|
||||
|
||||
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
||||
const auto entities = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
||||
if (entities.empty())
|
||||
return;
|
||||
|
||||
auto* entity = entities[0];
|
||||
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", 0, 0, entity->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(), u"GuardChat", 0, 0, entity->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
LoadProperty(self);
|
||||
|
||||
self->AddTimer("KillGuard", 5);
|
||||
} else if (timerName == "KillGuard") {
|
||||
KillGuard(self);
|
||||
} else if (timerName == "tornadoOff") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("TornadoDebris", false);
|
||||
@@ -222,7 +222,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
self->AddTimer("ShowVendor", 1.2f);
|
||||
self->AddTimer("ShowClearEffects", 2);
|
||||
} else if (timerName == "ShowClearEffects") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(-1, u"beamOn", "beam");
|
||||
@@ -236,7 +236,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SkyOff", 0, 0, LWOOBJID_EMPTY,
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == "killSpider") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(EnemiesGroup))) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(EnemiesGroup))) {
|
||||
entity->Kill();
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
DeactivateSpawner(self->GetVar<std::string>(SpiderScreamSpawner));
|
||||
DestroySpawner(self->GetVar<std::string>(SpiderScreamSpawner));
|
||||
|
||||
for (auto* player : EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CHARACTER)) {
|
||||
for (auto* player : Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CHARACTER)) {
|
||||
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
||||
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
} else if (timerName == "pollTornadoFX") {
|
||||
StartTornadoFx(self);
|
||||
} else if (timerName == "killFXObject") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("beam");
|
||||
@@ -385,7 +385,7 @@ void ZoneAgProperty::RemovePlayerRef(Entity* self) {
|
||||
void ZoneAgProperty::BaseOnFireEventServerSide(Entity* self, Entity* sender, std::string args) {
|
||||
if (args == "propertyRented") {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"playerID");
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
auto* player = Game::entityManager->GetEntity(playerId);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
@@ -409,7 +409,7 @@ void ZoneAgProperty::BaseOnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
sender->SetNetworkVar<std::string>(u"PropertyOwnerID", std::to_string(self->GetVar<LWOOBJID>(u"PropertyOwner")));
|
||||
} else if (args == "ClearProperty") {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"playerID");
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
auto* player = Game::entityManager->GetEntity(playerId);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
|
@@ -5,14 +5,14 @@
|
||||
#include "Entity.h"
|
||||
|
||||
void PropertyBankInteract::OnStartup(Entity* self) {
|
||||
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
auto* zoneControl = Game::entityManager->GetZoneControlEntity();
|
||||
if (zoneControl != nullptr) {
|
||||
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyBankInteract::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
auto* zoneControl = Game::entityManager->GetZoneControlEntity();
|
||||
if (zoneControl != nullptr) {
|
||||
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ void VeBricksampleServer::OnUse(Entity* self, Entity* user) {
|
||||
if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) {
|
||||
inventoryComponent->AddItem(loot, 1, eLootSourceType::ACTIVITY);
|
||||
|
||||
for (auto* brickEntity : EntityManager::Instance()->GetEntitiesInGroup("Bricks")) {
|
||||
for (auto* brickEntity : Game::entityManager->GetEntitiesInGroup("Bricks")) {
|
||||
GameMessages::SendNotifyClientObject(brickEntity->GetObjectID(), u"Pickedup");
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ void VeEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
|
||||
|
||||
// Notify the client that all objects have updated
|
||||
self->AddCallbackTimer(3.0f, [this]() {
|
||||
for (const auto* console : EntityManager::Instance()->GetEntitiesInGroup(m_ConsoleGroup)) {
|
||||
for (const auto* console : Game::entityManager->GetEntitiesInGroup(m_ConsoleGroup)) {
|
||||
GameMessages::SendNotifyClientObject(console->GetObjectID(), u"");
|
||||
}
|
||||
});
|
||||
|
@@ -19,7 +19,7 @@ void CatapultBaseServer::OnNotifyObject(Entity* self, Entity* sender, const std:
|
||||
void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "PlatAnim") {
|
||||
// get the arm asset
|
||||
const auto arm = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"ArmGroup"));
|
||||
const auto arm = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"ArmGroup"));
|
||||
|
||||
// tell the arm to the play the platform animation, which is just the arm laying there but with bouncer
|
||||
for (auto* obj : arm) {
|
||||
@@ -34,7 +34,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->AddTimer("bounce", 3);
|
||||
} else if (timerName == "launchAnim") {
|
||||
// get the arm asset
|
||||
auto* arm = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Arm"));
|
||||
auto* arm = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Arm"));
|
||||
if (arm == nullptr) return;
|
||||
|
||||
// tell the arm to player the launcher animation
|
||||
@@ -42,7 +42,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->AddTimer("resetArm", animTime);
|
||||
RenderComponent::PlayAnimation(arm, u"launch");
|
||||
} else if (timerName == "bounce") {
|
||||
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
|
||||
auto* bouncer = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
|
||||
if (bouncer == nullptr) return;
|
||||
|
||||
// bounce all players
|
||||
@@ -50,13 +50,13 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
// add a delay to play the animation
|
||||
self->AddTimer("launchAnim", .3);
|
||||
} else if (timerName == "resetArm") {
|
||||
auto* arm = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Arm"));
|
||||
auto* arm = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Arm"));
|
||||
if (arm == nullptr) return;
|
||||
|
||||
// set the arm back to natural state
|
||||
RenderComponent::PlayAnimation(arm, u"idle");
|
||||
|
||||
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
|
||||
auto* bouncer = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
|
||||
if (bouncer == nullptr) return;
|
||||
|
||||
// kill the bouncer
|
||||
|
@@ -7,7 +7,7 @@ void CatapultBouncerServer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
|
||||
self->SetNetworkVar<bool>(u"Built", true);
|
||||
|
||||
const auto base = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"BaseGroup"));
|
||||
const auto base = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"BaseGroup"));
|
||||
|
||||
for (auto* obj : base) {
|
||||
obj->NotifyObject(self, "BouncerBuilt");
|
||||
|
@@ -36,13 +36,13 @@ void CavePrisonCage::Setup(Entity* self, Spawner* spawner) {
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
// Spawn the villager inside the jail
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
// Save the villeger ID
|
||||
self->SetVar<LWOOBJID>(u"villager", entity->GetObjectID());
|
||||
|
||||
// Construct the entity
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
}
|
||||
|
||||
void CavePrisonCage::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
@@ -77,7 +77,7 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
|
||||
|
||||
rebuildComponent->AddRebuildCompleteCallback([this, self](Entity* user) {
|
||||
// The counterweight is a simple mover, which is not implemented, so we'll just set it's position
|
||||
auto* counterweight = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
||||
auto* counterweight = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
||||
|
||||
if (counterweight == nullptr) {
|
||||
return;
|
||||
@@ -87,7 +87,7 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
|
||||
counterweight->SetPosition(counterweight->GetPosition() + NiPoint3(0, -2, 0));
|
||||
|
||||
// Serialize the counterweight
|
||||
EntityManager::Instance()->SerializeEntity(counterweight);
|
||||
Game::entityManager->SerializeEntity(counterweight);
|
||||
|
||||
// notifyPlatformAtLastWaypoint
|
||||
|
||||
@@ -95,7 +95,7 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
|
||||
self->SetVar<LWOOBJID>(u"Builder", user->GetObjectID());
|
||||
|
||||
// Get the button and make sure it still exists
|
||||
auto* button = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Button"));
|
||||
auto* button = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Button"));
|
||||
|
||||
if (button == nullptr) {
|
||||
return;
|
||||
@@ -117,7 +117,7 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
|
||||
}
|
||||
|
||||
void CavePrisonCage::GetButton(Entity* self) {
|
||||
const auto buttons = EntityManager::Instance()->GetEntitiesInGroup("PrisonButton_0" + std::to_string(self->GetVarAs<int32_t>(u"myNumber")));
|
||||
const auto buttons = Game::entityManager->GetEntitiesInGroup("PrisonButton_0" + std::to_string(self->GetVarAs<int32_t>(u"myNumber")));
|
||||
|
||||
if (buttons.size() == 0) {
|
||||
// Try again in 0.5 seconds
|
||||
@@ -146,7 +146,7 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
|
||||
RenderComponent::PlayAnimation(self, u"idle-up");
|
||||
|
||||
// Get the villeger
|
||||
auto* villager = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"villager"));
|
||||
auto* villager = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"villager"));
|
||||
|
||||
if (villager == nullptr) {
|
||||
return;
|
||||
@@ -155,7 +155,7 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
|
||||
GameMessages::SendNotifyClientObject(villager->GetObjectID(), u"TimeToChat", 0, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
// Get the builder and make sure it still exists
|
||||
auto* builder = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Builder"));
|
||||
auto* builder = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Builder"));
|
||||
|
||||
if (builder == nullptr) {
|
||||
return;
|
||||
@@ -170,7 +170,7 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->AddTimer("VillagerEscape", 5.0f);
|
||||
} else if (timerName == "VillagerEscape") {
|
||||
// Get the villeger and make sure it still exists
|
||||
auto* villager = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"villager"));
|
||||
auto* villager = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"villager"));
|
||||
|
||||
if (villager == nullptr) {
|
||||
return;
|
||||
@@ -183,7 +183,7 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->AddTimer("SmashCounterweight", 2.0f);
|
||||
} else if (timerName == "SmashCounterweight") {
|
||||
// Get the counterweight and make sure it still exists
|
||||
auto* counterweight = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
||||
auto* counterweight = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
||||
|
||||
if (counterweight == nullptr) {
|
||||
return;
|
||||
@@ -193,7 +193,7 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
|
||||
counterweight->Smash();
|
||||
|
||||
// Get the button and make sure it still exists
|
||||
auto* button = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Button"));
|
||||
auto* button = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Button"));
|
||||
|
||||
if (button == nullptr) {
|
||||
return;
|
||||
|
@@ -28,13 +28,13 @@ void EnemySkeletonSpawner::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());
|
||||
|
@@ -9,7 +9,7 @@ void MonCoreSmashableDoors::OnDie(Entity* self, Entity* killer) {
|
||||
auto triggerGroup = "CoreNookTrig0" + myNum;
|
||||
|
||||
// Get the trigger
|
||||
auto triggers = EntityManager::Instance()->GetEntitiesInGroup(triggerGroup);
|
||||
auto triggers = Game::entityManager->GetEntitiesInGroup(triggerGroup);
|
||||
|
||||
if (triggers.empty()) {
|
||||
return;
|
||||
|
@@ -12,7 +12,7 @@ void NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(Entity* self, Entity* targ
|
||||
|
||||
// Wait for an animation to complete and flag that the player has learned spinjitzu
|
||||
self->AddCallbackTimer(5.0f, [targetID, element]() {
|
||||
auto* target = EntityManager::Instance()->GetEntity(targetID);
|
||||
auto* target = Game::entityManager->GetEntity(targetID);
|
||||
if (target != nullptr) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
|
@@ -28,7 +28,7 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, e
|
||||
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, false);
|
||||
|
||||
// Hide the chest
|
||||
for (auto* chest : EntityManager::Instance()->GetEntitiesInGroup(m_DragonChestGroup)) {
|
||||
for (auto* chest : Game::entityManager->GetEntitiesInGroup(m_DragonChestGroup)) {
|
||||
GameMessages::SendNotifyClientObject(chest->GetObjectID(), m_ShowChestNotification, 0, -1,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
@@ -41,19 +41,19 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, e
|
||||
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, true);
|
||||
|
||||
// Show the chest
|
||||
for (auto* chest : EntityManager::Instance()->GetEntitiesInGroup(m_DragonChestGroup)) {
|
||||
for (auto* chest : Game::entityManager->GetEntitiesInGroup(m_DragonChestGroup)) {
|
||||
GameMessages::SendNotifyClientObject(chest->GetObjectID(), m_ShowChestNotification, 1, -1,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
|
||||
auto playerID = target->GetObjectID();
|
||||
self->AddCallbackTimer(5.0f, [this, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
// Stop the dragon effects
|
||||
for (auto* dragon : EntityManager::Instance()->GetEntitiesInGroup(m_DragonStatueGroup)) {
|
||||
for (auto* dragon : Game::entityManager->GetEntitiesInGroup(m_DragonStatueGroup)) {
|
||||
GameMessages::SendStopFXEffect(dragon, true, "on");
|
||||
}
|
||||
});
|
||||
|
@@ -18,9 +18,9 @@ void RainOfArrows::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
|
||||
self->SetVar<LWOOBJID>(u"ChildFX", entity->GetObjectID());
|
||||
self->SetVar<LWOOBJID>(u"playerID", target->GetObjectID());
|
||||
@@ -30,11 +30,11 @@ void RainOfArrows::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void RainOfArrows::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* child = EntityManager::Instance()->GetEntity(
|
||||
auto* child = Game::entityManager->GetEntity(
|
||||
self->GetVar<LWOOBJID>(u"ChildFX")
|
||||
);
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(
|
||||
auto* player = Game::entityManager->GetEntity(
|
||||
self->GetVar<LWOOBJID>(u"playerID")
|
||||
);
|
||||
|
||||
|
@@ -122,7 +122,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string
|
||||
if (timerName == WaitingForPlayersTimer) {
|
||||
StartFight(self);
|
||||
} else if (timerName == SpawnNextWaveTimer) {
|
||||
auto* frakjaw = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(LedgeFrakjawVariable));
|
||||
auto* frakjaw = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(LedgeFrakjawVariable));
|
||||
if (frakjaw != nullptr) {
|
||||
SummonWave(self, frakjaw);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string
|
||||
}
|
||||
}
|
||||
} else if (timerName + TimerSplitChar == UnstunTimer) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(objectID);
|
||||
auto* entity = Game::entityManager->GetEntity(objectID);
|
||||
if (entity != nullptr) {
|
||||
auto* combatAI = entity->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAI != nullptr) {
|
||||
@@ -164,7 +164,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string
|
||||
}
|
||||
} else if (timerName == LowerFrakjawCamTimer) {
|
||||
// Destroy the frakjaw on the ledge
|
||||
auto* ledgeFrakjaw = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(LedgeFrakjawVariable));
|
||||
auto* ledgeFrakjaw = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(LedgeFrakjawVariable));
|
||||
if (ledgeFrakjaw != nullptr) {
|
||||
ledgeFrakjaw->Kill();
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string
|
||||
spawner->Activate();
|
||||
}
|
||||
} else if (timerName + TimerSplitChar == FrakjawSpawnInTimer) {
|
||||
auto* lowerFrakjaw = EntityManager::Instance()->GetEntity(objectID);
|
||||
auto* lowerFrakjaw = Game::entityManager->GetEntity(objectID);
|
||||
if (lowerFrakjaw != nullptr) {
|
||||
LowerFrakjawSummon(self, lowerFrakjaw);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* co
|
||||
counterWeight->Kill();
|
||||
}
|
||||
|
||||
auto* frakjaw = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(LedgeFrakjawVariable));
|
||||
auto* frakjaw = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(LedgeFrakjawVariable));
|
||||
if (frakjaw == nullptr) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"LedgeFrakjawDead", 0,
|
||||
0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
@@ -342,7 +342,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawHit(Entity* self, Entity* lowerFr
|
||||
std::vector<LWOOBJID> newTrashMobs = {};
|
||||
|
||||
for (const auto& trashMobID : trashMobsAlive) {
|
||||
auto* trashMob = EntityManager::Instance()->GetEntity(trashMobID);
|
||||
auto* trashMob = Game::entityManager->GetEntity(trashMobID);
|
||||
if (trashMob != nullptr) {
|
||||
newTrashMobs.push_back(trashMobID);
|
||||
|
||||
@@ -393,7 +393,7 @@ void NjMonastryBossInstance::HandleWaveEnemyDied(Entity* self, Entity* waveEnemy
|
||||
}
|
||||
|
||||
void NjMonastryBossInstance::TeleportPlayer(Entity* player, uint32_t position) {
|
||||
for (const auto* spawnPoint : EntityManager::Instance()->GetEntitiesInGroup("SpawnPoint" + std::to_string(position))) {
|
||||
for (const auto* spawnPoint : Game::entityManager->GetEntitiesInGroup("SpawnPoint" + std::to_string(position))) {
|
||||
GameMessages::SendTeleport(player->GetObjectID(), spawnPoint->GetPosition(), spawnPoint->GetRotation(),
|
||||
player->GetSystemAddress(), true);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void NjMonastryBossInstance::RemovePoison(Entity* self) {
|
||||
const auto& totalPlayer = self->GetVar<std::vector<LWOOBJID>>(TotalPlayersLoadedVariable);
|
||||
for (const auto& playerID : totalPlayer) {
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player != nullptr) {
|
||||
|
||||
auto* buffComponent = player->GetComponent<BuffComponent>();
|
||||
@@ -505,7 +505,7 @@ void NjMonastryBossInstance::FightOver(Entity* self) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0,
|
||||
LWOOBJID_EMPTY, TreasureChestSpawning, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
auto treasureChests = EntityManager::Instance()->GetEntitiesInGroup(ChestSpawnpointGroup);
|
||||
auto treasureChests = Game::entityManager->GetEntitiesInGroup(ChestSpawnpointGroup);
|
||||
for (auto* treasureChest : treasureChests) {
|
||||
auto info = EntityInfo{};
|
||||
|
||||
@@ -518,7 +518,7 @@ void NjMonastryBossInstance::FightOver(Entity* self) {
|
||||
};
|
||||
|
||||
// Finally spawn a treasure chest at the correct spawn point
|
||||
auto* chestObject = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(chestObject);
|
||||
auto* chestObject = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(chestObject);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user