Core/Movement: Fix wrong orientation set when pausing movement
Port From (https://github.com/TrinityCore/TrinityCore/commit/292df30394dc9e15bbdcc6303b35f97bf6a07ae9)
This commit is contained in:
@@ -163,6 +163,10 @@ namespace Game.Entities
|
|||||||
if (!IsInWorld || MoveSpline.Finalized())
|
if (!IsInWorld || MoveSpline.Finalized())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Update position now since Stop does not start a new movement that can be updated later
|
||||||
|
if (MoveSpline.HasStarted())
|
||||||
|
UpdateSplinePosition();
|
||||||
|
|
||||||
MoveSplineInit init = new(this);
|
MoveSplineInit init = new(this);
|
||||||
init.Stop();
|
init.Stop();
|
||||||
}
|
}
|
||||||
@@ -1699,6 +1703,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
return MoveSpline.Initialized() && !MoveSpline.Finalized();
|
return MoveSpline.Initialized() && !MoveSpline.Finalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateSplineMovement(uint diff)
|
void UpdateSplineMovement(uint diff)
|
||||||
{
|
{
|
||||||
int positionUpdateDelay = 400;
|
int positionUpdateDelay = 400;
|
||||||
@@ -1714,29 +1719,31 @@ namespace Game.Entities
|
|||||||
|
|
||||||
movesplineTimer.Update((int)diff);
|
movesplineTimer.Update((int)diff);
|
||||||
if (movesplineTimer.Passed() || arrived)
|
if (movesplineTimer.Passed() || arrived)
|
||||||
|
UpdateSplinePosition();
|
||||||
|
}
|
||||||
|
void UpdateSplinePosition()
|
||||||
|
{
|
||||||
|
Vector4 loc = MoveSpline.ComputePosition();
|
||||||
|
|
||||||
|
if (MoveSpline.onTransport)
|
||||||
{
|
{
|
||||||
movesplineTimer.Reset(positionUpdateDelay);
|
Position pos = m_movementInfo.transport.pos;
|
||||||
Vector4 loc = MoveSpline.ComputePosition();
|
pos.posX = loc.X;
|
||||||
float x = loc.X;
|
pos.posY = loc.Y;
|
||||||
float y = loc.Y;
|
pos.posZ = loc.Z;
|
||||||
float z = loc.Z;
|
pos.SetOrientation(loc.W);
|
||||||
float o = loc.W;
|
|
||||||
|
|
||||||
if (MoveSpline.onTransport)
|
ITransport transport = GetDirectTransport();
|
||||||
{
|
if (transport != null)
|
||||||
m_movementInfo.transport.pos.Relocate(x, y, z, o);
|
transport.CalculatePassengerPosition(ref loc.X, ref loc.Y, ref loc.Z, ref loc.W);
|
||||||
|
else
|
||||||
ITransport transport = GetDirectTransport();
|
return;
|
||||||
if (transport != null)
|
|
||||||
transport.CalculatePassengerPosition(ref x, ref y, ref z, ref o);
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (HasUnitState(UnitState.CannotTurn))
|
|
||||||
o = GetOrientation();
|
|
||||||
|
|
||||||
UpdatePosition(x, y, z, o);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HasUnitState(UnitState.CannotTurn))
|
||||||
|
loc.W = GetOrientation();
|
||||||
|
|
||||||
|
UpdatePosition(loc.X, loc.Y, loc.Z, loc.W);
|
||||||
}
|
}
|
||||||
public void DisableSpline()
|
public void DisableSpline()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -248,6 +248,11 @@ namespace Game.Movement
|
|||||||
return ms / 1000.0f;
|
return ms / 1000.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasStarted()
|
||||||
|
{
|
||||||
|
return time_passed > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void Interrupt() { splineflags.SetUnsetFlag(SplineFlag.Done); }
|
public void Interrupt() { splineflags.SetUnsetFlag(SplineFlag.Done); }
|
||||||
public void UpdateState(int difftime)
|
public void UpdateState(int difftime)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user