diff --git a/Content.Server/StationEvents/Components/PowerGridCheckDisabledComponent.cs b/Content.Server/StationEvents/Components/PowerGridCheckDisabledComponent.cs
deleted file mode 100644
index 90c6f2c22d..0000000000
--- a/Content.Server/StationEvents/Components/PowerGridCheckDisabledComponent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Content.Server.StationEvents.Events;
-
-namespace Content.Server.StationEvents.Components;
-
-///
-/// Added to APCs to prevent them from turning on until event end
-///
-[RegisterComponent, Access(typeof(PowerGridCheckRule))]
-public sealed class PowerGridCheckDisabledComponent : Component
-{
-}
diff --git a/Content.Server/StationEvents/Events/PowerGridCheckRule.cs b/Content.Server/StationEvents/Events/PowerGridCheckRule.cs
index acddc939c1..d24f04d800 100644
--- a/Content.Server/StationEvents/Events/PowerGridCheckRule.cs
+++ b/Content.Server/StationEvents/Events/PowerGridCheckRule.cs
@@ -6,7 +6,9 @@ using Robust.Shared.Utility;
using System.Threading;
using Content.Server.Power.EntitySystems;
using Timer = Robust.Shared.Timing.Timer;
+using System.Linq;
using Content.Server.GameTicking.Rules.Components;
+using Robust.Shared.Random;
using Content.Server.Station.Components;
using Content.Server.StationEvents.Components;
@@ -17,13 +19,6 @@ namespace Content.Server.StationEvents.Events
{
[Dependency] private readonly ApcSystem _apcSystem = default!;
- public override void Initialize()
- {
- base.Initialize();
-
- SubscribeLocalEvent(OnApcToggleMainBreaker);
- }
-
protected override void Started(EntityUid uid, PowerGridCheckRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
@@ -31,11 +26,10 @@ namespace Content.Server.StationEvents.Events
if (!TryGetRandomStation(out var chosenStation))
return;
- var query = AllEntityQuery();
- while (query.MoveNext(out var target, out var apc, out var transform))
+ foreach (var (apc, transform) in EntityQuery(true))
{
if (apc.MainBreakerEnabled && CompOrNull(transform.GridUid)?.Station == chosenStation)
- component.Powered.Add(target);
+ component.Powered.Add(apc.Owner);
}
RobustRandom.Shuffle(component.Powered);
@@ -54,10 +48,9 @@ namespace Content.Server.StationEvents.Events
if (TryComp(entity, out ApcComponent? apcComponent))
{
- if (!apcComponent.MainBreakerEnabled)
+ if(!apcComponent.MainBreakerEnabled)
_apcSystem.ApcToggleBreaker(entity, apcComponent);
}
- RemComp(entity);
}
// Can't use the default EndAudio
@@ -95,14 +88,8 @@ namespace Content.Server.StationEvents.Events
if (apcComponent.MainBreakerEnabled)
_apcSystem.ApcToggleBreaker(selected, apcComponent);
}
- EnsureComp(selected);
component.Unpowered.Add(selected);
}
}
-
- private void OnApcToggleMainBreaker(EntityUid uid, PowerGridCheckDisabledComponent component, ref ApcToggleMainBreakerAttemptEvent args)
- {
- args.Cancelled = true;
- }
}
}