mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-04-17 13:07:45 +00:00
Merge branch 'main' into npc-pathing
This commit is contained in:
@@ -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;
|
||||
@@ -42,7 +42,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "BaseFootRaceManager.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void BaseFootRaceManager::OnStartup(Entity* self) {
|
||||
// TODO: Add to FootRaceStarter group
|
||||
}
|
||||
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
const auto splitArguments = GeneralUtils::SplitString(args, '_');
|
||||
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") {
|
||||
@@ -37,10 +37,11 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
if (param2 != -1) // Certain footraces set a flag
|
||||
character->SetPlayerFlag(static_cast<uint32_t>(param2), true);
|
||||
character->SetPlayerFlag(param2, true);
|
||||
}
|
||||
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
SaveScore(self, player->GetObjectID(), static_cast<float>(param1), static_cast<float>(param2), static_cast<float>(param3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AgFans::OnStartup(Entity* self) {
|
||||
self->SetVar<bool>(u"alive", true);
|
||||
@@ -23,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));
|
||||
|
||||
@@ -34,7 +36,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||
|
||||
if (self->GetVar<bool>(u"on")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-off");
|
||||
RenderComponent::PlayAnimation(self, u"fan-off");
|
||||
|
||||
renderComponent->StopEffect("fanOn");
|
||||
self->SetVar<bool>(u"on", false);
|
||||
@@ -43,14 +45,14 @@ 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];
|
||||
GameMessages::SendPlayAnimation(fxObj, u"trigger");
|
||||
Entity* fxObj = Game::entityManager->GetEntitiesInGroup(fanGroup + "fx")[0];
|
||||
RenderComponent::PlayAnimation(fxObj, u"trigger");
|
||||
}
|
||||
}
|
||||
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-on");
|
||||
RenderComponent::PlayAnimation(self, u"fan-on");
|
||||
|
||||
renderComponent->PlayEffect(495, u"fanOn", "fanOn");
|
||||
self->SetVar<bool>(u"on", true);
|
||||
@@ -59,10 +61,10 @@ 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];
|
||||
GameMessages::SendPlayAnimation(fxObj, u"idle");
|
||||
Entity* fxObj = Game::entityManager->GetEntitiesInGroup(fanGroup + "fx")[0];
|
||||
RenderComponent::PlayAnimation(fxObj, u"idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
|
||||
if (inUse || self->GetLOT() != 6859) return;
|
||||
@@ -11,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);
|
||||
@@ -21,9 +22,9 @@ 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;
|
||||
GameMessages::SendPlayAnimation(entities.at(0), u"jetFX");
|
||||
RenderComponent::PlayAnimation(entities.at(0), u"jetFX");
|
||||
|
||||
// So we can give kill credit to person who build this
|
||||
builder = target->GetObjectID();
|
||||
@@ -39,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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "AgSalutingNpcs.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void AgSalutingNpcs::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
|
||||
if (emote != 356) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"salutePlayer");
|
||||
RenderComponent::PlayAnimation(self, u"salutePlayer");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "AgShipPlayerShockServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
|
||||
@@ -8,7 +10,7 @@ void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
|
||||
return;
|
||||
}
|
||||
active = true;
|
||||
GameMessages::SendPlayAnimation(user, shockAnim);
|
||||
RenderComponent::PlayAnimation(user, shockAnim);
|
||||
GameMessages::SendKnockback(user->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, NiPoint3(-20, 10, -20));
|
||||
|
||||
GameMessages::SendPlayFXEffect(self, 1430, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "GeneralUtils.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AgSpaceStuff::OnStartup(Entity* self) {
|
||||
self->AddTimer("FloaterScale", 5.0f);
|
||||
@@ -13,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());
|
||||
|
||||
@@ -27,13 +29,13 @@ void AgSpaceStuff::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "FloaterScale") {
|
||||
int scaleType = GeneralUtils::GenerateRandomNumber<int>(1, 5);
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType));
|
||||
RenderComponent::PlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType));
|
||||
self->AddTimer("FloaterPath", 0.4);
|
||||
} else if (timerName == "FloaterPath") {
|
||||
int pathType = GeneralUtils::GenerateRandomNumber<int>(1, 4);
|
||||
int randTime = GeneralUtils::GenerateRandomNumber<int>(20, 25);
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType)));
|
||||
RenderComponent::PlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType)));
|
||||
self->AddTimer("FloaterScale", randTime);
|
||||
} else if (timerName == "ShipShakeExplode") {
|
||||
DoShake(self, true);
|
||||
@@ -45,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);
|
||||
@@ -76,21 +78,21 @@ void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
|
||||
|
||||
auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
|
||||
if (shipFxObject2)
|
||||
GameMessages::SendPlayAnimation(shipFxObject2, u"explosion");
|
||||
RenderComponent::PlayAnimation(shipFxObject2, u"explosion");
|
||||
} else {
|
||||
auto* shipFxObject = GetEntityInGroup(ShipFX);
|
||||
auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
|
||||
|
||||
if (shipFxObject)
|
||||
GameMessages::SendPlayAnimation(shipFxObject, u"idle");
|
||||
RenderComponent::PlayAnimation(shipFxObject, u"idle");
|
||||
|
||||
if (shipFxObject2)
|
||||
GameMessages::SendPlayAnimation(shipFxObject2, u"idle");
|
||||
RenderComponent::PlayAnimation(shipFxObject2, u"idle");
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -29,7 +29,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
|
||||
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
|
||||
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
|
||||
|
||||
if (!samePipeSpawners.empty()) {
|
||||
samePipeSpawners[0]->SoftReset();
|
||||
@@ -40,7 +40,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (killer != nullptr && killer->IsPlayer()) {
|
||||
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
|
||||
|
||||
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
const auto nextPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!nextPipeSpawners.empty()) {
|
||||
nextPipeSpawners[0]->Activate();
|
||||
@@ -48,7 +48,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
} else {
|
||||
const auto nextPipe = pipeGroup + "1";
|
||||
|
||||
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
const auto firstPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!firstPipeSpawners.empty()) {
|
||||
firstPipeSpawners[0]->Activate();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "FvDragonSmashingGolemQb.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
|
||||
@@ -15,11 +17,11 @@ void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
GameMessages::SendPlayAnimation(self, u"dragonsmash");
|
||||
RenderComponent::PlayAnimation(self, u"dragonsmash");
|
||||
|
||||
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");
|
||||
|
||||
@@ -9,9 +9,9 @@ void FvFacilityBrick::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
auto* brickSpawner = dZoneManager::Instance()->GetSpawnersByName("ImaginationBrick")[0];
|
||||
auto* bugSpawner = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug")[0];
|
||||
auto* canisterSpawner = dZoneManager::Instance()->GetSpawnersByName("BrickCanister")[0];
|
||||
auto* brickSpawner = Game::zoneManager->GetSpawnersByName("ImaginationBrick")[0];
|
||||
auto* bugSpawner = Game::zoneManager->GetSpawnersByName("MaelstromBug")[0];
|
||||
auto* canisterSpawner = Game::zoneManager->GetSpawnersByName("BrickCanister")[0];
|
||||
|
||||
if (name == "ConsoleLeftUp") {
|
||||
GameMessages::SendStopFXEffect(self, true, "LeftPipeOff");
|
||||
@@ -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");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void FvFlyingCreviceDragon::OnStartup(Entity* self) {
|
||||
self->AddTimer("waypoint", 5);
|
||||
@@ -33,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;
|
||||
@@ -67,12 +68,12 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
|
||||
auto point = self->GetVar<int32_t>(u"waypoint");
|
||||
|
||||
if (point == 4) {
|
||||
GameMessages::SendPlayAnimation(self, u"attack1", 2);
|
||||
RenderComponent::PlayAnimation(self, u"attack1", 2.0f);
|
||||
self->AddTimer("platform1attack", 1.75f);
|
||||
} else if (point == 12) {
|
||||
GameMessages::SendPlayAnimation(self, u"attack2", 2);
|
||||
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;
|
||||
@@ -101,7 +102,7 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
|
||||
}
|
||||
}
|
||||
} else if (point == 16) {
|
||||
GameMessages::SendPlayAnimation(self, u"attack3", 2);
|
||||
RenderComponent::PlayAnimation(self, u"attack3", 2.0f);
|
||||
self->AddTimer("platform3attack", 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "FvNinjaGuard.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void FvNinjaGuard::OnStartup(Entity* self) {
|
||||
if (self->GetLOT() == 7412) {
|
||||
@@ -12,24 +14,24 @@ void FvNinjaGuard::OnStartup(Entity* self) {
|
||||
|
||||
void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
|
||||
if (emote != 392) {
|
||||
GameMessages::SendPlayAnimation(self, u"no");
|
||||
RenderComponent::PlayAnimation(self, u"no");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"scared");
|
||||
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) {
|
||||
GameMessages::SendPlayAnimation(rightGuard, u"laugh_rt");
|
||||
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) {
|
||||
GameMessages::SendPlayAnimation(leftGuard, u"laugh_lt");
|
||||
RenderComponent::PlayAnimation(leftGuard, u"laugh_lt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void LegoDieRoll::OnStartup(Entity* self) {
|
||||
@@ -17,23 +18,23 @@ void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
switch (dieRoll) {
|
||||
case 1:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-1");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-1");
|
||||
break;
|
||||
case 2:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-2");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-2");
|
||||
break;
|
||||
case 3:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-3");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-3");
|
||||
break;
|
||||
case 4:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-4");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-4");
|
||||
break;
|
||||
case 5:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-5");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-5");
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-6");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-6");
|
||||
// tracking the It's Truly Random Achievement
|
||||
auto* owner = self->GetOwner();
|
||||
auto* missionComponent = owner->GetComponent<MissionComponent>();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
void GfJailWalls::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Wall"));
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("Jail0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,11 @@ void GfJailWalls::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
|
||||
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Wall"));
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("Jail0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) {
|
||||
spawner->Activate();
|
||||
}
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
spawner->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "GfOrgan.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Entity.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void GfOrgan::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetBoolean(u"bIsInUse")) {
|
||||
@@ -11,7 +13,7 @@ void GfOrgan::OnUse(Entity* self, Entity* user) {
|
||||
self->SetBoolean(u"bIsInUse", true);
|
||||
self->AddTimer("reset", 5.0f);
|
||||
|
||||
GameMessages::SendPlayAnimation(user, u"jig");
|
||||
RenderComponent::PlayAnimation(user, u"jig");
|
||||
}
|
||||
|
||||
void GfOrgan::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ void TriggerAmbush::OnProximityUpdate(Entity* self, Entity* entering, std::strin
|
||||
|
||||
self->SetVar(u"triggered", true);
|
||||
|
||||
const auto spawners = dZoneManager::Instance()->GetSpawnersByName("Ambush");
|
||||
const auto spawners = Game::zoneManager->GetSpawnersByName("Ambush");
|
||||
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Activate();
|
||||
@@ -27,7 +27,7 @@ void TriggerAmbush::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
self->SetVar(u"triggered", false);
|
||||
|
||||
const auto spawners = dZoneManager::Instance()->GetSpawnersByName("Ambush");
|
||||
const auto spawners = Game::zoneManager->GetSpawnersByName("Ambush");
|
||||
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Reset();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "InventoryComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eGameActivity.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
@@ -78,7 +79,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 +96,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 +112,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);
|
||||
@@ -136,38 +137,26 @@ 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));
|
||||
if (player != nullptr) {
|
||||
if (button == 1 && identifier == u"Shooting_Gallery_Stop") {
|
||||
void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (!player) return;
|
||||
|
||||
if (identifier == u"Scoreboardinfo") {
|
||||
GameMessages::SendDisplayMessageBox(player->GetObjectID(), true,
|
||||
Game::zoneManager->GetZoneControlObject()->GetObjectID(),
|
||||
u"Shooting_Gallery_Retry", 2, u"Retry?",
|
||||
u"", player->GetSystemAddress());
|
||||
} else {
|
||||
if ((button == 1 && (identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay")) || identifier == u"SG1" || button == 0) {
|
||||
if (IsPlayerInActivity(self, player->GetObjectID())) return;
|
||||
self->SetNetworkVar<bool>(ClearVariable, true);
|
||||
StartGame(self);
|
||||
} else if (button == 0 && ((identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay"))) {
|
||||
RemovePlayer(player->GetObjectID());
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
} else if (button == 1 && identifier == u"Shooting_Gallery_Exit") {
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
RemovePlayer(player->GetObjectID());
|
||||
StopGame(self, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (identifier == u"Scoreboardinfo") {
|
||||
GameMessages::SendDisplayMessageBox(player->GetObjectID(), true,
|
||||
dZoneManager::Instance()->GetZoneControlObject()->GetObjectID(),
|
||||
u"Shooting_Gallery_Retry?", 2, u"Retry?",
|
||||
u"", player->GetSystemAddress());
|
||||
} else {
|
||||
if ((button == 1 && (identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay"))
|
||||
|| identifier == u"SG1" || button == 0) {
|
||||
|
||||
if (identifier == u"RePlay") {
|
||||
static_cast<Player*>(player)->SendToZone(1300);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetNetworkVar<bool>(ClearVariable, true);
|
||||
StartGame(self);
|
||||
} else if (button == 1 && identifier == u"Shooting_Gallery_Exit") {
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
RemovePlayer(player->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +194,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", "");
|
||||
|
||||
@@ -246,13 +235,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);
|
||||
|
||||
@@ -268,13 +257,17 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
const auto spawnNumber = (uint32_t)std::stoi(name.substr(7));
|
||||
const auto& activeSpawns = self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable);
|
||||
if (activeSpawns.size() < spawnNumber) {
|
||||
Game::logger->Log("SGCannon", "Trying to spawn %i when spawns size is only %i", spawnNumber, activeSpawns.size());
|
||||
return;
|
||||
}
|
||||
const auto& toSpawn = activeSpawns.at(spawnNumber);
|
||||
|
||||
const auto pathIndex = GeneralUtils::GenerateRandomNumber<float_t>(0, toSpawn.spawnPaths.size() - 1);
|
||||
|
||||
const auto* path = dZoneManager::Instance()->GetZone()->GetPath(
|
||||
toSpawn.spawnPaths.at(pathIndex)
|
||||
);
|
||||
const auto* path = Game::zoneManager->GetZone()->GetPath(toSpawn.spawnPaths.at(pathIndex));
|
||||
if (!path) {
|
||||
Game::logger->Log("SGCannon", "Path %s at index %i is null", toSpawn.spawnPaths.at(pathIndex).c_str(), pathIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
auto info = EntityInfo{};
|
||||
info.lot = toSpawn.lot;
|
||||
@@ -292,9 +285,9 @@ 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);
|
||||
auto* enemy = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
if (enemy) {
|
||||
EntityManager::Instance()->ConstructEntity(enemy);
|
||||
Game::entityManager->ConstructEntity(enemy);
|
||||
auto* movementAI = enemy->GetComponent<MovementAIComponent>();
|
||||
if (!movementAI) return;
|
||||
|
||||
@@ -327,18 +320,19 @@ SGCannon::OnActivityTimerUpdate(Entity* self, const std::string& name, float_t t
|
||||
}
|
||||
|
||||
void SGCannon::StartGame(Entity* self) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) return;
|
||||
self->SetNetworkVar<uint32_t>(TimeLimitVariable, self->GetVar<uint32_t>(TimeLimitVariable));
|
||||
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));
|
||||
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self), 1);
|
||||
Game::logger->Log("SGCannon", "Sending ActivityStart");
|
||||
GameMessages::SendActivityStart(self->GetObjectID(), player->GetSystemAddress());
|
||||
|
||||
@@ -381,9 +375,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:
|
||||
@@ -419,7 +413,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;
|
||||
|
||||
@@ -433,6 +427,14 @@ void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled) {
|
||||
if (canceled) {
|
||||
StopGame(self, canceled);
|
||||
RemovePlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SGCannon::StartChargedCannon(Entity* self, uint32_t optionalTime) {
|
||||
optionalTime = optionalTime == 0 ? constants.chargedTime : optionalTime;
|
||||
self->SetVar<bool>(SuperChargePausedVariable, false);
|
||||
@@ -497,18 +499,18 @@ 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")) {
|
||||
GameMessages::SendPlayAnimation(cannon, animationName, priority);
|
||||
for (auto* cannon : Game::entityManager->GetEntitiesInGroup("cannongroup")) {
|
||||
RenderComponent::PlayAnimation(cannon, animationName, priority);
|
||||
}
|
||||
|
||||
if (onCannon) {
|
||||
GameMessages::SendPlayAnimation(self, animationName, priority);
|
||||
RenderComponent::PlayAnimation(self, animationName, priority);
|
||||
}
|
||||
|
||||
if (onPlayer) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
GameMessages::SendPlayAnimation(player, animationName, priority);
|
||||
RenderComponent::PlayAnimation(player, animationName, priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,7 +529,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;
|
||||
|
||||
@@ -535,7 +537,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
|
||||
// The player won, store all the score and send rewards
|
||||
if (!cancel) {
|
||||
auto percentage = 0;
|
||||
int32_t percentage = 0.0f;
|
||||
auto misses = self->GetVar<uint32_t>(MissesVariable);
|
||||
auto fired = self->GetVar<uint32_t>(ShotsFiredVariable);
|
||||
|
||||
@@ -553,6 +555,9 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
|
||||
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
|
||||
|
||||
SaveScore(self, player->GetObjectID(),
|
||||
static_cast<float>(self->GetVar<uint32_t>(TotalScoreVariable)), static_cast<float>(self->GetVar<uint32_t>(MaxStreakVariable)), percentage);
|
||||
|
||||
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), self->GetVar<uint32_t>(MaxStreakVariable), percentage);
|
||||
self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true);
|
||||
|
||||
@@ -566,17 +571,6 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
|
||||
self->SetNetworkVar<std::u16string>(u"UI_Rewards",
|
||||
GeneralUtils::to_u16string(self->GetVar<uint32_t>(TotalScoreVariable)) + u"_0_0_0_0_0_0"
|
||||
);
|
||||
|
||||
GameMessages::SendRequestActivitySummaryLeaderboardData(
|
||||
player->GetObjectID(),
|
||||
self->GetObjectID(),
|
||||
player->GetSystemAddress(),
|
||||
GetGameID(self),
|
||||
1,
|
||||
10,
|
||||
0,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -585,7 +579,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();
|
||||
}
|
||||
|
||||
@@ -652,7 +646,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>();
|
||||
@@ -702,7 +696,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");
|
||||
@@ -777,8 +771,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);
|
||||
|
||||
@@ -63,12 +63,11 @@ public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnPlayerLoaded(Entity* self, Entity* player) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
|
||||
void OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int32_t value1,
|
||||
int32_t value2, const std::u16string& stringValue) override;
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier,
|
||||
const std::u16string& userData) override;
|
||||
void OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int32_t value1, int32_t value2, const std::u16string& stringValue) override;
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
void OnActivityTimerDone(Entity* self, const std::string& name) override;
|
||||
void OnActivityTimerUpdate(Entity* self, const std::string& name, float_t timeRemaining, float_t elapsedTime) override;
|
||||
void OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled) override;
|
||||
private:
|
||||
static std::vector<std::vector<SGEnemy>> GetWaves();
|
||||
static SGConstants GetConstants();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
// Constants are at the bottom
|
||||
|
||||
@@ -48,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;
|
||||
|
||||
@@ -62,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;
|
||||
@@ -122,10 +123,10 @@ void NsConcertInstrument::StartPlayingInstrument(Entity* self, Entity* player) {
|
||||
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
self->AddCallbackTimer(1.0f, [player, instrumentLot]() {
|
||||
GameMessages::SendPlayAnimation(player, animations.at(instrumentLot), 2.0f);
|
||||
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));
|
||||
@@ -153,14 +154,14 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) {
|
||||
}
|
||||
|
||||
GameMessages::SendEndCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS, 1.0f);
|
||||
GameMessages::SendPlayAnimation(player, smashAnimations.at(instrumentLot), 2.0f);
|
||||
RenderComponent::PlayAnimation(player, smashAnimations.at(instrumentLot), 2.0f);
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stopCheckingMovement", 0, 0,
|
||||
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void WhFans::OnStartup(Entity* self) {
|
||||
self->SetVar<bool>(u"alive", true);
|
||||
@@ -21,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>();
|
||||
|
||||
@@ -30,7 +32,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
|
||||
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||
|
||||
if (self->GetVar<bool>(u"on")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-off");
|
||||
RenderComponent::PlayAnimation(self, u"fan-off");
|
||||
|
||||
renderComponent->StopEffect("fanOn");
|
||||
self->SetVar<bool>(u"on", false);
|
||||
@@ -39,10 +41,10 @@ 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")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-on");
|
||||
RenderComponent::PlayAnimation(self, u"fan-on");
|
||||
|
||||
self->SetVar<bool>(u"on", true);
|
||||
|
||||
@@ -50,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -29,7 +29,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
|
||||
if (spawnerName.empty())
|
||||
spawnerName = "Guard";
|
||||
|
||||
auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName);
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName);
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
@@ -39,7 +39,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AgPropguards::GetFlagForMission(uint32_t missionID) {
|
||||
int32_t AgPropguards::GetFlagForMission(uint32_t missionID) {
|
||||
switch (missionID) {
|
||||
case 872:
|
||||
return 97;
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
class AgPropguards : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
private:
|
||||
static uint32_t GetFlagForMission(uint32_t missionID);
|
||||
static int32_t GetFlagForMission(uint32_t missionID);
|
||||
};
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "WildAmbients.h"
|
||||
#include "GameMessages.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void WildAmbients::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendPlayAnimation(self, u"interact");
|
||||
RenderComponent::PlayAnimation(self, u"interact");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user