From bcfe04ebeeb293a900d795ccac11c244f80ad03e Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Thu, 10 Aug 2023 15:37:55 +0300 Subject: [PATCH] Remove events from survival (#289) * Survival * Remove events --- .../StationEvents/Events/CargoGiftsRule.cs | 7 +++++++ .../StationEvents/Events/VentClogRule.cs | 18 ++++++++++++++++++ .../RampingStationEventSchedulerSystem.cs | 8 +++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Content.Server/StationEvents/Events/CargoGiftsRule.cs b/Content.Server/StationEvents/Events/CargoGiftsRule.cs index f0f9586ad3..4baecc82ee 100644 --- a/Content.Server/StationEvents/Events/CargoGiftsRule.cs +++ b/Content.Server/StationEvents/Events/CargoGiftsRule.cs @@ -13,9 +13,16 @@ public sealed class CargoGiftsRule : StationEventSystem [Dependency] private readonly CargoSystem _cargoSystem = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly GameTicker _ticker = default!; + [Dependency] private readonly RampingStationEventSchedulerSystem _rampingEventSystem = default!; // WD protected override void Added(EntityUid uid, CargoGiftsRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) { + if (_rampingEventSystem.CheckRampingEventRule()) // WD START + { + ForceEndSelf(uid, gameRule); + return; + } // WD END + base.Added(uid, component, gameRule, args); var str = Loc.GetString(component.Announce, diff --git a/Content.Server/StationEvents/Events/VentClogRule.cs b/Content.Server/StationEvents/Events/VentClogRule.cs index f378aec3fb..f789584359 100644 --- a/Content.Server/StationEvents/Events/VentClogRule.cs +++ b/Content.Server/StationEvents/Events/VentClogRule.cs @@ -15,11 +15,18 @@ namespace Content.Server.StationEvents.Events; public sealed class VentClogRule : StationEventSystem { [Dependency] private readonly SmokeSystem _smoke = default!; + [Dependency] private readonly RampingStationEventSchedulerSystem _rampingEventSystem = default!; // WD protected override void Started(EntityUid uid, VentClogRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) { base.Started(uid, component, gameRule, args); + if (_rampingEventSystem.CheckRampingEventRule()) // WD START + { + ForceEndSelf(uid, gameRule); + return; + } // WD END + if (!TryGetRandomStation(out var chosenStation)) return; @@ -56,4 +63,15 @@ public sealed class VentClogRule : StationEventSystem Audio.PlayPvs(component.Sound, transform.Coordinates); } } + + protected override void Added(EntityUid uid, VentClogRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) // WD + { + if (_rampingEventSystem.CheckRampingEventRule()) // WD START + { + ForceEndSelf(uid, gameRule); + return; + } // WD END + + base.Added(uid, component, gameRule, args); + } } diff --git a/Content.Server/StationEvents/RampingStationEventSchedulerSystem.cs b/Content.Server/StationEvents/RampingStationEventSchedulerSystem.cs index 5c972df52e..af2c4bc17f 100644 --- a/Content.Server/StationEvents/RampingStationEventSchedulerSystem.cs +++ b/Content.Server/StationEvents/RampingStationEventSchedulerSystem.cs @@ -1,4 +1,5 @@ -using Content.Server.GameTicking; +using System.Linq; +using Content.Server.GameTicking; using Content.Server.GameTicking.Rules; using Content.Server.GameTicking.Rules.Components; using Content.Server.StationEvents.Components; @@ -93,4 +94,9 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem().Any(); + } }