mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-30 21:51:33 +00:00
fix: ghost mis-matched pointer causing objects to not destruct
This commit is contained in:
parent
e42df5b02e
commit
7324740be6
@ -320,7 +320,7 @@ const std::unordered_map<std::string, LWOOBJID>& EntityManager::GetSpawnPointEnt
|
|||||||
return m_SpawnPoints;
|
return m_SpawnPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr, const bool skipChecks) {
|
void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr) {
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
LOG("Attempted to construct null entity");
|
LOG("Attempted to construct null entity");
|
||||||
return;
|
return;
|
||||||
@ -363,16 +363,12 @@ void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr
|
|||||||
entity->WriteComponents(stream, eReplicaPacketType::CONSTRUCTION);
|
entity->WriteComponents(stream, eReplicaPacketType::CONSTRUCTION);
|
||||||
|
|
||||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) {
|
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) {
|
||||||
if (skipChecks) {
|
for (auto* player : PlayerManager::GetAllPlayers()) {
|
||||||
Game::server->Send(stream, UNASSIGNED_SYSTEM_ADDRESS, true);
|
if (player->GetPlayerReadyForUpdates()) {
|
||||||
} else {
|
Game::server->Send(stream, player->GetSystemAddress(), false);
|
||||||
for (auto* player : PlayerManager::GetAllPlayers()) {
|
} else {
|
||||||
if (player->GetPlayerReadyForUpdates()) {
|
auto* ghostComponent = player->GetComponent<GhostComponent>();
|
||||||
Game::server->Send(stream, player->GetSystemAddress(), false);
|
if (ghostComponent) ghostComponent->AddLimboConstruction(entity->GetObjectID());
|
||||||
} else {
|
|
||||||
auto* ghostComponent = player->GetComponent<GhostComponent>();
|
|
||||||
if (ghostComponent) ghostComponent->AddLimboConstruction(entity->GetObjectID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
const std::unordered_map<LWOOBJID, Entity*> GetAllEntities() const { return m_Entities; }
|
const std::unordered_map<LWOOBJID, Entity*> GetAllEntities() const { return m_Entities; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ConstructEntity(Entity* entity, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS, bool skipChecks = false);
|
void ConstructEntity(Entity* entity, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
void DestructEntity(Entity* entity, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
void DestructEntity(Entity* entity, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
void SerializeEntity(Entity* entity);
|
void SerializeEntity(Entity* entity);
|
||||||
void SerializeEntity(const Entity& entity);
|
void SerializeEntity(const Entity& entity);
|
||||||
|
@ -1045,7 +1045,7 @@ void HandlePacket(Packet* packet) {
|
|||||||
|
|
||||||
const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID());
|
const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID());
|
||||||
|
|
||||||
Game::entityManager->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS, true);
|
Game::entityManager->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
if (respawnPoint != NiPoint3Constant::ZERO) {
|
if (respawnPoint != NiPoint3Constant::ZERO) {
|
||||||
GameMessages::SendPlayerReachedRespawnCheckpoint(player, respawnPoint, NiQuaternionConstant::IDENTITY);
|
GameMessages::SendPlayerReachedRespawnCheckpoint(player, respawnPoint, NiQuaternionConstant::IDENTITY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user