Files
tbd-station-14/Content.Server/MachineLinking/System/SignallerSystem.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

35 lines
1.2 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 SignallerSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SignallerComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<SignallerComponent, UseInHandEvent>(OnUseInHand);
}
private void OnInit(EntityUid uid, SignallerComponent component, ComponentInit args)
{
var transmitter = EnsureComp<SignalTransmitterComponent>(uid);
if (!transmitter.Outputs.ContainsKey(SignallerComponent.Port))
transmitter.AddPort(SignallerComponent.Port);
}
private void OnUseInHand(EntityUid uid, SignallerComponent component, UseInHandEvent args)
{
if (args.Handled)
return;
RaiseLocalEvent(uid, new InvokePortEvent(SignallerComponent.Port), false);
args.Handled = true;
}
}
}