mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
fix(Core/Movement): Make sure pet always follows its master. (#5103)
This commit is contained in:
@@ -151,12 +151,13 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
if (owner->IsHovering())
|
if (owner->IsHovering())
|
||||||
owner->UpdateAllowedPositionZ(x, y, z);
|
owner->UpdateAllowedPositionZ(x, y, z);
|
||||||
|
|
||||||
|
i_recalculateTravel = true;
|
||||||
|
|
||||||
bool success = i_path->CalculatePath(x, y, z, forceDest);
|
bool success = i_path->CalculatePath(x, y, z, forceDest);
|
||||||
if (!success || i_path->GetPathType() & PATHFIND_NOPATH)
|
if (!success || i_path->GetPathType() & PATHFIND_NOPATH)
|
||||||
{
|
{
|
||||||
if (cOwner)
|
if (cOwner)
|
||||||
cOwner->SetCannotReachTarget(true);
|
cOwner->SetCannotReachTarget(true);
|
||||||
owner->StopMoving();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +174,6 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
owner->AddUnitState(UNIT_STATE_CHASE_MOVE);
|
owner->AddUnitState(UNIT_STATE_CHASE_MOVE);
|
||||||
i_recalculateTravel = true;
|
|
||||||
|
|
||||||
Movement::MoveSplineInit init(owner);
|
Movement::MoveSplineInit init(owner);
|
||||||
init.MovebyPath(i_path->GetPath());
|
init.MovebyPath(i_path->GetPath());
|
||||||
@@ -333,17 +333,18 @@ bool FollowMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
|
|
||||||
target->GetNearPoint(owner, x, y, z, _range, 0.f, target->ToAbsoluteAngle(tAngle));
|
target->GetNearPoint(owner, x, y, z, _range, 0.f, target->ToAbsoluteAngle(tAngle));
|
||||||
|
|
||||||
|
i_recalculateTravel = true;
|
||||||
|
|
||||||
bool success = i_path->CalculatePath(x, y, z, forceDest);
|
bool success = i_path->CalculatePath(x, y, z, forceDest);
|
||||||
if (!success || i_path->GetPathType() & PATHFIND_NOPATH)
|
if (!success || i_path->GetPathType() & PATHFIND_NOPATH)
|
||||||
{
|
{
|
||||||
owner->StopMoving();
|
if (cOwner)
|
||||||
|
cOwner->SetCannotReachTarget(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
owner->AddUnitState(UNIT_STATE_FOLLOW_MOVE);
|
owner->AddUnitState(UNIT_STATE_FOLLOW_MOVE);
|
||||||
|
|
||||||
i_recalculateTravel = true;
|
|
||||||
|
|
||||||
Movement::MoveSplineInit init(owner);
|
Movement::MoveSplineInit init(owner);
|
||||||
init.MovebyPath(i_path->GetPath());
|
init.MovebyPath(i_path->GetPath());
|
||||||
init.SetFacing(target->GetOrientation());
|
init.SetFacing(target->GetOrientation());
|
||||||
|
|||||||
Reference in New Issue
Block a user