From 7695445c4c3c6c87e12c9746415fa0b68164900e Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Tue, 10 Nov 2026 15:15:16 -0600 Subject: [PATCH] feat: taking every object from one client can leave one out DestructAllEntities takes an object to skip, for the seamless instance move that keeps the player's own ghost. Co-Authored-By: Claude Fable 5.2 --- dGame/EntityManager.cpp | 3 ++- dGame/EntityManager.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dGame/EntityManager.cpp b/dGame/EntityManager.cpp index 6759b0efb..2d3b703b8 100644 --- a/dGame/EntityManager.cpp +++ b/dGame/EntityManager.cpp @@ -499,8 +499,9 @@ void EntityManager::SerializeEntity(const Entity& entity) { } } -void EntityManager::DestructAllEntities(const SystemAddress& sysAddr) { +void EntityManager::DestructAllEntities(const SystemAddress& sysAddr, const LWOOBJID except) { for (auto* entity : m_Entities | std::views::values) { + if (entity && except != LWOOBJID_EMPTY && entity->GetObjectID() == except) continue; DestructEntity(entity, sysAddr); } } diff --git a/dGame/EntityManager.h b/dGame/EntityManager.h index 6e597af1b..1809cea48 100644 --- a/dGame/EntityManager.h +++ b/dGame/EntityManager.h @@ -56,7 +56,8 @@ public: void SerializeEntity(const Entity& entity); void ConstructAllEntities(const SystemAddress& sysAddr); - void DestructAllEntities(const SystemAddress& sysAddr); + // Takes every object away from one client, except `except` when given + void DestructAllEntities(const SystemAddress& sysAddr, LWOOBJID except = LWOOBJID_EMPTY); void SetGhostDistanceMax(float value); void SetGhostDistanceMin(float value);