game: fix player phantom model on SMSG_DESTROY_OBJECT

handleDestroyObject invoked creatureDespawnCallback_ and
gameObjectDespawnCallback_ but not playerDespawnCallback_ for PLAYER
entities. This caused the CharacterRenderer instance for nearby players
to remain alive after they received a DESTROY_OBJECT packet (e.g. when
they teleported or went out of range via server-forced despawn), leaving
phantom models in the world.

Mirror the same despawn logic used for out-of-range removal: call
playerDespawnCallback_ and clean up the per-player bookkeeping maps so
the renderer cleans up the character instance correctly.
This commit is contained in:
Kelsi 2026-03-10 06:40:07 -07:00
parent ea9c7e68e7
commit 1e53369869

View file

@ -8399,6 +8399,14 @@ void GameHandler::handleDestroyObject(network::Packet& packet) {
if (entity) {
if (entity->getType() == ObjectType::UNIT && creatureDespawnCallback_) {
creatureDespawnCallback_(data.guid);
} else if (entity->getType() == ObjectType::PLAYER && playerDespawnCallback_) {
// Player entities also need renderer cleanup on DESTROY_OBJECT, not just out-of-range.
playerDespawnCallback_(data.guid);
otherPlayerVisibleItemEntries_.erase(data.guid);
otherPlayerVisibleDirty_.erase(data.guid);
otherPlayerMoveTimeMs_.erase(data.guid);
inspectedPlayerItemEntries_.erase(data.guid);
pendingAutoInspect_.erase(data.guid);
} else if (entity->getType() == ObjectType::GAMEOBJECT && gameObjectDespawnCallback_) {
gameObjectDespawnCallback_(data.guid);
}