Merge branch 'main' into pr/1107

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

View File

@@ -42,7 +42,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
CBITSTREAM;
// Get the entity
Entity* entity = EntityManager::Instance()->GetEntity(objectID);
Entity* entity = Game::entityManager->GetEntity(objectID);
User* usr = UserManager::Instance()->GetUser(sysAddr);
@@ -122,9 +122,9 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
auto* destroyable = entity->GetComponent<DestroyableComponent>();
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) {
auto* racingComponent = racingController->GetComponent<RacingControlComponent>();
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)) {
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) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
@@ -248,7 +248,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
dest->SetHealth(4);
dest->SetArmor(0);
dest->SetImagination(6);
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(entity);
}*/
break;
}
@@ -560,7 +560,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
break;
case eGameMessageType::ZONE_PROPERTY_MODEL_ROTATED:
EntityManager::Instance()->GetZoneControlEntity()->OnZonePropertyModelRotated(usr->GetLastUsedChar()->GetEntity());
Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelRotated(usr->GetLastUsedChar()->GetEntity());
break;
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") {
for (const auto memberId : team->members) {
auto* member = EntityManager::Instance()->GetEntity(memberId);
auto* member = Game::entityManager->GetEntity(memberId);
if (member == nullptr) continue;
@@ -1690,11 +1690,11 @@ void GameMessages::HandleActivityStateChangeRequest(RakNet::BitStream* inStream,
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);
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY);
std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY);
for (Entity* scriptEntity : scriptedActs) {
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());
/*
auto entites = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_VENDOR);
auto entites = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_VENDOR);
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];
*/
@@ -2270,7 +2270,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
if (inStream->ReadBit())
inStream->Read(startPosition);
auto* player = EntityManager::Instance()->GetEntity(playerId);
auto* player = Game::entityManager->GetEntity(playerId);
if (startPosition == NiPoint3::ZERO) {
startPosition = player->GetPosition();
@@ -2318,7 +2318,7 @@ void GameMessages::HandleStartBuildingWithItem(RakNet::BitStream* inStream, Enti
auto* user = UserManager::Instance()->GetUser(sysAddr);
auto* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
auto* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
SendStartArrangingWithItem(
player,
@@ -2352,7 +2352,7 @@ void GameMessages::HandlePropertyEditorEnd(RakNet::BitStream* inStream, Entity*
void GameMessages::HandlePropertyContentsFromClient(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& 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);
}
@@ -2715,9 +2715,9 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
info.settings.push_back(propertyObjectID);
info.settings.push_back(userModelID);
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
if (newEntity) {
EntityManager::Instance()->ConstructEntity(newEntity);
Game::entityManager->ConstructEntity(newEntity);
//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
@@ -2913,7 +2913,7 @@ void GameMessages::HandleCinematicUpdate(RakNet::BitStream* inStream, Entity* en
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) {
scriptEntity->OnCinematicUpdate(scriptEntity, entity, event, pathName, pathTime, overallTime, waypoint);
}
@@ -3293,7 +3293,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream* inStream, Entity*
inStream->Read(i64Invitee);
auto* invitee = EntityManager::Instance()->GetEntity(i64Invitee);
auto* invitee = Game::entityManager->GetEntity(i64Invitee);
if (invitee != nullptr && invitee->IsPlayer()) {
character = invitee->GetCharacter();
@@ -3880,7 +3880,7 @@ void GameMessages::HandleMessageBoxResponse(RakNet::BitStream* inStream, Entity*
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);
}
}
@@ -4041,7 +4041,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
// If we aren't possessing somethings, the don't do anything
if (objectId != LWOOBJID_EMPTY) {
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
if (possessorComponent && mount) {
if (!possessorComponent->GetIsDismounting()) return;
@@ -4066,7 +4066,7 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
if (possessableComponent) possessableComponent->Dismount();
// Update the entity that was possessing
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(entity);
// 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);
@@ -4076,11 +4076,11 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream* inStream, Entity* e
void GameMessages::HandleAcknowledgePossession(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(entity);
LWOOBJID objectId{};
inStream->Read(objectId);
auto* mount = EntityManager::Instance()->GetEntity(objectId);
if (mount) EntityManager::Instance()->SerializeEntity(mount);
auto* mount = Game::entityManager->GetEntity(objectId);
if (mount) Game::entityManager->SerializeEntity(mount);
}
//Racing
@@ -4116,7 +4116,7 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity*
inStream->Read(playerID);
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -4180,7 +4180,7 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (entity == nullptr) {
return;
@@ -4207,7 +4207,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre
inStream->Read(playerID);
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -4271,7 +4271,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
if (inStream->ReadBit()) inStream->Read(pickupSpawnerIndex);
if (inStream->ReadBit()) inStream->Read(vehiclePosition);
auto* pickup = EntityManager::Instance()->GetEntity(pickupObjID);
auto* pickup = Game::entityManager->GetEntity(pickupObjID);
if (pickup == nullptr) {
return;
@@ -4280,7 +4280,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
entity = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
entity = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (entity == nullptr) {
return;
@@ -4671,7 +4671,7 @@ void GameMessages::HandleToggleGhostReferenceOverride(RakNet::BitStream* inStrea
if (player != nullptr) {
player->SetGhostOverride(bOverride);
EntityManager::Instance()->UpdateGhosting(player);
Game::entityManager->UpdateGhosting(player);
}
}
@@ -4686,7 +4686,7 @@ void GameMessages::HandleSetGhostReferencePosition(RakNet::BitStream* inStream,
if (player != nullptr) {
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);
if (!user) return;
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!player) return;
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);
if (!user) return;
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!player) return;
Character* character = player->GetCharacter();
if (!character) return;
@@ -4838,7 +4838,7 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
//inv->RemoveItem(count, -1, iObjID);
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);
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
//Game::entityManager->SerializeEntity(player); // so inventory updates
GameMessages::SendVendorTransactionResult(entity, sysAddr);
}
@@ -4857,7 +4857,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return;
Entity* player = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!player) return;
Character* character = player->GetCharacter();
if (!character) return;
@@ -4897,7 +4897,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
//inv->RemoveItem(count, -1, iObjID);
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
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);
}
@@ -4944,7 +4944,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity
if (param3IsDefault) inStream->Read(param3);
inStream->Read(senderID);
auto* sender = EntityManager::Instance()->GetEntity(senderID);
auto* sender = Game::entityManager->GetEntity(senderID);
auto* player = Player::GetPlayer(sysAddr);
if (!player) {
@@ -5018,7 +5018,7 @@ void GameMessages::HandleRebuildCancel(RakNet::BitStream* inStream, Entity* enti
RebuildComponent* rebComp = static_cast<RebuildComponent*>(entity->GetComponent(eReplicaComponentType::QUICK_BUILD));
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) {
@@ -5034,7 +5034,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity,
inStream->Read(objectID);
inStream->Read(secondary);
Entity* interactedObject = EntityManager::Instance()->GetEntity(objectID);
Entity* interactedObject = Game::entityManager->GetEntity(objectID);
if (interactedObject == nullptr) {
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 (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);
@@ -5097,7 +5097,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
}
} else {
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();
@@ -5125,7 +5125,7 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E
User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return;
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
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);
}
Entity* offerer = EntityManager::Instance()->GetEntity(receiverID);
Entity* offerer = Game::entityManager->GetEntity(receiverID);
if (offerer == nullptr) {
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)) {
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(missionID);
inStream->Read(responder);
player = EntityManager::Instance()->GetEntity(responder);
player = Game::entityManager->GetEntity(responder);
for (CppScripts::Script* script : CppScripts::GetEntityScripts(entity)) {
script->OnMissionDialogueOK(entity, player, missionID, iMissionState);
@@ -5235,7 +5235,7 @@ void GameMessages::HandleRequestLinkedMission(RakNet::BitStream* inStream, Entit
inStream->Read(missionId);
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));
@@ -5248,7 +5248,7 @@ void GameMessages::HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* e
LWOOBJID playerID;
inStream->Read(playerID);
Entity* player = EntityManager::Instance()->GetEntity(playerID);
Entity* player = Game::entityManager->GetEntity(playerID);
if (!player || !entity || entity->GetCollectibleID() == 0) return;
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
@@ -5362,7 +5362,7 @@ void GameMessages::HandleEquipItem(RakNet::BitStream* inStream, Entity* entity)
item->Equip();
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(entity);
}
void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity) {
@@ -5382,7 +5382,7 @@ void GameMessages::HandleUnequipItem(RakNet::BitStream* inStream, Entity* entity
item->UnEquip();
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(entity);
}
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);
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(entity);
auto* missionComponent = entity->GetComponent<MissionComponent>();
@@ -5501,7 +5501,7 @@ void GameMessages::HandleMoveItemInInventory(RakNet::BitStream* inStream, Entity
}
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) {
@@ -5547,7 +5547,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre
}
inv->MoveItemToInventory(item, inventoryTypeB, stackCount, showFlyingLoot);
EntityManager::Instance()->SerializeEntity(entity);
Game::entityManager->SerializeEntity(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) {
User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return;
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
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
//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
@@ -5654,7 +5654,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return;
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return;
@@ -5707,9 +5707,9 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
*/
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;
@@ -5765,7 +5765,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
User* user = UserManager::Instance()->GetUser(sysAddr);
if (!user) return;
Entity* character = EntityManager::Instance()->GetEntity(user->GetLoggedInChar());
Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
if (!character) return;
Game::logger->Log("GameMessages", "Build and move");
@@ -5798,7 +5798,7 @@ void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity)
if (team != nullptr) {
for (const auto memberId : team->members) {
auto* member = EntityManager::Instance()->GetEntity(memberId);
auto* member = Game::entityManager->GetEntity(memberId);
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) {
bool immediate = inStream->ReadBit();
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
Entity* zoneControl = Game::entityManager->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
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) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
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));
if (!inv) return;
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(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 (value != 0) {
for (Entity* scriptedAct : scriptedActs) {
@@ -6034,7 +6034,7 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
void
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) {
const auto* rail = possibleRail->GetComponent<RailActivatorComponent>();
if (rail != nullptr) {
@@ -6046,7 +6046,7 @@ GameMessages::HandleClientRailMovementReady(RakNet::BitStream* inStream, Entity*
void GameMessages::HandleCancelRailMovement(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
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) {
auto* rail = possibleRail->GetComponent<RailActivatorComponent>();
if (rail != nullptr) {
@@ -6070,7 +6070,7 @@ void GameMessages::HandlePlayerRailArrivedNotification(RakNet::BitStream* inStre
int32_t 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 (CppScripts::Script* script : CppScripts::GetEntityScripts(possibleRail)) {
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) {
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);
};
@@ -6203,7 +6203,7 @@ void GameMessages::HandleRequestActivityExit(RakNet::BitStream* inStream, Entity
LWOOBJID player_id = LWOOBJID_EMPTY;
inStream->Read(player_id);
auto player = EntityManager::Instance()->GetEntity(player_id);
auto player = Game::entityManager->GetEntity(player_id);
if (!entity || !player) return;
entity->RequestActivityExit(entity, player_id, canceled);
}