Files
tbd-station-14/Content.Server/Explosion/EntitySystems/TriggerSystem.Signal.cs
Julian Giebel 6ebd784cb6 Device Linking and better linking ui (#13645)
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2023-05-07 16:07:24 +10:00

29 lines
994 B
C#

using Content.Server.DeviceLinking.Events;
using Content.Server.DeviceLinking.Systems;
using Content.Server.Explosion.Components;
namespace Content.Server.Explosion.EntitySystems
{
public sealed partial class TriggerSystem
{
[Dependency] private readonly DeviceLinkSystem _signalSystem = default!;
private void InitializeSignal()
{
SubscribeLocalEvent<TriggerOnSignalComponent,SignalReceivedEvent>(OnSignalReceived);
SubscribeLocalEvent<TriggerOnSignalComponent,ComponentInit>(OnInit);
}
private void OnSignalReceived(EntityUid uid, TriggerOnSignalComponent component, ref SignalReceivedEvent args)
{
if (args.Port != component.Port)
return;
Trigger(uid, args.Trigger);
}
private void OnInit(EntityUid uid, TriggerOnSignalComponent component, ComponentInit args)
{
_signalSystem.EnsureSinkPorts(uid, component.Port);
}
}
}