From 4d0eef1f6fe9d57fffccb69dfc4b72363f47f750 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 11 Mar 2026 16:52:53 -0700 Subject: [PATCH] Skip tab-targeting empty looted corpses Dead creatures with no remaining loot items are now excluded from tab-targeting cycle. Prevents cycling through empty corpses when looking for targetable enemies. Corpses with available loot remain targetable. --- src/game/game_handler.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 458a06bf..9cea04eb 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -10595,7 +10595,19 @@ void GameHandler::tabTarget(float playerX, float playerY, float playerZ) { const uint64_t guid = e->getGuid(); auto* unit = dynamic_cast(e.get()); if (!unit) return false; // Not a unit (shouldn't happen after type filter) - if (unit->getHealth() == 0) return false; // Dead / corpse + if (unit->getHealth() == 0) { + // Dead corpse: only targetable if it has loot or is skinnableable + // If corpse was looted and is now empty, skip it (except for skinning) + auto lootIt = localLootState_.find(guid); + if (lootIt == localLootState_.end() || lootIt->second.data.items.empty()) { + // No loot data or all items taken; check if skinnableable + // For now, skip empty looted corpses (proper skinning check requires + // creature type data that may not be immediately available) + return false; + } + // Has unlooted items available + return true; + } const bool hostileByFaction = unit->isHostile(); const bool hostileByCombat = isAggressiveTowardPlayer(guid); if (!hostileByFaction && !hostileByCombat) return false;