fix(Core/SmartAI): add prevent almost infinite spinning of mutual target to pets (#19090)

fix(Core/SmartAI)petspin
This commit is contained in:
Jelle Meeus
2024-06-20 02:13:34 +02:00
committed by GitHub
parent 85965feab6
commit 0d977c986e

View File

@@ -108,6 +108,14 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
mutualChase = true;
}
// Prevent almost infinite spinning for pets with mutualTarget
// _mutualChase is false for previous check
if (angle && !mutualChase && !_mutualChase && mutualTarget && chaseRange < meleeRange && cOwner && cOwner->IsPet())
{
angle = Optional<ChaseAngle>();
mutualChase = true;
}
// periodically check if we're already in the expected range...
i_recheckDistance.Update(time_diff);
if (i_recheckDistance.Passed())