re-enable CreatureAI::MovementInform for Chase/FollowMovementGenerator - didn't realize any AI used this

Port From (https://github.com/TrinityCore/TrinityCore/commit/5f0f530c0859982bc2c0c230d928aa3fc8d86d23)
This commit is contained in:
hondacrx
2021-09-26 17:27:33 -04:00
parent 9dfbea5255
commit 62afe3bf8e
2 changed files with 27 additions and 6 deletions
@@ -16,13 +16,9 @@
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Framework.GameMath;
namespace Game.Movement
{
@@ -95,6 +91,7 @@ namespace Game.Movement
_path = null;
owner.StopMoving();
owner.SetInFront(target);
DoMovementInform(owner, target);
return true;
}
}
@@ -106,6 +103,7 @@ namespace Game.Movement
_path = null;
owner.ClearUnitState(UnitState.ChaseMove);
owner.SetInFront(target);
DoMovementInform(owner, target);
}
// if the target moved, we have to consider whether to adjust
@@ -211,5 +209,16 @@ namespace Game.Movement
return false;
return !angle.HasValue || angle.Value.IsAngleOkay(target.GetRelativeAngle(owner));
}
static void DoMovementInform(Unit owner, Unit target)
{
Creature cOwner = owner.ToCreature();
if (cOwner != null)
{
CreatureAI ai = cOwner.GetAI();
if (ai != null)
ai.MovementInform(MovementGeneratorType.Chase, (uint)target.GetGUID().GetCounter());
}
}
}
}
@@ -16,7 +16,7 @@
*/
using Framework.Constants;
using Framework.GameMath;
using Game.AI;
using Game.Entities;
using System;
@@ -75,6 +75,7 @@ namespace Game.Movement
{
_path = null;
owner.StopMoving();
DoMovementInform(owner, target);
return true;
}
}
@@ -84,6 +85,7 @@ namespace Game.Movement
{
_path = null;
owner.ClearUnitState(UnitState.FollowMove);
DoMovementInform(owner, target);
}
if (_lastTargetPosition.GetExactDistSq(target.GetPosition()) > 0.0f)
@@ -175,5 +177,15 @@ namespace Game.Movement
return !angle.HasValue || angle.Value.IsAngleOkay(target.GetRelativeAngle(owner));
}
static void DoMovementInform(Unit owner, Unit target)
{
if (!owner.IsCreature())
return;
UnitAI ai = owner.GetAI();
if (ai != null)
((CreatureAI)ai).MovementInform(MovementGeneratorType.Follow, (uint)target.GetGUID().GetCounter());
}
}
}