Core/PetAI: apply some movement related corrections
Port From (https://github.com/TrinityCore/TrinityCore/commit/97dddac75adab46d55d3d698e36c4403a93b4372)
This commit is contained in:
@@ -292,7 +292,7 @@ namespace Game.AI
|
|||||||
|
|
||||||
// Clear target just in case. May help problem where health / focus / mana
|
// Clear target just in case. May help problem where health / focus / mana
|
||||||
// regen gets stuck. Also resets attack command.
|
// regen gets stuck. Also resets attack command.
|
||||||
// Can't use _stopAttack() because that activates movement handlers and ignores
|
// Can't use StopAttack() because that activates movement handlers and ignores
|
||||||
// next target selection
|
// next target selection
|
||||||
me.AttackStop();
|
me.AttackStop();
|
||||||
me.InterruptNonMeleeSpells(false);
|
me.InterruptNonMeleeSpells(false);
|
||||||
@@ -437,7 +437,10 @@ namespace Game.AI
|
|||||||
me.GetCharmInfo().GetStayPosition(out x, out y, out z);
|
me.GetCharmInfo().GetStayPosition(out x, out y, out z);
|
||||||
ClearCharmInfoFlags();
|
ClearCharmInfoFlags();
|
||||||
me.GetCharmInfo().SetIsReturning(true);
|
me.GetCharmInfo().SetIsReturning(true);
|
||||||
me.GetMotionMaster().Clear();
|
|
||||||
|
if (me.HasUnitState(UnitState.Chase))
|
||||||
|
me.GetMotionMaster().Remove(MovementGeneratorType.Chase);
|
||||||
|
|
||||||
me.GetMotionMaster().MovePoint((uint)me.GetGUID().GetCounter(), x, y, z);
|
me.GetMotionMaster().MovePoint((uint)me.GetGUID().GetCounter(), x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +450,10 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
ClearCharmInfoFlags();
|
ClearCharmInfoFlags();
|
||||||
me.GetCharmInfo().SetIsReturning(true);
|
me.GetCharmInfo().SetIsReturning(true);
|
||||||
me.GetMotionMaster().Clear();
|
|
||||||
|
if (me.HasUnitState(UnitState.Chase))
|
||||||
|
me.GetMotionMaster().Remove(MovementGeneratorType.Chase);
|
||||||
|
|
||||||
me.GetMotionMaster().MoveFollow(me.GetCharmerOrOwner(), SharedConst.PetFollowDist, me.GetFollowAngle());
|
me.GetMotionMaster().MoveFollow(me.GetCharmerOrOwner(), SharedConst.PetFollowDist, me.GetFollowAngle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -473,14 +479,20 @@ namespace Game.AI
|
|||||||
bool oldCmdAttack = me.GetCharmInfo().IsCommandAttack(); // This needs to be reset after other flags are cleared
|
bool oldCmdAttack = me.GetCharmInfo().IsCommandAttack(); // This needs to be reset after other flags are cleared
|
||||||
ClearCharmInfoFlags();
|
ClearCharmInfoFlags();
|
||||||
me.GetCharmInfo().SetIsCommandAttack(oldCmdAttack); // For passive pets commanded to attack so they will use spells
|
me.GetCharmInfo().SetIsCommandAttack(oldCmdAttack); // For passive pets commanded to attack so they will use spells
|
||||||
me.GetMotionMaster().Clear();
|
|
||||||
|
if (me.HasUnitState(UnitState.Follow))
|
||||||
|
me.GetMotionMaster().Remove(MovementGeneratorType.Follow);
|
||||||
|
|
||||||
me.GetMotionMaster().MoveChase(target, me.GetPetChaseDistance(), MathF.PI);
|
me.GetMotionMaster().MoveChase(target, me.GetPetChaseDistance(), MathF.PI);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearCharmInfoFlags();
|
ClearCharmInfoFlags();
|
||||||
me.GetCharmInfo().SetIsAtStay(true);
|
me.GetCharmInfo().SetIsAtStay(true);
|
||||||
me.GetMotionMaster().Clear();
|
|
||||||
|
if (me.HasUnitState(UnitState.Follow))
|
||||||
|
me.GetMotionMaster().Remove(MovementGeneratorType.Follow);
|
||||||
|
|
||||||
me.GetMotionMaster().MoveIdle();
|
me.GetMotionMaster().MoveIdle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user