diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 738f75955..ffdd272cf 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -167,7 +167,7 @@ namespace Game.Entities ai.CorpseRemoved(respawnDelay); if (destroyForNearbyPlayers) - DestroyForNearbyPlayers(); + UpdateObjectVisibilityOnDestroy(); // Should get removed later, just keep "compatibility" with scripts if (setSpawnTime) @@ -1907,7 +1907,7 @@ namespace Game.Entities if (m_respawnCompatibilityMode) { - DestroyForNearbyPlayers(); + UpdateObjectVisibilityOnDestroy(); RemoveCorpse(false, false); if (GetDeathState() == DeathState.Dead) @@ -1971,7 +1971,7 @@ namespace Game.Entities uint respawnDelay = GetRespawnDelay(); // do it before killing creature - DestroyForNearbyPlayers(); + UpdateObjectVisibilityOnDestroy(); bool overrideRespawnTime = false; if (IsAlive()) diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index a44149385..2acc91b30 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -865,7 +865,7 @@ namespace Game.Entities m_respawnTime = 0; if (m_spawnId != 0) - DestroyForNearbyPlayers(); + UpdateObjectVisibilityOnDestroy(); else Delete(); @@ -883,7 +883,7 @@ namespace Game.Entities SaveRespawnTime(); if (m_respawnCompatibilityMode) - DestroyForNearbyPlayers(); + UpdateObjectVisibilityOnDestroy(); else AddObjectToRemoveList(); diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 8a805aa08..14bfadc34 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -107,7 +107,7 @@ namespace Game.Entities return; if (!ObjectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container)) - DestroyForNearbyPlayers(); + UpdateObjectVisibilityOnDestroy(); IsInWorld = false; ClearUpdateMask(true); @@ -2813,6 +2813,8 @@ namespace Game.Entities UpdateObjectVisibility(true); } + public virtual void UpdateObjectVisibilityOnDestroy() { DestroyForNearbyPlayers(); } + public virtual void BuildUpdate(Dictionary data) { var notifier = new WorldObjectChangeAccumulator(this, data); diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 621cb64cc..7404d184f 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -956,7 +956,7 @@ namespace Game.Maps SendRemoveTransports(player); if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers() - player.DestroyForNearbyPlayers(); // previous player.UpdateObjectVisibility(true) + player.UpdateObjectVisibilityOnDestroy(); Cell cell = player.GetCurrentCell(); RemoveFromGrid(player, cell); @@ -977,7 +977,7 @@ namespace Game.Maps GetMultiPersonalPhaseTracker().UnregisterTrackedObject(obj); if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers() - obj.DestroyForNearbyPlayers(); // previous obj.UpdateObjectVisibility(true) + obj.UpdateObjectVisibilityOnDestroy(); Cell cell = obj.GetCurrentCell(); RemoveFromGrid(obj, cell); @@ -3323,7 +3323,7 @@ namespace Game.Maps { Cypher.Assert(corpse); - corpse.DestroyForNearbyPlayers(); + corpse.UpdateObjectVisibilityOnDestroy(); if (corpse.GetCurrentCell() != null) RemoveFromMap(corpse, false); else