* 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
24 lines
694 B
C#
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();
|
|
}
|
|
}
|
|
}
|