--- /dev/null
+using Content.Shared.DeviceLinking;
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Disposal.Tube;
+
+/// <summary>
+/// Disposal pipes with this component can be linked with devices to send a signal every time an item goes through the pipe
+/// </summary>
+[RegisterComponent, Access(typeof(DisposalSignallerSystem))]
+public sealed partial class DisposalSignallerComponent : Component
+{
+ [DataField]
+ public ProtoId<SourcePortPrototype> Port = "ItemDetected";
+}
--- /dev/null
+using Content.Server.DeviceLinking.Systems;
+
+namespace Content.Server.Disposal.Tube;
+
+public sealed class DisposalSignallerSystem : EntitySystem
+{
+ [Dependency] private readonly DeviceLinkSystem _link = default!;
+
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent<DisposalSignallerComponent, ComponentInit>(OnInit);
+ SubscribeLocalEvent<DisposalSignallerComponent, GetDisposalsNextDirectionEvent>(OnGetNextDirection, after: new[] { typeof(DisposalTubeSystem) });
+ }
+
+ private void OnInit(EntityUid uid, DisposalSignallerComponent comp, ComponentInit args)
+ {
+ _link.EnsureSourcePorts(uid, comp.Port);
+ }
+
+ private void OnGetNextDirection(EntityUid uid, DisposalSignallerComponent comp, ref GetDisposalsNextDirectionEvent args)
+ {
+ _link.InvokePort(uid, comp.Port);
+ }
+}
signal-port-name-power-discharging = Discharging
signal-port-description-power-discharging = This port is invoked with HIGH when the battery is losing charge and LOW when not.
+
+signal-port-name-item-detected = Detected
+signal-port-description-item-detected = This port is invoked whenever the transmitter detects an item.
id: PowerDischarging
name: signal-port-name-power-discharging
description: signal-port-description-power-discharging
+
+- type: sourcePort
+ id: ItemDetected
+ name: signal-port-name-item-detected
+ description: signal-port-description-item-detected
+ defaultLinks: [ Toggle, Trigger, Timer ]
containers:
- DisposalTagger
+- type: entity
+ id: DisposalSignaller
+ parent: DisposalPipeBase
+ name: disposal signaller
+ description: A pipe that emits a signal when in item goes through it.
+ components:
+ - type: Sprite
+ layers:
+ - map: [ "pipe" ]
+ state: conpipe-signaller
+ - type: DisposalTube
+ containerId: DisposalTransit
+ - type: DisposalTransit
+ - type: DeviceNetwork
+ deviceNetId: Wireless
+ receiveFrequencyId: BasicDevice
+ - type: DeviceLinkSource
+ ports:
+ - ItemDetected
+ - type: WirelessNetworkConnection
+ range: 200
+ - type: DisposalSignaller
+ - type: ContainerContainer
+ containers:
+ DisposalTransit: !type:Container
+ - type: GenericVisualizer
+ visuals:
+ enum.DisposalTubeVisuals.VisualState:
+ pipe:
+ Free: { state: conpipe-signaller }
+ Anchored: { state: pipe-signaller }
+ - type: Construction
+ graph: DisposalPipe
+ node: pipe
+ containers:
+ - DisposalTransit
+
- type: entity
id: DisposalTrunk
parent: DisposalPipeBase
- material: Steel
amount: 2
doAfter: 1
+ - to: signaller
+ steps:
+ - material: Steel
+ amount: 2
+ doAfter: 1
+ - material: Cable
+ amount: 1
+ doAfter: 1
- to: trunk
steps:
- material: Steel
steps:
- tool: Welding
doAfter: 1
+ - node: signaller
+ entity: DisposalSignaller
+ edges:
+ - to: start
+ completed:
+ - !type:SpawnPrototype
+ prototype: SheetSteel1
+ amount: 2
+ - !type:SpawnPrototype
+ prototype: CableApcStack1 # I have no idea why this does not work
+ - !type:DeleteEntity
+ steps:
+ - tool: Welding
+ doAfter: 1
- node: trunk
entity: DisposalTrunk
edges:
placementMode: SnapgridCenter
canBuildInImpassable: false
+- type: construction
+ id: DisposalSignaller
+ graph: DisposalPipe
+ startNode: start
+ targetNode: signaller
+ category: construction-category-utilities
+ placementMode: SnapgridCenter
+ canBuildInImpassable: false
+
- type: construction
id: DisposalTrunk
graph: DisposalPipe
"y": 32
},
"license": "CC-BY-SA-3.0",
- "copyright": "https://github.com/discordia-space/CEV-Eris/blob/bbe32606902c90f5290b57d905a3f31b84dc6d7d/icons/obj/pipes/disposal.dmi and modified by DrSmugleaf. Signal router sprites based on normal router modified by deltanedas (github). disposal bins by EmoGarbage404 (github). pipe-x pipe-xf, conpipe-x by K-Dynamic (github).",
+ "copyright": "https://github.com/discordia-space/CEV-Eris/blob/bbe32606902c90f5290b57d905a3f31b84dc6d7d/icons/obj/pipes/disposal.dmi and modified by DrSmugleaf. Signal router sprites based on normal router modified by deltanedas (github). disposal bins by EmoGarbage404 (github). pipe-x pipe-xf, conpipe-x by K-Dynamic (github). Signaler sprites based on tagger modified by Wolfkey",
"states": [
{
"name": "condisposal",
"name": "conpipe-tagger",
"directions": 4
},
+ {
+ "name": "conpipe-signaller",
+ "directions": 4
+ },
{
"name": "conpipe-y",
"directions": 4
"name": "pipe-tagger-partial",
"directions": 4
},
+ {
+ "name": "pipe-signaller",
+ "directions": 4,
+ "delays": [
+ [
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141
+ ],
+ [
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141
+ ],
+ [
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141
+ ],
+ [
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141,
+ 0.1,
+ 0.141
+ ]
+ ]
+ },
{
"name": "pipe-tf",
"directions": 4