Various weapon fixes and some change on vehicle sync

This commit is contained in:
sardelka9515
2022-12-04 19:34:54 +08:00
parent 4cc5054b91
commit 3a9068f060
24 changed files with 247 additions and 290 deletions

View File

@ -10,13 +10,8 @@ namespace RageCoop.Client
{
private float _accumulatedOff;
/// <summary>
/// </summary>
protected internal bool _lastFrozen = false;
private int _ownerID;
public Stopwatch LastSyncedStopWatch = new Stopwatch();
/// <summary>
/// Indicates whether the current player is responsible for syncing this entity.
@ -70,7 +65,11 @@ namespace RageCoop.Client
protected Vector3 Predict(Vector3 input)
{
return (Owner.PacketTravelTime + 0.001f * LastSyncedStopWatch.ElapsedMilliseconds) * Velocity + input;
return Diff() + input;
}
protected Vector3 Diff()
{
return (Owner.PacketTravelTime + 0.001f * LastSyncedStopWatch.ElapsedMilliseconds) * Velocity;
}
protected bool IsOff(float thisOff, float tolerance = 3, float limit = 30)
@ -91,6 +90,24 @@ namespace RageCoop.Client
#region LAST STATE
public void SetLastSynced(bool full)
{
LastSyncInterval = LastSentStopWatch.ElapsedMilliseconds;
LastSynced = Main.Ticked;
if (full)
{
LastFullSynced = Main.Ticked;
}
LastSyncedStopWatch.Restart();
}
public Stopwatch LastSyncedStopWatch = new Stopwatch();
/// <summary>
/// The interval between last sync and the earlier one
/// </summary>
public long LastSyncInterval;
/// <summary>
/// Last time a new sync message arrived.
/// </summary>