diff --git a/Content.Server/_CorvaxNext/AutoCryoSleep/AutoCryoSleepSystem.cs b/Content.Server/_CorvaxNext/AutoCryoSleep/AutoCryoSleepSystem.cs index 8660022aa5a..63e8660adac 100644 --- a/Content.Server/_CorvaxNext/AutoCryoSleep/AutoCryoSleepSystem.cs +++ b/Content.Server/_CorvaxNext/AutoCryoSleep/AutoCryoSleepSystem.cs @@ -23,6 +23,9 @@ public sealed class AutoCryoSleepSystem : EntitySystem private bool _enabled; private TimeSpan _disconnectedTime; + private TimeSpan _updateTime; + + private TimeSpan _nextUpdate = TimeSpan.Zero; public override void Initialize() { @@ -33,14 +36,20 @@ public override void Initialize() Subs.CVar(_config, NextVars.AutoCryoSleepEnabled, value => _enabled = value, true); Subs.CVar(_config, NextVars.AutoCryoSleepTime, value => _disconnectedTime = TimeSpan.FromSeconds(value), true); + Subs.CVar(_config, NextVars.AutoCryoSleepUpdateTime, value => _updateTime = TimeSpan.FromSeconds(value), true); } public override void Update(float frameTime) { + base.Update(frameTime); + if (!_enabled) return; - base.Update(frameTime); + if (_timing.CurTime < _nextUpdate) + return; + + _nextUpdate = _timing.CurTime + _updateTime; var disconnectedQuery = EntityQueryEnumerator(); while (disconnectedQuery.MoveNext(out var uid, out var component)) diff --git a/Content.Shared/_CorvaxNext/NextVars.cs b/Content.Shared/_CorvaxNext/NextVars.cs index 0ced0520cdf..7d451d2a182 100644 --- a/Content.Shared/_CorvaxNext/NextVars.cs +++ b/Content.Shared/_CorvaxNext/NextVars.cs @@ -19,6 +19,9 @@ public sealed class NextVars public static readonly CVarDef AutoCryoSleepTime = CVarDef.Create("auto_cryo_sleep.time", 500, CVar.SERVER); + public static readonly CVarDef AutoCryoSleepUpdateTime = + CVarDef.Create("auto_cryo_sleep.update_time", 120, CVar.SERVER); + /// /// Offer item. ///