Merge branch 'main' into pr/1107

This commit is contained in:
David Markowitz 2023-07-21 19:38:59 -07:00
commit 0c0f7216a1
205 changed files with 872 additions and 894 deletions

View File

@ -338,7 +338,7 @@ This is a Work in Progress, but below are some quick links to documentaion for s
## Former Contributors ## Former Contributors
* TheMachine * TheMachine
* Matthew * Matthew
* [Raine](https://github.com/Rainebannister) * [Raine](https://github.com/uwainium)
* Bricknave * Bricknave
## Special Thanks ## Special Thanks

View File

@ -10,6 +10,7 @@ class dConfig;
class RakPeerInterface; class RakPeerInterface;
class AssetManager; class AssetManager;
struct SystemAddress; struct SystemAddress;
class EntityManager;
namespace Game { namespace Game {
extern dLogger* logger; extern dLogger* logger;
@ -22,4 +23,5 @@ namespace Game {
extern AssetManager* assetManager; extern AssetManager* assetManager;
extern SystemAddress chatSysAddr; extern SystemAddress chatSysAddr;
extern bool shouldShutdown; extern bool shouldShutdown;
extern EntityManager* entityManager;
} }

View File

@ -290,7 +290,7 @@ void Character::DoQuickXMLDataParse() {
void Character::UnlockEmote(int emoteID) { void Character::UnlockEmote(int emoteID) {
m_UnlockedEmotes.push_back(emoteID); m_UnlockedEmotes.push_back(emoteID);
GameMessages::SendSetEmoteLockState(EntityManager::Instance()->GetEntity(m_ObjectID), false, emoteID); GameMessages::SendSetEmoteLockState(Game::entityManager->GetEntity(m_ObjectID), false, emoteID);
} }
void Character::SetBuildMode(bool buildMode) { void Character::SetBuildMode(bool buildMode) {
@ -418,13 +418,13 @@ void Character::WriteToDatabase() {
delete printer; delete printer;
} }
void Character::SetPlayerFlag(const int32_t flagId, const bool value) { void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
// If the flag is already set, we don't have to recalculate it // If the flag is already set, we don't have to recalculate it
if (GetPlayerFlag(flagId) == value) return; if (GetPlayerFlag(flagId) == value) return;
if (value) { if (value) {
// Update the mission component: // Update the mission component:
auto* player = EntityManager::Instance()->GetEntity(m_ObjectID); auto* player = Game::entityManager->GetEntity(m_ObjectID);
if (player != nullptr) { if (player != nullptr) {
auto* missionComponent = player->GetComponent<MissionComponent>(); auto* missionComponent = player->GetComponent<MissionComponent>();
@ -465,7 +465,7 @@ void Character::SetPlayerFlag(const int32_t flagId, const bool value) {
GameMessages::SendNotifyClientFlagChange(m_ObjectID, flagId, value, m_ParentUser->GetSystemAddress()); GameMessages::SendNotifyClientFlagChange(m_ObjectID, flagId, value, m_ParentUser->GetSystemAddress());
} }
bool Character::GetPlayerFlag(const int32_t flagId) const { bool Character::GetPlayerFlag(const uint32_t flagId) const {
// Calculate the index first // Calculate the index first
const auto flagIndex = uint32_t(std::floor(flagId / 64)); const auto flagIndex = uint32_t(std::floor(flagId / 64));
@ -602,7 +602,7 @@ void Character::SetCoins(int64_t newCoins, eLootSourceType lootSource) {
m_Coins = newCoins; m_Coins = newCoins;
GameMessages::SendSetCurrency(EntityManager::Instance()->GetEntity(m_ObjectID), m_Coins, 0, 0, 0, 0, true, lootSource); GameMessages::SendSetCurrency(Game::entityManager->GetEntity(m_ObjectID), m_Coins, 0, 0, 0, 0, true, lootSource);
} }
bool Character::HasBeenToWorld(LWOMAPID mapID) const { bool Character::HasBeenToWorld(LWOMAPID mapID) const {

View File

@ -415,14 +415,14 @@ public:
* @param flagId the ID of the flag to set * @param flagId the ID of the flag to set
* @param value the value to set for the flag * @param value the value to set for the flag
*/ */
void SetPlayerFlag(int32_t flagId, bool value); void SetPlayerFlag(uint32_t flagId, bool value);
/** /**
* Gets the value for a certain character flag * Gets the value for a certain character flag
* @param flagId the ID of the flag to get a value for * @param flagId the ID of the flag to get a value for
* @return the value of the flag given the ID (the default is false, obviously) * @return the value of the flag given the ID (the default is false, obviously)
*/ */
bool GetPlayerFlag(int32_t flagId) const; bool GetPlayerFlag(uint32_t flagId) const;
/** /**
* Notifies the character that they're now muted * Notifies the character that they're now muted

View File

@ -263,7 +263,7 @@ void Entity::Initialize() {
NiQuaternion rot; NiQuaternion rot;
const auto& targetSceneName = m_Character->GetTargetScene(); const auto& targetSceneName = m_Character->GetTargetScene();
auto* targetScene = EntityManager::Instance()->GetSpawnPointEntity(targetSceneName); auto* targetScene = Game::entityManager->GetSpawnPointEntity(targetSceneName);
if (m_Character->HasBeenToWorld(mapID) && targetSceneName.empty()) { if (m_Character->HasBeenToWorld(mapID) && targetSceneName.empty()) {
pos = m_Character->GetRespawnPoint(mapID); pos = m_Character->GetRespawnPoint(mapID);
@ -735,7 +735,7 @@ void Entity::Initialize() {
} }
}); });
if (!m_Character && EntityManager::Instance()->GetGhostingEnabled()) { if (!m_Character && Game::entityManager->GetGhostingEnabled()) {
// Don't ghost what is likely large scene elements // Don't ghost what is likely large scene elements
if (HasComponent(eReplicaComponentType::SIMPLE_PHYSICS) && HasComponent(eReplicaComponentType::RENDER) && (m_Components.size() == 2 || (HasComponent(eReplicaComponentType::TRIGGER) && m_Components.size() == 3))) { if (HasComponent(eReplicaComponentType::SIMPLE_PHYSICS) && HasComponent(eReplicaComponentType::RENDER) && (m_Components.size() == 2 || (HasComponent(eReplicaComponentType::TRIGGER) && m_Components.size() == 3))) {
goto no_ghosting; goto no_ghosting;
@ -1284,12 +1284,12 @@ void Entity::Update(const float deltaTime) {
} }
if (m_ShouldDestroyAfterUpdate) { if (m_ShouldDestroyAfterUpdate) {
EntityManager::Instance()->DestroyEntity(this->GetObjectID()); Game::entityManager->DestroyEntity(this->GetObjectID());
} }
} }
void Entity::OnCollisionProximity(LWOOBJID otherEntity, const std::string& proxName, const std::string& status) { void Entity::OnCollisionProximity(LWOOBJID otherEntity, const std::string& proxName, const std::string& status) {
Entity* other = EntityManager::Instance()->GetEntity(otherEntity); Entity* other = Game::entityManager->GetEntity(otherEntity);
if (!other) return; if (!other) return;
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) {
@ -1303,7 +1303,7 @@ void Entity::OnCollisionProximity(LWOOBJID otherEntity, const std::string& proxN
} }
void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) { void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
auto* other = EntityManager::Instance()->GetEntity(otherEntity); auto* other = Game::entityManager->GetEntity(otherEntity);
if (!other) return; if (!other) return;
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) {
@ -1350,7 +1350,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
} }
void Entity::OnCollisionLeavePhantom(const LWOOBJID otherEntity) { void Entity::OnCollisionLeavePhantom(const LWOOBJID otherEntity) {
auto* other = EntityManager::Instance()->GetEntity(otherEntity); auto* other = Game::entityManager->GetEntity(otherEntity);
if (!other) return; if (!other) return;
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) {
@ -1504,13 +1504,13 @@ void Entity::Smash(const LWOOBJID source, const eKillType killType, const std::u
auto* destroyableComponent = GetComponent<DestroyableComponent>(); auto* destroyableComponent = GetComponent<DestroyableComponent>();
if (destroyableComponent == nullptr) { if (destroyableComponent == nullptr) {
Kill(EntityManager::Instance()->GetEntity(source)); Kill(Game::entityManager->GetEntity(source));
return; return;
} }
auto* possessorComponent = GetComponent<PossessorComponent>(); auto* possessorComponent = GetComponent<PossessorComponent>();
if (possessorComponent) { if (possessorComponent) {
if (possessorComponent->GetPossessable() != LWOOBJID_EMPTY) { if (possessorComponent->GetPossessable() != LWOOBJID_EMPTY) {
auto* mount = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* mount = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (mount) possessorComponent->Dismount(mount, true); if (mount) possessorComponent->Dismount(mount, true);
} }
} }
@ -1538,7 +1538,7 @@ void Entity::Kill(Entity* murderer) {
} }
if (!IsPlayer()) { if (!IsPlayer()) {
EntityManager::Instance()->DestroyEntity(this); Game::entityManager->DestroyEntity(this);
} }
const auto& grpNameQBShowBricks = GetVar<std::string>(u"grpNameQBShowBricks"); const auto& grpNameQBShowBricks = GetVar<std::string>(u"grpNameQBShowBricks");
@ -1719,7 +1719,7 @@ void Entity::CancelCallbackTimers() {
void Entity::ScheduleKillAfterUpdate(Entity* murderer) { void Entity::ScheduleKillAfterUpdate(Entity* murderer) {
//if (m_Info.spawner) m_Info.spawner->ScheduleKill(this); //if (m_Info.spawner) m_Info.spawner->ScheduleKill(this);
EntityManager::Instance()->ScheduleForKill(this); Game::entityManager->ScheduleForKill(this);
if (murderer) m_ScheduleKiller = murderer; if (murderer) m_ScheduleKiller = murderer;
} }
@ -1763,7 +1763,7 @@ void Entity::TriggerEvent(eTriggerEventType event, Entity* optionalTarget) {
Entity* Entity::GetOwner() const { Entity* Entity::GetOwner() const {
if (m_OwnerOverride != LWOOBJID_EMPTY) { if (m_OwnerOverride != LWOOBJID_EMPTY) {
auto* other = EntityManager::Instance()->GetEntity(m_OwnerOverride); auto* other = Game::entityManager->GetEntity(m_OwnerOverride);
if (other != nullptr) { if (other != nullptr) {
return other->GetOwner(); return other->GetOwner();
@ -1907,7 +1907,7 @@ void Entity::SetPosition(NiPoint3 position) {
vehicel->SetPosition(position); vehicel->SetPosition(position);
} }
EntityManager::Instance()->SerializeEntity(this); Game::entityManager->SerializeEntity(this);
} }
void Entity::SetRotation(NiQuaternion rotation) { void Entity::SetRotation(NiQuaternion rotation) {
@ -1935,7 +1935,7 @@ void Entity::SetRotation(NiQuaternion rotation) {
vehicel->SetRotation(rotation); vehicel->SetRotation(rotation);
} }
EntityManager::Instance()->SerializeEntity(this); Game::entityManager->SerializeEntity(this);
} }
bool Entity::GetBoolean(const std::u16string& name) const { bool Entity::GetBoolean(const std::u16string& name) const {
@ -1987,7 +1987,7 @@ std::vector<LWOOBJID>& Entity::GetTargetsInPhantom() {
for (auto i = 0u; i < m_TargetsInPhantom.size(); ++i) { for (auto i = 0u; i < m_TargetsInPhantom.size(); ++i) {
const auto id = m_TargetsInPhantom.at(i); const auto id = m_TargetsInPhantom.at(i);
auto* entity = EntityManager::Instance()->GetEntity(id); auto* entity = Game::entityManager->GetEntity(id);
if (entity == nullptr) { if (entity == nullptr) {
continue; continue;

View File

@ -25,8 +25,6 @@
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "eReplicaPacketType.h" #include "eReplicaPacketType.h"
EntityManager* EntityManager::m_Address = nullptr;
// Configure which zones have ghosting disabled, mostly small worlds. // Configure which zones have ghosting disabled, mostly small worlds.
std::vector<LWOMAPID> EntityManager::m_GhostingExcludedZones = { std::vector<LWOMAPID> EntityManager::m_GhostingExcludedZones = {
// Small zones // Small zones
@ -80,9 +78,6 @@ void EntityManager::Initialize() {
if (dZoneManager::Instance()->GetZoneID().GetCloneID() != 0) m_HardcoreMode = false; if (dZoneManager::Instance()->GetZoneID().GetCloneID() != 0) m_HardcoreMode = false;
} }
EntityManager::~EntityManager() {
}
Entity* EntityManager::CreateEntity(EntityInfo info, User* user, Entity* parentEntity, const bool controller, const LWOOBJID explicitId) { Entity* EntityManager::CreateEntity(EntityInfo info, User* user, Entity* parentEntity, const bool controller, const LWOOBJID explicitId) {
// Determine the objectID for the new entity // Determine the objectID for the new entity

View File

@ -1,12 +1,13 @@
#ifndef ENTITYMANAGER_H #ifndef ENTITYMANAGER_H
#define ENTITYMANAGER_H #define ENTITYMANAGER_H
#include "dCommonVars.h"
#include <map> #include <map>
#include <stack> #include <stack>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include "dCommonVars.h"
class Entity; class Entity;
class EntityInfo; class EntityInfo;
class Player; class Player;
@ -17,19 +18,8 @@ struct SystemAddress;
class EntityManager { class EntityManager {
public: public:
static EntityManager* Instance() {
if (!m_Address) {
m_Address = new EntityManager();
m_Address->Initialize();
}
return m_Address;
}
void Initialize(); void Initialize();
~EntityManager();
void UpdateEntities(float deltaTime); void UpdateEntities(float deltaTime);
Entity* CreateEntity(EntityInfo info, User* user = nullptr, Entity* parentEntity = nullptr, bool controller = false, LWOOBJID explicitId = LWOOBJID_EMPTY); Entity* CreateEntity(EntityInfo info, User* user = nullptr, Entity* parentEntity = nullptr, bool controller = false, LWOOBJID explicitId = LWOOBJID_EMPTY);
void DestroyEntity(const LWOOBJID& objectID); void DestroyEntity(const LWOOBJID& objectID);
@ -89,7 +79,6 @@ private:
void KillEntities(); void KillEntities();
void DeleteEntities(); void DeleteEntities();
static EntityManager* m_Address; //For singleton method
static std::vector<LWOMAPID> m_GhostingExcludedZones; static std::vector<LWOMAPID> m_GhostingExcludedZones;
static std::vector<LOT> m_GhostingExcludedLOTs; static std::vector<LOT> m_GhostingExcludedLOTs;

View File

@ -266,7 +266,7 @@ void Leaderboard::SetupLeaderboard(bool weekly, uint32_t resultStart, uint32_t r
} }
void Leaderboard::Send(const LWOOBJID targetID) const { void Leaderboard::Send(const LWOOBJID targetID) const {
auto* player = EntityManager::Instance()->GetEntity(relatedPlayer); auto* player = Game::entityManager->GetEntity(relatedPlayer);
if (player != nullptr) { if (player != nullptr) {
GameMessages::SendActivitySummaryLeaderboardData(targetID, this, player->GetSystemAddress()); GameMessages::SendActivitySummaryLeaderboardData(targetID, this, player->GetSystemAddress());
} }

View File

@ -85,7 +85,7 @@ void Player::SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId) {
const auto objid = GetObjectID(); const auto objid = GetObjectID();
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneId, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneId, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
auto* entity = EntityManager::Instance()->GetEntity(objid); auto* entity = Game::entityManager->GetEntity(objid);
if (entity == nullptr) { if (entity == nullptr) {
return; return;
@ -108,7 +108,7 @@ void Player::SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId) {
WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift); WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
EntityManager::Instance()->DestructEntity(entity); Game::entityManager->DestructEntity(entity);
return; return;
}); });
} }
@ -135,13 +135,13 @@ void Player::RemoveLimboConstruction(LWOOBJID objectId) {
void Player::ConstructLimboEntities() { void Player::ConstructLimboEntities() {
for (const auto objectId : m_LimboConstructions) { for (const auto objectId : m_LimboConstructions) {
auto* entity = EntityManager::Instance()->GetEntity(objectId); auto* entity = Game::entityManager->GetEntity(objectId);
if (entity == nullptr) { if (entity == nullptr) {
continue; continue;
} }
EntityManager::Instance()->ConstructEntity(entity, m_SystemAddress); Game::entityManager->ConstructEntity(entity, m_SystemAddress);
} }
m_LimboConstructions.clear(); m_LimboConstructions.clear();
@ -224,7 +224,7 @@ Player* Player::GetPlayer(const SystemAddress& sysAddr) {
} }
Player* Player::GetPlayer(const std::string& name) { Player* Player::GetPlayer(const std::string& name) {
const auto characters = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CHARACTER); const auto characters = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CHARACTER);
for (auto* character : characters) { for (auto* character : characters) {
if (!character->IsPlayer()) continue; if (!character->IsPlayer()) continue;
@ -269,7 +269,7 @@ Player::~Player() {
continue; continue;
} }
auto* entity = EntityManager::Instance()->GetGhostCandidate(id); auto* entity = Game::entityManager->GetGhostCandidate(id);
if (entity != nullptr) { if (entity != nullptr) {
entity->SetObservers(entity->GetObservers() - 1); entity->SetObservers(entity->GetObservers() - 1);
@ -285,12 +285,12 @@ Player::~Player() {
} }
if (IsPlayer()) { if (IsPlayer()) {
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); Entity* zoneControl = Game::entityManager->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
script->OnPlayerExit(zoneControl, this); script->OnPlayerExit(zoneControl, this);
} }
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {

View File

@ -40,11 +40,11 @@ LWOOBJID Trade::GetParticipantB() const {
} }
Entity* Trade::GetParticipantAEntity() const { Entity* Trade::GetParticipantAEntity() const {
return EntityManager::Instance()->GetEntity(m_ParticipantA); return Game::entityManager->GetEntity(m_ParticipantA);
} }
Entity* Trade::GetParticipantBEntity() const { Entity* Trade::GetParticipantBEntity() const {
return EntityManager::Instance()->GetEntity(m_ParticipantB); return Game::entityManager->GetEntity(m_ParticipantB);
} }
void Trade::SetCoins(LWOOBJID participant, uint64_t coins) { void Trade::SetCoins(LWOOBJID participant, uint64_t coins) {

View File

@ -220,7 +220,7 @@ void UserManager::RequestCharacterList(const SystemAddress& sysAddr) {
skillComponent->Reset(); skillComponent->Reset();
} }
EntityManager::Instance()->DestroyEntity(chars[i]->GetEntity()); Game::entityManager->DestroyEntity(chars[i]->GetEntity());
chars[i]->SaveXMLToDatabase(); chars[i]->SaveXMLToDatabase();

View File

@ -39,7 +39,7 @@ void AirMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitS
auto* behavior = CreateBehavior(behaviorId); auto* behavior = CreateBehavior(behaviorId);
if (EntityManager::Instance()->GetEntity(target) != nullptr) { if (Game::entityManager->GetEntity(target) != nullptr) {
branch.target = target; branch.target = target;
} }

View File

@ -6,7 +6,7 @@
void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target == LWOOBJID_EMPTY ? context->originator : branch.target); auto* entity = Game::entityManager->GetEntity(branch.target == LWOOBJID_EMPTY ? context->originator : branch.target);
if (entity == nullptr) return; if (entity == nullptr) return;
@ -19,7 +19,7 @@ void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
} }
void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
if (entity == nullptr) return; if (entity == nullptr) return;

View File

@ -47,7 +47,7 @@ void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* b
} }
void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* self = EntityManager::Instance()->GetEntity(context->caster); auto* self = Game::entityManager->GetEntity(context->caster);
if (self == nullptr) { if (self == nullptr) {
Game::logger->Log("AreaOfEffectBehavior", "Invalid self for (%llu)!", context->originator); Game::logger->Log("AreaOfEffectBehavior", "Invalid self for (%llu)!", context->originator);
@ -58,7 +58,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
std::vector<Entity*> targets; std::vector<Entity*> targets;
auto* presetTarget = EntityManager::Instance()->GetEntity(branch.target); auto* presetTarget = Game::entityManager->GetEntity(branch.target);
if (presetTarget != nullptr) { if (presetTarget != nullptr) {
if (this->m_radius * this->m_radius >= Vector3::DistanceSquared(reference, presetTarget->GetPosition())) { if (this->m_radius * this->m_radius >= Vector3::DistanceSquared(reference, presetTarget->GetPosition())) {
@ -75,7 +75,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
// Gets all of the valid targets, passing in if should target enemies and friends // Gets all of the valid targets, passing in if should target enemies and friends
for (auto validTarget : context->GetValidTargets(m_ignoreFaction, includeFaction, m_TargetSelf == 1, m_targetEnemy == 1, m_targetFriend == 1)) { for (auto validTarget : context->GetValidTargets(m_ignoreFaction, includeFaction, m_TargetSelf == 1, m_targetEnemy == 1, m_targetFriend == 1)) {
auto* entity = EntityManager::Instance()->GetEntity(validTarget); auto* entity = Game::entityManager->GetEntity(validTarget);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("AreaOfEffectBehavior", "Invalid target (%llu) for (%llu)!", validTarget, context->originator); Game::logger->Log("AreaOfEffectBehavior", "Invalid target (%llu) for (%llu)!", validTarget, context->originator);

View File

@ -9,7 +9,7 @@
void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
if (context->unmanaged) { if (context->unmanaged) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>(); auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) { if (destroyableComponent != nullptr) {
@ -38,7 +38,7 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
} }
void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* targetEntity = EntityManager::Instance()->GetEntity(branch.target); auto* targetEntity = Game::entityManager->GetEntity(branch.target);
if (!targetEntity) { if (!targetEntity) {
Game::logger->Log("BasicAttackBehavior", "Target targetEntity %llu not found.", branch.target); Game::logger->Log("BasicAttackBehavior", "Target targetEntity %llu not found.", branch.target);
return; return;
@ -61,7 +61,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
if (isBlocked) { if (isBlocked) {
destroyableComponent->SetAttacksToBlock(std::min(destroyableComponent->GetAttacksToBlock() - 1, 0U)); destroyableComponent->SetAttacksToBlock(std::min(destroyableComponent->GetAttacksToBlock() - 1, 0U));
EntityManager::Instance()->SerializeEntity(targetEntity); Game::entityManager->SerializeEntity(targetEntity);
this->m_OnFailBlocked->Handle(context, bitStream, branch); this->m_OnFailBlocked->Handle(context, bitStream, branch);
return; return;
} }
@ -155,7 +155,7 @@ void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream*
} }
void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* targetEntity = EntityManager::Instance()->GetEntity(branch.target); auto* targetEntity = Game::entityManager->GetEntity(branch.target);
if (!targetEntity) { if (!targetEntity) {
Game::logger->Log("BasicAttackBehavior", "Target entity %llu is null!", branch.target); Game::logger->Log("BasicAttackBehavior", "Target entity %llu is null!", branch.target);
return; return;
@ -173,7 +173,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
if (isBlocking) { if (isBlocking) {
destroyableComponent->SetAttacksToBlock(destroyableComponent->GetAttacksToBlock() - 1); destroyableComponent->SetAttacksToBlock(destroyableComponent->GetAttacksToBlock() - 1);
EntityManager::Instance()->SerializeEntity(targetEntity); Game::entityManager->SerializeEntity(targetEntity);
this->m_OnFailBlocked->Calculate(context, bitStream, branch); this->m_OnFailBlocked->Calculate(context, bitStream, branch);
return; return;
} }

View File

@ -314,7 +314,7 @@ BehaviorTemplates Behavior::GetBehaviorTemplate(const uint32_t behaviorId) {
// For use with enemies, to display the correct damage animations on the players // For use with enemies, to display the correct damage animations on the players
void Behavior::PlayFx(std::u16string type, const LWOOBJID target, const LWOOBJID secondary) { void Behavior::PlayFx(std::u16string type, const LWOOBJID target, const LWOOBJID secondary) {
auto* targetEntity = EntityManager::Instance()->GetEntity(target); auto* targetEntity = Game::entityManager->GetEntity(target);
if (targetEntity == nullptr) { if (targetEntity == nullptr) {
return; return;

View File

@ -27,7 +27,7 @@ BehaviorEndEntry::BehaviorEndEntry() {
} }
uint32_t BehaviorContext::GetUniqueSkillId() const { uint32_t BehaviorContext::GetUniqueSkillId() const {
auto* entity = EntityManager::Instance()->GetEntity(this->originator); auto* entity = Game::entityManager->GetEntity(this->originator);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!", this->originator); Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!", this->originator);
@ -94,11 +94,11 @@ void BehaviorContext::ScheduleUpdate(const LWOOBJID id) {
void BehaviorContext::ExecuteUpdates() { void BehaviorContext::ExecuteUpdates() {
for (const auto& id : this->scheduledUpdates) { for (const auto& id : this->scheduledUpdates) {
auto* entity = EntityManager::Instance()->GetEntity(id); auto* entity = Game::entityManager->GetEntity(id);
if (entity == nullptr) continue; if (entity == nullptr) continue;
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
this->scheduledUpdates.clear(); this->scheduledUpdates.clear();
@ -308,7 +308,7 @@ void BehaviorContext::Reset() {
} }
std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, int32_t includeFaction, bool targetSelf, bool targetEnemy, bool targetFriend) const { std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, int32_t includeFaction, bool targetSelf, bool targetEnemy, bool targetFriend) const {
auto* entity = EntityManager::Instance()->GetEntity(this->caster); auto* entity = Game::entityManager->GetEntity(this->caster);
std::vector<LWOOBJID> targets; std::vector<LWOOBJID> targets;
@ -320,7 +320,7 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
if (!ignoreFaction && !includeFaction) { if (!ignoreFaction && !includeFaction) {
for (auto entry : entity->GetTargetsInPhantom()) { for (auto entry : entity->GetTargetsInPhantom()) {
auto* instance = EntityManager::Instance()->GetEntity(entry); auto* instance = Game::entityManager->GetEntity(entry);
if (instance == nullptr) { if (instance == nullptr) {
continue; continue;
@ -336,7 +336,7 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
return targets; return targets;
} }
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS); auto entities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS);
for (auto* candidate : entities) { for (auto* candidate : entities) {
const auto id = candidate->GetObjectID(); const auto id = candidate->GetObjectID();

View File

@ -10,7 +10,7 @@
void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
const auto target = context->originator; const auto target = context->originator;
auto* entity = EntityManager::Instance()->GetEntity(target); auto* entity = Game::entityManager->GetEntity(target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
@ -40,7 +40,7 @@ void BlockBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
void BlockBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void BlockBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
const auto target = context->originator; const auto target = context->originator;
auto* entity = EntityManager::Instance()->GetEntity(target); auto* entity = Game::entityManager->GetEntity(target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);

View File

@ -10,7 +10,7 @@
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator; const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
auto* entity = EntityManager::Instance()->GetEntity(target); auto* entity = Game::entityManager->GetEntity(target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target); Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
@ -30,7 +30,7 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
component->SetMaxArmor(component->GetMaxArmor() + this->m_armor); component->SetMaxArmor(component->GetMaxArmor() + this->m_armor);
component->SetMaxImagination(component->GetMaxImagination() + this->m_imagination); component->SetMaxImagination(component->GetMaxImagination() + this->m_imagination);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
if (!context->unmanaged) { if (!context->unmanaged) {
if (branch.duration > 0) { if (branch.duration > 0) {
@ -44,7 +44,7 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator; const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
auto* entity = EntityManager::Instance()->GetEntity(target); auto* entity = Game::entityManager->GetEntity(target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target); Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
@ -64,7 +64,7 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
component->SetMaxArmor(component->GetMaxArmor() - this->m_armor); component->SetMaxArmor(component->GetMaxArmor() - this->m_armor);
component->SetMaxImagination(component->GetMaxImagination() - this->m_imagination); component->SetMaxImagination(component->GetMaxImagination() - this->m_imagination);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
void BuffBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext branch, LWOOBJID second) { void BuffBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext branch, LWOOBJID second) {

View File

@ -11,7 +11,7 @@
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
GameMessages::SendVehicleAddPassiveBoostAction(branch.target, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendVehicleAddPassiveBoostAction(branch.target, UNASSIGNED_SYSTEM_ADDRESS);
auto* entity = EntityManager::Instance()->GetEntity(context->originator); auto* entity = Game::entityManager->GetEntity(context->originator);
if (entity == nullptr) { if (entity == nullptr) {
return; return;
@ -22,7 +22,7 @@ void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
auto* possessableComponent = entity->GetComponent<PossessableComponent>(); auto* possessableComponent = entity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) { if (possessableComponent != nullptr) {
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (possessor != nullptr) { if (possessor != nullptr) {
auto* characterComponent = possessor->GetComponent<CharacterComponent>(); auto* characterComponent = possessor->GetComponent<CharacterComponent>();

View File

@ -5,14 +5,14 @@
void ChangeOrientationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void ChangeOrientationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
Entity* sourceEntity; Entity* sourceEntity;
if (this->m_orientCaster) sourceEntity = EntityManager::Instance()->GetEntity(context->originator); if (this->m_orientCaster) sourceEntity = Game::entityManager->GetEntity(context->originator);
else sourceEntity = EntityManager::Instance()->GetEntity(branch.target); else sourceEntity = Game::entityManager->GetEntity(branch.target);
if (!sourceEntity) return; if (!sourceEntity) return;
if (this->m_toTarget) { if (this->m_toTarget) {
Entity* destinationEntity; Entity* destinationEntity;
if (this->m_orientCaster) destinationEntity = EntityManager::Instance()->GetEntity(branch.target); if (this->m_orientCaster) destinationEntity = Game::entityManager->GetEntity(branch.target);
else destinationEntity = EntityManager::Instance()->GetEntity(context->originator); else destinationEntity = Game::entityManager->GetEntity(context->originator);
if (!destinationEntity) return; if (!destinationEntity) return;
sourceEntity->SetRotation( sourceEntity->SetRotation(
@ -23,7 +23,7 @@ void ChangeOrientationBehavior::Calculate(BehaviorContext* context, RakNet::BitS
if (this->m_relative) baseAngle += sourceEntity->GetRotation().GetForwardVector(); if (this->m_relative) baseAngle += sourceEntity->GetRotation().GetForwardVector();
sourceEntity->SetRotation(NiQuaternion::FromEulerAngles(baseAngle)); sourceEntity->SetRotation(NiQuaternion::FromEulerAngles(baseAngle));
} else return; } else return;
EntityManager::Instance()->SerializeEntity(sourceEntity); Game::entityManager->SerializeEntity(sourceEntity);
return; return;
} }

View File

@ -8,7 +8,7 @@
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) { void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
@ -34,7 +34,7 @@ void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
} }
void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, const LWOOBJID second) { void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, const LWOOBJID second) {
auto* target = EntityManager::Instance()->GetEntity(second); auto* target = Game::entityManager->GetEntity(second);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second); Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second);

View File

@ -8,7 +8,7 @@
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) { void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", branch.target);
@ -32,7 +32,7 @@ void DamageReductionBehavior::Calculate(BehaviorContext* context, RakNet::BitStr
} }
void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, const LWOOBJID second) { void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, const LWOOBJID second) {
auto* target = EntityManager::Instance()->GetEntity(second); auto* target = Game::entityManager->GetEntity(second);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", second); Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", second);

View File

@ -7,7 +7,7 @@
#include "BehaviorContext.h" #include "BehaviorContext.h"
void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) { void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->LogDebug("DarkInspirationBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->LogDebug("DarkInspirationBehavior", "Failed to find target (%llu)!", branch.target);
@ -26,7 +26,7 @@ void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream
} }
void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->LogDebug("DarkInspirationBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->LogDebug("DarkInspirationBehavior", "Failed to find target (%llu)!", branch.target);

View File

@ -8,13 +8,13 @@
void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
// make sure required parameter has non-default value // make sure required parameter has non-default value
if (m_PercentSlowed == 0.0f) return; if (m_PercentSlowed == 0.0f) return;
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (!target) return; if (!target) return;
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return; if (!controllablePhysicsComponent) return;
controllablePhysicsComponent->SetGravityScale(m_PercentSlowed); controllablePhysicsComponent->SetGravityScale(m_PercentSlowed);
EntityManager::Instance()->SerializeEntity(target); Game::entityManager->SerializeEntity(target);
if (branch.duration > 0.0f) { if (branch.duration > 0.0f) {
context->RegisterTimerBehavior(this, branch); context->RegisterTimerBehavior(this, branch);
@ -36,13 +36,13 @@ void FallSpeedBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext b
} }
void FallSpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) { void FallSpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (!target) return; if (!target) return;
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return; if (!controllablePhysicsComponent) return;
controllablePhysicsComponent->SetGravityScale(1); controllablePhysicsComponent->SetGravityScale(1);
EntityManager::Instance()->SerializeEntity(target); Game::entityManager->SerializeEntity(target);
} }
void FallSpeedBehavior::Load(){ void FallSpeedBehavior::Load(){

View File

@ -42,7 +42,7 @@ void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStrea
return; return;
} }
auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster); auto* casterEntity = Game::entityManager->GetEntity(context->caster);
if (casterEntity != nullptr) { if (casterEntity != nullptr) {
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>(); auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent != nullptr) { if (controllablePhysicsComponent != nullptr) {
@ -51,7 +51,7 @@ void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStrea
controllablePhysicsComponent->SetVelocity(controllablePhysicsComponent->GetRotation().GetForwardVector() * 25); controllablePhysicsComponent->SetVelocity(controllablePhysicsComponent->GetRotation().GetForwardVector() * 25);
} }
EntityManager::Instance()->SerializeEntity(casterEntity); Game::entityManager->SerializeEntity(casterEntity);
} }
} }
@ -72,7 +72,7 @@ void ForceMovementBehavior::Load() {
} }
void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster); auto* casterEntity = Game::entityManager->GetEntity(context->caster);
if (casterEntity != nullptr) { if (casterEntity != nullptr) {
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>(); auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
if (controllablePhysicsComponent != nullptr) { if (controllablePhysicsComponent != nullptr) {
@ -80,7 +80,7 @@ void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::Bi
controllablePhysicsComponent->SetPosition(controllablePhysicsComponent->GetPosition() + controllablePhysicsComponent->GetVelocity() * m_Duration); controllablePhysicsComponent->SetPosition(controllablePhysicsComponent->GetPosition() + controllablePhysicsComponent->GetVelocity() * m_Duration);
controllablePhysicsComponent->SetVelocity({}); controllablePhysicsComponent->SetVelocity({});
EntityManager::Instance()->SerializeEntity(casterEntity); Game::entityManager->SerializeEntity(casterEntity);
} }
} }

View File

@ -8,7 +8,7 @@
void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) { void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("HealBehavior", "Failed to find entity for (%llu)!", branch.target); Game::logger->Log("HealBehavior", "Failed to find entity for (%llu)!", branch.target);

View File

@ -7,7 +7,7 @@
void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) { void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
if (entity == nullptr) { if (entity == nullptr) {
return; return;

View File

@ -10,7 +10,7 @@
#include "eStateChangeType.h" #include "eStateChangeType.h"
void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) { void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (!target) { if (!target) {
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
@ -56,7 +56,7 @@ void ImmunityBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bi
} }
void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, const LWOOBJID second) { void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, const LWOOBJID second) {
auto* target = EntityManager::Instance()->GetEntity(second); auto* target = Game::entityManager->GetEntity(second);
if (!target) { if (!target) {
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second); Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second);

View File

@ -42,7 +42,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
if (branch.target == context->originator) return; if (branch.target == context->originator) return;
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) return; if (target == nullptr) return;
@ -67,7 +67,7 @@ void InterruptBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
if (branch.target == context->originator) return; if (branch.target == context->originator) return;
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) return; if (target == nullptr) return;

View File

@ -6,7 +6,7 @@
#include "Character.h" #include "Character.h"
void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) { void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
GameMessages::SendSetJetPackMode(entity, true, this->m_BypassChecks, this->m_EnableHover, this->m_effectId, this->m_Airspeed, this->m_MaxAirspeed, this->m_VerticalVelocity, this->m_WarningEffectID); GameMessages::SendSetJetPackMode(entity, true, this->m_BypassChecks, this->m_EnableHover, this->m_effectId, this->m_Airspeed, this->m_MaxAirspeed, this->m_VerticalVelocity, this->m_WarningEffectID);
@ -20,7 +20,7 @@ void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_st
} }
void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
GameMessages::SendSetJetPackMode(entity, false); GameMessages::SendSetJetPackMode(entity, false);

View File

@ -21,7 +21,7 @@ void KnockbackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
bool blocked = false; bool blocked = false;
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target != nullptr) { if (target != nullptr) {
auto* destroyableComponent = target->GetComponent<DestroyableComponent>(); auto* destroyableComponent = target->GetComponent<DestroyableComponent>();

View File

@ -1,14 +1,14 @@
#include "LootBuffBehavior.h" #include "LootBuffBehavior.h"
void LootBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void LootBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto target = EntityManager::Instance()->GetEntity(context->caster); auto target = Game::entityManager->GetEntity(context->caster);
if (!target) return; if (!target) return;
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return; if (!controllablePhysicsComponent) return;
controllablePhysicsComponent->AddPickupRadiusScale(m_Scale); controllablePhysicsComponent->AddPickupRadiusScale(m_Scale);
EntityManager::Instance()->SerializeEntity(target); Game::entityManager->SerializeEntity(target);
if (branch.duration > 0) context->RegisterTimerBehavior(this, branch); if (branch.duration > 0) context->RegisterTimerBehavior(this, branch);
@ -19,14 +19,14 @@ void LootBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bi
} }
void LootBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void LootBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
auto target = EntityManager::Instance()->GetEntity(context->caster); auto target = Game::entityManager->GetEntity(context->caster);
if (!target) return; if (!target) return;
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return; if (!controllablePhysicsComponent) return;
controllablePhysicsComponent->RemovePickupRadiusScale(m_Scale); controllablePhysicsComponent->RemovePickupRadiusScale(m_Scale);
EntityManager::Instance()->SerializeEntity(target); Game::entityManager->SerializeEntity(target);
} }
void LootBuffBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) { void LootBuffBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) {

View File

@ -14,13 +14,13 @@
void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
const auto originator = context->originator; const auto originator = context->originator;
auto* entity = EntityManager::Instance()->GetEntity(originator); auto* entity = Game::entityManager->GetEntity(originator);
if (entity == nullptr) return; if (entity == nullptr) return;
for (size_t i = 0; i < m_NumIntervals; i++) { for (size_t i = 0; i < m_NumIntervals; i++) {
entity->AddCallbackTimer((i + 1) * m_Delay, [originator, branch, this]() { entity->AddCallbackTimer((i + 1) * m_Delay, [originator, branch, this]() {
auto* entity = EntityManager::Instance()->GetEntity(originator); auto* entity = Game::entityManager->GetEntity(originator);
if (entity == nullptr) return; if (entity == nullptr) return;

View File

@ -16,7 +16,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
return; return;
}; };
auto* entity = EntityManager::Instance()->GetEntity(context->originator); auto* entity = Game::entityManager->GetEntity(context->originator);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator); Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator);
@ -40,7 +40,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
}; };
} }
auto* targetEntity = EntityManager::Instance()->GetEntity(target); auto* targetEntity = Game::entityManager->GetEntity(target);
for (auto i = 0u; i < this->m_projectileCount; ++i) { for (auto i = 0u; i < this->m_projectileCount; ++i) {
LWOOBJID projectileId{}; LWOOBJID projectileId{};
@ -61,7 +61,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
bitStream->Write(branch.target); bitStream->Write(branch.target);
auto* entity = EntityManager::Instance()->GetEntity(context->originator); auto* entity = Game::entityManager->GetEntity(context->originator);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator); Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator);
@ -78,7 +78,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
} }
auto* other = EntityManager::Instance()->GetEntity(branch.target); auto* other = Game::entityManager->GetEntity(branch.target);
if (other == nullptr) { if (other == nullptr) {
Game::logger->Log("ProjectileAttackBehavior", "Invalid projectile target (%llu)!", branch.target); Game::logger->Log("ProjectileAttackBehavior", "Invalid projectile target (%llu)!", branch.target);

View File

@ -12,7 +12,7 @@
#include "dZoneManager.h" #include "dZoneManager.h"
void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* caster = EntityManager::Instance()->GetEntity(context->caster); auto* caster = Game::entityManager->GetEntity(context->caster);
if (!caster) return; if (!caster) return;
auto* character = caster->GetCharacter(); auto* character = caster->GetCharacter();
@ -32,7 +32,7 @@ void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, targetMapId, targetCloneId, false, [objId](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, targetMapId, targetCloneId, false, [objId](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
auto* entity = EntityManager::Instance()->GetEntity(objId); auto* entity = Game::entityManager->GetEntity(objId);
if (!entity) return; if (!entity) return;
const auto sysAddr = entity->GetSystemAddress(); const auto sysAddr = entity->GetSystemAddress();

View File

@ -6,9 +6,9 @@
#include "MovementAIComponent.h" #include "MovementAIComponent.h"
void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(context->originator); auto* entity = Game::entityManager->GetEntity(context->originator);
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (entity == nullptr || target == nullptr) { if (entity == nullptr || target == nullptr) {
return; return;

View File

@ -6,7 +6,7 @@
#include "BuffComponent.h" #include "BuffComponent.h"
void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(context->caster); auto* entity = Game::entityManager->GetEntity(context->caster);
if (!entity) return; if (!entity) return;
auto* buffComponent = entity->GetComponent<BuffComponent>(); auto* buffComponent = entity->GetComponent<BuffComponent>();

View File

@ -8,7 +8,7 @@
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) { void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("RepairBehavior", "Failed to find entity for (%llu)!", branch.target); Game::logger->Log("RepairBehavior", "Failed to find entity for (%llu)!", branch.target);

View File

@ -5,8 +5,8 @@
#include "CppScripts.h" #include "CppScripts.h"
void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
auto* caster = EntityManager::Instance()->GetEntity(context->originator); auto* caster = Game::entityManager->GetEntity(context->originator);
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) { if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) {
@ -17,8 +17,8 @@ void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit
void void
SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
auto* caster = EntityManager::Instance()->GetEntity(context->originator); auto* caster = Game::entityManager->GetEntity(context->originator);
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) { if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) {

View File

@ -12,7 +12,7 @@
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* origin = EntityManager::Instance()->GetEntity(context->originator); auto* origin = Game::entityManager->GetEntity(context->originator);
if (origin == nullptr) { if (origin == nullptr) {
Game::logger->Log("SpawnBehavior", "Failed to find self entity (%llu)!", context->originator); Game::logger->Log("SpawnBehavior", "Failed to find self entity (%llu)!", context->originator);
@ -21,7 +21,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
} }
if (branch.isProjectile) { if (branch.isProjectile) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target != nullptr) { if (target != nullptr) {
origin = target; origin = target;
@ -38,10 +38,10 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
info.spawnerNodeID = 0; info.spawnerNodeID = 0;
info.pos = info.pos + (info.rot.GetForwardVector() * m_Distance); info.pos = info.pos + (info.rot.GetForwardVector() * m_Distance);
auto* entity = EntityManager::Instance()->CreateEntity( auto* entity = Game::entityManager->CreateEntity(
info, info,
nullptr, nullptr,
EntityManager::Instance()->GetEntity(context->originator) Game::entityManager->GetEntity(context->originator)
); );
if (entity == nullptr) { if (entity == nullptr) {
@ -59,7 +59,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
rebuildComponent->SetRepositionPlayer(false); rebuildComponent->SetRepositionPlayer(false);
} }
EntityManager::Instance()->ConstructEntity(entity); Game::entityManager->ConstructEntity(entity);
if (branch.duration > 0) { if (branch.duration > 0) {
context->RegisterTimerBehavior(this, branch, entity->GetObjectID()); context->RegisterTimerBehavior(this, branch, entity->GetObjectID());
@ -79,7 +79,7 @@ void SpawnBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
} }
void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext branch, const LWOOBJID second) { void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext branch, const LWOOBJID second) {
auto* entity = EntityManager::Instance()->GetEntity(second); auto* entity = Game::entityManager->GetEntity(second);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("SpawnBehavior", "Failed to find spawned entity (%llu)!", second); Game::logger->Log("SpawnBehavior", "Failed to find spawned entity (%llu)!", second);

View File

@ -9,14 +9,14 @@
void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
if (m_AffectsCaster) branch.target = context->caster; if (m_AffectsCaster) branch.target = context->caster;
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (!target) return; if (!target) return;
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return; if (!controllablePhysicsComponent) return;
controllablePhysicsComponent->AddSpeedboost(m_RunSpeed); controllablePhysicsComponent->AddSpeedboost(m_RunSpeed);
EntityManager::Instance()->SerializeEntity(target); Game::entityManager->SerializeEntity(target);
if (branch.duration > 0.0f) { if (branch.duration > 0.0f) {
context->RegisterTimerBehavior(this, branch); context->RegisterTimerBehavior(this, branch);
@ -38,14 +38,14 @@ void SpeedBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch
} }
void SpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) { void SpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (!target) return; if (!target) return;
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>(); auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
if (!controllablePhysicsComponent) return; if (!controllablePhysicsComponent) return;
controllablePhysicsComponent->RemoveSpeedboost(m_RunSpeed); controllablePhysicsComponent->RemoveSpeedboost(m_RunSpeed);
EntityManager::Instance()->SerializeEntity(target); Game::entityManager->SerializeEntity(target);
} }
void SpeedBehavior::Load() { void SpeedBehavior::Load() {

View File

@ -21,7 +21,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
return; return;
}; };
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
@ -44,7 +44,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) { void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
if (this->m_stunCaster || branch.target == context->originator) { if (this->m_stunCaster || branch.target == context->originator) {
auto* self = EntityManager::Instance()->GetEntity(context->originator); auto* self = Game::entityManager->GetEntity(context->originator);
if (self == nullptr) { if (self == nullptr) {
Game::logger->Log("StunBehavior", "Invalid self entity (%llu)!", context->originator); Game::logger->Log("StunBehavior", "Invalid self entity (%llu)!", context->originator);
@ -69,7 +69,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
bool blocked = false; bool blocked = false;
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target != nullptr) { if (target != nullptr) {
auto* destroyableComponent = target->GetComponent<DestroyableComponent>(); auto* destroyableComponent = target->GetComponent<DestroyableComponent>();

View File

@ -16,7 +16,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
}; };
} }
auto* entity = EntityManager::Instance()->GetEntity(context->originator); auto* entity = Game::entityManager->GetEntity(context->originator);
if (entity == nullptr) { if (entity == nullptr) {
return; return;
@ -41,7 +41,7 @@ void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
auto state = true; auto state = true;
if (this->m_imagination > 0 || !this->m_isEnemyFaction) { if (this->m_imagination > 0 || !this->m_isEnemyFaction) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
state = entity != nullptr; state = entity != nullptr;

View File

@ -76,7 +76,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
} }
void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* self = EntityManager::Instance()->GetEntity(context->originator); auto* self = Game::entityManager->GetEntity(context->originator);
if (self == nullptr) { if (self == nullptr) {
Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!", context->originator); Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!", context->originator);
return; return;
@ -85,7 +85,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
const auto* destroyableComponent = self->GetComponent<DestroyableComponent>(); const auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if ((this->m_usePickedTarget || context->clientInitalized) && branch.target > 0) { if ((this->m_usePickedTarget || context->clientInitalized) && branch.target > 0) {
const auto* target = EntityManager::Instance()->GetEntity(branch.target); const auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
return; return;
@ -120,7 +120,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
// Find all valid targets, based on whether we target enemies or friends // Find all valid targets, based on whether we target enemies or friends
for (const auto& contextTarget : context->GetValidTargets()) { for (const auto& contextTarget : context->GetValidTargets()) {
if (destroyableComponent != nullptr) { if (destroyableComponent != nullptr) {
const auto* targetEntity = EntityManager::Instance()->GetEntity(contextTarget); const auto* targetEntity = Game::entityManager->GetEntity(contextTarget);
if (m_targetEnemy && destroyableComponent->IsEnemy(targetEntity) if (m_targetEnemy && destroyableComponent->IsEnemy(targetEntity)
|| m_targetFriend && destroyableComponent->IsFriend(targetEntity)) { || m_targetFriend && destroyableComponent->IsFriend(targetEntity)) {
@ -136,7 +136,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
break; break;
} }
auto* entity = EntityManager::Instance()->GetEntity(validTarget); auto* entity = Game::entityManager->GetEntity(validTarget);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("TacArcBehavior", "Invalid target (%llu) for (%llu)!", validTarget, context->originator); Game::logger->Log("TacArcBehavior", "Invalid target (%llu) for (%llu)!", validTarget, context->originator);

View File

@ -7,7 +7,7 @@
void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
@ -23,7 +23,7 @@ void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
} }
void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* target = EntityManager::Instance()->GetEntity(branch.target); auto* target = Game::entityManager->GetEntity(branch.target);
if (target == nullptr) { if (target == nullptr) {
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target); Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);

View File

@ -5,7 +5,7 @@
void VentureVisionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void VentureVisionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
const auto targetEntity = EntityManager::Instance()->GetEntity(branch.target); const auto targetEntity = Game::entityManager->GetEntity(branch.target);
if (targetEntity) { if (targetEntity) {
auto characterComponent = targetEntity->GetComponent<CharacterComponent>(); auto characterComponent = targetEntity->GetComponent<CharacterComponent>();
@ -21,7 +21,7 @@ void VentureVisionBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
} }
void VentureVisionBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { void VentureVisionBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
const auto targetEntity = EntityManager::Instance()->GetEntity(branch.target); const auto targetEntity = Game::entityManager->GetEntity(branch.target);
if (targetEntity) { if (targetEntity) {
auto characterComponent = targetEntity->GetComponent<CharacterComponent>(); auto characterComponent = targetEntity->GetComponent<CharacterComponent>();

View File

@ -8,14 +8,14 @@
void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = Game::entityManager->GetEntity(branch.target);
auto success = true; auto success = true;
if (entity == nullptr) { if (entity == nullptr) {
success = false; success = false;
} else if (this->m_rangeCheck) { } else if (this->m_rangeCheck) {
auto* self = EntityManager::Instance()->GetEntity(context->originator); auto* self = Game::entityManager->GetEntity(context->originator);
if (self == nullptr) { if (self == nullptr) {
Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)", context->originator); Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)", context->originator);

View File

@ -173,7 +173,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
} }
if (m_SoftTimer <= 0.0f) { if (m_SoftTimer <= 0.0f) {
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
m_SoftTimer = 5.0f; m_SoftTimer = 5.0f;
} else { } else {
@ -305,7 +305,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
} }
if (serilizationRequired) { if (serilizationRequired) {
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 6270, u"tether", "tether"); GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 6270, u"tether", "tether");
@ -412,7 +412,7 @@ LWOOBJID BaseCombatAIComponent::FindTarget() {
float biggestThreat = 0; float biggestThreat = 0;
for (const auto& entry : possibleTargets) { for (const auto& entry : possibleTargets) {
auto* entity = EntityManager::Instance()->GetEntity(entry); auto* entity = Game::entityManager->GetEntity(entry);
if (entity == nullptr) { if (entity == nullptr) {
continue; continue;
@ -458,7 +458,7 @@ LWOOBJID BaseCombatAIComponent::FindTarget() {
std::vector<LWOOBJID> deadThreats{}; std::vector<LWOOBJID> deadThreats{};
for (const auto& threatTarget : m_ThreatEntries) { for (const auto& threatTarget : m_ThreatEntries) {
auto* entity = EntityManager::Instance()->GetEntity(threatTarget.first); auto* entity = Game::entityManager->GetEntity(threatTarget.first);
if (entity == nullptr) { if (entity == nullptr) {
deadThreats.push_back(threatTarget.first); deadThreats.push_back(threatTarget.first);
@ -497,7 +497,7 @@ std::vector<LWOOBJID> BaseCombatAIComponent::GetTargetWithinAggroRange() const {
std::vector<LWOOBJID> targets; std::vector<LWOOBJID> targets;
for (auto id : m_Parent->GetTargetsInPhantom()) { for (auto id : m_Parent->GetTargetsInPhantom()) {
auto* other = EntityManager::Instance()->GetEntity(id); auto* other = Game::entityManager->GetEntity(id);
const auto distance = Vector3::DistanceSquared(m_Parent->GetPosition(), other->GetPosition()); const auto distance = Vector3::DistanceSquared(m_Parent->GetPosition(), other->GetPosition());
@ -535,11 +535,11 @@ void BaseCombatAIComponent::SetAiState(AiState newState) {
if (newState == this->m_State) return; if (newState == this->m_State) return;
this->m_State = newState; this->m_State = newState;
m_DirtyStateOrTarget = true; m_DirtyStateOrTarget = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const { bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
auto* entity = EntityManager::Instance()->GetEntity(target); auto* entity = Game::entityManager->GetEntity(target);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("BaseCombatAIComponent", "Invalid entity for checking validity (%llu)!", target); Game::logger->Log("BaseCombatAIComponent", "Invalid entity for checking validity (%llu)!", target);
@ -588,11 +588,11 @@ void BaseCombatAIComponent::SetTarget(const LWOOBJID target) {
if (this->m_Target == target) return; if (this->m_Target == target) return;
m_Target = target; m_Target = target;
m_DirtyStateOrTarget = true; m_DirtyStateOrTarget = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
Entity* BaseCombatAIComponent::GetTargetEntity() const { Entity* BaseCombatAIComponent::GetTargetEntity() const {
return EntityManager::Instance()->GetEntity(m_Target); return Game::entityManager->GetEntity(m_Target);
} }
void BaseCombatAIComponent::Taunt(LWOOBJID offender, float threat) { void BaseCombatAIComponent::Taunt(LWOOBJID offender, float threat) {

View File

@ -36,7 +36,7 @@ Entity* BouncerComponent::GetParentEntity() const {
void BouncerComponent::SetPetEnabled(bool value) { void BouncerComponent::SetPetEnabled(bool value) {
m_PetEnabled = value; m_PetEnabled = value;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void BouncerComponent::SetPetBouncerEnabled(bool value) { void BouncerComponent::SetPetBouncerEnabled(bool value) {
@ -44,7 +44,7 @@ void BouncerComponent::SetPetBouncerEnabled(bool value) {
GameMessages::SendBouncerActiveStatus(m_Parent->GetObjectID(), value, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendBouncerActiveStatus(m_Parent->GetObjectID(), value, UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
if (value) { if (value) {
m_Parent->TriggerEvent(eTriggerEventType::PET_ON_SWITCH, m_Parent); m_Parent->TriggerEvent(eTriggerEventType::PET_ON_SWITCH, m_Parent);
@ -68,7 +68,7 @@ void BouncerComponent::LookupPetSwitch() {
const auto& groups = m_Parent->GetGroups(); const auto& groups = m_Parent->GetGroups();
for (const auto& group : groups) { for (const auto& group : groups) {
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup(group); const auto& entities = Game::entityManager->GetEntitiesInGroup(group);
for (auto* entity : entities) { for (auto* entity : entities) {
auto* switchComponent = entity->GetComponent<SwitchComponent>(); auto* switchComponent = entity->GetComponent<SwitchComponent>();
@ -79,7 +79,7 @@ void BouncerComponent::LookupPetSwitch() {
m_PetSwitchLoaded = true; m_PetSwitchLoaded = true;
m_PetEnabled = true; m_PetEnabled = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
Game::logger->Log("BouncerComponent", "Loaded pet bouncer"); Game::logger->Log("BouncerComponent", "Loaded pet bouncer");
} }

View File

@ -17,7 +17,7 @@ BuildBorderComponent::~BuildBorderComponent() {
void BuildBorderComponent::OnUse(Entity* originator) { void BuildBorderComponent::OnUse(Entity* originator) {
if (originator->GetCharacter()) { if (originator->GetCharacter()) {
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque"); const auto& entities = Game::entityManager->GetEntitiesInGroup("PropertyPlaque");
auto buildArea = m_Parent->GetObjectID(); auto buildArea = m_Parent->GetObjectID();

View File

@ -300,7 +300,7 @@ void ControllablePhysicsComponent::RemovePickupRadiusScale(float value) {
auto candidateRadius = m_ActivePickupRadiusScales[i]; auto candidateRadius = m_ActivePickupRadiusScales[i];
if (m_PickupRadius < candidateRadius) m_PickupRadius = candidateRadius; if (m_PickupRadius < candidateRadius) m_PickupRadius = candidateRadius;
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void ControllablePhysicsComponent::AddSpeedboost(float value) { void ControllablePhysicsComponent::AddSpeedboost(float value) {
@ -327,7 +327,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) {
m_SpeedBoost = m_ActiveSpeedBoosts.back(); m_SpeedBoost = m_ActiveSpeedBoosts.back();
} }
SetSpeedMultiplier(m_SpeedBoost / 500.0f); // 500 being the base speed SetSpeedMultiplier(m_SpeedBoost / 500.0f); // 500 being the base speed
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bool specialAnims){ void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bool specialAnims){
@ -339,13 +339,13 @@ void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bo
m_IsInBubble = true; m_IsInBubble = true;
m_DirtyBubble = true; m_DirtyBubble = true;
m_SpecialAnims = specialAnims; m_SpecialAnims = specialAnims;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void ControllablePhysicsComponent::DeactivateBubbleBuff(){ void ControllablePhysicsComponent::DeactivateBubbleBuff(){
m_DirtyBubble = true; m_DirtyBubble = true;
m_IsInBubble = false; m_IsInBubble = false;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
}; };
void ControllablePhysicsComponent::SetStunImmunity( void ControllablePhysicsComponent::SetStunImmunity(

View File

@ -253,7 +253,7 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args); GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void DestroyableComponent::SetArmor(int32_t value) { void DestroyableComponent::SetArmor(int32_t value) {
@ -294,7 +294,7 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args); GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void DestroyableComponent::SetImagination(int32_t value) { void DestroyableComponent::SetImagination(int32_t value) {
@ -333,7 +333,7 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args); GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void DestroyableComponent::SetDamageToAbsorb(int32_t value) { void DestroyableComponent::SetDamageToAbsorb(int32_t value) {
@ -482,11 +482,11 @@ LWOOBJID DestroyableComponent::GetKillerID() const {
} }
Entity* DestroyableComponent::GetKiller() const { Entity* DestroyableComponent::GetKiller() const {
return EntityManager::Instance()->GetEntity(m_KillerID); return Game::entityManager->GetEntity(m_KillerID);
} }
bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignoreFactions, const bool targetEnemy, const bool targetFriend) const { bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignoreFactions, const bool targetEnemy, const bool targetFriend) const {
auto* targetEntity = EntityManager::Instance()->GetEntity(target); auto* targetEntity = Game::entityManager->GetEntity(target);
if (targetEntity == nullptr) { if (targetEntity == nullptr) {
Game::logger->Log("DestroyableComponent", "Invalid entity for checking validity (%llu)!", target); Game::logger->Log("DestroyableComponent", "Invalid entity for checking validity (%llu)!", target);
@ -532,7 +532,7 @@ void DestroyableComponent::Heal(const uint32_t health) {
SetHealth(current); SetHealth(current);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
@ -550,7 +550,7 @@ void DestroyableComponent::Imagine(const int32_t deltaImagination) {
SetImagination(current); SetImagination(current);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
@ -564,7 +564,7 @@ void DestroyableComponent::Repair(const uint32_t armor) {
SetArmor(current); SetArmor(current);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
@ -626,7 +626,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
if (possessor) { if (possessor) {
auto possessableId = possessor->GetPossessable(); auto possessableId = possessor->GetPossessable();
if (possessableId != LWOOBJID_EMPTY) { if (possessableId != LWOOBJID_EMPTY) {
auto possessable = EntityManager::Instance()->GetEntity(possessableId); auto possessable = Game::entityManager->GetEntity(possessableId);
if (possessable) { if (possessable) {
possessor->Dismount(possessable); possessor->Dismount(possessable);
} }
@ -638,10 +638,10 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
} }
if (echo) { if (echo) {
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
auto* attacker = EntityManager::Instance()->GetEntity(source); auto* attacker = Game::entityManager->GetEntity(source);
m_Parent->OnHit(attacker); m_Parent->OnHit(attacker);
m_Parent->OnHitOrHealResult(attacker, sourceDamage); m_Parent->OnHitOrHealResult(attacker, sourceDamage);
NotifySubscribers(attacker, sourceDamage); NotifySubscribers(attacker, sourceDamage);
@ -661,7 +661,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
} }
//check if hardcore mode is enabled //check if hardcore mode is enabled
if (EntityManager::Instance()->GetHardcoreMode()) { if (Game::entityManager->GetHardcoreMode()) {
DoHardcoreModeDrops(source); DoHardcoreModeDrops(source);
} }
@ -696,12 +696,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
SetArmor(0); SetArmor(0);
SetHealth(0); SetHealth(0);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
m_KillerID = source; m_KillerID = source;
auto* owner = EntityManager::Instance()->GetEntity(source); auto* owner = Game::entityManager->GetEntity(source);
if (owner != nullptr) { if (owner != nullptr) {
owner = owner->GetOwner(); // If the owner is overwritten, we collect that here owner = owner->GetOwner(); // If the owner is overwritten, we collect that here
@ -721,7 +721,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
if (missions != nullptr) { if (missions != nullptr) {
if (team != nullptr) { if (team != nullptr) {
for (const auto memberId : team->members) { for (const auto memberId : team->members) {
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = Game::entityManager->GetEntity(memberId);
if (member == nullptr) continue; if (member == nullptr) continue;
@ -761,12 +761,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
if (team->lootOption == 0) { // Round robin if (team->lootOption == 0) { // Round robin
specificOwner = TeamManager::Instance()->GetNextLootOwner(team); specificOwner = TeamManager::Instance()->GetNextLootOwner(team);
auto* member = EntityManager::Instance()->GetEntity(specificOwner); auto* member = Game::entityManager->GetEntity(specificOwner);
if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins()); if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
} else { } else {
for (const auto memberId : team->members) { // Free for all for (const auto memberId : team->members) { // Free for all
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = Game::entityManager->GetEntity(memberId);
if (member == nullptr) continue; if (member == nullptr) continue;
@ -797,12 +797,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
} }
} }
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); Entity* zoneControl = Game::entityManager->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
script->OnPlayerDied(zoneControl, m_Parent); script->OnPlayerDied(zoneControl, m_Parent);
} }
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
@ -965,7 +965,7 @@ void DestroyableComponent::FixStats() {
destroyableComponent->SetImagination(currentImagination); destroyableComponent->SetImagination(currentImagination);
// Serialize the entity // Serialize the entity
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
void DestroyableComponent::AddOnHitCallback(const std::function<void(Entity*)>& callback) { void DestroyableComponent::AddOnHitCallback(const std::function<void(Entity*)>& callback) {
@ -979,12 +979,12 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
auto* character = m_Parent->GetComponent<CharacterComponent>(); auto* character = m_Parent->GetComponent<CharacterComponent>();
auto uscore = character->GetUScore(); auto uscore = character->GetUScore();
auto uscoreToLose = uscore * (EntityManager::Instance()->GetHardcoreLoseUscoreOnDeathPercent() / 100); auto uscoreToLose = uscore * (Game::entityManager->GetHardcoreLoseUscoreOnDeathPercent() / 100);
character->SetUScore(uscore - uscoreToLose); character->SetUScore(uscore - uscoreToLose);
GameMessages::SendModifyLEGOScore(m_Parent, m_Parent->GetSystemAddress(), -uscoreToLose, eLootSourceType::MISSION); GameMessages::SendModifyLEGOScore(m_Parent, m_Parent->GetSystemAddress(), -uscoreToLose, eLootSourceType::MISSION);
if (EntityManager::Instance()->GetHardcoreDropinventoryOnDeath()) { if (Game::entityManager->GetHardcoreDropinventoryOnDeath()) {
//drop all items from inventory: //drop all items from inventory:
auto* inventory = m_Parent->GetComponent<InventoryComponent>(); auto* inventory = m_Parent->GetComponent<InventoryComponent>();
if (inventory) { if (inventory) {
@ -1001,7 +1001,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
GameMessages::SendDropClientLoot(m_Parent, source, item.second->GetLot(), 0, m_Parent->GetPosition(), item.second->GetCount()); GameMessages::SendDropClientLoot(m_Parent, source, item.second->GetLot(), 0, m_Parent->GetPosition(), item.second->GetCount());
item.second->SetCount(0, false, false); item.second->SetCount(0, false, false);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
} }
@ -1021,25 +1021,25 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
// Reload the player since we can't normally reduce uscore from the server and we want the UI to update // Reload the player since we can't normally reduce uscore from the server and we want the UI to update
// do this last so we don't get killed.... again // do this last so we don't get killed.... again
EntityManager::Instance()->DestructEntity(m_Parent); Game::entityManager->DestructEntity(m_Parent);
EntityManager::Instance()->ConstructEntity(m_Parent); Game::entityManager->ConstructEntity(m_Parent);
return; return;
} }
//award the player some u-score: //award the player some u-score:
auto* player = EntityManager::Instance()->GetEntity(source); auto* player = Game::entityManager->GetEntity(source);
if (player && player->IsPlayer()) { if (player && player->IsPlayer()) {
auto* playerStats = player->GetComponent<CharacterComponent>(); auto* playerStats = player->GetComponent<CharacterComponent>();
if (playerStats) { if (playerStats) {
//get the maximum health from this enemy: //get the maximum health from this enemy:
auto maxHealth = GetMaxHealth(); auto maxHealth = GetMaxHealth();
int uscore = maxHealth * EntityManager::Instance()->GetHardcoreUscoreEnemiesMultiplier(); int uscore = maxHealth * Game::entityManager->GetHardcoreUscoreEnemiesMultiplier();
playerStats->SetUScore(playerStats->GetUScore() + uscore); playerStats->SetUScore(playerStats->GetUScore() + uscore);
GameMessages::SendModifyLEGOScore(player, player->GetSystemAddress(), uscore, eLootSourceType::MISSION); GameMessages::SendModifyLEGOScore(player, player->GetSystemAddress(), uscore, eLootSourceType::MISSION);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
} }

View File

@ -826,7 +826,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
if (character != nullptr && !skipChecks) { if (character != nullptr && !skipChecks) {
// Hacky proximity rocket // Hacky proximity rocket
if (item->GetLot() == 6416) { if (item->GetLot() == 6416) {
const auto rocketLauchPads = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::ROCKET_LAUNCH); const auto rocketLauchPads = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::ROCKET_LAUNCH);
const auto position = m_Parent->GetPosition(); const auto position = m_Parent->GetPosition();
@ -887,7 +887,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
EquipScripts(item); EquipScripts(item);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void InventoryComponent::UnEquipItem(Item* item) { void InventoryComponent::UnEquipItem(Item* item) {
@ -917,7 +917,7 @@ void InventoryComponent::UnEquipItem(Item* item) {
UnequipScripts(item); UnequipScripts(item);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
// Trigger property event // Trigger property event
if (PropertyManagementComponent::Instance() != nullptr && item->GetCount() > 0 && Inventory::FindInventoryTypeForLot(item->GetLot()) == MODELS) { if (PropertyManagementComponent::Instance() != nullptr && item->GetCount() > 0 && Inventory::FindInventoryTypeForLot(item->GetLot()) == MODELS) {
@ -968,7 +968,7 @@ void InventoryComponent::HandlePossession(Item* item) {
if (possessorComponent->GetIsDismounting()) return; if (possessorComponent->GetIsDismounting()) return;
// Check to see if we are already mounting something // Check to see if we are already mounting something
auto* currentlyPossessedEntity = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* currentlyPossessedEntity = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
auto currentlyPossessedItem = possessorComponent->GetMountItemID(); auto currentlyPossessedItem = possessorComponent->GetMountItemID();
if (currentlyPossessedItem) { if (currentlyPossessedItem) {
@ -991,21 +991,11 @@ void InventoryComponent::HandlePossession(Item* item) {
info.rot = startRotation; info.rot = startRotation;
info.spawnerID = m_Parent->GetObjectID(); info.spawnerID = m_Parent->GetObjectID();
auto* mount = EntityManager::Instance()->CreateEntity(info, nullptr, m_Parent); auto* mount = Game::entityManager->CreateEntity(info, nullptr, m_Parent);
// Check to see if the mount is a vehicle, if so, flip it // Check to see if the mount is a vehicle, if so, flip it
auto* vehicleComponent = mount->GetComponent<VehiclePhysicsComponent>(); auto* vehicleComponent = mount->GetComponent<VehiclePhysicsComponent>();
if (vehicleComponent) { if (vehicleComponent) characterComponent->SetIsRacing(true);
auto angles = startRotation.GetEulerAngles();
// Make it right side up
angles.x -= PI;
// Make it going in the direction of the player
angles.y -= PI;
startRotation = NiQuaternion::FromEulerAngles(angles);
mount->SetRotation(startRotation);
// We're pod racing now
characterComponent->SetIsRacing(true);
}
// Setup the destroyable stats // Setup the destroyable stats
auto* destroyableComponent = mount->GetComponent<DestroyableComponent>(); auto* destroyableComponent = mount->GetComponent<DestroyableComponent>();
@ -1026,9 +1016,9 @@ void InventoryComponent::HandlePossession(Item* item) {
GameMessages::SendSetJetPackMode(m_Parent, false); GameMessages::SendSetJetPackMode(m_Parent, false);
// Make it go to the client // Make it go to the client
EntityManager::Instance()->ConstructEntity(mount); Game::entityManager->ConstructEntity(mount);
// Update the possessor // Update the possessor
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
// have to unlock the input so it vehicle can be driven // have to unlock the input so it vehicle can be driven
if (vehicleComponent) GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress()); if (vehicleComponent) GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
@ -1090,7 +1080,7 @@ void InventoryComponent::PopEquippedItems() {
destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth())); destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth()));
destroyableComponent->SetArmor(static_cast<int32_t>(destroyableComponent->GetMaxArmor())); destroyableComponent->SetArmor(static_cast<int32_t>(destroyableComponent->GetMaxArmor()));
destroyableComponent->SetImagination(static_cast<int32_t>(destroyableComponent->GetMaxImagination())); destroyableComponent->SetImagination(static_cast<int32_t>(destroyableComponent->GetMaxImagination()));
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
m_Dirty = true; m_Dirty = true;
@ -1266,7 +1256,7 @@ void InventoryComponent::SpawnPet(Item* item) {
info.rot = NiQuaternion::IDENTITY; info.rot = NiQuaternion::IDENTITY;
info.spawnerID = m_Parent->GetObjectID(); info.spawnerID = m_Parent->GetObjectID();
auto* pet = EntityManager::Instance()->CreateEntity(info); auto* pet = Game::entityManager->CreateEntity(info);
auto* petComponent = pet->GetComponent<PetComponent>(); auto* petComponent = pet->GetComponent<PetComponent>();
@ -1274,7 +1264,7 @@ void InventoryComponent::SpawnPet(Item* item) {
petComponent->Activate(item); petComponent->Activate(item);
} }
EntityManager::Instance()->ConstructEntity(pet); Game::entityManager->ConstructEntity(pet);
} }
void InventoryComponent::SetDatabasePet(LWOOBJID id, const DatabasePet& data) { void InventoryComponent::SetDatabasePet(LWOOBJID id, const DatabasePet& data) {
@ -1383,7 +1373,7 @@ void InventoryComponent::SetNPCItems(const std::vector<LOT>& items) {
UpdateSlot(info.equipLocation, { id, static_cast<LOT>(item), 1, slot++ }, true); UpdateSlot(info.equipLocation, { id, static_cast<LOT>(item), 1, slot++ }, true);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
InventoryComponent::~InventoryComponent() { InventoryComponent::~InventoryComponent() {

View File

@ -35,7 +35,7 @@ void LUPExhibitComponent::NextExhibit() {
m_Exhibit = m_Exhibits[m_ExhibitIndex]; m_Exhibit = m_Exhibits[m_ExhibitIndex];
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags) { void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags) {

View File

@ -149,7 +149,7 @@ nextAction:
SetVelocity(velocity); SetVelocity(velocity);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
const MovementAIInfo& MovementAIComponent::GetInfo() const { const MovementAIInfo& MovementAIComponent::GetInfo() const {
@ -221,7 +221,7 @@ bool MovementAIComponent::Warp(const NiPoint3& point) {
SetPosition(destination); SetPosition(destination);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
return true; return true;
} }
@ -253,7 +253,7 @@ void MovementAIComponent::Stop() {
m_CurrentSpeed = 0; m_CurrentSpeed = 0;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void MovementAIComponent::PullToPoint(const NiPoint3& point) { void MovementAIComponent::PullToPoint(const NiPoint3& point) {

View File

@ -133,7 +133,7 @@ void MovingPlatformComponent::SetMovementState(eMovementPlatformState value) {
subComponent->mState = value; subComponent->mState = value;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint) { void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint) {
@ -194,7 +194,7 @@ void MovingPlatformComponent::StartPathing() {
//GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS); //GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void MovingPlatformComponent::ContinuePathing() { void MovingPlatformComponent::ContinuePathing() {
@ -242,7 +242,7 @@ void MovingPlatformComponent::ContinuePathing() {
subComponent->mCurrentWaypointIndex = pathSize; subComponent->mCurrentWaypointIndex = pathSize;
switch (behavior) { switch (behavior) {
case PathBehavior::Once: case PathBehavior::Once:
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
return; return;
case PathBehavior::Bounce: case PathBehavior::Bounce:
@ -304,7 +304,7 @@ void MovingPlatformComponent::ContinuePathing() {
ContinuePathing(); ContinuePathing();
}); });
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void MovingPlatformComponent::StopPathing() { void MovingPlatformComponent::StopPathing() {
@ -318,7 +318,7 @@ void MovingPlatformComponent::StopPathing() {
subComponent->mDesiredWaypointIndex = -1; subComponent->mDesiredWaypointIndex = -1;
subComponent->mShouldStopAtDesiredWaypoint = false; subComponent->mShouldStopAtDesiredWaypoint = false;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
//GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS); //GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
} }
@ -341,7 +341,7 @@ void MovingPlatformComponent::WarpToWaypoint(size_t index) {
m_Parent->SetPosition(waypoint.position); m_Parent->SetPosition(waypoint.position);
m_Parent->SetRotation(waypoint.rotation); m_Parent->SetRotation(waypoint.rotation);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
size_t MovingPlatformComponent::GetLastWaypointIndex() const { size_t MovingPlatformComponent::GetLastWaypointIndex() const {

View File

@ -154,7 +154,7 @@ void PetComponent::OnUse(Entity* originator) {
} }
if (m_Tamer != LWOOBJID_EMPTY) { if (m_Tamer != LWOOBJID_EMPTY) {
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer); auto* tamer = Game::entityManager->GetEntity(m_Tamer);
if (tamer != nullptr) { if (tamer != nullptr) {
return; return;
@ -344,7 +344,7 @@ void PetComponent::Update(float deltaTime) {
if (m_Timer <= 0) { if (m_Timer <= 0) {
Wander(); Wander();
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} else { } else {
m_Timer = 5; m_Timer = 5;
@ -369,7 +369,7 @@ void PetComponent::Update(float deltaTime) {
} }
if (m_TresureTime > 0) { if (m_TresureTime > 0) {
auto* tresure = EntityManager::Instance()->GetEntity(m_Interaction); auto* tresure = Game::entityManager->GetEntity(m_Interaction);
if (tresure == nullptr) { if (tresure == nullptr) {
m_TresureTime = 0; m_TresureTime = 0;
@ -476,7 +476,7 @@ skipTresure:
void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) { void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) {
if (m_Tamer == LWOOBJID_EMPTY) return; if (m_Tamer == LWOOBJID_EMPTY) return;
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer); auto* tamer = Game::entityManager->GetEntity(m_Tamer);
if (tamer == nullptr) { if (tamer == nullptr) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
@ -498,7 +498,7 @@ void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) {
destroyableComponent->SetImagination(imagination); destroyableComponent->SetImagination(imagination);
EntityManager::Instance()->SerializeEntity(tamer); Game::entityManager->SerializeEntity(tamer);
if (clientFailed) { if (clientFailed) {
if (imagination < cached->second.imaginationCost) { if (imagination < cached->second.imaginationCost) {
@ -516,7 +516,7 @@ void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) {
void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) { void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
if (m_Tamer == LWOOBJID_EMPTY) return; if (m_Tamer == LWOOBJID_EMPTY) return;
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer); auto* tamer = Game::entityManager->GetEntity(m_Tamer);
if (tamer == nullptr) { if (tamer == nullptr) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
@ -539,11 +539,11 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
info.rot = NiQuaternion::IDENTITY; info.rot = NiQuaternion::IDENTITY;
info.spawnerID = tamer->GetObjectID(); info.spawnerID = tamer->GetObjectID();
auto* modelEntity = EntityManager::Instance()->CreateEntity(info); auto* modelEntity = Game::entityManager->CreateEntity(info);
m_ModelId = modelEntity->GetObjectID(); m_ModelId = modelEntity->GetObjectID();
EntityManager::Instance()->ConstructEntity(modelEntity); Game::entityManager->ConstructEntity(modelEntity);
GameMessages::SendNotifyTamingModelLoadedOnServer(m_Tamer, tamer->GetSystemAddress()); GameMessages::SendNotifyTamingModelLoadedOnServer(m_Tamer, tamer->GetSystemAddress());
@ -639,7 +639,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
return; return;
} }
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer); auto* tamer = Game::entityManager->GetEntity(m_Tamer);
if (tamer == nullptr) { if (tamer == nullptr) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
@ -661,7 +661,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
//Save our pet's new name to the db: //Save our pet's new name to the db:
SetPetNameForModeration(GeneralUtils::UTF16ToWTF8(name)); SetPetNameForModeration(GeneralUtils::UTF16ToWTF8(name));
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
std::u16string u16name = GeneralUtils::UTF8ToUTF16(m_Name); std::u16string u16name = GeneralUtils::UTF8ToUTF16(m_Name);
std::u16string u16ownerName = GeneralUtils::UTF8ToUTF16(m_OwnerName); std::u16string u16ownerName = GeneralUtils::UTF8ToUTF16(m_OwnerName);
@ -684,7 +684,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID()); GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
auto* modelEntity = EntityManager::Instance()->GetEntity(m_ModelId); auto* modelEntity = Game::entityManager->GetEntity(m_ModelId);
if (modelEntity != nullptr) { if (modelEntity != nullptr) {
modelEntity->Smash(m_Tamer); modelEntity->Smash(m_Tamer);
@ -703,7 +703,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) { void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
if (m_Tamer == LWOOBJID_EMPTY) return; if (m_Tamer == LWOOBJID_EMPTY) return;
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer); auto* tamer = Game::entityManager->GetEntity(m_Tamer);
if (tamer == nullptr) { if (tamer == nullptr) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
@ -733,7 +733,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
m_Timer = 0; m_Timer = 0;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
// Notify the end of a pet taming minigame // Notify the end of a pet taming minigame
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
@ -754,7 +754,7 @@ void PetComponent::StartTimer() {
void PetComponent::ClientFailTamingMinigame() { void PetComponent::ClientFailTamingMinigame() {
if (m_Tamer == LWOOBJID_EMPTY) return; if (m_Tamer == LWOOBJID_EMPTY) return;
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer); auto* tamer = Game::entityManager->GetEntity(m_Tamer);
if (tamer == nullptr) { if (tamer == nullptr) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
@ -784,7 +784,7 @@ void PetComponent::ClientFailTamingMinigame() {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
m_Timer = 0; m_Timer = 0;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
// Notify the end of a pet taming minigame // Notify the end of a pet taming minigame
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
@ -887,7 +887,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) {
m_Timer = 3; m_Timer = 3;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
owner->GetCharacter()->SetPlayerFlag(ePlayerFlag::FIRST_MANUAL_PET_HIBERNATE, true); owner->GetCharacter()->SetPlayerFlag(ePlayerFlag::FIRST_MANUAL_PET_HIBERNATE, true);
@ -1004,7 +1004,7 @@ LWOOBJID PetComponent::GetOwnerId() const {
} }
Entity* PetComponent::GetOwner() const { Entity* PetComponent::GetOwner() const {
return EntityManager::Instance()->GetEntity(m_Owner); return Game::entityManager->GetEntity(m_Owner);
} }
LWOOBJID PetComponent::GetDatabaseId() const { LWOOBJID PetComponent::GetDatabaseId() const {
@ -1046,7 +1046,7 @@ PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer) {
return nullptr; return nullptr;
} }
auto* entity = EntityManager::Instance()->GetEntity(pair->second); auto* entity = Game::entityManager->GetEntity(pair->second);
if (entity == nullptr) { if (entity == nullptr) {
currentActivities.erase(tamer); currentActivities.erase(tamer);
@ -1064,7 +1064,7 @@ PetComponent* PetComponent::GetActivePet(LWOOBJID owner) {
return nullptr; return nullptr;
} }
auto* entity = EntityManager::Instance()->GetEntity(pair->second); auto* entity = Game::entityManager->GetEntity(pair->second);
if (entity == nullptr) { if (entity == nullptr) {
activePets.erase(owner); activePets.erase(owner);

View File

@ -362,7 +362,7 @@ void PhantomPhysicsComponent::Update(float deltaTime) {
//If we are a respawn volume, inform the client: //If we are a respawn volume, inform the client:
if (m_IsRespawnVolume) { if (m_IsRespawnVolume) {
auto entity = EntityManager::Instance()->GetEntity(en->GetObjectID()); auto entity = Game::entityManager->GetEntity(en->GetObjectID());
if (entity) { if (entity) {
GameMessages::SendPlayerReachedRespawnCheckpoint(entity, m_RespawnPos, m_RespawnRot); GameMessages::SendPlayerReachedRespawnCheckpoint(entity, m_RespawnPos, m_RespawnRot);
@ -403,8 +403,8 @@ void PhantomPhysicsComponent::SpawnVertices() {
info.spawnerID = m_Parent->GetObjectID(); info.spawnerID = m_Parent->GetObjectID();
info.spawnerNodeID = 0; info.spawnerNodeID = 0;
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr); Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
EntityManager::Instance()->ConstructEntity(newEntity); Game::entityManager->ConstructEntity(newEntity);
} }
} }

View File

@ -13,7 +13,7 @@ PossessorComponent::PossessorComponent(Entity* parent) : Component(parent) {
PossessorComponent::~PossessorComponent() { PossessorComponent::~PossessorComponent() {
if (m_Possessable != LWOOBJID_EMPTY) { if (m_Possessable != LWOOBJID_EMPTY) {
auto* mount = EntityManager::Instance()->GetEntity(m_Possessable); auto* mount = Game::entityManager->GetEntity(m_Possessable);
if (mount) { if (mount) {
auto* possessable = mount->GetComponent<PossessableComponent>(); auto* possessable = mount->GetComponent<PossessableComponent>();
if (possessable) { if (possessable) {
@ -58,8 +58,8 @@ void PossessorComponent::Mount(Entity* mount) {
GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress()); GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
GameMessages::SendSetStunned(m_Parent->GetObjectID(), eStateChangeType::PUSH, m_Parent->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true); GameMessages::SendSetStunned(m_Parent->GetObjectID(), eStateChangeType::PUSH, m_Parent->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
EntityManager::Instance()->SerializeEntity(mount); Game::entityManager->SerializeEntity(mount);
} }
void PossessorComponent::Dismount(Entity* mount, bool forceDismount) { void PossessorComponent::Dismount(Entity* mount, bool forceDismount) {
@ -73,8 +73,8 @@ void PossessorComponent::Dismount(Entity* mount, bool forceDismount) {
possessableComponent->SetPossessor(LWOOBJID_EMPTY); possessableComponent->SetPossessor(LWOOBJID_EMPTY);
if (forceDismount) possessableComponent->ForceDepossess(); if (forceDismount) possessableComponent->ForceDepossess();
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
EntityManager::Instance()->SerializeEntity(mount); Game::entityManager->SerializeEntity(mount);
auto characterComponent = m_Parent->GetComponent<CharacterComponent>(); auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
if (characterComponent) characterComponent->SetIsRacing(false); if (characterComponent) characterComponent->SetIsRacing(false);

View File

@ -90,7 +90,7 @@ LWOOBJID PropertyManagementComponent::GetOwnerId() const {
} }
Entity* PropertyManagementComponent::GetOwner() const { Entity* PropertyManagementComponent::GetOwner() const {
return EntityManager::Instance()->GetEntity(owner); return Game::entityManager->GetEntity(owner);
} }
void PropertyManagementComponent::SetOwner(Entity* value) { void PropertyManagementComponent::SetOwner(Entity* value) {
@ -185,7 +185,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) {
return false; return false;
} }
auto* entity = EntityManager::Instance()->GetEntity(playerId); auto* entity = Game::entityManager->GetEntity(playerId);
auto* user = entity->GetParentUser(); auto* user = entity->GetParentUser();
@ -256,7 +256,7 @@ void PropertyManagementComponent::OnStartBuilding() {
LWOMAPID zoneId = 1100; LWOMAPID zoneId = 1100;
const auto entrance = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_ENTRANCE); const auto entrance = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_ENTRANCE);
originalPrivacyOption = privacyOption; originalPrivacyOption = privacyOption;
@ -339,9 +339,9 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
info.settings.push_back(setting->Copy()); info.settings.push_back(setting->Copy());
} }
Entity* newEntity = EntityManager::Instance()->CreateEntity(info); Entity* newEntity = Game::entityManager->CreateEntity(info);
if (newEntity != nullptr) { if (newEntity != nullptr) {
EntityManager::Instance()->ConstructEntity(newEntity); Game::entityManager->ConstructEntity(newEntity);
// Make sure the propMgmt doesn't delete our model after the server dies // Make sure the propMgmt doesn't delete our model after the server dies
// Trying to do this after the entity is constructed. Shouldn't really change anything but // Trying to do this after the entity is constructed. Shouldn't really change anything but
@ -371,7 +371,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
info.respawnTime = 10; info.respawnTime = 10;
info.emulated = true; info.emulated = true;
info.emulator = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(); info.emulator = Game::entityManager->GetZoneControlEntity()->GetObjectID();
info.spawnerID = persistentId; info.spawnerID = persistentId;
GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT); GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT);
@ -401,7 +401,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->GetZoneControlEntity()->OnZonePropertyModelPlaced(entity); Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelPlaced(entity);
}); });
// Progress place model missions // Progress place model missions
auto missionComponent = entity->GetComponent<MissionComponent>(); auto missionComponent = entity->GetComponent<MissionComponent>();
@ -441,7 +441,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
Game::logger->Log("PropertyManagementComponent", "Failed to find spawner"); Game::logger->Log("PropertyManagementComponent", "Failed to find spawner");
} }
auto* model = EntityManager::Instance()->GetEntity(id); auto* model = Game::entityManager->GetEntity(id);
if (model == nullptr) { if (model == nullptr) {
Game::logger->Log("PropertyManagementComponent", "Failed to find model entity"); Game::logger->Log("PropertyManagementComponent", "Failed to find model entity");
@ -449,7 +449,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
return; return;
} }
EntityManager::Instance()->DestructEntity(model); Game::entityManager->DestructEntity(model);
Game::logger->Log("PropertyManagementComponent", "Deleting model LOT %i", model->GetLOT()); Game::logger->Log("PropertyManagementComponent", "Deleting model LOT %i", model->GetLOT());
@ -520,13 +520,13 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
item->Equip(); item->Equip();
GameMessages::SendUGCEquipPostDeleteBasedOnEditMode(entity->GetObjectID(), entity->GetSystemAddress(), item->GetId(), item->GetCount()); GameMessages::SendUGCEquipPostDeleteBasedOnEditMode(entity->GetObjectID(), entity->GetSystemAddress(), item->GetId(), item->GetCount());
EntityManager::Instance()->GetZoneControlEntity()->OnZonePropertyModelPickedUp(entity); Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelPickedUp(entity);
break; break;
} }
case 1: // Return to inv case 1: // Return to inv
{ {
EntityManager::Instance()->GetZoneControlEntity()->OnZonePropertyModelRemoved(entity); Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelRemoved(entity);
break; break;
} }
@ -613,7 +613,7 @@ void PropertyManagementComponent::Load() {
info.respawnTime = 10; info.respawnTime = 10;
//info.emulated = true; //info.emulated = true;
//info.emulator = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(); //info.emulator = Game::entityManager->GetZoneControlEntity()->GetObjectID();
info.spawnerID = id; info.spawnerID = id;
@ -698,7 +698,7 @@ void PropertyManagementComponent::Save() {
modelIds.push_back(id); modelIds.push_back(id);
auto* entity = EntityManager::Instance()->GetEntity(pair.first); auto* entity = Game::entityManager->GetEntity(pair.first);
if (entity == nullptr) { if (entity == nullptr) {
continue; continue;

View File

@ -109,7 +109,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
auto* path = dZoneManager::Instance()->GetZone()->GetPath( auto* path = dZoneManager::Instance()->GetZone()->GetPath(
GeneralUtils::UTF16ToWTF8(m_PathName)); GeneralUtils::UTF16ToWTF8(m_PathName));
auto spawnPointEntities = EntityManager::Instance()->GetEntitiesByLOT(4843); auto spawnPointEntities = Game::entityManager->GetEntitiesByLOT(4843);
auto startPosition = NiPoint3::ZERO; auto startPosition = NiPoint3::ZERO;
auto startRotation = NiQuaternion::IDENTITY; auto startRotation = NiQuaternion::IDENTITY;
const std::string placementAsString = std::to_string(positionNumber); const std::string placementAsString = std::to_string(positionNumber);
@ -136,7 +136,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
info.spawnerID = m_Parent->GetObjectID(); info.spawnerID = m_Parent->GetObjectID();
auto* carEntity = auto* carEntity =
EntityManager::Instance()->CreateEntity(info, nullptr, m_Parent); Game::entityManager->CreateEntity(info, nullptr, m_Parent);
// Make the vehicle a child of the racing controller. // Make the vehicle a child of the racing controller.
m_Parent->AddChild(carEntity); m_Parent->AddChild(carEntity);
@ -207,9 +207,9 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
// Construct and serialize everything when done. // Construct and serialize everything when done.
EntityManager::Instance()->ConstructEntity(carEntity); Game::entityManager->ConstructEntity(carEntity);
EntityManager::Instance()->SerializeEntity(player); Game::entityManager->SerializeEntity(player);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
GameMessages::SendRacingSetPlayerResetInfo( GameMessages::SendRacingSetPlayerResetInfo(
m_Parent->GetObjectID(), 0, 0, player->GetObjectID(), startPosition, 1, m_Parent->GetObjectID(), 0, 0, player->GetObjectID(), startPosition, 1,
@ -220,7 +220,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
// Reset the player to the start position during downtime, in case something // Reset the player to the start position during downtime, in case something
// went wrong. // went wrong.
m_Parent->AddCallbackTimer(1, [this, playerID]() { m_Parent->AddCallbackTimer(1, [this, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) { if (player == nullptr) {
return; return;
@ -269,7 +269,7 @@ void RacingControlComponent::OnRacingClientReady(Entity* player) {
racingPlayer.vehicleID, UNASSIGNED_SYSTEM_ADDRESS); racingPlayer.vehicleID, UNASSIGNED_SYSTEM_ADDRESS);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void RacingControlComponent::OnRequestDie(Entity* player) { void RacingControlComponent::OnRequestDie(Entity* player) {
@ -282,7 +282,7 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
} }
auto* vehicle = auto* vehicle =
EntityManager::Instance()->GetEntity(racingPlayer.vehicleID); Game::entityManager->GetEntity(racingPlayer.vehicleID);
if (!vehicle) return; if (!vehicle) return;
@ -319,8 +319,8 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>(); auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
// Reset imagination to half its current value, rounded up to the nearest value divisible by 10, as it was done in live. // Reset imagination to half its current value, rounded up to the nearest value divisible by 10, as it was done in live.
if (destroyableComponent) destroyableComponent->SetImagination(respawnImagination); if (destroyableComponent) destroyableComponent->SetImagination(respawnImagination);
EntityManager::Instance()->SerializeEntity(vehicle); Game::entityManager->SerializeEntity(vehicle);
}); });
auto* characterComponent = player->GetComponent<CharacterComponent>(); auto* characterComponent = player->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) { if (characterComponent != nullptr) {
@ -348,7 +348,7 @@ void RacingControlComponent::OnRacingPlayerInfoResetFinished(Entity* player) {
} }
auto* vehicle = auto* vehicle =
EntityManager::Instance()->GetEntity(racingPlayer.vehicleID); Game::entityManager->GetEntity(racingPlayer.vehicleID);
if (vehicle == nullptr) { if (vehicle == nullptr) {
return; return;
@ -401,7 +401,7 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
} }
} }
} else if ((id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") && button == m_ActivityExitConfirm) { } else if ((id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") && button == m_ActivityExitConfirm) {
auto* vehicle = EntityManager::Instance()->GetEntity(data->vehicleID); auto* vehicle = Game::entityManager->GetEntity(data->vehicleID);
if (vehicle == nullptr) { if (vehicle == nullptr) {
return; return;
@ -502,7 +502,7 @@ void RacingControlComponent::Update(float deltaTime) {
// Check if any players has disconnected before loading in // Check if any players has disconnected before loading in
for (size_t i = 0; i < m_LobbyPlayers.size(); i++) { for (size_t i = 0; i < m_LobbyPlayers.size(); i++) {
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(m_LobbyPlayers[i]); Game::entityManager->GetEntity(m_LobbyPlayers[i]);
if (playerEntity == nullptr) { if (playerEntity == nullptr) {
--m_LoadedPlayers; --m_LoadedPlayers;
@ -524,7 +524,7 @@ void RacingControlComponent::Update(float deltaTime) {
if (m_EmptyTimer >= 30) { if (m_EmptyTimer >= 30) {
for (const auto player : m_LobbyPlayers) { for (const auto player : m_LobbyPlayers) {
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(player); Game::entityManager->GetEntity(player);
if (playerEntity == nullptr) { if (playerEntity == nullptr) {
continue; continue;
@ -549,7 +549,7 @@ void RacingControlComponent::Update(float deltaTime) {
"Loading player now!"); "Loading player now!");
auto* player = auto* player =
EntityManager::Instance()->GetEntity(m_LobbyPlayers[positionNumber]); Game::entityManager->GetEntity(m_LobbyPlayers[positionNumber]);
if (player == nullptr) { if (player == nullptr) {
return; return;
@ -573,7 +573,7 @@ void RacingControlComponent::Update(float deltaTime) {
if (!m_Started) { if (!m_Started) {
// Check if anyone has disconnected during this period // Check if anyone has disconnected during this period
for (size_t i = 0; i < m_RacingPlayers.size(); i++) { for (size_t i = 0; i < m_RacingPlayers.size(); i++) {
auto* playerEntity = EntityManager::Instance()->GetEntity( auto* playerEntity = Game::entityManager->GetEntity(
m_RacingPlayers[i].playerID); m_RacingPlayers[i].playerID);
if (playerEntity == nullptr) { if (playerEntity == nullptr) {
@ -589,7 +589,7 @@ void RacingControlComponent::Update(float deltaTime) {
if (m_LoadedPlayers < 2 && !(m_LoadedPlayers == 1 && m_SoloRacing)) { if (m_LoadedPlayers < 2 && !(m_LoadedPlayers == 1 && m_SoloRacing)) {
for (const auto player : m_LobbyPlayers) { for (const auto player : m_LobbyPlayers) {
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(player); Game::entityManager->GetEntity(player);
if (playerEntity == nullptr) { if (playerEntity == nullptr) {
continue; continue;
@ -622,9 +622,9 @@ void RacingControlComponent::Update(float deltaTime) {
for (const auto& player : m_RacingPlayers) { for (const auto& player : m_RacingPlayers) {
auto* vehicle = auto* vehicle =
EntityManager::Instance()->GetEntity(player.vehicleID); Game::entityManager->GetEntity(player.vehicleID);
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(player.playerID); Game::entityManager->GetEntity(player.playerID);
if (vehicle != nullptr && playerEntity != nullptr) { if (vehicle != nullptr && playerEntity != nullptr) {
GameMessages::SendTeleport( GameMessages::SendTeleport(
@ -642,8 +642,8 @@ void RacingControlComponent::Update(float deltaTime) {
destroyableComponent->SetImagination(0); destroyableComponent->SetImagination(0);
} }
EntityManager::Instance()->SerializeEntity(vehicle); Game::entityManager->SerializeEntity(vehicle);
EntityManager::Instance()->SerializeEntity( Game::entityManager->SerializeEntity(
playerEntity); playerEntity);
} }
} }
@ -669,9 +669,9 @@ void RacingControlComponent::Update(float deltaTime) {
// Reset players to their start location, without smashing them // Reset players to their start location, without smashing them
for (auto& player : m_RacingPlayers) { for (auto& player : m_RacingPlayers) {
auto* vehicleEntity = auto* vehicleEntity =
EntityManager::Instance()->GetEntity(player.vehicleID); Game::entityManager->GetEntity(player.vehicleID);
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(player.playerID); Game::entityManager->GetEntity(player.playerID);
if (vehicleEntity == nullptr || playerEntity == nullptr) { if (vehicleEntity == nullptr || playerEntity == nullptr) {
continue; continue;
@ -688,9 +688,9 @@ void RacingControlComponent::Update(float deltaTime) {
// Activate the players movement // Activate the players movement
for (auto& player : m_RacingPlayers) { for (auto& player : m_RacingPlayers) {
auto* vehicleEntity = auto* vehicleEntity =
EntityManager::Instance()->GetEntity(player.vehicleID); Game::entityManager->GetEntity(player.vehicleID);
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(player.playerID); Game::entityManager->GetEntity(player.playerID);
if (vehicleEntity == nullptr || playerEntity == nullptr) { if (vehicleEntity == nullptr || playerEntity == nullptr) {
continue; continue;
@ -708,7 +708,7 @@ void RacingControlComponent::Update(float deltaTime) {
Game::logger->Log("RacingControlComponent", "Starting race"); Game::logger->Log("RacingControlComponent", "Starting race");
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
m_StartTime = std::time(nullptr); m_StartTime = std::time(nullptr);
} }
@ -726,9 +726,9 @@ void RacingControlComponent::Update(float deltaTime) {
GeneralUtils::UTF16ToWTF8(m_PathName)); GeneralUtils::UTF16ToWTF8(m_PathName));
for (auto& player : m_RacingPlayers) { for (auto& player : m_RacingPlayers) {
auto* vehicle = EntityManager::Instance()->GetEntity(player.vehicleID); auto* vehicle = Game::entityManager->GetEntity(player.vehicleID);
auto* playerEntity = auto* playerEntity =
EntityManager::Instance()->GetEntity(player.playerID); Game::entityManager->GetEntity(player.playerID);
if (vehicle == nullptr || playerEntity == nullptr) { if (vehicle == nullptr || playerEntity == nullptr) {
continue; continue;

View File

@ -68,7 +68,7 @@ void RailActivatorComponent::OnUse(Entity* originator) {
const auto originatorID = originator->GetObjectID(); const auto originatorID = originator->GetObjectID();
m_Parent->AddCallbackTimer(animationLength, [originatorID, this]() { m_Parent->AddCallbackTimer(animationLength, [originatorID, this]() {
auto* originator = EntityManager::Instance()->GetEntity(originatorID); auto* originator = Game::entityManager->GetEntity(originatorID);
if (originator == nullptr) { if (originator == nullptr) {
return; return;

View File

@ -120,7 +120,7 @@ void RebuildComponent::Update(float deltaTime) {
else { else {
m_SoftTimer = 5.0f; m_SoftTimer = 5.0f;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
}*/ }*/
switch (m_State) { switch (m_State) {
@ -139,7 +139,7 @@ void RebuildComponent::Update(float deltaTime) {
if (m_TimerIncomplete >= m_TimeBeforeSmash - 4.0f) { if (m_TimerIncomplete >= m_TimeBeforeSmash - 4.0f) {
m_ShowResetEffect = true; m_ShowResetEffect = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
if (m_TimerIncomplete >= m_TimeBeforeSmash) { if (m_TimerIncomplete >= m_TimeBeforeSmash) {
@ -163,7 +163,7 @@ void RebuildComponent::Update(float deltaTime) {
if (!m_ShowResetEffect) { if (!m_ShowResetEffect) {
m_ShowResetEffect = true; m_ShowResetEffect = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
@ -206,7 +206,7 @@ void RebuildComponent::Update(float deltaTime) {
++m_DrainedImagination; ++m_DrainedImagination;
--newImagination; --newImagination;
destComp->SetImagination(newImagination); destComp->SetImagination(newImagination);
EntityManager::Instance()->SerializeEntity(builder); Game::entityManager->SerializeEntity(builder);
} }
@ -225,7 +225,7 @@ void RebuildComponent::Update(float deltaTime) {
if (m_TimerIncomplete >= m_TimeBeforeSmash - 4.0f) { if (m_TimerIncomplete >= m_TimeBeforeSmash - 4.0f) {
m_ShowResetEffect = true; m_ShowResetEffect = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
if (m_TimerIncomplete >= m_TimeBeforeSmash) { if (m_TimerIncomplete >= m_TimeBeforeSmash) {
@ -263,20 +263,20 @@ void RebuildComponent::SpawnActivator() {
info.spawnerID = m_Parent->GetObjectID(); info.spawnerID = m_Parent->GetObjectID();
info.pos = m_ActivatorPosition == NiPoint3::ZERO ? m_Parent->GetPosition() : m_ActivatorPosition; info.pos = m_ActivatorPosition == NiPoint3::ZERO ? m_Parent->GetPosition() : m_ActivatorPosition;
m_Activator = EntityManager::Instance()->CreateEntity(info, nullptr, m_Parent); m_Activator = Game::entityManager->CreateEntity(info, nullptr, m_Parent);
if (m_Activator) { if (m_Activator) {
m_ActivatorId = m_Activator->GetObjectID(); m_ActivatorId = m_Activator->GetObjectID();
EntityManager::Instance()->ConstructEntity(m_Activator); Game::entityManager->ConstructEntity(m_Activator);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
} }
void RebuildComponent::DespawnActivator() { void RebuildComponent::DespawnActivator() {
if (m_Activator) { if (m_Activator) {
EntityManager::Instance()->DestructEntity(m_Activator); Game::entityManager->DestructEntity(m_Activator);
m_Activator->ScheduleKillAfterUpdate(); m_Activator->ScheduleKillAfterUpdate();
@ -287,7 +287,7 @@ void RebuildComponent::DespawnActivator() {
} }
Entity* RebuildComponent::GetActivator() { Entity* RebuildComponent::GetActivator() {
return EntityManager::Instance()->GetEntity(m_ActivatorId); return Game::entityManager->GetEntity(m_ActivatorId);
} }
NiPoint3 RebuildComponent::GetActivatorPosition() { NiPoint3 RebuildComponent::GetActivatorPosition() {
@ -335,7 +335,7 @@ eRebuildState RebuildComponent::GetState() {
} }
Entity* RebuildComponent::GetBuilder() const { Entity* RebuildComponent::GetBuilder() const {
auto* builder = EntityManager::Instance()->GetEntity(m_Builder); auto* builder = Game::entityManager->GetEntity(m_Builder);
return builder; return builder;
} }
@ -403,14 +403,14 @@ void RebuildComponent::StartRebuild(Entity* user) {
auto* character = user->GetComponent<CharacterComponent>(); auto* character = user->GetComponent<CharacterComponent>();
character->SetCurrentActivity(eGameActivity::QUICKBUILDING); character->SetCurrentActivity(eGameActivity::QUICKBUILDING);
EntityManager::Instance()->SerializeEntity(user); Game::entityManager->SerializeEntity(user);
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::BUILDING, user->GetObjectID()); GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::BUILDING, user->GetObjectID());
GameMessages::SendEnableRebuild(m_Parent, true, false, false, eQuickBuildFailReason::NOT_GIVEN, 0.0f, user->GetObjectID()); GameMessages::SendEnableRebuild(m_Parent, true, false, false, eQuickBuildFailReason::NOT_GIVEN, 0.0f, user->GetObjectID());
m_State = eRebuildState::BUILDING; m_State = eRebuildState::BUILDING;
m_StateDirty = true; m_StateDirty = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
auto* movingPlatform = m_Parent->GetComponent<MovingPlatformComponent>(); auto* movingPlatform = m_Parent->GetComponent<MovingPlatformComponent>();
if (movingPlatform != nullptr) { if (movingPlatform != nullptr) {
@ -443,7 +443,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
return; return;
} }
EntityManager::Instance()->SerializeEntity(user); Game::entityManager->SerializeEntity(user);
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::COMPLETED, user->GetObjectID()); GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::COMPLETED, user->GetObjectID());
GameMessages::SendPlayFXEffect(m_Parent, 507, u"create", "BrickFadeUpVisCompleteEffect", LWOOBJID_EMPTY, 0.4f, 1.0f, true); GameMessages::SendPlayFXEffect(m_Parent, 507, u"create", "BrickFadeUpVisCompleteEffect", LWOOBJID_EMPTY, 0.4f, 1.0f, true);
@ -456,7 +456,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
m_Timer = 0.0f; m_Timer = 0.0f;
m_DrainedImagination = 0; m_DrainedImagination = 0;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
// Removes extra item requirements, isn't live accurate. // Removes extra item requirements, isn't live accurate.
// In live, all items were removed at the start of the quickbuild, then returned if it was cancelled. // In live, all items were removed at the start of the quickbuild, then returned if it was cancelled.
@ -476,7 +476,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
auto* team = TeamManager::Instance()->GetTeam(builder->GetObjectID()); auto* team = TeamManager::Instance()->GetTeam(builder->GetObjectID());
if (team) { if (team) {
for (const auto memberId : team->members) { // progress missions for all team members for (const auto memberId : team->members) { // progress missions for all team members
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = Game::entityManager->GetEntity(memberId);
if (member) { if (member) {
auto* missionComponent = member->GetComponent<MissionComponent>(); auto* missionComponent = member->GetComponent<MissionComponent>();
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId); if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
@ -541,7 +541,7 @@ void RebuildComponent::ResetRebuild(bool failed) {
m_ShowResetEffect = false; m_ShowResetEffect = false;
m_DrainedImagination = 0; m_DrainedImagination = 0;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
// Notify scripts and possible subscribers // Notify scripts and possible subscribers
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) for (auto* script : CppScripts::GetEntityScripts(m_Parent))
@ -581,7 +581,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR
for (const auto& cb : m_RebuildStateCallbacks) for (const auto& cb : m_RebuildStateCallbacks)
cb(m_State); cb(m_State);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
if (entity == nullptr) { if (entity == nullptr) {
@ -591,7 +591,7 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR
CharacterComponent* characterComponent = entity->GetComponent<CharacterComponent>(); CharacterComponent* characterComponent = entity->GetComponent<CharacterComponent>();
if (characterComponent) { if (characterComponent) {
characterComponent->SetCurrentActivity(eGameActivity::NONE); characterComponent->SetCurrentActivity(eGameActivity::NONE);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
} }

View File

@ -81,7 +81,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
GameMessages::SendChangeObjectWorldState(rocket->GetId(), eObjectWorldState::ATTACHED, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendChangeObjectWorldState(rocket->GetId(), eObjectWorldState::ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->SerializeEntity(originator); Game::entityManager->SerializeEntity(originator);
} }
void RocketLaunchpadControlComponent::OnUse(Entity* originator) { void RocketLaunchpadControlComponent::OnUse(Entity* originator) {

View File

@ -137,7 +137,7 @@ void ScriptedActivityComponent::PlayerJoin(Entity* player) {
instance->AddParticipant(player); instance->AddParticipant(player);
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void ScriptedActivityComponent::PlayerJoinLobby(Entity* player) { void ScriptedActivityComponent::PlayerJoinLobby(Entity* player) {
@ -445,7 +445,7 @@ void ScriptedActivityComponent::RemoveActivityPlayerData(LWOOBJID playerID) {
m_ActivityPlayers[i] = nullptr; m_ActivityPlayers[i] = nullptr;
m_ActivityPlayers.erase(m_ActivityPlayers.begin() + i); m_ActivityPlayers.erase(m_ActivityPlayers.begin() + i);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
return; return;
} }
@ -458,7 +458,7 @@ ActivityPlayer* ScriptedActivityComponent::AddActivityPlayerData(LWOOBJID player
return data; return data;
m_ActivityPlayers.push_back(new ActivityPlayer{ playerID, {} }); m_ActivityPlayers.push_back(new ActivityPlayer{ playerID, {} });
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
return GetActivityPlayerData(playerID); return GetActivityPlayerData(playerID);
} }
@ -480,7 +480,7 @@ void ScriptedActivityComponent::SetActivityValue(LWOOBJID playerID, uint32_t ind
data->values[std::min(index, (uint32_t)9)] = value; data->values[std::min(index, (uint32_t)9)] = value;
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void ScriptedActivityComponent::PlayerRemove(LWOOBJID playerID) { void ScriptedActivityComponent::PlayerRemove(LWOOBJID playerID) {
@ -535,7 +535,7 @@ void ActivityInstance::StartZone() {
const auto objid = player->GetObjectID(); const auto objid = player->GetObjectID();
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, m_ActivityInfo.instanceMapID, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, m_ActivityInfo.instanceMapID, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
auto* player = EntityManager::Instance()->GetEntity(objid); auto* player = Game::entityManager->GetEntity(objid);
if (player == nullptr) if (player == nullptr)
return; return;
@ -585,7 +585,7 @@ std::vector<Entity*> ActivityInstance::GetParticipants() const {
entities.reserve(m_Participants.size()); entities.reserve(m_Participants.size());
for (const auto& id : m_Participants) { for (const auto& id : m_Participants) {
auto* entity = EntityManager::Instance()->GetEntity(id); auto* entity = Game::entityManager->GetEntity(id);
if (entity != nullptr) if (entity != nullptr)
entities.push_back(entity); entities.push_back(entity);
} }
@ -617,5 +617,5 @@ void ActivityInstance::SetScore(uint32_t score) {
} }
Entity* LobbyPlayer::GetEntity() const { Entity* LobbyPlayer::GetEntity() const {
return EntityManager::Instance()->GetEntity(entityID); return Game::entityManager->GetEntity(entityID);
} }

View File

@ -14,7 +14,7 @@ void ShootingGalleryComponent::SetStaticParams(const StaticShootingGalleryParams
void ShootingGalleryComponent::SetDynamicParams(const DynamicShootingGalleryParams& params) { void ShootingGalleryComponent::SetDynamicParams(const DynamicShootingGalleryParams& params) {
m_DynamicParams = params; m_DynamicParams = params;
m_Dirty = true; m_Dirty = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const { void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const {

View File

@ -292,7 +292,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
start.optionalOriginatorID = context->originator; start.optionalOriginatorID = context->originator;
start.optionalTargetID = target; start.optionalTargetID = target;
auto* originator = EntityManager::Instance()->GetEntity(context->originator); auto* originator = Game::entityManager->GetEntity(context->originator);
if (originator != nullptr) { if (originator != nullptr) {
start.originatorRot = originator->GetRotation(); start.originatorRot = originator->GetRotation();
@ -338,7 +338,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime) {
entry.time += deltaTime; entry.time += deltaTime;
auto* origin = EntityManager::Instance()->GetEntity(entry.context->originator); auto* origin = Game::entityManager->GetEntity(entry.context->originator);
if (origin == nullptr) { if (origin == nullptr) {
continue; continue;
@ -349,7 +349,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime) {
const auto position = entry.startPosition + (entry.velocity * entry.time); const auto position = entry.startPosition + (entry.velocity * entry.time);
for (const auto& targetId : targets) { for (const auto& targetId : targets) {
auto* target = EntityManager::Instance()->GetEntity(targetId); auto* target = Game::entityManager->GetEntity(targetId);
const auto targetPosition = target->GetPosition(); const auto targetPosition = target->GetPosition();
@ -397,7 +397,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime) {
void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry) const { void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry) const {
auto* other = EntityManager::Instance()->GetEntity(entry.branchContext.target); auto* other = Game::entityManager->GetEntity(entry.branchContext.target);
if (other == nullptr) { if (other == nullptr) {
if (entry.branchContext.target != LWOOBJID_EMPTY) { if (entry.branchContext.target != LWOOBJID_EMPTY) {

View File

@ -76,7 +76,7 @@ void SoundTriggerComponent::ActivateMusicCue(const std::string& name) {
-1.0f -1.0f
}); });
dirty = true; dirty = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
@ -88,6 +88,6 @@ void SoundTriggerComponent::DeactivateMusicCue(const std::string& name) {
if (musicCue != this->musicCues.end()) { if (musicCue != this->musicCues.end()) {
this->musicCues.erase(musicCue); this->musicCues.erase(musicCue);
dirty = true; dirty = true;
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }

View File

@ -49,7 +49,7 @@ void SwitchComponent::EntityEnter(Entity* entity) {
const auto grpName = m_Parent->GetVarAsString(u"grp_name"); const auto grpName = m_Parent->GetVarAsString(u"grp_name");
if (!grpName.empty()) { if (!grpName.empty()) {
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(grpName); const auto entities = Game::entityManager->GetEntitiesInGroup(grpName);
for (auto* entity : entities) { for (auto* entity : entities) {
entity->OnFireEventServerSide(entity, "OnActivated"); entity->OnFireEventServerSide(entity, "OnActivated");
@ -63,7 +63,7 @@ void SwitchComponent::EntityEnter(Entity* entity) {
RenderComponent::PlayAnimation(m_Parent, u"engaged"); RenderComponent::PlayAnimation(m_Parent, u"engaged");
m_PetBouncer->SetPetBouncerEnabled(true); m_PetBouncer->SetPetBouncerEnabled(true);
} else { } else {
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
@ -85,7 +85,7 @@ void SwitchComponent::Update(float deltaTime) {
const auto grpName = m_Parent->GetVarAsString(u"grp_name"); const auto grpName = m_Parent->GetVarAsString(u"grp_name");
if (!grpName.empty()) { if (!grpName.empty()) {
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(grpName); const auto entities = Game::entityManager->GetEntitiesInGroup(grpName);
for (auto* entity : entities) { for (auto* entity : entities) {
entity->OnFireEventServerSide(entity, "OnDectivated"); entity->OnFireEventServerSide(entity, "OnDectivated");
@ -95,7 +95,7 @@ void SwitchComponent::Update(float deltaTime) {
if (m_PetBouncer != nullptr) { if (m_PetBouncer != nullptr) {
m_PetBouncer->SetPetBouncerEnabled(false); m_PetBouncer->SetPetBouncerEnabled(false);
} else { } else {
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
} }
} }

View File

@ -170,10 +170,10 @@ std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* comman
else if (command->target == "targetTeam" && optionalTarget) { else if (command->target == "targetTeam" && optionalTarget) {
auto* team = TeamManager::Instance()->GetTeam(optionalTarget->GetObjectID()); auto* team = TeamManager::Instance()->GetTeam(optionalTarget->GetObjectID());
for (const auto memberId : team->members) { for (const auto memberId : team->members) {
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = Game::entityManager->GetEntity(memberId);
if (member) entities.push_back(member); if (member) entities.push_back(member);
} }
} else if (command->target == "objGroup") entities = EntityManager::Instance()->GetEntitiesInGroup(command->targetName); } else if (command->target == "objGroup") entities = Game::entityManager->GetEntitiesInGroup(command->targetName);
else if (command->target == "allPlayers") { else if (command->target == "allPlayers") {
for (auto* player : Player::GetAllPlayers()) { for (auto* player : Player::GetAllPlayers()) {
entities.push_back(player); entities.push_back(player);
@ -249,7 +249,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), direction); GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), direction);
phantomPhysicsComponent->SetDirection(direction); phantomPhysicsComponent->SetDirection(direction);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
@ -274,7 +274,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
NiPoint3 direction = delta / length; NiPoint3 direction = delta / length;
phantomPhysicsComponent->SetDirection(direction); phantomPhysicsComponent->SetDirection(direction);
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){ void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
@ -395,7 +395,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v
phantomPhysicsComponent->SetMax(max); phantomPhysicsComponent->SetMax(max);
} }
EntityManager::Instance()->SerializeEntity(targetEntity); Game::entityManager->SerializeEntity(targetEntity);
} }
void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) { void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) {
@ -405,7 +405,7 @@ void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::s
return; return;
} }
phantomPhysicsComponent->SetPhysicsEffectActive(args == "On"); phantomPhysicsComponent->SetPhysicsEffectActive(args == "On");
EntityManager::Instance()->SerializeEntity(targetEntity); Game::entityManager->SerializeEntity(targetEntity);
} }
void TriggerComponent::HandleActivateSpawnerNetwork(std::string args){ void TriggerComponent::HandleActivateSpawnerNetwork(std::string args){

View File

@ -135,7 +135,7 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
void VehiclePhysicsComponent::Update(float deltaTime) { void VehiclePhysicsComponent::Update(float deltaTime) {
if (m_SoftUpdate > 5) { if (m_SoftUpdate > 5) {
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
m_SoftUpdate = 0; m_SoftUpdate = 0;
} else { } else {
m_SoftUpdate += deltaTime; m_SoftUpdate += deltaTime;

View File

@ -42,7 +42,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
CBITSTREAM; CBITSTREAM;
// Get the entity // Get the entity
Entity* entity = EntityManager::Instance()->GetEntity(objectID); Entity* entity = Game::entityManager->GetEntity(objectID);
User* usr = UserManager::Instance()->GetUser(sysAddr); User* usr = UserManager::Instance()->GetUser(sysAddr);
@ -122,9 +122,9 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
auto* destroyable = entity->GetComponent<DestroyableComponent>(); auto* destroyable = entity->GetComponent<DestroyableComponent>();
destroyable->SetImagination(destroyable->GetImagination()); destroyable->SetImagination(destroyable->GetImagination());
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
std::vector<Entity*> racingControllers = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL); std::vector<Entity*> racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
for (Entity* racingController : racingControllers) { for (Entity* racingController : racingControllers) {
auto* racingComponent = racingController->GetComponent<RacingControlComponent>(); auto* racingComponent = racingController->GetComponent<RacingControlComponent>();
if (racingComponent != nullptr) { if (racingComponent != nullptr) {
@ -132,12 +132,12 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
} }
} }
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); Entity* zoneControl = Game::entityManager->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
script->OnPlayerLoaded(zoneControl, player); script->OnPlayerLoaded(zoneControl, player);
} }
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
@ -248,7 +248,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
dest->SetHealth(4); dest->SetHealth(4);
dest->SetArmor(0); dest->SetArmor(0);
dest->SetImagination(6); dest->SetImagination(6);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
}*/ }*/
break; break;
} }
@ -560,7 +560,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
break; break;
case eGameMessageType::ZONE_PROPERTY_MODEL_ROTATED: case eGameMessageType::ZONE_PROPERTY_MODEL_ROTATED:
EntityManager::Instance()->GetZoneControlEntity()->OnZonePropertyModelRotated(usr->GetLastUsedChar()->GetEntity()); Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelRotated(usr->GetLastUsedChar()->GetEntity());
break; break;
case eGameMessageType::UPDATE_PROPERTY_OR_MODEL_FOR_FILTER_CHECK: case eGameMessageType::UPDATE_PROPERTY_OR_MODEL_FOR_FILTER_CHECK:

View File

@ -1101,7 +1101,7 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
if (object.type != "Powerup") { if (object.type != "Powerup") {
for (const auto memberId : team->members) { for (const auto memberId : team->members) {
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = Game::entityManager->GetEntity(memberId);
if (member == nullptr) continue; if (member == nullptr) continue;
@ -1690,11 +1690,11 @@ void GameMessages::HandleActivityStateChangeRequest(RakNet::BitStream* inStream,
stringValue.push_back(character); stringValue.push_back(character);
} }
auto* assosiate = EntityManager::Instance()->GetEntity(objectID); auto* assosiate = Game::entityManager->GetEntity(objectID);
Game::logger->Log("Activity State Change", "%s [%i, %i] from %i to %i", GeneralUtils::UTF16ToWTF8(stringValue).c_str(), value1, value2, entity->GetLOT(), assosiate != nullptr ? assosiate->GetLOT() : 0); Game::logger->Log("Activity State Change", "%s [%i, %i] from %i to %i", GeneralUtils::UTF16ToWTF8(stringValue).c_str(), value1, value2, entity->GetLOT(), assosiate != nullptr ? assosiate->GetLOT() : 0);
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
scriptEntity->OnActivityStateChangeRequest(objectID, value1, value2, stringValue); scriptEntity->OnActivityStateChangeRequest(objectID, value1, value2, stringValue);
} }
@ -2223,7 +2223,7 @@ void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity*
Game::logger->Log("HandleQueryPropertyData", "Entity (%i) requesting data", entity->GetLOT()); Game::logger->Log("HandleQueryPropertyData", "Entity (%i) requesting data", entity->GetLOT());
/* /*
auto entites = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_VENDOR); auto entites = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_VENDOR);
entity = entites[0]; entity = entites[0];
*/ */
@ -2235,7 +2235,7 @@ void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity*
} }
/* /*
entites = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_MANAGEMENT); entites = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_MANAGEMENT);
entity = entites[0]; entity = entites[0];
*/ */
@ -2270,7 +2270,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
if (inStream->ReadBit()) if (inStream->ReadBit())
inStream->Read(startPosition); inStream->Read(startPosition);
auto* player = EntityManager::Instance()->GetEntity(playerId); auto* player = Game::entityManager->GetEntity(playerId);
if (startPosition == NiPoint3::ZERO) { if (startPosition == NiPoint3::ZERO) {
startPosition = player->GetPosition(); startPosition = player->GetPosition();
@ -2318,7 +2318,7 @@ void GameMessages::HandleStartBuildingWithItem(RakNet::BitStream* inStream, Enti
auto* user = UserManager::Instance()->GetUser(sysAddr); auto* user = UserManager::Instance()->GetUser(sysAddr);
auto* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); auto* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
SendStartArrangingWithItem( SendStartArrangingWithItem(
player, player,
@ -2352,7 +2352,7 @@ void GameMessages::HandlePropertyEditorEnd(RakNet::BitStream* inStream, Entity*
void GameMessages::HandlePropertyContentsFromClient(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandlePropertyContentsFromClient(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
SendGetModelsOnProperty(player->GetObjectID(), PropertyManagementComponent::Instance()->GetModels(), UNASSIGNED_SYSTEM_ADDRESS); SendGetModelsOnProperty(player->GetObjectID(), PropertyManagementComponent::Instance()->GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
} }
@ -2715,9 +2715,9 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
info.settings.push_back(propertyObjectID); info.settings.push_back(propertyObjectID);
info.settings.push_back(userModelID); info.settings.push_back(userModelID);
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr); Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
if (newEntity) { if (newEntity) {
EntityManager::Instance()->ConstructEntity(newEntity); Game::entityManager->ConstructEntity(newEntity);
//Make sure the propMgmt doesn't delete our model after the server dies //Make sure the propMgmt doesn't delete our model after the server dies
//Trying to do this after the entity is constructed. Shouldn't really change anything but //Trying to do this after the entity is constructed. Shouldn't really change anything but
@ -2913,7 +2913,7 @@ void GameMessages::HandleCinematicUpdate(RakNet::BitStream* inStream, Entity* en
inStream->Read<int32_t>(waypoint); inStream->Read<int32_t>(waypoint);
} }
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
scriptEntity->OnCinematicUpdate(scriptEntity, entity, event, pathName, pathTime, overallTime, waypoint); scriptEntity->OnCinematicUpdate(scriptEntity, entity, event, pathName, pathTime, overallTime, waypoint);
} }
@ -3293,7 +3293,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream* inStream, Entity*
inStream->Read(i64Invitee); inStream->Read(i64Invitee);
auto* invitee = EntityManager::Instance()->GetEntity(i64Invitee); auto* invitee = Game::entityManager->GetEntity(i64Invitee);
if (invitee != nullptr && invitee->IsPlayer()) { if (invitee != nullptr && invitee->IsPlayer()) {
character = invitee->GetCharacter(); character = invitee->GetCharacter();
@ -3880,7 +3880,7 @@ void GameMessages::HandleMessageBoxResponse(RakNet::BitStream* inStream, Entity*
racingControlComponent->HandleMessageBoxResponse(userEntity, iButton, GeneralUtils::UTF16ToWTF8(identifier)); racingControlComponent->HandleMessageBoxResponse(userEntity, iButton, GeneralUtils::UTF16ToWTF8(identifier));
} }
for (auto* shootingGallery : EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY)) { for (auto* shootingGallery : Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY)) {
shootingGallery->OnMessageBoxResponse(userEntity, iButton, identifier, userData); shootingGallery->OnMessageBoxResponse(userEntity, iButton, identifier, userData);
} }
} }
@ -4041,7 +4041,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
// If we aren't possessing somethings, the don't do anything // If we aren't possessing somethings, the don't do anything
if (objectId != LWOOBJID_EMPTY) { if (objectId != LWOOBJID_EMPTY) {
auto* possessorComponent = entity->GetComponent<PossessorComponent>(); auto* possessorComponent = entity->GetComponent<PossessorComponent>();
auto* mount = EntityManager::Instance()->GetEntity(objectId); auto* mount = Game::entityManager->GetEntity(objectId);
// make sure we have the things we need and they aren't null // make sure we have the things we need and they aren't null
if (possessorComponent && mount) { if (possessorComponent && mount) {
if (!possessorComponent->GetIsDismounting()) return; if (!possessorComponent->GetIsDismounting()) return;
@ -4066,7 +4066,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
if (possessableComponent) possessableComponent->Dismount(); if (possessableComponent) possessableComponent->Dismount();
// Update the entity that was possessing // Update the entity that was possessing
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
// We aren't mounted so remove the stun // We aren't mounted so remove the stun
GameMessages::SendSetStunned(entity->GetObjectID(), eStateChangeType::POP, UNASSIGNED_SYSTEM_ADDRESS, LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true); GameMessages::SendSetStunned(entity->GetObjectID(), eStateChangeType::POP, UNASSIGNED_SYSTEM_ADDRESS, LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
@ -4076,11 +4076,11 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
void GameMessages::HandleAcknowledgePossession(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleAcknowledgePossession(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
LWOOBJID objectId{}; LWOOBJID objectId{};
inStream->Read(objectId); inStream->Read(objectId);
auto* mount = EntityManager::Instance()->GetEntity(objectId); auto* mount = Game::entityManager->GetEntity(objectId);
if (mount) EntityManager::Instance()->SerializeEntity(mount); if (mount) Game::entityManager->SerializeEntity(mount);
} }
//Racing //Racing
@ -4116,7 +4116,7 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity*
inStream->Read(playerID); inStream->Read(playerID);
auto* player = EntityManager::Instance()->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) { if (player == nullptr) {
return; return;
@ -4180,7 +4180,7 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
auto* possessableComponent = entity->GetComponent<PossessableComponent>(); auto* possessableComponent = entity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) { if (possessableComponent != nullptr) {
entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (entity == nullptr) { if (entity == nullptr) {
return; return;
@ -4207,7 +4207,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre
inStream->Read(playerID); inStream->Read(playerID);
auto* player = EntityManager::Instance()->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) { if (player == nullptr) {
return; return;
@ -4271,7 +4271,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
if (inStream->ReadBit()) inStream->Read(pickupSpawnerIndex); if (inStream->ReadBit()) inStream->Read(pickupSpawnerIndex);
if (inStream->ReadBit()) inStream->Read(vehiclePosition); if (inStream->ReadBit()) inStream->Read(vehiclePosition);
auto* pickup = EntityManager::Instance()->GetEntity(pickupObjID); auto* pickup = Game::entityManager->GetEntity(pickupObjID);
if (pickup == nullptr) { if (pickup == nullptr) {
return; return;
@ -4280,7 +4280,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
auto* possessableComponent = entity->GetComponent<PossessableComponent>(); auto* possessableComponent = entity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) { if (possessableComponent != nullptr) {
entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor()); entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (entity == nullptr) { if (entity == nullptr) {
return; return;
@ -4671,7 +4671,7 @@ void GameMessages::HandleToggleGhostReferenceOverride(RakNet::BitStream* inStrea
if (player != nullptr) { if (player != nullptr) {
player->SetGhostOverride(bOverride); player->SetGhostOverride(bOverride);
EntityManager::Instance()->UpdateGhosting(player); Game::entityManager->UpdateGhosting(player);
} }
} }
@ -4686,7 +4686,7 @@ void GameMessages::HandleSetGhostReferencePosition(RakNet::BitStream* inStream,
if (player != nullptr) { if (player != nullptr) {
player->SetGhostOverridePoint(position); player->SetGhostOverridePoint(position);
EntityManager::Instance()->UpdateGhosting(player); Game::entityManager->UpdateGhosting(player);
} }
} }
@ -4704,7 +4704,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!player) return; if (!player) return;
auto* propertyVendorComponent = static_cast<PropertyVendorComponent*>(entity->GetComponent(eReplicaComponentType::PROPERTY_VENDOR)); auto* propertyVendorComponent = static_cast<PropertyVendorComponent*>(entity->GetComponent(eReplicaComponentType::PROPERTY_VENDOR));
@ -4807,7 +4807,7 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!player) return; if (!player) return;
Character* character = player->GetCharacter(); Character* character = player->GetCharacter();
if (!character) return; if (!character) return;
@ -4838,7 +4838,7 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
//inv->RemoveItem(count, -1, iObjID); //inv->RemoveItem(count, -1, iObjID);
inv->MoveItemToInventory(item, eInventoryType::VENDOR_BUYBACK, count, true, false, true); inv->MoveItemToInventory(item, eInventoryType::VENDOR_BUYBACK, count, true, false, true);
character->SetCoins(std::floor(character->GetCoins() + (static_cast<uint32_t>(itemComp.baseValue * sellScalar) * count)), eLootSourceType::VENDOR); character->SetCoins(std::floor(character->GetCoins() + (static_cast<uint32_t>(itemComp.baseValue * sellScalar) * count)), eLootSourceType::VENDOR);
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates //Game::entityManager->SerializeEntity(player); // so inventory updates
GameMessages::SendVendorTransactionResult(entity, sysAddr); GameMessages::SendVendorTransactionResult(entity, sysAddr);
} }
@ -4857,7 +4857,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!player) return; if (!player) return;
Character* character = player->GetCharacter(); Character* character = player->GetCharacter();
if (!character) return; if (!character) return;
@ -4897,7 +4897,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
//inv->RemoveItem(count, -1, iObjID); //inv->RemoveItem(count, -1, iObjID);
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false); inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
character->SetCoins(character->GetCoins() - cost, eLootSourceType::VENDOR); character->SetCoins(character->GetCoins() - cost, eLootSourceType::VENDOR);
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates //Game::entityManager->SerializeEntity(player); // so inventory updates
GameMessages::SendVendorTransactionResult(entity, sysAddr); GameMessages::SendVendorTransactionResult(entity, sysAddr);
} }
@ -4944,7 +4944,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity
if (param3IsDefault) inStream->Read(param3); if (param3IsDefault) inStream->Read(param3);
inStream->Read(senderID); inStream->Read(senderID);
auto* sender = EntityManager::Instance()->GetEntity(senderID); auto* sender = Game::entityManager->GetEntity(senderID);
auto* player = Player::GetPlayer(sysAddr); auto* player = Player::GetPlayer(sysAddr);
if (!player) { if (!player) {
@ -5018,7 +5018,7 @@ void GameMessages::HandleRebuildCancel(RakNet::BitStream* inStream, Entity* enti
RebuildComponent* rebComp = static_cast<RebuildComponent*>(entity->GetComponent(eReplicaComponentType::QUICK_BUILD)); RebuildComponent* rebComp = static_cast<RebuildComponent*>(entity->GetComponent(eReplicaComponentType::QUICK_BUILD));
if (!rebComp) return; if (!rebComp) return;
rebComp->CancelRebuild(EntityManager::Instance()->GetEntity(userID), eQuickBuildFailReason::CANCELED_EARLY); rebComp->CancelRebuild(Game::entityManager->GetEntity(userID), eQuickBuildFailReason::CANCELED_EARLY);
} }
void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
@ -5034,7 +5034,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity,
inStream->Read(objectID); inStream->Read(objectID);
inStream->Read(secondary); inStream->Read(secondary);
Entity* interactedObject = EntityManager::Instance()->GetEntity(objectID); Entity* interactedObject = Game::entityManager->GetEntity(objectID);
if (interactedObject == nullptr) { if (interactedObject == nullptr) {
Game::logger->Log("GameMessages", "Object %llu tried to interact, but doesn't exist!", objectID); Game::logger->Log("GameMessages", "Object %llu tried to interact, but doesn't exist!", objectID);
@ -5087,7 +5087,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
if (!missionComponent) return; if (!missionComponent) return;
if (targetID != LWOOBJID_EMPTY) { if (targetID != LWOOBJID_EMPTY) {
auto* targetEntity = EntityManager::Instance()->GetEntity(targetID); auto* targetEntity = Game::entityManager->GetEntity(targetID);
Game::logger->LogDebug("GameMessages", "Emote target found (%d)", targetEntity != nullptr); Game::logger->LogDebug("GameMessages", "Emote target found (%d)", targetEntity != nullptr);
@ -5097,7 +5097,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
} }
} else { } else {
Game::logger->LogDebug("GameMessages", "Target ID is empty, using backup"); Game::logger->LogDebug("GameMessages", "Target ID is empty, using backup");
const auto scriptedEntities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT); const auto scriptedEntities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
const auto& referencePoint = entity->GetPosition(); const auto& referencePoint = entity->GetPosition();
@ -5125,7 +5125,7 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return; if (!character) return;
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY)); InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return; if (!inv) return;
@ -5183,7 +5183,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e
Game::logger->Log("GameMessages", "Unable to get mission %i for entity %llu to update reward in RespondToMission", missionID, playerID); Game::logger->Log("GameMessages", "Unable to get mission %i for entity %llu to update reward in RespondToMission", missionID, playerID);
} }
Entity* offerer = EntityManager::Instance()->GetEntity(receiverID); Entity* offerer = Game::entityManager->GetEntity(receiverID);
if (offerer == nullptr) { if (offerer == nullptr) {
Game::logger->Log("GameMessages", "Unable to get receiver entity %llu for RespondToMission", receiverID); Game::logger->Log("GameMessages", "Unable to get receiver entity %llu for RespondToMission", receiverID);
@ -5191,7 +5191,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e
} }
for (CppScripts::Script* script : CppScripts::GetEntityScripts(offerer)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(offerer)) {
script->OnRespondToMission(offerer, missionID, EntityManager::Instance()->GetEntity(playerID), reward); script->OnRespondToMission(offerer, missionID, Game::entityManager->GetEntity(playerID), reward);
} }
} }
@ -5206,7 +5206,7 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en
inStream->Read(iMissionState); inStream->Read(iMissionState);
inStream->Read(missionID); inStream->Read(missionID);
inStream->Read(responder); inStream->Read(responder);
player = EntityManager::Instance()->GetEntity(responder); player = Game::entityManager->GetEntity(responder);
for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) {
script->OnMissionDialogueOK(entity, player, missionID, iMissionState); script->OnMissionDialogueOK(entity, player, missionID, iMissionState);
@ -5235,7 +5235,7 @@ void GameMessages::HandleRequestLinkedMission(RakNet::BitStream* inStream, Entit
inStream->Read(missionId); inStream->Read(missionId);
inStream->Read(bMissionOffered); inStream->Read(bMissionOffered);
auto* player = EntityManager::Instance()->GetEntity(playerId); auto* player = Game::entityManager->GetEntity(playerId);
auto* missionOfferComponent = static_cast<MissionOfferComponent*>(entity->GetComponent(eReplicaComponentType::MISSION_OFFER)); auto* missionOfferComponent = static_cast<MissionOfferComponent*>(entity->GetComponent(eReplicaComponentType::MISSION_OFFER));
@ -5248,7 +5248,7 @@ void GameMessages::HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* e
LWOOBJID playerID; LWOOBJID playerID;
inStream->Read(playerID); inStream->Read(playerID);
Entity* player = EntityManager::Instance()->GetEntity(playerID); Entity* player = Game::entityManager->GetEntity(playerID);
if (!player || !entity || entity->GetCollectibleID() == 0) return; if (!player || !entity || entity->GetCollectibleID() == 0) return;
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION)); MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
@ -5362,7 +5362,7 @@ void GameMessages::HandleEquipItem(RakNet::BitStream* inStream, Entity* entity)
item->Equip(); item->Equip();
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity) { void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity) {
@ -5382,7 +5382,7 @@ void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity
item->UnEquip(); item->UnEquip();
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
@ -5467,7 +5467,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En
} }
item->SetCount(item->GetCount() - iStackCount, true); item->SetCount(item->GetCount() - iStackCount, true);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
auto* missionComponent = entity->GetComponent<MissionComponent>(); auto* missionComponent = entity->GetComponent<MissionComponent>();
@ -5501,7 +5501,7 @@ void GameMessages::HandleMoveItemInInventory(RakNet::BitStream* inStream, Entity
} }
inv->MoveStack(item, static_cast<eInventoryType>(destInvType), slot); inv->MoveStack(item, static_cast<eInventoryType>(destInvType), slot);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
@ -5547,7 +5547,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre
} }
inv->MoveItemToInventory(item, inventoryTypeB, stackCount, showFlyingLoot); inv->MoveItemToInventory(item, inventoryTypeB, stackCount, showFlyingLoot);
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
void GameMessages::HandleBuildModeSet(RakNet::BitStream* inStream, Entity* entity) { void GameMessages::HandleBuildModeSet(RakNet::BitStream* inStream, Entity* entity) {
@ -5566,7 +5566,7 @@ void GameMessages::HandleBuildModeSet(RakNet::BitStream* inStream, Entity* entit
void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return; if (!character) return;
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY)); InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return; if (!inv) return;
@ -5577,7 +5577,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
GameMessages::SendModularBuildEnd(character); // i dont know if this does anything but DLUv2 did it GameMessages::SendModularBuildEnd(character); // i dont know if this does anything but DLUv2 did it
//inv->UnequipItem(inv->GetItemStackByLOT(6086, eInventoryType::ITEMS)); // take off the thinking cap //inv->UnequipItem(inv->GetItemStackByLOT(6086, eInventoryType::ITEMS)); // take off the thinking cap
//EntityManager::Instance()->SerializeEntity(entity); //Game::entityManager->SerializeEntity(entity);
uint8_t count; // 3 for rockets, 7 for cars uint8_t count; // 3 for rockets, 7 for cars
@ -5654,7 +5654,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return; if (!character) return;
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY)); InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return; if (!inv) return;
@ -5707,9 +5707,9 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
*/ */
if (PropertyManagementComponent::Instance() != nullptr) { if (PropertyManagementComponent::Instance() != nullptr) {
const auto& buildAreas = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::BUILD_BORDER); const auto& buildAreas = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::BUILD_BORDER);
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque"); const auto& entities = Game::entityManager->GetEntitiesInGroup("PropertyPlaque");
Entity* buildArea; Entity* buildArea;
@ -5765,7 +5765,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
User* user = UserManager::Instance()->GetUser(sysAddr); User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return; if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return; if (!character) return;
Game::logger->Log("GameMessages", "Build and move"); Game::logger->Log("GameMessages", "Build and move");
@ -5798,7 +5798,7 @@ void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity)
if (team != nullptr) { if (team != nullptr) {
for (const auto memberId : team->members) { for (const auto memberId : team->members) {
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = Game::entityManager->GetEntity(memberId);
if (member == nullptr || memberId == playerID) continue; if (member == nullptr || memberId == playerID) continue;
@ -5810,12 +5810,12 @@ void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity)
void GameMessages::HandleResurrect(RakNet::BitStream* inStream, Entity* entity) { void GameMessages::HandleResurrect(RakNet::BitStream* inStream, Entity* entity) {
bool immediate = inStream->ReadBit(); bool immediate = inStream->ReadBit();
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); Entity* zoneControl = Game::entityManager->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
script->OnPlayerResurrected(zoneControl, entity); script->OnPlayerResurrected(zoneControl, entity);
} }
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
@ -5835,7 +5835,7 @@ void GameMessages::HandlePopEquippedItemsState(RakNet::BitStream* inStream, Enti
InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY)); InventoryComponent* inv = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return; if (!inv) return;
inv->PopEquippedItems(); inv->PopEquippedItems();
EntityManager::Instance()->SerializeEntity(entity); // so it updates on client side Game::entityManager->SerializeEntity(entity); // so it updates on client side
} }
@ -5901,7 +5901,7 @@ void GameMessages::HandleMatchRequest(RakNet::BitStream* inStream, Entity* entit
inStream->Read(type); inStream->Read(type);
inStream->Read(value); inStream->Read(value);
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
if (type == 0) { // join if (type == 0) { // join
if (value != 0) { if (value != 0) {
for (Entity* scriptedAct : scriptedActs) { for (Entity* scriptedAct : scriptedActs) {
@ -6034,7 +6034,7 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
void void
GameMessages::HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { GameMessages::HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR); const auto possibleRails = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR);
for (const auto* possibleRail : possibleRails) { for (const auto* possibleRail : possibleRails) {
const auto* rail = possibleRail->GetComponent<RailActivatorComponent>(); const auto* rail = possibleRail->GetComponent<RailActivatorComponent>();
if (rail != nullptr) { if (rail != nullptr) {
@ -6046,7 +6046,7 @@ GameMessages::HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity*
void GameMessages::HandleCancelRailMovement(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleCancelRailMovement(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
const auto immediate = inStream->ReadBit(); const auto immediate = inStream->ReadBit();
const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR); const auto possibleRails = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR);
for (const auto* possibleRail : possibleRails) { for (const auto* possibleRail : possibleRails) {
auto* rail = possibleRail->GetComponent<RailActivatorComponent>(); auto* rail = possibleRail->GetComponent<RailActivatorComponent>();
if (rail != nullptr) { if (rail != nullptr) {
@ -6070,7 +6070,7 @@ void GameMessages::HandlePlayerRailArrivedNotification(RakNet::BitStream* inStre
int32_t waypointNumber; int32_t waypointNumber;
inStream->Read(waypointNumber); inStream->Read(waypointNumber);
const auto possibleRails = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR); const auto possibleRails = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RAIL_ACTIVATOR);
for (auto* possibleRail : possibleRails) { for (auto* possibleRail : possibleRails) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(possibleRail)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(possibleRail)) {
script->OnPlayerRailArrived(possibleRail, entity, pathName, waypointNumber); script->OnPlayerRailArrived(possibleRail, entity, pathName, waypointNumber);
@ -6163,7 +6163,7 @@ void GameMessages::SendDeactivateBubbleBuffFromServer(LWOOBJID objectId, const S
void GameMessages::HandleZoneSummaryDismissed(RakNet::BitStream* inStream, Entity* entity) { void GameMessages::HandleZoneSummaryDismissed(RakNet::BitStream* inStream, Entity* entity) {
LWOOBJID player_id; LWOOBJID player_id;
inStream->Read<LWOOBJID>(player_id); inStream->Read<LWOOBJID>(player_id);
auto target = EntityManager::Instance()->GetEntity(player_id); auto target = Game::entityManager->GetEntity(player_id);
entity->TriggerEvent(eTriggerEventType::ZONE_SUMMARY_DISMISSED, target); entity->TriggerEvent(eTriggerEventType::ZONE_SUMMARY_DISMISSED, target);
}; };
@ -6203,7 +6203,7 @@ void GameMessages::HandleRequestActivityExit(RakNet::BitStream* inStream, Entity
LWOOBJID player_id = LWOOBJID_EMPTY; LWOOBJID player_id = LWOOBJID_EMPTY;
inStream->Read(player_id); inStream->Read(player_id);
auto player = EntityManager::Instance()->GetEntity(player_id); auto player = Game::entityManager->GetEntity(player_id);
if (!entity || !player) return; if (!entity || !player) return;
entity->RequestActivityExit(entity, player_id, canceled); entity->RequestActivityExit(entity, player_id, canceled);
} }

View File

@ -100,7 +100,7 @@ Item::Item(
Game::logger->Log("Item", "Move and equipped (%i) from (%i)", this->lot, this->inventory->GetType()); Game::logger->Log("Item", "Move and equipped (%i) from (%i)", this->lot, this->inventory->GetType());
EntityManager::Instance()->SerializeEntity(inventory->GetComponent()->GetParent()); Game::entityManager->SerializeEntity(inventory->GetComponent()->GetParent());
} }
} }

View File

@ -44,7 +44,7 @@ void ItemSetPassiveAbility::Activate(Entity* target) {
return; return;
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
const auto id = static_cast<eItemSetPassiveAbilityID>(m_ItemSet->GetID()); const auto id = static_cast<eItemSetPassiveAbilityID>(m_ItemSet->GetID());
const auto parentID = m_Parent->GetObjectID(); const auto parentID = m_Parent->GetObjectID();
@ -203,7 +203,7 @@ void ItemSetPassiveAbility::OnEnemySmshed(Entity* target) {
return; return;
} }
EntityManager::Instance()->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
const auto id = static_cast<eItemSetPassiveAbilityID>(m_ItemSet->GetID()); const auto id = static_cast<eItemSetPassiveAbilityID>(m_ItemSet->GetID());
const auto parentID = m_Parent->GetObjectID(); const auto parentID = m_Parent->GetObjectID();

View File

@ -547,7 +547,7 @@ void Mission::YieldRewards() {
destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination), true); destroyableComponent->SetMaxImagination(destroyableComponent->GetMaxImagination() + static_cast<float>(info->reward_maximagination), true);
} }
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
if (info->reward_emote > 0) { if (info->reward_emote > 0) {
character->UnlockEmote(info->reward_emote); character->UnlockEmote(info->reward_emote);

View File

@ -230,7 +230,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
break; break;
} }
entity = EntityManager::Instance()->GetEntity(associate); entity = Game::entityManager->GetEntity(associate);
if (entity == nullptr) { if (entity == nullptr) {
if (associate != LWOOBJID_EMPTY) { if (associate != LWOOBJID_EMPTY) {
Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate); Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate);
@ -272,7 +272,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
{ {
if (!InParameters(value)) break; if (!InParameters(value)) break;
entity = EntityManager::Instance()->GetEntity(associate); entity = Game::entityManager->GetEntity(associate);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate); Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate);
@ -302,7 +302,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
case eMissionTaskType::PERFORM_ACTIVITY: case eMissionTaskType::PERFORM_ACTIVITY:
{ {
auto* minigameManager = EntityManager::Instance()->GetEntity(associate); auto* minigameManager = Game::entityManager->GetEntity(associate);
if (minigameManager == nullptr) if (minigameManager == nullptr)
break; break;
@ -346,7 +346,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
{ {
if (!InAllTargets(value)) break; if (!InAllTargets(value)) break;
entity = EntityManager::Instance()->GetEntity(associate); entity = Game::entityManager->GetEntity(associate);
if (entity == nullptr) { if (entity == nullptr) {
Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate); Game::logger->Log("MissionTask", "Failed to find associated entity (%llu)!", associate);

View File

@ -184,7 +184,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
} }
character->SetPvpEnabled(!character->GetPvpEnabled()); character->SetPvpEnabled(!character->GetPvpEnabled());
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
std::stringstream message; std::stringstream message;
message << character->GetName() << " changed their PVP flag to " << std::to_string(character->GetPvpEnabled()) << "!"; message << character->GetName() << " changed their PVP flag to " << std::to_string(character->GetPvpEnabled()) << "!";
@ -289,7 +289,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
const auto objid = entity->GetObjectID(); const auto objid = entity->GetObjectID();
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, newZone, 0, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, newZone, 0, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
auto* entity = EntityManager::Instance()->GetEntity(objid); auto* entity = Game::entityManager->GetEntity(objid);
if (entity == nullptr) { if (entity == nullptr) {
return; return;
@ -372,7 +372,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
ChatPackets::SendSystemMessage(sysAddr, u"Invalid Minifig Item Id ID."); ChatPackets::SendSystemMessage(sysAddr, u"Invalid Minifig Item Id ID.");
return; return;
} }
EntityManager::Instance()->DestructEntity(entity, sysAddr); Game::entityManager->DestructEntity(entity, sysAddr);
auto* charComp = entity->GetComponent<CharacterComponent>(); auto* charComp = entity->GetComponent<CharacterComponent>();
std::string lowerName = args[0]; std::string lowerName = args[0];
if (lowerName.empty()) return; if (lowerName.empty()) return;
@ -399,12 +399,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
charComp->m_Character->SetLeftHand(minifigItemId); charComp->m_Character->SetLeftHand(minifigItemId);
charComp->m_Character->SetRightHand(minifigItemId); charComp->m_Character->SetRightHand(minifigItemId);
} else { } else {
EntityManager::Instance()->ConstructEntity(entity); Game::entityManager->ConstructEntity(entity);
ChatPackets::SendSystemMessage(sysAddr, u"Invalid Minifig item to change, try one of the following: Eyebrows, Eyes, HairColor, HairStyle, Pants, LeftHand, Mouth, RightHand, Shirt, Hands"); ChatPackets::SendSystemMessage(sysAddr, u"Invalid Minifig item to change, try one of the following: Eyebrows, Eyes, HairColor, HairStyle, Pants, LeftHand, Mouth, RightHand, Shirt, Hands");
return; return;
} }
EntityManager::Instance()->ConstructEntity(entity); Game::entityManager->ConstructEntity(entity);
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(lowerName) + u" set to " + (GeneralUtils::to_u16string(minifigItemId))); ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(lowerName) + u" set to " + (GeneralUtils::to_u16string(minifigItemId)));
GameMessages::SendToggleGMInvis(entity->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS); // need to retoggle because it gets reenabled on creation of new character GameMessages::SendToggleGMInvis(entity->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS); // need to retoggle because it gets reenabled on creation of new character
@ -415,13 +415,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
RenderComponent::PlayAnimation(entity, anim); RenderComponent::PlayAnimation(entity, anim);
auto* possessorComponent = entity->GetComponent<PossessorComponent>(); auto* possessorComponent = entity->GetComponent<PossessorComponent>();
if (possessorComponent) { if (possessorComponent) {
auto* possessedComponent = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* possessedComponent = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (possessedComponent) RenderComponent::PlayAnimation(possessedComponent, anim); if (possessedComponent) RenderComponent::PlayAnimation(possessedComponent, anim);
} }
} }
if (chatCommand == "list-spawns" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { if (chatCommand == "list-spawns" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
for (const auto& pair : EntityManager::Instance()->GetSpawnPointEntities()) { for (const auto& pair : Game::entityManager->GetSpawnPointEntities()) {
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(pair.first)); ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::ASCIIToUTF16(pair.first));
} }
@ -450,7 +450,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
auto* user = UserManager::Instance()->GetUser(args[0]); auto* user = UserManager::Instance()->GetUser(args[0]);
if (user) { if (user) {
auto* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar()); auto* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
player->Smash(entity->GetObjectID()); player->Smash(entity->GetObjectID());
ChatPackets::SendSystemMessage(sysAddr, u"It has been done, do you feel good about yourself now?"); ChatPackets::SendSystemMessage(sysAddr, u"It has been done, do you feel good about yourself now?");
return; return;
@ -478,7 +478,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (possessor) { if (possessor) {
auto possessedID = possessor->GetPossessable(); auto possessedID = possessor->GetPossessable();
if (possessedID != LWOOBJID_EMPTY) { if (possessedID != LWOOBJID_EMPTY) {
auto possessable = EntityManager::Instance()->GetEntity(possessedID); auto possessable = Game::entityManager->GetEntity(possessedID);
if (possessable) { if (possessable) {
auto* possessControllablePhysicsComponent = possessable->GetComponent<ControllablePhysicsComponent>(); auto* possessControllablePhysicsComponent = possessable->GetComponent<ControllablePhysicsComponent>();
if (possessControllablePhysicsComponent) { if (possessControllablePhysicsComponent) {
@ -488,7 +488,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
} }
} }
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
if (chatCommand == "freecam" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { if (chatCommand == "freecam" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
@ -937,13 +937,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
auto* possessorComponent = entity->GetComponent<PossessorComponent>(); auto* possessorComponent = entity->GetComponent<PossessorComponent>();
if (possessorComponent) { if (possessorComponent) {
auto* possassableEntity = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* possassableEntity = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (possassableEntity != nullptr) { if (possassableEntity != nullptr) {
auto* vehiclePhysicsComponent = possassableEntity->GetComponent<VehiclePhysicsComponent>(); auto* vehiclePhysicsComponent = possassableEntity->GetComponent<VehiclePhysicsComponent>();
if (vehiclePhysicsComponent) { if (vehiclePhysicsComponent) {
vehiclePhysicsComponent->SetPosition(pos); vehiclePhysicsComponent->SetPosition(pos);
EntityManager::Instance()->SerializeEntity(possassableEntity); Game::entityManager->SerializeEntity(possassableEntity);
} else GameMessages::SendTeleport(possassableEntity->GetObjectID(), pos, NiQuaternion(), sysAddr); } else GameMessages::SendTeleport(possassableEntity->GetObjectID(), pos, NiQuaternion(), sysAddr);
} }
} }
@ -952,7 +952,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (chatCommand == "tpall" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { if (chatCommand == "tpall" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
const auto pos = entity->GetPosition(); const auto pos = entity->GetPosition();
const auto characters = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CHARACTER); const auto characters = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CHARACTER);
for (auto* character : characters) { for (auto* character : characters) {
GameMessages::SendTeleport(character->GetObjectID(), pos, NiQuaternion(), character->GetSystemAddress()); GameMessages::SendTeleport(character->GetObjectID(), pos, NiQuaternion(), character->GetSystemAddress());
@ -966,7 +966,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (possessorComponent) { if (possessorComponent) {
auto possessableId = possessorComponent->GetPossessable(); auto possessableId = possessorComponent->GetPossessable();
if (possessableId != LWOOBJID_EMPTY) { if (possessableId != LWOOBJID_EMPTY) {
auto* possessableEntity = EntityManager::Instance()->GetEntity(possessableId); auto* possessableEntity = Game::entityManager->GetEntity(possessableId);
if (possessableEntity) possessorComponent->Dismount(possessableEntity, true); if (possessableEntity) possessorComponent->Dismount(possessableEntity, true);
} }
} }
@ -1180,7 +1180,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
dest->SetImagination(999); dest->SetImagination(999);
dest->SetMaxImagination(999.0f); dest->SetMaxImagination(999.0f);
} }
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
if (chatCommand == "startcelebration" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) { if (chatCommand == "startcelebration" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) {
@ -1204,7 +1204,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
dest->SetImagination(9); dest->SetImagination(9);
dest->SetMaxImagination(9.0f); dest->SetMaxImagination(9.0f);
} }
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
if (chatCommand == "refillstats" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { if (chatCommand == "refillstats" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
@ -1216,7 +1216,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
dest->SetImagination((int)dest->GetMaxImagination()); dest->SetImagination((int)dest->GetMaxImagination());
} }
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
} }
if (chatCommand == "lookup" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) { if (chatCommand == "lookup" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) {
@ -1260,26 +1260,14 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
info.spawnerID = entity->GetObjectID(); info.spawnerID = entity->GetObjectID();
info.spawnerNodeID = 0; info.spawnerNodeID = 0;
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr); Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
if (newEntity == nullptr) { if (newEntity == nullptr) {
ChatPackets::SendSystemMessage(sysAddr, u"Failed to spawn entity."); ChatPackets::SendSystemMessage(sysAddr, u"Failed to spawn entity.");
return; return;
} }
auto vehiclePhysicsComponent = newEntity->GetComponent<VehiclePhysicsComponent>(); Game::entityManager->ConstructEntity(newEntity);
if (vehiclePhysicsComponent) {
auto newRot = newEntity->GetRotation();
auto angles = newRot.GetEulerAngles();
// make it right side up
angles.x -= PI;
// make it going in the direction of the player
angles.y -= PI;
newRot = NiQuaternion::FromEulerAngles(angles);
newEntity->SetRotation(newRot);
}
EntityManager::Instance()->ConstructEntity(newEntity);
} }
if (chatCommand == "spawngroup" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 3) { if (chatCommand == "spawngroup" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 3) {
@ -1322,13 +1310,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
info.pos = playerPosition + NiPoint3(cos(randomAngle) * randomRadius, 0.0f, sin(randomAngle) * randomRadius); info.pos = playerPosition + NiPoint3(cos(randomAngle) * randomRadius, 0.0f, sin(randomAngle) * randomRadius);
info.rot = NiQuaternion(); info.rot = NiQuaternion();
auto newEntity = EntityManager::Instance()->CreateEntity(info); auto newEntity = Game::entityManager->CreateEntity(info);
if (newEntity == nullptr) { if (newEntity == nullptr) {
ChatPackets::SendSystemMessage(sysAddr, u"Failed to spawn entity."); ChatPackets::SendSystemMessage(sysAddr, u"Failed to spawn entity.");
return; return;
} }
EntityManager::Instance()->ConstructEntity(newEntity); Game::entityManager->ConstructEntity(newEntity);
numberToSpawn--; numberToSpawn--;
} }
} }
@ -1557,7 +1545,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
auto* entity = EntityManager::Instance()->GetEntity(objid); auto* entity = Game::entityManager->GetEntity(objid);
if (!entity) return; if (!entity) return;
const auto sysAddr = entity->GetSystemAddress(); const auto sysAddr = entity->GetSystemAddress();
@ -1621,7 +1609,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
return; return;
} }
auto* vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (vehicle == nullptr) { if (vehicle == nullptr) {
return; return;
@ -1650,7 +1638,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
auto* possessorComponent = entity->GetComponent<PossessorComponent>(); auto* possessorComponent = entity->GetComponent<PossessorComponent>();
if (possessorComponent == nullptr) return; if (possessorComponent == nullptr) return;
auto* vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (vehicle == nullptr) return; if (vehicle == nullptr) return;
GameMessages::SendVehicleRemovePassiveBoostAction(vehicle->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendVehicleRemovePassiveBoostAction(vehicle->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
@ -1672,7 +1660,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (chatCommand == "spawnphysicsverts" && entity->GetGMLevel() >= eGameMasterLevel::JUNIOR_DEVELOPER) { if (chatCommand == "spawnphysicsverts" && entity->GetGMLevel() >= eGameMasterLevel::JUNIOR_DEVELOPER) {
//Go tell physics to spawn all the vertices: //Go tell physics to spawn all the vertices:
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PHANTOM_PHYSICS); auto entities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PHANTOM_PHYSICS);
for (auto en : entities) { for (auto en : entities) {
auto phys = static_cast<PhantomPhysicsComponent*>(en->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS)); auto phys = static_cast<PhantomPhysicsComponent*>(en->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
if (phys) if (phys)
@ -1681,7 +1669,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
} }
if (chatCommand == "reportproxphys" && entity->GetGMLevel() >= eGameMasterLevel::JUNIOR_DEVELOPER) { if (chatCommand == "reportproxphys" && entity->GetGMLevel() >= eGameMasterLevel::JUNIOR_DEVELOPER) {
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROXIMITY_MONITOR); auto entities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROXIMITY_MONITOR);
for (auto en : entities) { for (auto en : entities) {
auto phys = static_cast<ProximityMonitorComponent*>(en->GetComponent(eReplicaComponentType::PROXIMITY_MONITOR)); auto phys = static_cast<ProximityMonitorComponent*>(en->GetComponent(eReplicaComponentType::PROXIMITY_MONITOR));
if (phys) { if (phys) {
@ -1777,7 +1765,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
Game::config->ReloadConfig(); Game::config->ReloadConfig();
VanityUtilities::SpawnVanity(); VanityUtilities::SpawnVanity();
dpWorld::Instance().Reload(); dpWorld::Instance().Reload();
auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); auto entities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (auto entity : entities) { for (auto entity : entities) {
auto* scriptedActivityComponent = entity->GetComponent<ScriptedActivityComponent>(); auto* scriptedActivityComponent = entity->GetComponent<ScriptedActivityComponent>();
if (!scriptedActivityComponent) continue; if (!scriptedActivityComponent) continue;
@ -1874,7 +1862,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
auto closestDistance = 0.0f; auto closestDistance = 0.0f;
const auto candidates = EntityManager::Instance()->GetEntitiesByComponent(component); const auto candidates = Game::entityManager->GetEntitiesByComponent(component);
for (auto* candidate : candidates) { for (auto* candidate : candidates) {
if (candidate->GetLOT() == 1 || candidate->GetLOT() == 8092) { if (candidate->GetLOT() == 1 || candidate->GetLOT() == 8092) {
@ -1906,7 +1894,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
return; return;
} }
EntityManager::Instance()->SerializeEntity(closest); Game::entityManager->SerializeEntity(closest);
auto* table = CDClientManager::Instance().GetTable<CDObjectsTable>(); auto* table = CDClientManager::Instance().GetTable<CDObjectsTable>();
@ -1946,7 +1934,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
movingPlatformComponent->GotoWaypoint(value); movingPlatformComponent->GotoWaypoint(value);
} }
EntityManager::Instance()->SerializeEntity(closest); Game::entityManager->SerializeEntity(closest);
} else if (args[1] == "-a" && args.size() >= 3) { } else if (args[1] == "-a" && args.size() >= 3) {
RenderComponent::PlayAnimation(closest, args.at(2)); RenderComponent::PlayAnimation(closest, args.at(2));
} else if (args[1] == "-s") { } else if (args[1] == "-s") {

View File

@ -137,14 +137,14 @@ void VanityUtilities::SpawnVanity() {
info.lot = 8139; info.lot = 8139;
info.pos = { 259.5f, 246.4f, -705.2f }; info.pos = { 259.5f, 246.4f, -705.2f };
info.rot = { 0.0f, 0.0f, 1.0f, 0.0f }; info.rot = { 0.0f, 0.0f, 1.0f, 0.0f };
info.spawnerID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(); info.spawnerID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
info.settings = { new LDFData<bool>(u"hasCustomText", true), info.settings = { new LDFData<bool>(u"hasCustomText", true),
new LDFData<std::string>(u"customText", ParseMarkdown((BinaryPathFinder::GetBinaryDir() / "vanity/TESTAMENT.md").string())) }; new LDFData<std::string>(u"customText", ParseMarkdown((BinaryPathFinder::GetBinaryDir() / "vanity/TESTAMENT.md").string())) };
auto* entity = EntityManager::Instance()->CreateEntity(info); auto* entity = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(entity); Game::entityManager->ConstructEntity(entity);
} }
} }
} }
@ -155,10 +155,10 @@ Entity* VanityUtilities::SpawnNPC(LOT lot, const std::string& name, const NiPoin
info.lot = lot; info.lot = lot;
info.pos = position; info.pos = position;
info.rot = rotation; info.rot = rotation;
info.spawnerID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(); info.spawnerID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
info.settings = ldf; info.settings = ldf;
auto* entity = EntityManager::Instance()->CreateEntity(info); auto* entity = Game::entityManager->CreateEntity(info);
entity->SetVar(u"npcName", name); entity->SetVar(u"npcName", name);
auto* inventoryComponent = entity->GetComponent<InventoryComponent>(); auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
@ -175,7 +175,7 @@ Entity* VanityUtilities::SpawnNPC(LOT lot, const std::string& name, const NiPoin
destroyableComponent->SetHealth(0); destroyableComponent->SetHealth(0);
} }
EntityManager::Instance()->ConstructEntity(entity); Game::entityManager->ConstructEntity(entity);
return entity; return entity;
} }
@ -535,7 +535,7 @@ void VanityUtilities::NPCTalk(Entity* npc) {
npc->GetObjectID(), u"sendToclient_bubble", 0, 0, npc->GetObjectID(), selected, UNASSIGNED_SYSTEM_ADDRESS); npc->GetObjectID(), u"sendToclient_bubble", 0, 0, npc->GetObjectID(), selected, UNASSIGNED_SYSTEM_ADDRESS);
} }
EntityManager::Instance()->SerializeEntity(npc); Game::entityManager->SerializeEntity(npc);
const float nextTime = GeneralUtils::GenerateRandomNumber<float>(15, 60); const float nextTime = GeneralUtils::GenerateRandomNumber<float>(15, 60);

View File

@ -2,6 +2,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdint>
class RawChunk; class RawChunk;
struct RawMesh; struct RawMesh;

View File

@ -82,7 +82,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac
CINSTREAM_SKIP_HEADER; CINSTREAM_SKIP_HEADER;
Entity* entity = EntityManager::Instance()->GetEntity(user->GetLastUsedChar()->GetObjectID()); Entity* entity = Game::entityManager->GetEntity(user->GetLastUsedChar()->GetObjectID());
if (!entity) return; if (!entity) return;
ControllablePhysicsComponent* comp = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS)); ControllablePhysicsComponent* comp = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
@ -95,7 +95,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac
comp->SetVelocity(zeroVel); comp->SetVelocity(zeroVel);
comp->SetAngularVelocity(zeroVel); comp->SetAngularVelocity(zeroVel);
comp->SetIsOnGround(true); //probably8 comp->SetIsOnGround(true); //probably8
EntityManager::Instance()->SerializeEntity(entity); Game::entityManager->SerializeEntity(entity);
return; return;
} }
*/ */
@ -166,7 +166,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac
bool updateChar = true; bool updateChar = true;
if (possessorComponent != nullptr) { if (possessorComponent != nullptr) {
auto* possassableEntity = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* possassableEntity = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (possassableEntity != nullptr) { if (possassableEntity != nullptr) {
auto* possessableComponent = possassableEntity->GetComponent<PossessableComponent>(); auto* possessableComponent = possassableEntity->GetComponent<PossessableComponent>();
@ -199,7 +199,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac
controllablePhysicsComponent->SetAngularVelocity(angVelocity); controllablePhysicsComponent->SetAngularVelocity(angVelocity);
controllablePhysicsComponent->SetDirtyAngularVelocity(angVelocityFlag); controllablePhysicsComponent->SetDirtyAngularVelocity(angVelocityFlag);
} }
EntityManager::Instance()->SerializeEntity(possassableEntity); Game::entityManager->SerializeEntity(possassableEntity);
} }
} }
@ -227,9 +227,9 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac
auto* player = static_cast<Player*>(entity); auto* player = static_cast<Player*>(entity);
player->SetGhostReferencePoint(position); player->SetGhostReferencePoint(position);
EntityManager::Instance()->QueueGhostUpdate(player->GetObjectID()); Game::entityManager->QueueGhostUpdate(player->GetObjectID());
if (updateChar) EntityManager::Instance()->SerializeEntity(entity); if (updateChar) Game::entityManager->SerializeEntity(entity);
//TODO: add moving platform stuffs //TODO: add moving platform stuffs
/*bool movingPlatformFlag; /*bool movingPlatformFlag;
@ -267,7 +267,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac
continue; continue;
} }
EntityManager::Instance()->SerializeEntity(entity, player); Game::entityManager->SerializeEntity(entity, player);
} }
*/ */
} }

View File

@ -61,13 +61,13 @@ void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
} }
// There is suppose to be a 0.1 second delay here but that may be admitted? // There is suppose to be a 0.1 second delay here but that may be admitted?
auto* controller = EntityManager::Instance()->GetZoneControlEntity(); auto* controller = Game::entityManager->GetZoneControlEntity();
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
self->SetPosition({ 10000, 0, 10000 }); self->SetPosition({ 10000, 0, 10000 });
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
controller->OnFireEventServerSide(self, "ClearProperty"); controller->OnFireEventServerSide(self, "ClearProperty");
} }
@ -97,7 +97,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
rot = controllable->GetRotation(); rot = controllable->GetRotation();
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>(); auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
@ -113,7 +113,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
//TODO: Set faction to -1 and set immunity //TODO: Set faction to -1 and set immunity
destroyable->SetFaction(-1); destroyable->SetFaction(-1);
destroyable->SetIsImmune(true); destroyable->SetIsImmune(true);
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
self->AddTimer("WithdrawComplete", withdrawTime + 1.0f); self->AddTimer("WithdrawComplete", withdrawTime + 1.0f);
waitForIdle = true; waitForIdle = true;
@ -146,7 +146,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
//Reset the current wave death counter //Reset the current wave death counter
m_DeathCounter = 0; m_DeathCounter = 0;
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
// Prepare a timer for post leap attack // Prepare a timer for post leap attack
self->AddTimer("AdvanceAttack", attackPause); self->AddTimer("AdvanceAttack", attackPause);
@ -179,7 +179,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
std::vector<LWOOBJID> spiderEggs{}; std::vector<LWOOBJID> spiderEggs{};
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("EGG"); auto spooders = Game::entityManager->GetEntitiesInGroup("EGG");
for (auto spodder : spooders) { for (auto spodder : spooders) {
spiderEggs.push_back(spodder->GetObjectID()); spiderEggs.push_back(spodder->GetObjectID());
} }
@ -201,7 +201,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
} }
if (randomEgg) { if (randomEgg) {
auto* eggEntity = EntityManager::Instance()->GetEntity(randomEgg); auto* eggEntity = Game::entityManager->GetEntity(randomEgg);
if (eggEntity == nullptr) { if (eggEntity == nullptr) {
continue; continue;
@ -234,7 +234,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
// We have successfully readied a full wave // We have successfully readied a full wave
// initiate hatching! // initiate hatching!
for (auto egg : hatchList) { for (auto egg : hatchList) {
auto* eggEntity = EntityManager::Instance()->GetEntity(egg); auto* eggEntity = Game::entityManager->GetEntity(egg);
if (eggEntity == nullptr) { if (eggEntity == nullptr) {
continue; continue;
@ -304,7 +304,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) {
void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) { void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
if (!impactList.empty()) { if (!impactList.empty()) {
auto* entity = EntityManager::Instance()->GetEntity(impactList[0]); auto* entity = Game::entityManager->GetEntity(impactList[0]);
impactList.erase(impactList.begin()); impactList.erase(impactList.begin());
@ -408,7 +408,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
controllable->SetStatic(false); controllable->SetStatic(false);
controllable->SetRotation(rot); controllable->SetRotation(rot);
controllable->SetStatic(true); controllable->SetStatic(true);
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
//Play the Spider Boss' mountain idle anim //Play the Spider Boss' mountain idle anim
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle); auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
@ -419,7 +419,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
rot = controllable->GetRotation(); rot = controllable->GetRotation();
//If there are still baby spiders, don't do anyhting either //If there are still baby spiders, don't do anyhting either
const auto spiders = EntityManager::Instance()->GetEntitiesInGroup("BabySpider"); const auto spiders = Game::entityManager->GetEntitiesInGroup("BabySpider");
if (spiders.size() > 0) if (spiders.size() > 0)
self->AddTimer("checkForSpiders", time); self->AddTimer("checkForSpiders", time);
else else
@ -491,7 +491,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
}*/ }*/
auto landingTarget = self->GetI64(u"LandingTarget"); auto landingTarget = self->GetI64(u"LandingTarget");
auto landingEntity = EntityManager::Instance()->GetEntity(landingTarget); auto landingEntity = Game::entityManager->GetEntity(landingTarget);
auto* skillComponent = self->GetComponent<SkillComponent>(); auto* skillComponent = self->GetComponent<SkillComponent>();
@ -547,10 +547,10 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
destroyable->SetIsImmune(false); destroyable->SetIsImmune(false);
destroyable->SetFaction(4); destroyable->SetFaction(4);
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
} else if (timerName == "Clear") { } else if (timerName == "Clear") {
EntityManager::Instance()->FireEventServerSide(self, "ClearProperty"); Game::entityManager->FireEventServerSide(self, "ClearProperty");
self->CancelAllTimers(); self->CancelAllTimers();
} else if (timerName == "UnlockSpecials") { } else if (timerName == "UnlockSpecials") {
//We no longer need to lock specials //We no longer need to lock specials
@ -605,7 +605,7 @@ void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
controllable->SetRotation(NiQuaternion::IDENTITY); controllable->SetRotation(NiQuaternion::IDENTITY);
controllable->SetStatic(true); controllable->SetStatic(true);
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
} }
//---------------------------------------------- //----------------------------------------------

View File

@ -28,7 +28,7 @@ void AmDarklingDragon::OnDie(Entity* self, Entity* killer) {
auto golemId = self->GetVar<LWOOBJID>(u"Golem"); auto golemId = self->GetVar<LWOOBJID>(u"Golem");
auto* golem = EntityManager::Instance()->GetEntity(golemId); auto* golem = Game::entityManager->GetEntity(golemId);
if (golem != nullptr) { if (golem != nullptr) {
golem->Smash(self->GetObjectID()); golem->Smash(self->GetObjectID());
@ -109,9 +109,9 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID()) new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
}; };
auto* golemObject = EntityManager::Instance()->CreateEntity(info); auto* golemObject = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(golemObject); Game::entityManager->ConstructEntity(golemObject);
} }
} }
} }

View File

@ -3,7 +3,7 @@
void FvMaelstromCavalry::OnStartup(Entity* self) { void FvMaelstromCavalry::OnStartup(Entity* self) {
for (const auto& group : self->GetGroups()) { for (const auto& group : self->GetGroups()) {
const auto& objects = EntityManager::Instance()->GetEntitiesInGroup(group); const auto& objects = Game::entityManager->GetEntitiesInGroup(group);
for (auto* obj : objects) { for (auto* obj : objects) {
if (obj->GetLOT() != 8551) continue; if (obj->GetLOT() != 8551) continue;
@ -22,7 +22,7 @@ void FvMaelstromCavalry::OnDie(Entity* self, Entity* killer) {
return; return;
} }
const auto& triggers = EntityManager::Instance()->GetEntitiesInGroup("HorsemenTrigger"); const auto& triggers = Game::entityManager->GetEntitiesInGroup("HorsemenTrigger");
for (auto* trigger : triggers) { for (auto* trigger : triggers) {
trigger->OnFireEventServerSide(self, "HorsemenDeath"); trigger->OnFireEventServerSide(self, "HorsemenDeath");

View File

@ -35,13 +35,13 @@ void FvMaelstromDragon::OnDie(Entity* self, Entity* killer) {
info.rot = rotation; info.rot = rotation;
info.spawnerID = self->GetObjectID(); info.spawnerID = self->GetObjectID();
auto* chest = EntityManager::Instance()->CreateEntity(info); auto* chest = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(chest); Game::entityManager->ConstructEntity(chest);
auto golemId = self->GetVar<LWOOBJID>(u"Golem"); auto golemId = self->GetVar<LWOOBJID>(u"Golem");
auto* golem = EntityManager::Instance()->GetEntity(golemId); auto* golem = Game::entityManager->GetEntity(golemId);
if (golem != nullptr) { if (golem != nullptr) {
golem->Smash(self->GetObjectID()); golem->Smash(self->GetObjectID());
@ -125,9 +125,9 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID()) new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
}; };
auto* golemObject = EntityManager::Instance()->CreateEntity(info); auto* golemObject = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(golemObject); Game::entityManager->ConstructEntity(golemObject);
} }
} }
} }

View File

@ -15,7 +15,7 @@ void BaseEnemyApe::OnStartup(Entity* self) {
} }
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) { void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
auto* anchor = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"QB")); auto* anchor = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
if (anchor != nullptr && !anchor->GetIsDead()) { if (anchor != nullptr && !anchor->GetIsDead()) {
anchor->Smash(self->GetObjectID(), eKillType::SILENT); anchor->Smash(self->GetObjectID(), eKillType::SILENT);
} }
@ -56,7 +56,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
if (destroyableComponent != nullptr) { if (destroyableComponent != nullptr) {
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned); destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
} }
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1); self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1);
StunApe(self, false); StunApe(self, false);
@ -92,14 +92,14 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
new LDFData<LWOOBJID>(u"ape", self->GetObjectID()) new LDFData<LWOOBJID>(u"ape", self->GetObjectID())
}; };
auto* anchor = EntityManager::Instance()->CreateEntity(entityInfo); auto* anchor = Game::entityManager->CreateEntity(entityInfo);
EntityManager::Instance()->ConstructEntity(anchor); Game::entityManager->ConstructEntity(anchor);
self->SetVar<LWOOBJID>(u"QB", anchor->GetObjectID()); self->SetVar<LWOOBJID>(u"QB", anchor->GetObjectID());
} else if (timerName == "anchorDamageTimer") { } else if (timerName == "anchorDamageTimer") {
// Attacks the ape with some god skill // Attacks the ape with some god skill
const auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"smasher")); const auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"smasher"));
if (player == nullptr) { if (player == nullptr) {
return; return;
} }

View File

@ -38,8 +38,8 @@ void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
info.spawnerID = self->GetObjectID(); info.spawnerID = self->GetObjectID();
info.settings = cfg; info.settings = cfg;
Entity* turret = EntityManager::Instance()->CreateEntity(info, nullptr); Entity* turret = Game::entityManager->CreateEntity(info, nullptr);
if (turret) { if (turret) {
EntityManager::Instance()->ConstructEntity(turret); Game::entityManager->ConstructEntity(turret);
} }
} }

View File

@ -15,7 +15,7 @@ void GfApeSmashingQB::OnTimerDone(Entity* self, std::string timerName) {
} }
void GfApeSmashingQB::OnRebuildComplete(Entity* self, Entity* target) { void GfApeSmashingQB::OnRebuildComplete(Entity* self, Entity* target) {
auto* ape = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"ape")); auto* ape = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"ape"));
if (ape != nullptr) { if (ape != nullptr) {
ape->OnFireEventServerSide(target, "rebuildDone"); ape->OnFireEventServerSide(target, "rebuildDone");
RenderComponent::PlayAnimation(self, u"smash", 1.7f); RenderComponent::PlayAnimation(self, u"smash", 1.7f);

View File

@ -29,7 +29,7 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
rating = team->members.size(); rating = team->members.size();
for (const auto member : team->members) { for (const auto member : team->members) {
auto* memberObject = EntityManager::Instance()->GetEntity(member); auto* memberObject = Game::entityManager->GetEntity(member);
if (memberObject == nullptr) continue; if (memberObject == nullptr) continue;

View File

@ -7,14 +7,14 @@
#include "Loot.h" #include "Loot.h"
void BootyDigServer::OnStartup(Entity* self) { void BootyDigServer::OnStartup(Entity* self) {
auto* zoneControlObject = EntityManager::Instance()->GetZoneControlEntity(); auto* zoneControlObject = Game::entityManager->GetZoneControlEntity();
if (zoneControlObject != nullptr) { if (zoneControlObject != nullptr) {
zoneControlObject->OnFireEventServerSide(self, "CheckForPropertyOwner"); zoneControlObject->OnFireEventServerSide(self, "CheckForPropertyOwner");
} }
} }
void BootyDigServer::OnPlayerLoaded(Entity* self, Entity* player) { void BootyDigServer::OnPlayerLoaded(Entity* self, Entity* player) {
auto* zoneControlObject = EntityManager::Instance()->GetZoneControlEntity(); auto* zoneControlObject = Game::entityManager->GetZoneControlEntity();
if (zoneControlObject != nullptr) { if (zoneControlObject != nullptr) {
zoneControlObject->OnFireEventServerSide(self, "CheckForPropertyOwner"); zoneControlObject->OnFireEventServerSide(self, "CheckForPropertyOwner");
} }

View File

@ -18,7 +18,7 @@ void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* se
if (sender == nullptr) return; if (sender == nullptr) return;
if (args == "attemptCollection") { if (args == "attemptCollection") {
Entity* player = EntityManager::Instance()->GetEntity(self->GetSpawnerID()); Entity* player = Game::entityManager->GetEntity(self->GetSpawnerID());
if (!player) return; if (!player) return;
auto missionComponent = player->GetComponent<MissionComponent>(); auto missionComponent = player->GetComponent<MissionComponent>();

View File

@ -8,7 +8,7 @@
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) { void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
//Tell the client to spawn the baby spiderling: //Tell the client to spawn the baby spiderling:
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("cagedSpider"); auto spooders = Game::entityManager->GetEntitiesInGroup("cagedSpider");
for (auto spodder : spooders) { for (auto spodder : spooders) {
GameMessages::SendFireEventClientSide(spodder->GetObjectID(), user->GetSystemAddress(), u"toggle", LWOOBJID_EMPTY, 0, 0, user->GetObjectID()); GameMessages::SendFireEventClientSide(spodder->GetObjectID(), user->GetSystemAddress(), u"toggle", LWOOBJID_EMPTY, 0, 0, user->GetObjectID());
} }

View File

@ -28,7 +28,7 @@ void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::str
void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) { void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != "killBird") return; if (timerName != "killBird") return;
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID")); auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
if (player == nullptr) return; if (player == nullptr) return;

View File

@ -2,14 +2,14 @@
#include "EntityManager.h" #include "EntityManager.h"
void AgMonumentLaserServer::OnStartup(Entity* self) { void AgMonumentLaserServer::OnStartup(Entity* self) {
auto lasers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"volGroup")); auto lasers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
for (auto laser : lasers) { for (auto laser : lasers) {
if (laser) laser->SetBoolean(u"active", true); if (laser) laser->SetBoolean(u"active", true);
} }
} }
void AgMonumentLaserServer::OnDie(Entity* self, Entity* killer) { void AgMonumentLaserServer::OnDie(Entity* self, Entity* killer) {
auto lasers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVarAsString(u"volGroup")); auto lasers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
for (auto laser : lasers) { for (auto laser : lasers) {
if (laser) laser->SetBoolean(u"active", false); if (laser) laser->SetBoolean(u"active", false);
} }

View File

@ -2,7 +2,7 @@
#include "EntityManager.h" #include "EntityManager.h"
void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) { void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) {
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager"); auto managers = Game::entityManager->GetEntitiesInGroup("race_manager");
if (!managers.empty()) { if (!managers.empty()) {
managers[0]->OnFireEventServerSide(target, "course_cancel"); managers[0]->OnFireEventServerSide(target, "course_cancel");
} }

View File

@ -8,7 +8,7 @@ void AgMonumentRaceGoal::OnStartup(Entity* self) {
void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (name == "RaceGoal" && entering && entering->IsPlayer() && status == "ENTER") { if (name == "RaceGoal" && entering && entering->IsPlayer() && status == "ENTER") {
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager"); auto managers = Game::entityManager->GetEntitiesInGroup("race_manager");
if (managers.empty() || !managers.at(0)) return; if (managers.empty() || !managers.at(0)) return;
managers.at(0)->OnFireEventServerSide(entering, "course_finish"); managers.at(0)->OnFireEventServerSide(entering, "course_finish");
} }

View File

@ -40,7 +40,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID()); scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
} else if (identifier == u"player_dialog_start_course" && button == 1) { } else if (identifier == u"player_dialog_start_course" && button == 1) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress()); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
@ -54,7 +54,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
data->values[1] = *(float*)&startTime; data->values[1] = *(float*)&startTime;
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
} else if (identifier == u"FootRaceCancel") { } else if (identifier == u"FootRaceCancel") {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress()); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
@ -92,7 +92,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
"performact_time"); "performact_time");
} }
EntityManager::Instance()->SerializeEntity(self); Game::entityManager->SerializeEntity(self);
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), static_cast<float>(finish)); LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), static_cast<float>(finish));
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard", GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",

View File

@ -35,7 +35,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" }; : std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
for (const auto& group : groups) { for (const auto& group : groups) {
auto samples = EntityManager::Instance()->GetEntitiesInGroup(group); auto samples = Game::entityManager->GetEntitiesInGroup(group);
for (auto* sample : samples) { for (auto* sample : samples) {
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0, GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
target->GetObjectID(), "", target->GetSystemAddress()); target->GetObjectID(), "", target->GetSystemAddress());

View File

@ -63,7 +63,7 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
return; return;
if (timerName == "killSpider") { if (timerName == "killSpider") {
auto spawnTargets = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup)); auto spawnTargets = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup));
for (auto* spawnTarget : spawnTargets) { for (auto* spawnTarget : spawnTargets) {
EntityInfo info{}; EntityInfo info{};
@ -75,8 +75,8 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID()) new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID())
}; };
auto* chest = EntityManager::Instance()->CreateEntity(info); auto* chest = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(chest); Game::entityManager->ConstructEntity(chest);
} }
} }

Some files were not shown because too many files have changed in this diff Show More