Core/Misc: movement cleanup

Port From (https://github.com/TrinityCore/TrinityCore/commit/4793b073eec2af32622ff703911721100730e868)
This commit is contained in:
hondacrx
2021-09-26 12:17:10 -04:00
parent e747de7608
commit 569e20ebc1
12 changed files with 76 additions and 48 deletions
+7 -3
View File
@@ -150,6 +150,11 @@ namespace Game.Entities
public float GetSpeedRate(UnitMoveType mtype) { return m_speed_rate[(int)mtype]; }
public virtual MovementGeneratorType GetDefaultMovementType()
{
return MovementGeneratorType.Idle;
}
public void StopMoving()
{
ClearUnitState(UnitState.Moving);
@@ -523,10 +528,9 @@ namespace Game.Entities
if (creature.HasUnitTypeMask(UnitTypeMask.Minion) && !creature.IsInCombat())
{
var top = creature.GetMotionMaster().TopOrNull();
if (top != null && top.GetMovementGeneratorType() == MovementGeneratorType.Follow)
if (GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Follow)
{
Unit followed = ((AbstractFollower)top).GetTarget();
Unit followed = ((AbstractFollower)GetMotionMaster().Top()).GetTarget();
if (followed != null && followed.GetGUID() == GetOwnerGUID() && !followed.IsInCombat())
{
float ownerSpeed = followed.GetSpeedRate(mtype);