mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Fix events.enabled (#10345)
This commit is contained in:
parent
cdae608e3c
commit
c627280c2f
1 changed files with 10 additions and 6 deletions
|
|
@ -8,7 +8,6 @@ using Robust.Server.Player;
|
|||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.StationEvents
|
||||
{
|
||||
|
|
@ -43,16 +42,21 @@ namespace Content.Server.StationEvents
|
|||
|
||||
// Can't just check debug / release for a default given mappers need to use release mode
|
||||
// As such we'll always pause it by default.
|
||||
_configurationManager.OnValueChanged(CCVars.EventsEnabled, value => RuleAdded = value, true);
|
||||
_configurationManager.OnValueChanged(CCVars.EventsEnabled, SetEnabled, true);
|
||||
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||
}
|
||||
|
||||
public override void Started()
|
||||
public override void Shutdown()
|
||||
{
|
||||
if (!_configurationManager.GetCVar(CCVars.EventsEnabled))
|
||||
RuleAdded = false;
|
||||
base.Shutdown();
|
||||
_configurationManager.UnsubValueChanged(CCVars.EventsEnabled, SetEnabled);
|
||||
}
|
||||
|
||||
public bool EventsEnabled { get; private set; }
|
||||
private void SetEnabled(bool value) => EventsEnabled = value;
|
||||
|
||||
public override void Started() { }
|
||||
public override void Ended() { }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -86,7 +90,7 @@ namespace Content.Server.StationEvents
|
|||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
if (!RuleStarted)
|
||||
if (!RuleStarted || !EventsEnabled)
|
||||
return;
|
||||
|
||||
if (_timeUntilNextEvent > 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue