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

View File

@@ -113,7 +113,7 @@ bool ChaseMovementGenerator<T>::DispatchSplineToPosition(T* owner, float x, floa
}
owner->StopMoving();
return true;
return false;
}
if (cutPath)
@@ -134,7 +134,7 @@ bool ChaseMovementGenerator<T>::DispatchSplineToPosition(T* owner, float x, floa
init.SetWalk(walk);
init.Launch();
return false;
return true;
}
template<class T>
@@ -219,18 +219,21 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
{
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;
i_path = nullptr;
if (cOwner)
cOwner->SetCannotReachTarget();
owner->StopMoving();
owner->SetInFront(target);
MovementInform(owner);
return true;
if ((owner->HasUnitState(UNIT_STATE_CHASE_MOVE) && !target->isMoving() && !mutualChase) || _range)
{
i_recalculateTravel = false;
i_path = nullptr;
if (cOwner)
cOwner->SetCannotReachTarget();
owner->StopMoving();
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));
}
if (m_currentMode == CHASE_MODE_DISTANCING)
return true;
// if the target moved, we have to consider whether to adjust
if (!_lastTargetPosition || target->GetPosition() != _lastTargetPosition.value() || mutualChase != _mutualChase || !owner->IsWithinLOSInMap(target))
{