Files
tbd-station-14/Content.Server/DeviceNetwork/Systems/DeviceNetworkRequiresPowerSystem.cs
metalgearsloth a89d4c750b Power stuff (#31314)
* Power stuff

- Add shared IsPowered
- Add shared ResolveApc
- Move PowerChangedEvent to shared for now
- Add SlimPoweredLight that actually functions how you'd expect a PoweredLight to function it id didn't have a bunch of bloat on it.

* big update

* boing
2024-08-25 22:18:42 +10:00

24 lines
694 B
C#

using Content.Server.DeviceNetwork.Components;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Power.EntitySystems;
namespace Content.Server.DeviceNetwork.Systems;
public sealed class DeviceNetworkRequiresPowerSystem : EntitySystem
{
public override void Initialize()
{
SubscribeLocalEvent<DeviceNetworkRequiresPowerComponent, BeforePacketSentEvent>(OnBeforePacketSent);
}
private void OnBeforePacketSent(EntityUid uid, DeviceNetworkRequiresPowerComponent component,
BeforePacketSentEvent args)
{
if (!this.IsPowered(uid, EntityManager))
{
args.Cancel();
}
}
}