Core/Units: moved cyclic spline synchronization mechanic heartbeat handling
Port From (https://github.com/TrinityCore/TrinityCore/commit/c2fedbb6cc89510002e9f56751e7f8427e306487)
This commit is contained in:
@@ -27,7 +27,6 @@ namespace Game.Entities
|
|||||||
public MoveSpline MoveSpline { get; set; }
|
public MoveSpline MoveSpline { get; set; }
|
||||||
MotionMaster i_motionMaster;
|
MotionMaster i_motionMaster;
|
||||||
public uint m_movementCounter; //< Incrementing counter used in movement packets
|
public uint m_movementCounter; //< Incrementing counter used in movement packets
|
||||||
TimeTracker splineSyncTimer;
|
|
||||||
MovementForces _movementForces;
|
MovementForces _movementForces;
|
||||||
PositionUpdateInfo _positionUpdateInfo;
|
PositionUpdateInfo _positionUpdateInfo;
|
||||||
protected Unit m_unitMovedByMe; // only ever set for players, and only for direct client control
|
protected Unit m_unitMovedByMe; // only ever set for players, and only for direct client control
|
||||||
|
|||||||
@@ -1809,20 +1809,6 @@ namespace Game.Entities
|
|||||||
MoveSpline.UpdateState((int)diff);
|
MoveSpline.UpdateState((int)diff);
|
||||||
bool arrived = MoveSpline.Finalized();
|
bool arrived = MoveSpline.Finalized();
|
||||||
|
|
||||||
if (MoveSpline.IsCyclic())
|
|
||||||
{
|
|
||||||
splineSyncTimer.Update(diff);
|
|
||||||
if (splineSyncTimer.Passed())
|
|
||||||
{
|
|
||||||
splineSyncTimer.Reset(5000); // Retail value, do not change
|
|
||||||
|
|
||||||
FlightSplineSync flightSplineSync = new();
|
|
||||||
flightSplineSync.Guid = GetGUID();
|
|
||||||
flightSplineSync.SplineDist = (float)MoveSpline.TimePassed() / MoveSpline.Duration();
|
|
||||||
SendMessageToSet(flightSplineSync, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arrived)
|
if (arrived)
|
||||||
{
|
{
|
||||||
DisableSpline();
|
DisableSpline();
|
||||||
@@ -1860,6 +1846,17 @@ namespace Game.Entities
|
|||||||
UpdatePosition(loc.X, loc.Y, loc.Z, loc.W);
|
UpdatePosition(loc.X, loc.Y, loc.Z, loc.W);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendFlightSplineSyncUpdate()
|
||||||
|
{
|
||||||
|
if (!MoveSpline.IsCyclic() || MoveSpline.Finalized())
|
||||||
|
return;
|
||||||
|
|
||||||
|
FlightSplineSync flightSplineSync = new();
|
||||||
|
flightSplineSync.Guid = GetGUID();
|
||||||
|
flightSplineSync.SplineDist = (float)MoveSpline.TimePassed() / MoveSpline.Duration();
|
||||||
|
SendMessageToSet(flightSplineSync, true);
|
||||||
|
}
|
||||||
|
|
||||||
void InterruptMovementBasedAuras()
|
void InterruptMovementBasedAuras()
|
||||||
{
|
{
|
||||||
// TODO: Check if orientation transport offset changed instead of only global orientation
|
// TODO: Check if orientation transport offset changed instead of only global orientation
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
|
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
|
||||||
|
|
||||||
splineSyncTimer = new TimeTracker();
|
|
||||||
|
|
||||||
m_unitData = new UnitData();
|
m_unitData = new UnitData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2557,6 +2555,14 @@ namespace Game.Entities
|
|||||||
return m_deathState;
|
return m_deathState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Heartbeat()
|
||||||
|
{
|
||||||
|
base.Heartbeat();
|
||||||
|
|
||||||
|
// SMSG_FLIGHT_SPLINE_SYNC for cyclic splines
|
||||||
|
SendFlightSplineSyncUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
public bool HaveOffhandWeapon()
|
public bool HaveOffhandWeapon()
|
||||||
{
|
{
|
||||||
if (IsTypeId(TypeId.Player))
|
if (IsTypeId(TypeId.Player))
|
||||||
|
|||||||
Reference in New Issue
Block a user