diff --git a/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs b/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs index 48786d52dc..c34a502b21 100644 --- a/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs @@ -1,4 +1,8 @@ -using Content.Server.StationEvents; +using System; +using System.Collections.Generic; +using System.Text; +using Content.Server.StationEvents; +using Content.Server.Interfaces.GameTicking; using JetBrains.Annotations; using Robust.Server.Console; using Robust.Server.Interfaces.Player; @@ -9,25 +13,23 @@ using Robust.Shared.Interfaces.Reflection; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Localization; -using System; -using System.Collections.Generic; -using System.Text; using static Content.Shared.StationEvents.SharedStationEvent; namespace Content.Server.GameObjects.EntitySystems.StationEvents { [UsedImplicitly] + // Somewhat based off of TG's implementation of events public sealed class StationEventSystem : EntitySystem { #pragma warning disable 649 [Dependency] private readonly IServerNetManager _netManager; [Dependency] private readonly IPlayerManager _playerManager; + [Dependency] private readonly IGameTicker _gameTicker; #pragma warning restore 649 - // Somewhat based off of TG's implementation of events public StationEvent CurrentEvent { get; private set; } - public IReadOnlyCollection StationEvents => _stationEvents; + private List _stationEvents = new List(); private const float MinimumTimeUntilFirstEvent = 600; @@ -194,7 +196,18 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents { return; } - + + // Stop events from happening in lobby and force active event to end if the round ends + if (_gameTicker.RunLevel != GameTicking.GameRunLevel.InRound) + { + if (CurrentEvent != null) + { + Enabled = false; + } + + return; + } + // Keep running the current event if (CurrentEvent != null) { diff --git a/Content.Server/StationEvents/StationEventCommand.cs b/Content.Server/StationEvents/StationEventCommand.cs index 6712c8fa46..85f335b2ff 100644 --- a/Content.Server/StationEvents/StationEventCommand.cs +++ b/Content.Server/StationEvents/StationEventCommand.cs @@ -1,5 +1,4 @@ #nullable enable -using Content.Server.GameObjects.EntitySystems; using Content.Server.GameObjects.EntitySystems.StationEvents; using JetBrains.Annotations; using Robust.Server.Interfaces.Console;