From c0593552d2b77eb967ccc4de8604d5094e5e13ef Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Fri, 26 Mar 2021 14:44:43 +0000 Subject: [PATCH] Update WakeUpSync.cs --- QSB/TimeSync/WakeUpSync.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/QSB/TimeSync/WakeUpSync.cs b/QSB/TimeSync/WakeUpSync.cs index 0aa0b24e..8cec7f81 100644 --- a/QSB/TimeSync/WakeUpSync.cs +++ b/QSB/TimeSync/WakeUpSync.cs @@ -12,7 +12,7 @@ namespace QSB.TimeSync { public static WakeUpSync LocalInstance { get; private set; } - private const float PauseOrFastForwardThreshold = 0.5f; + private const float PauseOrFastForwardThreshold = 1.0f; private const float TimescaleBounds = 0.3f; private const float MaxFastForwardSpeed = 60f; @@ -25,7 +25,6 @@ namespace QSB.TimeSync private float _sendTimer; private float _serverTime; - private float _timeScale; private bool _isFirstFastForward = true; private int _localLoopCount; private int _serverLoopCount; @@ -144,7 +143,6 @@ namespace QSB.TimeSync { Locator.GetActiveCamera().enabled = false; } - _timeScale = MaxFastForwardSpeed; _state = State.FastForwarding; OWTime.SetMaxDeltaTime(0.033333335f); OWTime.SetFixedTimestep(0.033333335f); @@ -160,7 +158,7 @@ namespace QSB.TimeSync } DebugLog.DebugWrite($"START PAUSING (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info); Locator.GetActiveCamera().enabled = false; - _timeScale = 0f; + OWTime.SetTimeScale(0f); _state = State.Pausing; SpinnerUI.Show(); TimeSyncUI.Start(TimeSyncType.Pausing); @@ -168,7 +166,7 @@ namespace QSB.TimeSync private void ResetTimeScale() { - _timeScale = 1f; + OWTime.SetTimeScale(1f); OWTime.SetMaxDeltaTime(0.06666667f); OWTime.SetFixedTimestep(0.01666667f); Locator.GetActiveCamera().enabled = true; @@ -228,7 +226,7 @@ namespace QSB.TimeSync Locator.GetPlayerCamera().enabled = false; } var diff = _serverTime - Time.timeSinceLevelLoad; - Time.timeScale = Mathf.SmoothStep(MinFastForwardSpeed, MaxFastForwardSpeed, Mathf.Abs(diff) / MaxFastForwardDiff); + OWTime.SetTimeScale(Mathf.SmoothStep(MinFastForwardSpeed, MaxFastForwardSpeed, Mathf.Abs(diff) / MaxFastForwardDiff)); if (QSBSceneManager.CurrentScene == OWScene.SolarSystem && _isFirstFastForward) { @@ -238,10 +236,6 @@ namespace QSB.TimeSync Physics.SyncTransforms(); } } - else - { - Time.timeScale = _timeScale; - } var isDoneFastForwarding = _state == State.FastForwarding && Time.timeSinceLevelLoad >= _serverTime; var isDonePausing = _state == State.Pausing && Time.timeSinceLevelLoad < _serverTime;