Files
tbd-station-14/Content.Server/GameObjects/Components/MachineLinking/SignalButtonComponent.cs
Paul Ritter 501156f84c makes conveyors to use machine linking & refactors machine linking a bit (#2464)
* makes conveyors to use machine linking & refactors machine linking a bit

* nullable errors

* temp commit, starting work on construction

* working recipies & graphs

* fixes crash

* makes items gravitate towards the center when on a conveyor

* makes conveyors take bool signal too

* ignores components clientside

* default arm
entitymanager
maxtransmitters
unsubscribe methods

* twowayLEVER

* _

* componentreference
struct

* yaml run
leverDefinitelyNotCopiedFromGirderNoNoNo dies today :(

* nullable

* no divide by 0

* making sloth happy

* space gone - happy?

* final fix

* yes

* adds item to lathe

* conveyor item -> conveyor assembly

* technology

* reviews ADRESSED

* Update Content.Shared/GameObjects/Verbs/VerbUtility.cs

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-11-19 00:53:46 +11:00

46 lines
1.4 KiB
C#

using Content.Server.GameObjects.Components.MachineLinking.Signals;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Localization;
namespace Content.Server.GameObjects.Components.MachineLinking
{
[RegisterComponent]
public class SignalButtonComponent : Component, IActivate, IInteractHand
{
public override string Name => "SignalButton";
public void Activate(ActivateEventArgs eventArgs)
{
TransmitSignal(eventArgs.User);
}
public bool InteractHand(InteractHandEventArgs eventArgs)
{
TransmitSignal(eventArgs.User);
return true;
}
private void TransmitSignal(IEntity user)
{
if (!Owner.TryGetComponent<SignalTransmitterComponent>(out var transmitter))
{
return;
}
if (transmitter.TransmitSignal(new ToggleSignal()))
{
// Since the button doesn't have an animation, I'm going to use a popup message
Owner.PopupMessage(user, Loc.GetString("Click."));
}
else
{
Owner.PopupMessage(user, Loc.GetString("No receivers connected."));
}
}
}
}