mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +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) &&
|
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasUnitFlag(UNIT_FLAG_POSSESSED) &&
|
||||||
(owner->IsPet() || owner->IsGuardian() || owner->GetGUID() == target->GetCritterGUID() || owner->GetCharmerOrOwnerGUID() == target->GetGUID()))
|
(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));
|
speed = std::max(target->GetSpeed(moveType), owner->GetSpeed(moveType));
|
||||||
|
|
||||||
if (playerPet)
|
if (playerPet)
|
||||||
@@ -503,8 +509,8 @@ bool FollowMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
|
|||||||
|
|
||||||
Movement::MoveSplineInit init(owner);
|
Movement::MoveSplineInit init(owner);
|
||||||
init.MovebyPath(i_path->GetPath());
|
init.MovebyPath(i_path->GetPath());
|
||||||
init.SetWalk(target->IsWalking());
|
init.SetWalk(target->IsWalking() || target->movespline->isWalking());
|
||||||
if (Optional<float> velocity = GetVelocity(owner, target, i_path->GetActualEndPosition(), owner->IsGuardian() && target->GetTypeId() == TYPEID_PLAYER))
|
if (Optional<float> velocity = GetVelocity(owner, target, i_path->GetActualEndPosition(), owner->IsGuardian()))
|
||||||
init.SetVelocity(*velocity);
|
init.SetVelocity(*velocity);
|
||||||
init.Launch();
|
init.Launch();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user