quantum-space-buddies/QSB/TimeSync/PreserveTimeScale.cs
AmazingAlek 188bbad5e7
Alek/sleep sync (#29)
* syncing time
* clients auto-sleep or pause to reach server's time
* disabled manual sleep/pause for clients
2020-02-28 22:07:39 +01:00

26 lines
546 B
C#

using OWML.ModHelper.Events;
using UnityEngine;
namespace QSB.TimeSync
{
public class PreserveTimeScale : MonoBehaviour
{
private void Start()
{
GlobalMessenger.AddListener("GamePaused", OnPause);
var campfires = GameObject.FindObjectsOfType<Campfire>();
foreach (var campfire in campfires)
{
campfire.SetValue("_canSleepHere", false);
}
}
private void OnPause()
{
Time.timeScale = 1;
}
}
}