2022-09-19 16:59:32 -07:00
|
|
|
using Content.Server.DeviceNetwork.Components;
|
|
|
|
|
using Content.Server.Power.Components;
|
|
|
|
|
using Content.Server.Power.EntitySystems;
|
2024-08-25 22:18:42 +10:00
|
|
|
using Content.Shared.Power.EntitySystems;
|
2022-09-19 16:59:32 -07:00
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|