mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix hostile target selection when faction flags are wrong
- make tab-target accept units that are either faction-hostile or actively aggressive toward the player\n- fix cases where enemies remain un-tab-targetable after combat starts due to stale/friendly faction state\n- prefer hostile UNIT picks over nearby GAMEOBJECT picks for both left-click target and right-click interact flows\n- keep existing dead-unit filtering and interaction behavior intact while improving combat target acquisition
This commit is contained in:
parent
44a947163d
commit
7e1a463061
2 changed files with 34 additions and 1 deletions
|
|
@ -6992,10 +6992,13 @@ void GameHandler::tabTarget(float playerX, float playerY, float playerZ) {
|
|||
// Helper: returns true if the entity is a living hostile that can be tab-targeted.
|
||||
auto isValidTabTarget = [&](const std::shared_ptr<Entity>& e) -> bool {
|
||||
if (!e) return false;
|
||||
const uint64_t guid = e->getGuid();
|
||||
auto* unit = dynamic_cast<Unit*>(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->isHostile()) return false; // Friendly
|
||||
const bool hostileByFaction = unit->isHostile();
|
||||
const bool hostileByCombat = isAggressiveTowardPlayer(guid);
|
||||
if (!hostileByFaction && !hostileByCombat) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue