defer time sync disable

This commit is contained in:
JohnCorby 2022-01-01 00:22:18 -08:00
parent 3b3ea16257
commit a703463394
2 changed files with 11 additions and 5 deletions

View File

@ -29,8 +29,7 @@ namespace QSB.EyeOfTheUniverse.EyeStateSync.Messages
if (Value >= EyeState.ForestIsDark)
{
WakeUpSync.LocalInstance.ResetTimeScale();
WakeUpSync.LocalInstance.enabled = false;
WakeUpSync.LocalInstance.EyeDisable = true;
}
}
@ -41,8 +40,7 @@ namespace QSB.EyeOfTheUniverse.EyeStateSync.Messages
if (Value >= EyeState.ForestIsDark)
{
WakeUpSync.LocalInstance.ResetTimeScale();
WakeUpSync.LocalInstance.enabled = false;
WakeUpSync.LocalInstance.EyeDisable = true;
}
}
}

View File

@ -34,6 +34,8 @@ namespace QSB.TimeSync
private int _serverLoopCount;
private bool _hasWokenUp;
public bool EyeDisable;
public override void OnStartLocalPlayer() => LocalInstance = this;
public void OnDisconnect()
@ -215,7 +217,7 @@ namespace QSB.TimeSync
TimeSyncUI.Start(TimeSyncType.Pausing, reason);
}
public void ResetTimeScale()
private void ResetTimeScale()
{
OWTime.SetTimeScale(1f);
OWTime.SetMaxDeltaTime(0.06666667f);
@ -252,6 +254,12 @@ namespace QSB.TimeSync
{
UpdateClient();
}
if (EyeDisable)
{
ResetTimeScale();
enabled = false;
}
}
private void UpdateServer()