mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Objects: Add overridable function UpdateObjectVisibilityOnDestroy
This commit is contained in:
@@ -425,7 +425,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
|
||||
ai->CorpseRemoved(respawnDelay);
|
||||
|
||||
if (destroyForNearbyPlayers)
|
||||
DestroyForNearbyPlayers();
|
||||
UpdateObjectVisibilityOnDestroy();
|
||||
|
||||
// Should get removed later, just keep "compatibility" with scripts
|
||||
if (setSpawnTime)
|
||||
@@ -2201,7 +2201,7 @@ void Creature::Respawn(bool force)
|
||||
|
||||
if (m_respawnCompatibilityMode)
|
||||
{
|
||||
DestroyForNearbyPlayers();
|
||||
UpdateObjectVisibilityOnDestroy();
|
||||
RemoveCorpse(false, false);
|
||||
|
||||
if (getDeathState() == DEAD)
|
||||
@@ -2266,7 +2266,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
|
||||
uint32 respawnDelay = GetRespawnDelay();
|
||||
|
||||
// do it before killing creature
|
||||
DestroyForNearbyPlayers();
|
||||
UpdateObjectVisibilityOnDestroy();
|
||||
|
||||
bool overrideRespawnTime = false;
|
||||
if (IsAlive())
|
||||
|
||||
@@ -957,7 +957,7 @@ void GameObject::Update(uint32 diff)
|
||||
m_respawnTime = 0;
|
||||
|
||||
if (m_spawnId)
|
||||
DestroyForNearbyPlayers();
|
||||
UpdateObjectVisibilityOnDestroy();
|
||||
else
|
||||
Delete();
|
||||
|
||||
@@ -974,7 +974,7 @@ void GameObject::Update(uint32 diff)
|
||||
SaveRespawnTime();
|
||||
|
||||
if (m_respawnCompatibilityMode)
|
||||
DestroyForNearbyPlayers();
|
||||
UpdateObjectVisibilityOnDestroy();
|
||||
else
|
||||
AddObjectToRemoveList();
|
||||
|
||||
|
||||
@@ -910,7 +910,7 @@ void WorldObject::RemoveFromWorld()
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
DestroyForNearbyPlayers();
|
||||
UpdateObjectVisibilityOnDestroy();
|
||||
|
||||
Object::RemoveFromWorld();
|
||||
}
|
||||
|
||||
@@ -656,6 +656,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
|
||||
void DestroyForNearbyPlayers();
|
||||
virtual void UpdateObjectVisibility(bool forced = true);
|
||||
virtual void UpdateObjectVisibilityOnCreate() { UpdateObjectVisibility(true); }
|
||||
virtual void UpdateObjectVisibilityOnDestroy() { DestroyForNearbyPlayers(); }
|
||||
void UpdatePositionData();
|
||||
|
||||
void BuildUpdate(UpdateDataMapType&) override;
|
||||
|
||||
@@ -1079,7 +1079,7 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
|
||||
SendRemoveTransports(player);
|
||||
|
||||
if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers()
|
||||
player->DestroyForNearbyPlayers(); // previous player->UpdateObjectVisibility(true)
|
||||
player->UpdateObjectVisibilityOnDestroy();
|
||||
|
||||
if (player->IsInGrid())
|
||||
player->RemoveFromGrid();
|
||||
@@ -1101,7 +1101,7 @@ void Map::RemoveFromMap(T *obj, bool remove)
|
||||
GetMultiPersonalPhaseTracker().UnregisterTrackedObject(obj);
|
||||
|
||||
if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers()
|
||||
obj->DestroyForNearbyPlayers(); // previous obj->UpdateObjectVisibility(true)
|
||||
obj->UpdateObjectVisibilityOnDestroy();
|
||||
|
||||
obj->RemoveFromGrid();
|
||||
|
||||
@@ -4788,7 +4788,7 @@ void Map::RemoveCorpse(Corpse* corpse)
|
||||
{
|
||||
ASSERT(corpse);
|
||||
|
||||
corpse->DestroyForNearbyPlayers();
|
||||
corpse->UpdateObjectVisibilityOnDestroy();
|
||||
if (corpse->IsInGrid())
|
||||
RemoveFromMap(corpse, false);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user