Files
ss14-wega/Content.Server/GameTicking/Rules/VariationPass/UnpowerAllVariationPassSystem.cs
Killerqu00 f8b96d39b7 [April Fools] Very Bad Day (#35691)
* very bad day preset

* unpowerAll systems and components

* make everyone hurt and drunk

* the rest is done

* turn very bad day into very bad 15 minutes godo
2025-03-31 12:57:04 +02:00

29 lines
1.1 KiB
C#

using Content.Server.GameTicking.Rules.VariationPass.Components;
using Content.Server.Power.Components;
using Content.Server.Wires;
using Content.Shared.Whitelist;
using Robust.Shared.Random;
namespace Content.Server.GameTicking.Rules.VariationPass;
/// <summary>
/// Handles unpowering stuff around the station.
/// This system identifies target devices and adds <see cref="UnpowerOnMapInitComponent"/> to them.
/// The actual wire cutting is handled by <see cref="CutWireOnMapInitSystem"/>.
/// </summary>
public sealed class UnpowerAllVariationPassSystem : VariationPassSystem<UnpowerAllVariationPassComponent>
{
protected override void ApplyVariation(Entity<UnpowerAllVariationPassComponent> ent, ref StationVariationPassEvent args)
{
var query = AllEntityQuery<BatteryComponent, TransformComponent>();
while (query.MoveNext(out var uid, out _, out var transform))
{
// Ignore if not part of the station
if (!IsMemberOfStation((uid, transform), ref args))
continue;
EnsureComp<UnpowerOnMapInitComponent>(uid);
}
}
}