Add use-delay to signal transmitters (#7703)
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<SignalButtonComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<SignalButtonComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<SignalButtonComponent, InteractHandEvent>(OnInteractHand);
|
SubscribeLocalEvent<SignalButtonComponent, ActivateInWorldEvent>(OnActivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, SignalButtonComponent component, ComponentInit args)
|
private void OnInit(EntityUid uid, SignalButtonComponent component, ComponentInit args)
|
||||||
@@ -24,7 +24,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
transmitter.AddPort("Pressed");
|
transmitter.AddPort("Pressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInteractHand(EntityUid uid, SignalButtonComponent component, InteractHandEvent args)
|
private void OnActivated(EntityUid uid, SignalButtonComponent component, ActivateInWorldEvent args)
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(uid, new InvokePortEvent("Pressed"), false);
|
RaiseLocalEvent(uid, new InvokePortEvent("Pressed"), false);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<SignalSwitchComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<SignalSwitchComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<SignalSwitchComponent, InteractHandEvent>(OnInteracted);
|
SubscribeLocalEvent<SignalSwitchComponent, ActivateInWorldEvent>(OnActivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, SignalSwitchComponent component, ComponentInit args)
|
private void OnInit(EntityUid uid, SignalSwitchComponent component, ComponentInit args)
|
||||||
@@ -23,7 +23,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInteracted(EntityUid uid, SignalSwitchComponent component, InteractHandEvent args)
|
private void OnActivated(EntityUid uid, SignalSwitchComponent component, ActivateInWorldEvent args)
|
||||||
{
|
{
|
||||||
component.State = !component.State;
|
component.State = !component.State;
|
||||||
RaiseLocalEvent(uid, new InvokePortEvent(component.State ? "On" : "Off"), false);
|
RaiseLocalEvent(uid, new InvokePortEvent(component.State ? "On" : "Off"), false);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.MachineLinking.Components;
|
using Content.Server.MachineLinking.Components;
|
||||||
using Content.Server.MachineLinking.Events;
|
using Content.Server.MachineLinking.Events;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -13,7 +13,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<TwoWayLeverComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<TwoWayLeverComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<TwoWayLeverComponent, InteractHandEvent>(OnInteractHand);
|
SubscribeLocalEvent<TwoWayLeverComponent, ActivateInWorldEvent>(OnActivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, TwoWayLeverComponent component, ComponentInit args)
|
private void OnInit(EntityUid uid, TwoWayLeverComponent component, ComponentInit args)
|
||||||
@@ -24,7 +24,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
transmitter.AddPort(state);
|
transmitter.AddPort(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInteractHand(EntityUid uid, TwoWayLeverComponent component, InteractHandEvent args)
|
private void OnActivated(EntityUid uid, TwoWayLeverComponent component, ActivateInWorldEvent args)
|
||||||
{
|
{
|
||||||
component.State = component.State switch
|
component.State = component.State switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,3 +10,4 @@
|
|||||||
sprite: Objects/Devices/signaller.rsi
|
sprite: Objects/Devices/signaller.rsi
|
||||||
state: signaller
|
state: signaller
|
||||||
- type: Signaller
|
- type: Signaller
|
||||||
|
- type: UseDelay
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
sprite: Structures/Wallmounts/switch.rsi
|
sprite: Structures/Wallmounts/switch.rsi
|
||||||
state: on
|
state: on
|
||||||
- type: SignalSwitch
|
- type: SignalSwitch
|
||||||
|
- type: UseDelay
|
||||||
|
delay: 0.5 # prevent light-toggling auto-clickers.
|
||||||
- type: Rotatable
|
- type: Rotatable
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
@@ -32,6 +34,8 @@
|
|||||||
sprite: Structures/Wallmounts/switch.rsi
|
sprite: Structures/Wallmounts/switch.rsi
|
||||||
state: dead
|
state: dead
|
||||||
- type: SignalButton
|
- type: SignalButton
|
||||||
|
- type: UseDelay
|
||||||
|
delay: 0.5 # prevent light-toggling auto-clickers.
|
||||||
- type: Rotatable
|
- type: Rotatable
|
||||||
placement:
|
placement:
|
||||||
mode: SnapgridCenter
|
mode: SnapgridCenter
|
||||||
@@ -82,6 +86,8 @@
|
|||||||
sprite: Structures/conveyor.rsi
|
sprite: Structures/conveyor.rsi
|
||||||
state: switch-off
|
state: switch-off
|
||||||
- type: TwoWayLever
|
- type: TwoWayLever
|
||||||
|
- type: UseDelay
|
||||||
|
delay: 0.2 # prevent light-toggling auto-clickers.
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
visuals:
|
visuals:
|
||||||
- type: TwoWayLeverVisualizer
|
- type: TwoWayLeverVisualizer
|
||||||
|
|||||||
Reference in New Issue
Block a user