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:
David Markowitz
2023-07-15 13:56:33 -07:00
committed by GitHub
parent 9375c36c7b
commit 455f9470a5
200 changed files with 861 additions and 862 deletions

View File

@@ -14,7 +14,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
Entity* player;
if (possessableComponent != nullptr) {
auto* player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
auto* player = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (player == nullptr) {
return;
@@ -28,7 +28,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
return;
}
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (vehicle == nullptr) {
return;

View File

@@ -11,7 +11,7 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
if (splitArguments.size() > 1) {
const auto eventName = splitArguments[0];
const auto player = EntityManager::Instance()->GetEntity(std::stoull(splitArguments[1]));
const auto player = Game::entityManager->GetEntity(std::stoull(splitArguments[1]));
if (player != nullptr) {
if (eventName == "updatePlayer") {

View File

@@ -24,12 +24,12 @@ void AgBusDoor::OnProximityUpdate(Entity* self, Entity* entering, std::string na
m_OuterCounter = 0;
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoor")) {
auto* entity = EntityManager::Instance()->GetEntity(pair.first);
auto* entity = Game::entityManager->GetEntity(pair.first);
if (entity != nullptr && entity->IsPlayer()) m_Counter++;
}
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoorOuter")) {
auto* entity = EntityManager::Instance()->GetEntity(pair.first);
auto* entity = Game::entityManager->GetEntity(pair.first);
if (entity != nullptr && entity->IsPlayer()) m_OuterCounter++;
}

View File

@@ -25,7 +25,7 @@ void AgFans::OnStartup(Entity* self) {
void AgFans::ToggleFX(Entity* self, bool hit) {
std::string fanGroup = self->GetGroups()[0];
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
std::vector<Entity*> fanVolumes = Game::entityManager->GetEntitiesInGroup(fanGroup);
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
@@ -45,9 +45,9 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
if (!volumePhys) continue;
volumePhys->SetPhysicsEffectActive(false);
EntityManager::Instance()->SerializeEntity(volume);
Game::entityManager->SerializeEntity(volume);
if (!hit) {
Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0];
Entity* fxObj = Game::entityManager->GetEntitiesInGroup(fanGroup + "fx")[0];
RenderComponent::PlayAnimation(fxObj, u"trigger");
}
}
@@ -61,9 +61,9 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
if (!volumePhys) continue;
volumePhys->SetPhysicsEffectActive(true);
EntityManager::Instance()->SerializeEntity(volume);
Game::entityManager->SerializeEntity(volume);
if (!hit) {
Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0];
Entity* fxObj = Game::entityManager->GetEntitiesInGroup(fanGroup + "fx")[0];
RenderComponent::PlayAnimation(fxObj, u"idle");
}
}

View File

@@ -36,9 +36,9 @@ void AgImagSmashable::CrateAnimal(Entity* self) {
info.spawnerID = self->GetSpawnerID();
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);
}
}
}

View File

