From 9e9fbbee8165b60833b53c96a59192f1ab8166ca Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 8 May 2021 09:30:09 +0100 Subject: [PATCH] add timescale cap --- QSB/TimeSync/WakeUpSync.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/QSB/TimeSync/WakeUpSync.cs b/QSB/TimeSync/WakeUpSync.cs index 8cec7f81..b58397b4 100644 --- a/QSB/TimeSync/WakeUpSync.cs +++ b/QSB/TimeSync/WakeUpSync.cs @@ -261,6 +261,16 @@ namespace QSB.TimeSync } var mappedTimescale = diff.Map(-PauseOrFastForwardThreshold, PauseOrFastForwardThreshold, 1 + TimescaleBounds, 1 - TimescaleBounds); + if (mappedTimescale > 100f) + { + DebugLog.ToConsole($"Warning - CheckTimeDifference() returned over 100 - should have switched into fast-forward!", MessageType.Warning); + mappedTimescale = 100f; + } + if (mappedTimescale < 0) + { + DebugLog.ToConsole($"Warning - CheckTimeDifference() returned below 0 - should have switched into pausing!", MessageType.Warning); + mappedTimescale = 0f; + } OWTime.SetTimeScale(mappedTimescale); } }