Core/Movement: Prevent NO_PATH evades from incorrectly happening in a few places.

Port From (https://github.com/TrinityCore/TrinityCore/commit/6f0e58cce0088dd030d5bf85ae03e9d942241800)
This commit is contained in:
hondacrx
2021-10-30 20:01:28 -04:00
parent 5d94082841
commit 5675589bd2
@@ -85,6 +85,9 @@ namespace Game.Movement
{ {
owner.StopMoving(); owner.StopMoving();
_lastTargetPosition = null; _lastTargetPosition = null;
Creature cOwner = owner.ToCreature();
if (cOwner != null)
cOwner.SetCannotReachTarget(false);
return true; return true;
} }
@@ -119,6 +122,9 @@ namespace Game.Movement
if (owner.HasUnitState(UnitState.ChaseMove) && owner.MoveSpline.Finalized()) if (owner.HasUnitState(UnitState.ChaseMove) && owner.MoveSpline.Finalized())
{ {
_path = null; _path = null;
Creature cOwner = owner.ToCreature();
if (cOwner != null)
cOwner.SetCannotReachTarget(false);
owner.ClearUnitState(UnitState.ChaseMove); owner.ClearUnitState(UnitState.ChaseMove);
owner.SetInFront(target); owner.SetInFront(target);
DoMovementInform(owner, target); DoMovementInform(owner, target);
@@ -201,6 +207,9 @@ namespace Game.Movement
{ {
AddFlag(MovementGeneratorFlags.Deactivated); AddFlag(MovementGeneratorFlags.Deactivated);
owner.ClearUnitState(UnitState.ChaseMove); owner.ClearUnitState(UnitState.ChaseMove);
Creature cOwner = owner.ToCreature();
if (cOwner != null)
cOwner.SetCannotReachTarget(false);
} }
public override void Finalize(Unit owner, bool active, bool movementInform) public override void Finalize(Unit owner, bool active, bool movementInform)