fix(Core/Movement): Fixup root distancing mobs being stuck in a loop (#23514)

This commit is contained in:
killerwife
2025-11-03 07:44:29 +01:00
committed by GitHub
parent 92c7ba73bf
commit 288b495701
@@ -113,7 +113,7 @@ bool ChaseMovementGenerator<T>::DispatchSplineToPosition(T* owner, float x, floa
} }
owner->StopMoving(); owner->StopMoving();
return true; return false;
} }
if (cutPath) if (cutPath)
@@ -134,7 +134,7 @@ bool ChaseMovementGenerator<T>::DispatchSplineToPosition(T* owner, float x, floa
init.SetWalk(walk); init.SetWalk(walk);
init.Launch(); init.Launch();
return false; return true;
} }
template<class T> template<class T>
@@ -219,18 +219,21 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
{ {
i_recheckDistance.Reset(400); // Sniffed value i_recheckDistance.Reset(400); // Sniffed value
if (i_recalculateTravel && PositionOkay(owner, target, _movingTowards ? maxTarget : Optional<float>(), angle)) if (m_currentMode != CHASE_MODE_DISTANCING)
{ {
if ((owner->HasUnitState(UNIT_STATE_CHASE_MOVE) && !target->isMoving() && !mutualChase) || _range) if (i_recalculateTravel && PositionOkay(owner, target, _movingTowards ? maxTarget : Optional<float>(), angle))
{ {
i_recalculateTravel = false; if ((owner->HasUnitState(UNIT_STATE_CHASE_MOVE) && !target->isMoving() && !mutualChase) || _range)
i_path = nullptr; {
if (cOwner) i_recalculateTravel = false;
cOwner->SetCannotReachTarget(); i_path = nullptr;
owner->StopMoving(); if (cOwner)
owner->SetInFront(target); cOwner->SetCannotReachTarget();
MovementInform(owner); owner->StopMoving();
return true; owner->SetInFront(target);
MovementInform(owner);
return true;
}
} }
} }
} }
@@ -262,6 +265,9 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
i_leashExtensionTimer.Reset(cOwner->GetAttackTime(BASE_ATTACK)); i_leashExtensionTimer.Reset(cOwner->GetAttackTime(BASE_ATTACK));
} }
if (m_currentMode == CHASE_MODE_DISTANCING)
return true;
// if the target moved, we have to consider whether to adjust // if the target moved, we have to consider whether to adjust
if (!_lastTargetPosition || target->GetPosition() != _lastTargetPosition.value() || mutualChase != _mutualChase || !owner->IsWithinLOSInMap(target)) if (!_lastTargetPosition || target->GetPosition() != _lastTargetPosition.value() || mutualChase != _mutualChase || !owner->IsWithinLOSInMap(target))
{ {