@@ -12,7 +12,7 @@ void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
);
inUse = true;
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
auto entities = Game::entityManager->GetEntitiesInGroup("Jet_FX");
if (entities.empty()) return;
GameMessages::SendPlayFXEffect(entities.at(0), 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true);
self->AddTimer("radarDish", 2.0f);
@@ -22,7 +22,7 @@ void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target) {
if (self->GetLOT() != 6209) return;
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
auto entities = Game::entityManager->GetEntitiesInGroup("Jet_FX");
if (entities.empty()) return;
RenderComponent::PlayAnimation(entities.at(0), u"jetFX");
@@ -40,7 +40,7 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "radarDish") {
GameMessages::SendStopFXEffect(self, true, "radarDish");
} else if (timerName == "PlayEffect") {
auto entities = EntityManager::Instance()->GetEntitiesInGroup("mortarMain");
auto entities = Game::entityManager->GetEntitiesInGroup("mortarMain");
if (entities.empty()) return;
const auto selected = GeneralUtils::GenerateRandomNumber<int>(0, entities.size() - 1);

View File

@@ -26,7 +26,7 @@ void AgQbElevator::OnProximityUpdate(Entity* self, Entity* entering, std::string
if (self->GetBoolean(u"qbPlayerRdy")) return;
if (status == "ENTER") {
Entity* builder = EntityManager::Instance()->GetEntity(self->GetI64(u"qbPlayer"));
Entity* builder = Game::entityManager->GetEntity(self->GetI64(u"qbPlayer"));
if (builder && builder == entering) {
//the builder has entered so cancel the start timer and just start moving
self->SetBoolean(u"qbPlayerRdy", true);

View File

@@ -4,7 +4,7 @@ void AgQbWall::OnRebuildComplete(Entity* self, Entity* player) {
self->SetVar(u"player", player->GetObjectID());
auto targetWallSpawners = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner"));
if (targetWallSpawners != "") {
auto groupObjs = EntityManager::Instance()->GetEntitiesInGroup(targetWallSpawners);
auto groupObjs = Game::entityManager->GetEntitiesInGroup(targetWallSpawners);
for (auto* obj : groupObjs) {
if (obj) {
obj->SetVar(u"player", player->GetObjectID());

View File

@@ -15,9 +15,9 @@ void AgSpaceStuff::OnStartup(Entity* self) {
info.lot = 33;
info.spawnerID = self->GetObjectID();
auto* ref = EntityManager::Instance()->CreateEntity(info);
auto* ref = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(ref);
Game::entityManager->ConstructEntity(ref);
self->SetVar(u"ShakeObject", ref->GetObjectID());
@@ -47,7 +47,7 @@ void AgSpaceStuff::OnTimerDone(Entity* self, std::string timerName) {
void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
if (!explodeIdle) {
auto* ref = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"ShakeObject"));
auto* ref = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"ShakeObject"));
const auto randomTime = self->GetVar<int>(u"RandomTime");
auto time = GeneralUtils::GenerateRandomNumber<int>(0, randomTime + 1);
@@ -92,7 +92,7 @@ void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
}
Entity* AgSpaceStuff::GetEntityInGroup(const std::string& group) {
auto entities = EntityManager::Instance()->GetEntitiesInGroup(group);
auto entities = Game::entityManager->GetEntitiesInGroup(group);
Entity* en = nullptr;
for (auto entity : entities) {

View File

@@ -4,7 +4,7 @@
#include "GameMessages.h"
void ActNinjaSensei::OnStartup(Entity* self) {
auto students = EntityManager::Instance()->GetEntitiesInGroup(this->m_StudentGroup);
auto students = Game::entityManager->GetEntitiesInGroup(this->m_StudentGroup);
std::vector<Entity*> validStudents = {};
for (auto* student : students) {
if (student && student->GetLOT() == this->m_StudentLOT) validStudents.push_back(student);

View File

@@ -8,7 +8,7 @@
void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
const auto myGroup = "AllPipes";
const auto groupObjs = EntityManager::Instance()->GetEntitiesInGroup(myGroup);
const auto groupObjs = Game::entityManager->GetEntitiesInGroup(myGroup);
auto indexCount = 0;
@@ -27,14 +27,14 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
}
if (indexCount >= 2) {
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
const auto refinery = Game::entityManager->GetEntitiesInGroup("Paradox");
if (!refinery.empty()) {
GameMessages::SendPlayFXEffect(refinery[0]->GetObjectID(), 3999, u"create", "pipeFX");
}
for (auto* object : groupObjs) {
auto* player = EntityManager::Instance()->GetEntity(object->GetVar<LWOOBJID>(u"PlayerID"));
auto* player = Game::entityManager->GetEntity(object->GetVar<LWOOBJID>(u"PlayerID"));
if (player != nullptr) {
auto* missionComponent = player->GetComponent<MissionComponent>();
@@ -53,7 +53,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
void ActParadoxPipeFix::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == eRebuildState::RESETTING) {
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
const auto refinery = Game::entityManager->GetEntitiesInGroup("Paradox");
if (!refinery.empty()) {
GameMessages::SendStopFXEffect(refinery[0], true, "pipeFX");

View File

@@ -13,7 +13,7 @@ void FvConsoleLeftQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState s
if (state == eRebuildState::COMPLETED) {
self->SetVar(u"IAmBuilt", true);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleLeftUp");
@@ -22,7 +22,7 @@ void FvConsoleLeftQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState s
self->SetVar(u"IAmBuilt", false);
self->SetVar(u"AmActive", false);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleLeftDown");
@@ -38,7 +38,7 @@ void FvConsoleLeftQuickbuild::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"IAmBuilt")) {
self->SetVar(u"AmActive", true);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleLeftActive");

View File

@@ -13,7 +13,7 @@ void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState
if (state == eRebuildState::COMPLETED) {
self->SetVar(u"IAmBuilt", true);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleRightUp");
@@ -22,7 +22,7 @@ void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState
self->SetVar(u"IAmBuilt", false);
self->SetVar(u"AmActive", false);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleRightDown");
@@ -38,7 +38,7 @@ void FvConsoleRightQuickbuild::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"IAmBuilt")) {
self->SetVar(u"AmActive", true);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleRightActive");

View File

@@ -21,7 +21,7 @@ void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState s
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
auto* dragon = EntityManager::Instance()->GetEntity(dragonId);
auto* dragon = Game::entityManager->GetEntity(dragonId);
if (dragon != nullptr) {
dragon->OnFireEventServerSide(self, "rebuildDone");

View File

@@ -46,14 +46,14 @@ void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::st
}
if (self->GetVar<bool>(u"ConsoleLEFTActive") && self->GetVar<bool>(u"ConsoleRIGHTActive")) {
auto* object = EntityManager::Instance()->GetEntitiesInGroup("Brick")[0];
auto* object = Game::entityManager->GetEntitiesInGroup("Brick")[0];
if (object != nullptr) {
GameMessages::SendPlayFXEffect(object->GetObjectID(), 122, u"create", "bluebrick");
GameMessages::SendPlayFXEffect(object->GetObjectID(), 1034, u"cast", "imaginationexplosion");
}
object = EntityManager::Instance()->GetEntitiesInGroup("Canister")[0];
object = Game::entityManager->GetEntitiesInGroup("Canister")[0];
if (object != nullptr) {
object->Smash(self->GetObjectID(), eKillType::SILENT);
@@ -64,7 +64,7 @@ void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::st
} else if (self->GetVar<bool>(u"ConsoleLEFTActive") || self->GetVar<bool>(u"ConsoleRIGHTActive")) {
brickSpawner->Activate();
auto* object = EntityManager::Instance()->GetEntitiesInGroup("Brick")[0];
auto* object = Game::entityManager->GetEntitiesInGroup("Brick")[0];
if (object != nullptr) {
GameMessages::SendStopFXEffect(object, true, "bluebrick");

View File

@@ -34,7 +34,7 @@ void FvFlyingCreviceDragon::OnTimerDone(Entity* self, std::string timerName) {
groupName = "dragonFireballs3";
}
const auto& group = EntityManager::Instance()->GetEntitiesInGroup(groupName);
const auto& group = Game::entityManager->GetEntitiesInGroup(groupName);
if (group.empty()) {
return;
@@ -73,7 +73,7 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
} else if (point == 12) {
RenderComponent::PlayAnimation(self, u"attack2", 2.0f);
const auto& group2 = EntityManager::Instance()->GetEntitiesInGroup("dragonFireballs2");
const auto& group2 = Game::entityManager->GetEntitiesInGroup("dragonFireballs2");
if (group2.empty()) {
return;

View File

@@ -22,13 +22,13 @@ void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* ta
RenderComponent::PlayAnimation(self, u"scared");
if (self->GetLOT() == 7412) {
auto* rightGuard = EntityManager::Instance()->GetEntity(m_RightGuard);
auto* rightGuard = Game::entityManager->GetEntity(m_RightGuard);
if (rightGuard != nullptr) {
RenderComponent::PlayAnimation(rightGuard, u"laugh_rt");
}
} else if (self->GetLOT() == 11128) {
auto* leftGuard = EntityManager::Instance()->GetEntity(m_LeftGuard);
auto* leftGuard = Game::entityManager->GetEntity(m_LeftGuard);
if (leftGuard != nullptr) {
RenderComponent::PlayAnimation(leftGuard, u"laugh_lt");

View File

@@ -9,7 +9,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
auto* character = target->GetCharacter();
if (character != nullptr && character->GetPlayerFlag(81)) {
auto raceObjects = EntityManager::Instance()->GetEntitiesInGroup("PandaRaceObject");
auto raceObjects = Game::entityManager->GetEntitiesInGroup("PandaRaceObject");
if (raceObjects.empty())
return;
@@ -19,7 +19,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
return;
// If the player already spawned a panda
auto playerPandas = EntityManager::Instance()->GetEntitiesInGroup("panda" + std::to_string(target->GetObjectID()));
auto playerPandas = Game::entityManager->GetEntitiesInGroup("panda" + std::to_string(target->GetObjectID()));
if (!playerPandas.empty()) {
GameMessages::SendFireEventClientSide(self->GetObjectID(), target->GetSystemAddress(), u"playerPanda",
target->GetObjectID(), 0, 0, target->GetObjectID());
@@ -27,7 +27,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
}
// If there's already too many spawned pandas
auto pandas = EntityManager::Instance()->GetEntitiesInGroup("pandas");
auto pandas = Game::entityManager->GetEntitiesInGroup("pandas");
if (pandas.size() > 4) {
GameMessages::SendFireEventClientSide(self->GetObjectID(), target->GetSystemAddress(), u"tooManyPandas",
target->GetObjectID(), 0, 0, target->GetObjectID());
@@ -43,7 +43,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
new LDFData<std::u16string>(u"groupID", u"panda" + (GeneralUtils::to_u16string(target->GetObjectID())) + u";pandas")
};
auto* panda = EntityManager::Instance()->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(panda);
auto* panda = Game::entityManager->CreateEntity(info);
Game::entityManager->ConstructEntity(panda);
}
}

View File

@@ -20,9 +20,9 @@ void GfBanana::SpawnBanana(Entity* self) {
info.lot = 6909;
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(u"banana", entity->GetObjectID());
@@ -46,7 +46,7 @@ void GfBanana::OnHit(Entity* self, Entity* attacker) {
if (bananaId == LWOOBJID_EMPTY) return;
auto* bananaEntity = EntityManager::Instance()->GetEntity(bananaId);
auto* bananaEntity = Game::entityManager->GetEntity(bananaId);
if (bananaEntity == nullptr) {
self->SetVar(u"banana", LWOOBJID_EMPTY);
@@ -79,12 +79,12 @@ void GfBanana::OnHit(Entity* self, Entity* attacker) {
info.lot = 6718;
info.spawnerID = self->GetObjectID();
auto* entity = EntityManager::Instance()->CreateEntity(info);
auto* entity = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(entity, UNASSIGNED_SYSTEM_ADDRESS);
Game::entityManager->ConstructEntity(entity, UNASSIGNED_SYSTEM_ADDRESS);
*/
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
}
void GfBanana::OnTimerDone(Entity* self, std::string timerName) {

View File

@@ -83,7 +83,7 @@ void GfCampfire::OnTimerDone(Entity* self, std::string timerName) {
const auto targetId = self->GetVar<LWOOBJID>("target");
auto* entering = EntityManager::Instance()->GetEntity(targetId);
auto* entering = Game::entityManager->GetEntity(targetId);
if (entering == nullptr)
{

View File

@@ -30,8 +30,8 @@ void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) {
}
}
auto* treasure = EntityManager::Instance()->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(treasure);
auto* treasure = Game::entityManager->CreateEntity(info);
Game::entityManager->ConstructEntity(treasure);
self->SetVar<LWOOBJID>(u"chestObj", treasure->GetObjectID());
}
@@ -40,7 +40,7 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
if (treasureID == LWOOBJID_EMPTY)
return;
auto treasure = EntityManager::Instance()->GetEntity(treasureID);
auto treasure = Game::entityManager->GetEntity(treasureID);
if (treasure == nullptr)
return;

View File

@@ -78,7 +78,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
const std::u16string& stringValue) {
Game::logger->Log("SGCannon", "Got activity state change request: %s", GeneralUtils::UTF16ToWTF8(stringValue).c_str());
if (stringValue == u"clientready") {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
Game::logger->Log("SGCannon", "Player is ready");
/*GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
@@ -95,7 +95,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
Game::logger->Log("SGCannon", "Setting player ID");
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
} else {
Game::logger->Log("SGCannon", "Shooting gallery component is null");
}
@@ -111,7 +111,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
possessor->SetPossessableType(ePossessionType::NO_POSSESSION);
}
EntityManager::Instance()->SerializeEntity(player);
Game::entityManager->SerializeEntity(player);
}
self->SetNetworkVar<bool>(HideScoreBoardVariable, true);
@@ -137,7 +137,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
}
void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (!player) return;
if (identifier == u"Scoreboardinfo") {
@@ -193,7 +193,7 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
ActivityTimerStart(self, EndWaveTimer, timeLimit, timeLimit);
}
const auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
const auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
GameMessages::SendPlayFXEffect(player->GetObjectID(), -1, u"SG-start", "");
@@ -234,13 +234,13 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
PauseChargeCannon(self);
}
} else if (name == GameOverTimer) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
Game::logger->Log("SGCannon", "Sending ActivityPause true");
GameMessages::SendActivityPause(self->GetObjectID(), true, player->GetSystemAddress());
/*const auto leftoverCannonballs = EntityManager::Instance()->GetEntitiesInGroup("cannonball");
/*const auto leftoverCannonballs = Game::entityManager->GetEntitiesInGroup("cannonball");
if (leftoverCannonballs.empty()) {
RecordPlayerScore(self);
@@ -284,8 +284,8 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
Game::logger->Log("SGCannon", "Spawning enemy %i on path %s", toSpawn.lot, path->pathName.c_str());
auto* enemy = EntityManager::Instance()->CreateEntity(info, nullptr, self);
EntityManager::Instance()->ConstructEntity(enemy);
auto* enemy = Game::entityManager->CreateEntity(info, nullptr, self);
Game::entityManager->ConstructEntity(enemy);
auto* movementAI = new MovementAIComponent(enemy, {});
@@ -334,12 +334,12 @@ void SGCannon::StartGame(Entity* self) {
self->SetNetworkVar<bool>(AudioStartIntroVariable, true);
self->SetVar<LOT>(CurrentRewardVariable, LOT_NULL);
auto rewardObjects = EntityManager::Instance()->GetEntitiesInGroup(constants.rewardModelGroup);
auto rewardObjects = Game::entityManager->GetEntitiesInGroup(constants.rewardModelGroup);
for (auto* reward : rewardObjects) {
reward->OnFireEventServerSide(self, ModelToBuildEvent);
}
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self));
Game::logger->Log("SGCannon", "Sending ActivityStart");
@@ -384,9 +384,9 @@ void SGCannon::SpawnNewModel(Entity* self) {
self->SetNetworkVar<int32_t>(RewardAddedVariable, currentReward);
}
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
for (auto* rewardModel : EntityManager::Instance()->GetEntitiesInGroup(constants.rewardModelGroup)) {
for (auto* rewardModel : Game::entityManager->GetEntitiesInGroup(constants.rewardModelGroup)) {
uint32_t lootMatrix;
switch (self->GetVar<uint32_t>(MatrixVariable)) {
case 1:
@@ -422,7 +422,7 @@ void SGCannon::SpawnNewModel(Entity* self) {
}
void SGCannon::RemovePlayer(LWOOBJID playerID) {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr)
return;
@@ -508,7 +508,7 @@ void SGCannon::RecordPlayerScore(Entity* self) {
}
void SGCannon::PlaySceneAnimation(Entity* self, const std::u16string& animationName, bool onCannon, bool onPlayer, float_t priority) {
for (auto* cannon : EntityManager::Instance()->GetEntitiesInGroup("cannongroup")) {
for (auto* cannon : Game::entityManager->GetEntitiesInGroup("cannongroup")) {
RenderComponent::PlayAnimation(cannon, animationName, priority);
}
@@ -517,7 +517,7 @@ void SGCannon::PlaySceneAnimation(Entity* self, const std::u16string& animationN
}
if (onPlayer) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
RenderComponent::PlayAnimation(player, animationName, priority);
}
@@ -538,7 +538,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
self->SetNetworkVar<bool>(ReSetSuperChargeVariable, true);
self->SetNetworkVar<bool>(HideSuperChargeVariable, true);
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player == nullptr)
return;
@@ -596,7 +596,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
ActivityTimerStopAllTimers(self);
// Destroy all spawners
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup("SGEnemy")) {
for (auto* entity : Game::entityManager->GetEntitiesInGroup("SGEnemy")) {
entity->Kill();
}
@@ -663,7 +663,7 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
self->SetNetworkVar<std::u16string>(u"beatHighScore", GeneralUtils::to_u16string(newScore));
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player == nullptr) return;
auto missionComponent = player->GetComponent<MissionComponent>();
@@ -713,7 +713,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
if (enable && self->GetVar<bool>(SuperChargeActiveVariable))
return;
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player == nullptr) {
Game::logger->Log("SGCannon", "Player not found in toggle super charge");
@@ -788,8 +788,8 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
shootingGalleryComponent->SetDynamicParams(properties);
EntityManager::Instance()->SerializeEntity(self);
EntityManager::Instance()->SerializeEntity(player);
Game::entityManager->SerializeEntity(self);
Game::entityManager->SerializeEntity(player);
self->SetNetworkVar<uint64_t>(CannonBallSkillIDVariable, skillID);
self->SetVar<bool>(SuperChargeActiveVariable, enable);

View File

@@ -2,7 +2,7 @@
#include "EntityManager.h"
void ZoneSGServer::OnStartup(Entity* self) {
const auto cannons = EntityManager::Instance()->GetEntitiesByLOT(1864);
const auto cannons = Game::entityManager->GetEntitiesByLOT(1864);
for (const auto& cannon : cannons)
self->SetVar<LWOOBJID>(CannonIDVariable, cannon->GetObjectID());
}
@@ -10,7 +10,7 @@ void ZoneSGServer::OnStartup(Entity* self) {
void ZoneSGServer::OnActivityStateChangeRequest(Entity* self, const LWOOBJID senderID, const int32_t value1,
const int32_t value2, const std::u16string& stringValue) {
auto* cannon = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
auto* cannon = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
if (cannon != nullptr) {
cannon->OnActivityStateChangeRequest(senderID, value1, value2, stringValue);
}
@@ -19,7 +19,7 @@ void ZoneSGServer::OnActivityStateChangeRequest(Entity* self, const LWOOBJID sen
void ZoneSGServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) {
auto* cannon = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
auto* cannon = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
if (cannon != nullptr) {
cannon->OnFireEventServerSide(sender, args, param1, param2, param3);
}

View File

@@ -4,7 +4,7 @@
#include "EntityManager.h"
void PropertyDeathPlane::OnCollisionPhantom(Entity* self, Entity* target) {
const auto teleportGroup = EntityManager::Instance()->GetEntitiesInGroup("Teleport");
const auto teleportGroup = Game::entityManager->GetEntitiesInGroup("Teleport");
if (teleportGroup.size() == 0) {
return;

View File

@@ -49,7 +49,7 @@ void NsConcertInstrument::OnFireEventServerSide(Entity* self, Entity* sender, st
if (activePlayerID == LWOOBJID_EMPTY)
return;
const auto activePlayer = EntityManager::Instance()->GetEntity(activePlayerID);
const auto activePlayer = Game::entityManager->GetEntity(activePlayerID);
if (activePlayer == nullptr)
return;
@@ -63,7 +63,7 @@ void NsConcertInstrument::OnTimerDone(Entity* self, std::string name) {
return;
// If for some reason the player becomes null (for example an unexpected leave), we need to clean up
const auto activePlayer = EntityManager::Instance()->GetEntity(activePlayerID);
const auto activePlayer = Game::entityManager->GetEntity(activePlayerID);
if (activePlayer == nullptr && name != "cleanupAfterStop") {
StopPlayingInstrument(self, nullptr);
return;
@@ -126,7 +126,7 @@ void NsConcertInstrument::StartPlayingInstrument(Entity* self, Entity* player) {
RenderComponent::PlayAnimation(player, animations.at(instrumentLot), 2.0f);
});
for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) {
for (auto* soundBox : Game::entityManager->GetEntitiesInGroup("Audio-Concert")) {
auto* soundTrigger = soundBox->GetComponent<SoundTriggerComponent>();
if (soundTrigger != nullptr) {
soundTrigger->ActivateMusicCue(music.at(instrumentLot));
@@ -161,7 +161,7 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) {
self->SetVar<bool>(u"beingPlayed", false);
for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) {
for (auto* soundBox : Game::entityManager->GetEntitiesInGroup("Audio-Concert")) {
auto* soundTrigger = soundBox->GetComponent<SoundTriggerComponent>();
if (soundTrigger != nullptr) {
soundTrigger->DeactivateMusicCue(music.at(instrumentLot));

View File

@@ -42,7 +42,7 @@ void NsConcertQuickBuild::OnStartup(Entity* self) {
// Get the manager of the crate of this quick build
const auto groupNumber = std::stoi(splitGroup.at(3));
const auto managerObjects = EntityManager::Instance()->GetEntitiesInGroup("CB_" + std::to_string(groupNumber));
const auto managerObjects = Game::entityManager->GetEntitiesInGroup("CB_" + std::to_string(groupNumber));
if (managerObjects.empty())
return;
@@ -67,7 +67,7 @@ float NsConcertQuickBuild::GetBlinkTime(float time) {
}
void NsConcertQuickBuild::OnDie(Entity* self, Entity* killer) {
auto* managerObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"managerObject"));
auto* managerObject = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"managerObject"));
if (managerObject) {
managerObject->CancelAllTimers();
managerObject->AddCallbackTimer(1.0f, [managerObject]() {
@@ -90,7 +90,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) {
// Find all the quick build objects of the same lot
auto finishedQuickBuildObjects = std::vector<Entity*>();
for (auto quickBuildID : finishedQuickBuilds) {
const auto quickBuildObject = EntityManager::Instance()->GetEntity(quickBuildID);
const auto quickBuildObject = Game::entityManager->GetEntity(quickBuildID);
if (quickBuildObject && quickBuildObject->GetLOT() == self->GetLOT()) {
quickBuildObject->SetVar<LWOOBJID>(u"Player_" + (GeneralUtils::to_u16string(groupNumber)), target->GetObjectID());
finishedQuickBuildObjects.push_back(quickBuildObject);
@@ -101,7 +101,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) {
if (finishedQuickBuildObjects.size() >= 4) {
// Move all the platforms so the user can collect the imagination brick
const auto movingPlatforms = EntityManager::Instance()->GetEntitiesInGroup("ConcertPlatforms");
const auto movingPlatforms = Game::entityManager->GetEntitiesInGroup("ConcertPlatforms");
for (auto* movingPlatform : movingPlatforms) {
auto* component = movingPlatform->GetComponent<MovingPlatformComponent>();
if (component) {
@@ -184,7 +184,7 @@ void NsConcertQuickBuild::ProgressLicensedTechnician(Entity* self) {
for (auto i = 1; i < 5; i++) {
const auto playerID = self->GetVar<LWOOBJID>(u"Player_" + (GeneralUtils::to_u16string(i)));
if (playerID != LWOOBJID_EMPTY) {
const auto player = EntityManager::Instance()->GetEntity(playerID);
const auto player = Game::entityManager->GetEntity(playerID);
if (player) {
auto playerMissionComponent = player->GetComponent<MissionComponent>();
if (playerMissionComponent)
@@ -202,7 +202,7 @@ void NsConcertQuickBuild::UpdateEffects(Entity* self) {
return;
for (const auto& effectName : setIterator->second.effects) {
const auto effectObjects = EntityManager::Instance()->GetEntitiesInGroup(quickBuildFX.at(effectName));
const auto effectObjects = Game::entityManager->GetEntitiesInGroup(quickBuildFX.at(effectName));
for (auto* effectObject : effectObjects) {
GameMessages::SendPlayFXEffect(effectObject, 0, GeneralUtils::ASCIIToUTF16(effectName),
effectName + "Effect", LWOOBJID_EMPTY, 1, 1, true);
@@ -216,7 +216,7 @@ void NsConcertQuickBuild::CancelEffects(Entity* self) {
return;
for (const auto& effectName : setIterator->second.effects) {
const auto effectObjects = EntityManager::Instance()->GetEntitiesInGroup(quickBuildFX.at(effectName));
const auto effectObjects = Game::entityManager->GetEntitiesInGroup(quickBuildFX.at(effectName));
for (auto* effectObject : effectObjects) {
GameMessages::SendStopFXEffect(effectObject, true, effectName + "Effect");
}

View File

@@ -31,7 +31,7 @@ void NsQbImaginationStatue::OnTimerDone(Entity* self, std::string timerName) {
void NsQbImaginationStatue::SpawnLoot(Entity* self) {
const auto playerId = self->GetVar<LWOOBJID>(u"Player");
auto* player = EntityManager::Instance()->GetEntity(playerId);
auto* player = Game::entityManager->GetEntity(playerId);
if (player == nullptr) return;

View File

@@ -7,7 +7,7 @@ void RockHydrantBroken::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());
@@ -23,7 +23,7 @@ void RockHydrantBroken::OnStartup(Entity* self) {
void RockHydrantBroken::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);

View File

@@ -15,7 +15,7 @@ void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
info.settings = { data };
info.spawnerID = self->GetSpawnerID();
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
auto* hydrant = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(hydrant);
Game::entityManager->ConstructEntity(hydrant);
}

View File

@@ -23,7 +23,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
fanGroup = "";
}
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
std::vector<Entity*> fanVolumes = Game::entityManager->GetEntitiesInGroup(fanGroup);
auto* renderComponent = self->GetComponent<RenderComponent>();
@@ -41,7 +41,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
auto volumePhys = volume->GetComponent<PhantomPhysicsComponent>();
if (!volumePhys) continue;
volumePhys->SetPhysicsEffectActive(false);
EntityManager::Instance()->SerializeEntity(volume);
Game::entityManager->SerializeEntity(volume);
}
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
RenderComponent::PlayAnimation(self, u"fan-on");
@@ -52,7 +52,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
auto volumePhys = volume->GetComponent<PhantomPhysicsComponent>();
if (!volumePhys) continue;
volumePhys->SetPhysicsEffectActive(true);
EntityManager::Instance()->SerializeEntity(volume);
Game::entityManager->SerializeEntity(volume);
}
}
}

View File

@@ -15,7 +15,7 @@ void HydrantSmashable::OnDie(Entity* self, Entity* killer) {
info.settings = { data };
info.spawnerID = self->GetSpawnerID();
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
auto* hydrant = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(hydrant);
Game::entityManager->ConstructEntity(hydrant);
}

View File

@@ -31,10 +31,10 @@ void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionI
(missionID == 320 && state == eMissionState::AVAILABLE) /*||
(state == eMissionState::COMPLETE && missionID == 891 && missionState == eMissionState::READY_TO_COMPLETE)*/
) {
//GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
//GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
target->GetCharacter()->SetPlayerFlag(113, true);
EntityManager::Instance()->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
Game::entityManager->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
}
}

View File

@@ -20,7 +20,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
} else if (missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
// Makes the guard disappear once the mission has been completed
const auto zoneControlID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
const auto zoneControlID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(),
"", UNASSIGNED_SYSTEM_ADDRESS);

View File

@@ -12,14 +12,14 @@ void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) {
auto* destroyableComponent = killer->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetImagination(destroyableComponent->GetImagination() + 10);
EntityManager::Instance()->SerializeEntity(killer);
Game::entityManager->SerializeEntity(killer);
}
// get possessor to progress statistics and tasks.
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (possessor != nullptr) {
auto* missionComponent = possessor->GetComponent<MissionComponent>();

View File

@@ -30,14 +30,14 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) {
if (destroyableComponent != nullptr) {
destroyableComponent->SetImagination(60);
EntityManager::Instance()->SerializeEntity(killer);
Game::entityManager->SerializeEntity(killer);
}
// Find possessor of race car to progress missions and update stats.
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (possessor != nullptr) {
auto* missionComponent = possessor->GetComponent<MissionComponent>();

View File

@@ -15,7 +15,7 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std
return;
}
auto* vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
auto* vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (vehicle == nullptr) {
return;

View File

@@ -11,7 +11,7 @@ void RaceSmashServer::OnDie(Entity* self, Entity* killer) {
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (possessor != nullptr) {
auto* missionComponent = possessor->GetComponent<MissionComponent>();

View File

@@ -8,27 +8,27 @@ void WildNinjaSensei::OnStartup(Entity* self) {
void WildNinjaSensei::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "CraneStart") {
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
auto ninjas = Game::entityManager->GetEntitiesInGroup("Ninjastuff");
for (auto ninja : ninjas) ninja->NotifyObject(self, "Crane");
self->AddTimer("Bow", 15.5f);
self->AddTimer("TigerStart", 25);
GameMessages::SendPlayAnimation(self, u"crane");
} else if (timerName == "TigerStart") {
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
auto ninjas = Game::entityManager->GetEntitiesInGroup("Ninjastuff");
GameMessages::SendPlayAnimation(self, u"bow");
for (auto ninja : ninjas) ninja->NotifyObject(self, "Tiger");
self->AddTimer("Bow", 15.5f);
self->AddTimer("MantisStart", 25);
GameMessages::SendPlayAnimation(self, u"tiger");
} else if (timerName == "MantisStart") {
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
auto ninjas = Game::entityManager->GetEntitiesInGroup("Ninjastuff");
GameMessages::SendPlayAnimation(self, u"tiger");
for (auto ninja : ninjas) ninja->NotifyObject(self, "Mantis");
self->AddTimer("Bow", 15.5f);
self->AddTimer("CraneStart", 25);
GameMessages::SendPlayAnimation(self, u"mantis");
} else if (timerName == "Bow") {
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
auto ninjas = Game::entityManager->GetEntitiesInGroup("Ninjastuff");
for (auto ninja : ninjas) ninja->NotifyObject(self, "Bow");
GameMessages::SendPlayAnimation(self, u"bow");
}