Core/Movement: Add some extra assertions to MotionMaster.
Port From (https://github.com/TrinityCore/TrinityCore/commit/792914fb518349ef270e6f769f343bbcd333b942)
This commit is contained in:
@@ -130,8 +130,6 @@ namespace Game
|
|||||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||||
|
|
||||||
GetPlayer().GetMotionMaster().Remove(MovementGeneratorType.Flight);
|
|
||||||
|
|
||||||
if (mountDisplayId != 0)
|
if (mountDisplayId != 0)
|
||||||
GetPlayer().Mount(mountDisplayId);
|
GetPlayer().Mount(mountDisplayId);
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,12 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
int nodeCount = _path.Count; //! Number of nodes in path.
|
int nodeCount = _path.Count; //! Number of nodes in path.
|
||||||
_endMapId = _path[nodeCount - 1].ContinentID; //! MapId of last node
|
_endMapId = _path[nodeCount - 1].ContinentID; //! MapId of last node
|
||||||
_preloadTargetNode = (uint)nodeCount - 3;
|
|
||||||
|
if (nodeCount < 3)
|
||||||
|
_preloadTargetNode = 0;
|
||||||
|
else
|
||||||
|
_preloadTargetNode = (uint)nodeCount - 3;
|
||||||
|
|
||||||
_endGridX = _path[nodeCount - 1].Loc.X;
|
_endGridX = _path[nodeCount - 1].Loc.X;
|
||||||
_endGridY = _path[nodeCount - 1].Loc.Y;
|
_endGridY = _path[nodeCount - 1].Loc.Y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -884,7 +884,8 @@ namespace Game.Movement
|
|||||||
Log.outDebug(LogFilter.Server, $"MotionMaster::MoveTaxiFlight: {_owner.GetGUID()} taxi to Path Id: {path} (node {pathnode})");
|
Log.outDebug(LogFilter.Server, $"MotionMaster::MoveTaxiFlight: {_owner.GetGUID()} taxi to Path Id: {path} (node {pathnode})");
|
||||||
|
|
||||||
// Only one FLIGHT_MOTION_TYPE is allowed
|
// Only one FLIGHT_MOTION_TYPE is allowed
|
||||||
Remove(MovementGeneratorType.Flight);
|
bool hasExisting = HasMovementGenerator(gen => gen.GetMovementGeneratorType() == MovementGeneratorType.Flight);
|
||||||
|
Cypher.Assert(!hasExisting, "Duplicate flight path movement generator");
|
||||||
|
|
||||||
FlightPathMovementGenerator movement = new();
|
FlightPathMovementGenerator movement = new();
|
||||||
movement.LoadPath(_owner.ToPlayer());
|
movement.LoadPath(_owner.ToPlayer());
|
||||||
|
|||||||
Reference in New Issue
Block a user