From 363e02e9637f3d4b16cc2bceefd80dc528848db7 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Sat, 26 Sep 2026 18:41:58 -0500 Subject: [PATCH] fix: enemies and summons drop targets that have died FindTarget kept returning the current target while it stayed inside the tether radius, even after it died, so enemies stood over dead players (most visible in long respawn areas like the Battle of Nimbus Station) and pet or summon AI hovered over enemies playing their death animation. A dead current target now loses its threat and a new target is picked, and dead entities are skipped both as proximity candidates and as threat entries. Players who respawn are picked up again through the usual proximity and threat paths. Verified by building WorldServer and the test suite; needs an in-game check (die to an enemy, the enemy should return to idle or pick another player). Fixes #1428 Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/BaseCombatAIComponent.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/BaseCombatAIComponent.cpp b/dGame/dComponents/BaseCombatAIComponent.cpp index 9c3bc4be9..09335459c 100644 --- a/dGame/dComponents/BaseCombatAIComponent.cpp +++ b/dGame/dComponents/BaseCombatAIComponent.cpp @@ -375,6 +375,13 @@ LWOOBJID BaseCombatAIComponent::FindTarget() { auto* target = GetTargetEntity(); + // A target that died is no longer worth attacking, drop it and look for someone else. + if (target != nullptr && target->GetIsDead()) { + SetThreat(m_Target, 0.0f); + target = nullptr; + m_DirtyThreat = true; + } + if (target != nullptr && !m_DirtyThreat) { const auto targetPosition = target->GetPosition(); @@ -399,7 +406,7 @@ LWOOBJID BaseCombatAIComponent::FindTarget() { for (const auto& entry : possibleTargets) { auto* entity = Game::entityManager->GetEntity(entry); - if (entity == nullptr) { + if (entity == nullptr || entity->GetIsDead()) { continue; } @@ -445,7 +452,7 @@ LWOOBJID BaseCombatAIComponent::FindTarget() { for (const auto& threatTarget : m_ThreatEntries) { auto* entity = Game::entityManager->GetEntity(threatTarget.first); - if (entity == nullptr) { + if (entity == nullptr || entity->GetIsDead()) { deadThreats.push_back(threatTarget.first); continue;