Changes per Ninja

This commit is contained in:
MrGadget1024 2023-03-27 01:35:03 -04:00
parent d086eef32d
commit c74cda8382

View File

@ -45,6 +45,7 @@ public class NetworkTransformReliable : NetworkTransformBase
[Header("Snapshot Interpolation")] [Header("Snapshot Interpolation")]
[Tooltip("Add a small timeline offset to account for decoupled arrival of NetworkTime and NetworkTransform snapshots.\nfixes: https://github.com/MirrorNetworking/Mirror/issues/3427")] [Tooltip("Add a small timeline offset to account for decoupled arrival of NetworkTime and NetworkTransform snapshots.\nfixes: https://github.com/MirrorNetworking/Mirror/issues/3427")]
public bool timelineOffset = false; public bool timelineOffset = false;
double offset => NetworkServer.sendInterval * (timelineOffset ? sendIntervalMultiplier : sendIntervalMultiplier - 1);
// delta compression needs to remember 'last' to compress against // delta compression needs to remember 'last' to compress against
protected Vector3Long lastSerializedPosition = Vector3Long.zero; protected Vector3Long lastSerializedPosition = Vector3Long.zero;
@ -320,7 +321,7 @@ protected virtual void OnClientToServerSync(Vector3? position, Quaternion? rotat
// 'only sync on change' needs a correction on every new move sequence. // 'only sync on change' needs a correction on every new move sequence.
if (onlySyncOnChange && if (onlySyncOnChange &&
NeedsCorrection(serverSnapshots, connectionToClient.remoteTimeStamp, NetworkServer.sendInterval * sendIntervalMultiplier, onlySyncOnChangeInterval)) NeedsCorrection(serverSnapshots, connectionToClient.remoteTimeStamp, NetworkServer.sendInterval * sendIntervalMultiplier, onlySyncOnChangeCorrectionMultiplier))
{ {
RewriteHistory( RewriteHistory(
serverSnapshots, serverSnapshots,
@ -337,7 +338,6 @@ protected virtual void OnClientToServerSync(Vector3? position, Quaternion? rotat
// needs to be sendInterval. half sendInterval doesn't solve it. // needs to be sendInterval. half sendInterval doesn't solve it.
// https://github.com/MirrorNetworking/Mirror/issues/3427 // https://github.com/MirrorNetworking/Mirror/issues/3427
// remove this after LocalWorldState. // remove this after LocalWorldState.
double offset = NetworkServer.sendInterval * (timelineOffset ? sendIntervalMultiplier : sendIntervalMultiplier - 1);
AddSnapshot(serverSnapshots, connectionToClient.remoteTimeStamp + offset, position, rotation, scale); AddSnapshot(serverSnapshots, connectionToClient.remoteTimeStamp + offset, position, rotation, scale);
} }
@ -349,7 +349,7 @@ protected virtual void OnServerToClientSync(Vector3? position, Quaternion? rotat
// 'only sync on change' needs a correction on every new move sequence. // 'only sync on change' needs a correction on every new move sequence.
if (onlySyncOnChange && if (onlySyncOnChange &&
NeedsCorrection(clientSnapshots, NetworkClient.connection.remoteTimeStamp, NetworkClient.sendInterval * sendIntervalMultiplier, onlySyncOnChangeInterval)) NeedsCorrection(clientSnapshots, NetworkClient.connection.remoteTimeStamp, NetworkClient.sendInterval * sendIntervalMultiplier, onlySyncOnChangeCorrectionMultiplier))
{ {
RewriteHistory( RewriteHistory(
clientSnapshots, clientSnapshots,
@ -366,7 +366,6 @@ protected virtual void OnServerToClientSync(Vector3? position, Quaternion? rotat
// needs to be sendInterval. half sendInterval doesn't solve it. // needs to be sendInterval. half sendInterval doesn't solve it.
// https://github.com/MirrorNetworking/Mirror/issues/3427 // https://github.com/MirrorNetworking/Mirror/issues/3427
// remove this after LocalWorldState. // remove this after LocalWorldState.
double offset = NetworkServer.sendInterval * (timelineOffset ? sendIntervalMultiplier : sendIntervalMultiplier - 1);
AddSnapshot(clientSnapshots, NetworkClient.connection.remoteTimeStamp + offset, position, rotation, scale); AddSnapshot(clientSnapshots, NetworkClient.connection.remoteTimeStamp + offset, position, rotation, scale);
} }