Core/PlayerAI: apply some movement related corrections

Port From (https://github.com/TrinityCore/TrinityCore/commit/6814b4d32b283c3a1b676d2f13953894a9f1ff7a)
This commit is contained in:
hondacrx
2021-12-07 18:23:50 -05:00
parent 96a207b00e
commit c3dc452024
+13 -10
View File
@@ -1278,8 +1278,10 @@ namespace Game.AI
_isFollowing = true; _isFollowing = true;
me.AttackStop(); me.AttackStop();
me.CastStop(); me.CastStop();
me.StopMoving();
me.GetMotionMaster().Clear(); if (me.HasUnitState(UnitState.Chase))
me.GetMotionMaster().Remove(MovementGeneratorType.Chase);
me.GetMotionMaster().MoveFollow(charmer, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); me.GetMotionMaster().MoveFollow(charmer, SharedConst.PetFollowDist, SharedConst.PetFollowAngle);
} }
return; return;
@@ -1343,8 +1345,10 @@ namespace Game.AI
_isFollowing = true; _isFollowing = true;
me.AttackStop(); me.AttackStop();
me.CastStop(); me.CastStop();
me.StopMoving();
me.GetMotionMaster().Clear(); if (me.HasUnitState(UnitState.Chase))
me.GetMotionMaster().Remove(MovementGeneratorType.Chase);
me.GetMotionMaster().MoveFollow(charmer, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); me.GetMotionMaster().MoveFollow(charmer, SharedConst.PetFollowDist, SharedConst.PetFollowAngle);
} }
} }
@@ -1355,17 +1359,16 @@ namespace Game.AI
{ {
me.CastStop(); me.CastStop();
me.AttackStop(); me.AttackStop();
me.StopMoving();
me.GetMotionMaster().Clear(); if (me.GetMotionMaster().Size() <= 1) // if there is no current movement (we dont want to erase/overwrite any existing stuff)
me.GetMotionMaster().MovePoint(0, me.GetPosition(), false); // force re-sync of current position for all clients me.GetMotionMaster().MovePoint(0, me.GetPosition(), false); // force re-sync of current position for all clients
} }
else else
{ {
me.CastStop(); me.CastStop();
me.AttackStop(); me.AttackStop();
// @todo only voluntary movement (don't cancel stuff like death grip or charge mid-animation)
me.GetMotionMaster().Clear(); me.GetMotionMaster().Clear(MovementGeneratorPriority.Normal);
me.StopMoving();
} }
base.OnCharmed(isNew); base.OnCharmed(isNew);