Core/Movement: MotionMaster reimplementation
Port From (https://github.com/TrinityCore/TrinityCore/commit/426f9f2f92b26fbb68e7cda9290ccbd586c6af4e)
This commit is contained in:
@@ -110,7 +110,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsReturningHome()
|
||||
{
|
||||
if (GetMotionMaster().GetMotionSlotType(MovementSlot.Active) == MovementGeneratorType.Home)
|
||||
if (GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Home)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -551,8 +551,7 @@ namespace Game.Entities
|
||||
{
|
||||
Unit charmer = Global.ObjAccessor.GetUnit(this, LastCharmerGUID);
|
||||
if (charmer)
|
||||
if (CanStartAttack(charmer, true))
|
||||
i_AI.AttackStart(charmer);
|
||||
EngageWithTarget(charmer);
|
||||
}
|
||||
|
||||
LastCharmerGUID.Clear();
|
||||
@@ -1917,7 +1916,8 @@ namespace Game.Entities
|
||||
SetNativeDisplayId(display.CreatureDisplayID, display.DisplayScale);
|
||||
}
|
||||
|
||||
GetMotionMaster().InitDefault();
|
||||
GetMotionMaster().InitializeDefault();
|
||||
|
||||
//Re-initialize reactstate that could be altered by movementgenerators
|
||||
InitializeReactState();
|
||||
|
||||
|
||||
@@ -266,7 +266,8 @@ namespace Game.Entities
|
||||
creature.GetMotionMaster().Initialize();
|
||||
else
|
||||
creature.GetMotionMaster().MoveIdle();
|
||||
Log.outDebug(LogFilter.Unit, "Set {0} movement for member GUID: {1}", dismiss ? "default" : "idle", creature.GetGUID().ToString());
|
||||
|
||||
Log.outDebug(LogFilter.Unit, $"CreatureGroup::FormationReset: Set {(dismiss ? "default" : "idle")} movement for member {creature.GetGUID()}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,20 +315,20 @@ namespace Game.Entities
|
||||
if (!member.IsFlying())
|
||||
member.UpdateGroundPositionZ(dx, dy, ref dz);
|
||||
|
||||
Position point = new(dx, dy, dz, destination.GetOrientation());
|
||||
|
||||
member.GetMotionMaster().MoveFormation(id, point, moveType, !member.IsWithinDist(_leader, dist + 5.0f), orientation);
|
||||
member.SetHomePosition(dx, dy, dz, pathangle);
|
||||
|
||||
Position point = new(dx, dy, dz, destination.GetOrientation());
|
||||
member.GetMotionMaster().MoveFormation(id, point, moveType, !member.IsWithinDist(_leader, dist + 5.0f), orientation);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanLeaderStartMoving()
|
||||
{
|
||||
foreach (var itr in _members)
|
||||
foreach (var pair in _members)
|
||||
{
|
||||
if (itr.Key != _leader && itr.Key.IsAlive())
|
||||
if (pair.Key != _leader && pair.Key.IsAlive())
|
||||
{
|
||||
if (itr.Key.IsEngaged() || itr.Key.IsReturningHome())
|
||||
if (pair.Key.IsEngaged() || pair.Key.IsReturningHome())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user