23 lines
652 B
C#
23 lines
652 B
C#
using Content.Server.DeviceNetwork.Components;
|
|
using Content.Server.Power.Components;
|
|
using Content.Server.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();
|
|
}
|
|
}
|
|
}
|