mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 16:47:26 +00:00
28 lines
823 B
C#
28 lines
823 B
C#
using Content.Shared.DeviceLinking.Events;
|
|
using Content.Shared.Power.EntitySystems;
|
|
using Content.Shared.Power.Components;
|
|
using Content.Shared.DeviceLinking;
|
|
using Content.Shared._DV.DeviceLinking.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared._DV.DeviceLinking.Systems;
|
|
|
|
public sealed class PowerTogglePortSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedPowerReceiverSystem _power = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<PowerTogglePortComponent, SignalReceivedEvent>(OnSignalReceived);
|
|
}
|
|
|
|
private void OnSignalReceived(Entity<PowerTogglePortComponent> entity, ref SignalReceivedEvent args)
|
|
{
|
|
if (args.Port == entity.Comp.PowerTogglePort)
|
|
_power.TogglePower(entity);
|
|
}
|
|
|
|
}
|