add timescale cap

This commit is contained in:
Mister_Nebula 2021-05-08 09:30:09 +01:00
parent c8dd5a8dfa
commit 9e9fbbee81

View File

@ -261,6 +261,16 @@ namespace QSB.TimeSync
} }
var mappedTimescale = diff.Map(-PauseOrFastForwardThreshold, PauseOrFastForwardThreshold, 1 + TimescaleBounds, 1 - TimescaleBounds); 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); OWTime.SetTimeScale(mappedTimescale);
} }
} }