mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
fix(Core/Movement): Updated creature pet's follow movement. (#15360)
This commit is contained in:
@@ -296,7 +296,13 @@ static Optional<float> GetVelocity(Unit* owner, Unit* target, G3D::Vector3 const
|
||||
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasUnitFlag(UNIT_FLAG_POSSESSED) &&
|
||||
(owner->IsPet() || owner->IsGuardian() || owner->GetGUID() == target->GetCritterGUID() || owner->GetCharmerOrOwnerGUID() == target->GetGUID()))
|
||||
{
|
||||
UnitMoveType moveType = Movement::SelectSpeedType(target->GetUnitMovementFlags());
|
||||
uint32 moveFlags = target->GetUnitMovementFlags();
|
||||
if (target->movespline->isWalking())
|
||||
{
|
||||
moveFlags |= MOVEMENTFLAG_WALKING;
|
||||
}
|
||||
|
||||
UnitMoveType moveType = Movement::SelectSpeedType(moveFlags);
|
||||
speed = std::max(target->GetSpeed(moveType), owner->GetSpeed(moveType));
|
||||
|
||||
if (playerPet)
|
||||
@@ -503,8 +509,8 @@ bool FollowMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
||||
|
||||
Movement::MoveSplineInit init(owner);
|
||||
init.MovebyPath(i_path->GetPath());
|
||||
init.SetWalk(target->IsWalking());
|
||||
if (Optional<float> velocity = GetVelocity(owner, target, i_path->GetActualEndPosition(), owner->IsGuardian() && target->GetTypeId() == TYPEID_PLAYER))
|
||||
init.SetWalk(target->IsWalking() || target->movespline->isWalking());
|
||||
if (Optional<float> velocity = GetVelocity(owner, target, i_path->GetActualEndPosition(), owner->IsGuardian()))
|
||||
init.SetVelocity(*velocity);
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user