mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-15 13:35:08 +00:00
fix(Core/Movement): Teleport pet when pathfinding returns PATHFIND_NOT_USING_PATH (#23494)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com> Co-authored-by: Ryan Turner <16946913+TheSCREWEDSoftware@users.noreply.github.com>
This commit is contained in:
@@ -158,6 +158,15 @@ void PetAI::UpdateAI(uint32 diff)
|
||||
else
|
||||
m_updateAlliesTimer -= diff;
|
||||
|
||||
if (owner && owner->IsPlayer() && !me->GetVictim() && me->CanNotReachTarget())
|
||||
{
|
||||
if (me->GetDistance(owner) > 40.0f)
|
||||
{
|
||||
me->NearTeleportTo(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), me->GetOrientation());
|
||||
me->SetCannotReachTarget(); // Clear flag after teleport
|
||||
}
|
||||
}
|
||||
|
||||
if (me->GetVictim() && me->GetVictim()->IsAlive())
|
||||
{
|
||||
// is only necessary to stop casting, the pet must not exit combat
|
||||
|
||||
@@ -648,8 +648,16 @@ bool FollowMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
||||
owner->UpdateAllowedPositionZ(x, y, z);
|
||||
|
||||
bool success = i_path->CalculatePath(x, y, z, forceDest);
|
||||
if (!success || (i_path->GetPathType() & PATHFIND_NOPATH && !followingMaster))
|
||||
|
||||
bool cannotReachTarget = !success || (i_path->GetPathType() & PATHFIND_NOPATH && !followingMaster);
|
||||
if (oPet && followingMaster && !owner->CanFly() && (i_path->GetPathType() & PATHFIND_NOT_USING_PATH))
|
||||
cannotReachTarget = true;
|
||||
|
||||
if (cannotReachTarget)
|
||||
{
|
||||
if (oPet && followingMaster)
|
||||
cOwner->SetCannotReachTarget(target->GetGUID());
|
||||
|
||||
if (!owner->IsStopped())
|
||||
owner->StopMoving();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user