Fix events.enabled (#10345)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user