Files
tbd-station-14/Content.Server/MachineLinking/System/SignalButtonSystem.cs
Snowni 87c618db4b Remote Explosives (#7682)
* Remote Explosives

* Apparently we forgot to push the changed files. Dumb.

We Forgor.#

* Made Requested Changes.

* And more changes.

* Added requested changes and tweaked a few other things.

* Fixed RSI issue (hopefully.) Readded Ensurecomp.
2022-04-22 16:54:39 +10:00

33 lines
1.1 KiB
C#

using Content.Server.MachineLinking.Components;
using Content.Server.MachineLinking.Events;
using Content.Shared.Interaction;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Content.Shared.Interaction.Events;
namespace Content.Server.MachineLinking.System
{
[UsedImplicitly]
public sealed class SignalButtonSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SignalButtonComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<SignalButtonComponent, InteractHandEvent>(OnInteractHand);
}
private void OnInit(EntityUid uid, SignalButtonComponent component, ComponentInit args)
{
var transmitter = EnsureComp<SignalTransmitterComponent>(uid);
if (!transmitter.Outputs.ContainsKey("Pressed"))
transmitter.AddPort("Pressed");
}
private void OnInteractHand(EntityUid uid, SignalButtonComponent component, InteractHandEvent args)
{
RaiseLocalEvent(uid, new InvokePortEvent("Pressed"), false);
args.Handled = true;
}
}
}