Core/Movement: MotionMaster reimplementation
Port From (https://github.com/TrinityCore/TrinityCore/commit/426f9f2f92b26fbb68e7cda9290ccbd586c6af4e)
This commit is contained in:
@@ -345,11 +345,7 @@ namespace Game
|
||||
GetPlayer().SpawnCorpseBones();
|
||||
}
|
||||
// stop taxi flight at port
|
||||
if (GetPlayer().IsInFlight())
|
||||
{
|
||||
GetPlayer().GetMotionMaster().MovementExpired();
|
||||
GetPlayer().CleanupAfterTaxiFlight();
|
||||
}
|
||||
GetPlayer().FinishTaxiFlight();
|
||||
|
||||
BattlefieldStatusActive battlefieldStatus;
|
||||
Global.BattlegroundMgr.BuildBattlegroundStatusActive(out battlefieldStatus, bg, GetPlayer(), battlefieldPort.Ticket.Id, GetPlayer().GetBattlegroundQueueJoinTime(bgQueueTypeId), bg.GetArenaType());
|
||||
|
||||
@@ -324,22 +324,21 @@ namespace Game
|
||||
}
|
||||
|
||||
// flight fast teleport case
|
||||
if (GetPlayer().GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Flight)
|
||||
if (GetPlayer().IsInFlight())
|
||||
{
|
||||
if (!GetPlayer().InBattleground())
|
||||
{
|
||||
if (!seamlessTeleport)
|
||||
{
|
||||
// short preparations to continue flight
|
||||
IMovementGenerator movementGenerator = GetPlayer().GetMotionMaster().Top();
|
||||
MovementGenerator movementGenerator = GetPlayer().GetMotionMaster().GetCurrentMovementGenerator();
|
||||
movementGenerator.Initialize(GetPlayer());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Battlegroundstate prepare, stop flight
|
||||
GetPlayer().GetMotionMaster().MovementExpired();
|
||||
GetPlayer().CleanupAfterTaxiFlight();
|
||||
GetPlayer().FinishTaxiFlight();
|
||||
}
|
||||
|
||||
// resurrect character at enter into instance where his corpse exist after add to map
|
||||
@@ -719,13 +718,12 @@ namespace Game
|
||||
TaxiNodesRecord curDestNode = CliDB.TaxiNodesStorage.LookupByKey(curDest);
|
||||
|
||||
// far teleport case
|
||||
if (curDestNode != null && curDestNode.ContinentID != GetPlayer().GetMapId())
|
||||
if (curDestNode != null && curDestNode.ContinentID != GetPlayer().GetMapId() && GetPlayer().GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Flight)
|
||||
{
|
||||
if (GetPlayer().GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Flight)
|
||||
FlightPathMovementGenerator flight = GetPlayer().GetMotionMaster().GetCurrentMovementGenerator() as FlightPathMovementGenerator;
|
||||
if (flight != null)
|
||||
{
|
||||
// short preparations to continue flight
|
||||
FlightPathMovementGenerator flight = (FlightPathMovementGenerator)GetPlayer().GetMotionMaster().Top();
|
||||
|
||||
flight.SetCurrentNodeAfterTeleport();
|
||||
TaxiPathNodeRecord node = flight.GetPath()[(int)flight.GetCurrentNode()];
|
||||
flight.SkipCurrentNode();
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Game
|
||||
{
|
||||
case CommandStates.Stay: //flat=1792 //STAY
|
||||
pet.StopMoving();
|
||||
pet.GetMotionMaster().Clear(false);
|
||||
pet.GetMotionMaster().Clear();
|
||||
pet.GetMotionMaster().MoveIdle();
|
||||
charmInfo.SetCommandState(CommandStates.Stay);
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace Game
|
||||
break;
|
||||
case CommandStates.MoveTo:
|
||||
pet.StopMoving();
|
||||
pet.GetMotionMaster().Clear(false);
|
||||
pet.GetMotionMaster().Clear();
|
||||
pet.GetMotionMaster().MovePoint(0, x, y, z);
|
||||
charmInfo.SetCommandState(CommandStates.MoveTo);
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
GetPlayer().GetMotionMaster().Clear(MovementSlot.Controlled);
|
||||
GetPlayer().GetMotionMaster().Remove(MovementGeneratorType.Flight);
|
||||
|
||||
if (mountDisplayId != 0)
|
||||
GetPlayer().Mount(mountDisplayId);
|
||||
@@ -235,11 +235,11 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.TaxiRequestEarlyLanding, Processing = PacketProcessing.ThreadSafe)]
|
||||
void HandleTaxiRequestEarlyLanding(TaxiRequestEarlyLanding taxiRequestEarlyLanding)
|
||||
{
|
||||
if (GetPlayer().GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Flight)
|
||||
FlightPathMovementGenerator flight = GetPlayer().GetMotionMaster().GetCurrentMovementGenerator() as FlightPathMovementGenerator;
|
||||
if (flight != null)
|
||||
{
|
||||
if (GetPlayer().m_taxi.RequestEarlyLanding())
|
||||
{
|
||||
FlightPathMovementGenerator flight = (FlightPathMovementGenerator)GetPlayer().GetMotionMaster().Top();
|
||||
flight.LoadPath(GetPlayer(), flight.GetPath()[(int)flight.GetCurrentNode()].NodeIndex);
|
||||
flight.Reset(GetPlayer());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user