Core/Movement: FormationMovementGenerator

Port From (https://github.com/TrinityCore/TrinityCore/commit/84df2c57a385df4503fc1f8ff5dfdf445ea2e31f)
This commit is contained in:
hondacrx
2020-05-07 14:34:16 -04:00
parent c9a91fa62f
commit 415d6d84ba
7 changed files with 198 additions and 30 deletions
@@ -187,7 +187,7 @@ namespace Game.Movement
creature.AddUnitState(UnitState.RoamingMove);
Position formationDest = new Position(node.x, node.y, node.z, 0.0f);
Position formationDest = new Position(node.x, node.y, node.z, (node.orientation != 0 && node.delay != 0) ? node.orientation : 0.0f);
MoveSplineInit init = new MoveSplineInit(creature);
//! If creature is on transport, we assume waypoints set in DB are already transport offsets
@@ -196,7 +196,11 @@ namespace Game.Movement
init.DisableTransportPathTransformations();
ITransport trans = creature.GetDirectTransport();
if (trans != null)
trans.CalculatePassengerPosition(ref formationDest.posX, ref formationDest.posY, ref formationDest.posZ, ref formationDest.Orientation);
{
float orientation = formationDest.GetOrientation();
trans.CalculatePassengerPosition(ref formationDest.posX, ref formationDest.posY, ref formationDest.posZ, ref orientation);
formationDest.SetOrientation(orientation);
}
}
//! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call
@@ -227,10 +231,7 @@ namespace Game.Movement
//Call for creature group update
if (creature.GetFormation() != null && creature.GetFormation().GetLeader() == creature)
{
creature.SetWalk(node.moveType != WaypointMoveType.Run);
creature.GetFormation().LeaderMoveTo(formationDest.posX, formationDest.posY, formationDest.posZ);
}
creature.GetFormation().LeaderMoveTo(formationDest, node.id, (uint)node.moveType, (node.orientation != 0 && node.delay != 0) ? true : false);
return true;
}