diff --git a/Content.Server/Disposal/Tube/Components/DisposalSignalRouterComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalSignalRouterComponent.cs
new file mode 100644
index 0000000000..b4ef81d898
--- /dev/null
+++ b/Content.Server/Disposal/Tube/Components/DisposalSignalRouterComponent.cs
@@ -0,0 +1,36 @@
+using Content.Server.Disposal.Tube.Systems;
+using Content.Shared.DeviceLinking;
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Disposal.Tube.Components;
+
+///
+/// Requires to function.
+///
+[RegisterComponent, Access(typeof(DisposalSignalRouterSystem))]
+public sealed partial class DisposalSignalRouterComponent : Component
+{
+ ///
+ /// Whether to route items to the side or not.
+ ///
+ [DataField]
+ public bool Routing;
+
+ ///
+ /// Port that sets the router to send items to the side.
+ ///
+ [DataField]
+ public ProtoId OnPort = "On";
+
+ ///
+ /// Port that sets the router to send items ahead.
+ ///
+ [DataField]
+ public ProtoId OffPort = "Off";
+
+ ///
+ /// Port that toggles the router between sending items to the side and ahead.
+ ///
+ [DataField]
+ public ProtoId TogglePort = "Toggle";
+}
diff --git a/Content.Server/Disposal/Tube/Systems/DisposalSignalRouterSystem.cs b/Content.Server/Disposal/Tube/Systems/DisposalSignalRouterSystem.cs
new file mode 100644
index 0000000000..3a9fdbbf8d
--- /dev/null
+++ b/Content.Server/Disposal/Tube/Systems/DisposalSignalRouterSystem.cs
@@ -0,0 +1,52 @@
+using Content.Server.DeviceLinking.Events;
+using Content.Server.DeviceLinking.Systems;
+using Content.Server.Disposal.Tube;
+using Content.Server.Disposal.Tube.Components;
+
+namespace Content.Server.Disposal.Tube.Systems;
+
+///
+/// Handles signals and the routing get next direction event.
+///
+public sealed class DisposalSignalRouterSystem : EntitySystem
+{
+ [Dependency] private readonly DeviceLinkSystem _deviceLink = default!;
+
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ SubscribeLocalEvent(OnInit);
+ SubscribeLocalEvent(OnSignalReceived);
+ SubscribeLocalEvent(OnGetNextDirection, after: new[] { typeof(DisposalTubeSystem) });
+ }
+
+ private void OnInit(EntityUid uid, DisposalSignalRouterComponent comp, ComponentInit args)
+ {
+ _deviceLink.EnsureSinkPorts(uid, comp.OnPort, comp.OffPort, comp.TogglePort);
+ }
+
+ private void OnSignalReceived(EntityUid uid, DisposalSignalRouterComponent comp, ref SignalReceivedEvent args)
+ {
+ // TogglePort flips it
+ // OnPort sets it to true
+ // OffPort sets it to false
+ comp.Routing = args.Port == comp.TogglePort
+ ? !comp.Routing
+ : args.Port == comp.OnPort;
+ }
+
+ private void OnGetNextDirection(EntityUid uid, DisposalSignalRouterComponent comp, ref GetDisposalsNextDirectionEvent args)
+ {
+ if (!comp.Routing)
+ {
+ args.Next = Transform(uid).LocalRotation.GetDir();
+ return;
+ }
+
+ // use the junction side direction when a tag matches
+ var ev = new GetDisposalsConnectableDirectionsEvent();
+ RaiseLocalEvent(uid, ref ev);
+ args.Next = ev.Connectable[1];
+ }
+}
diff --git a/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml b/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml
index 9e3780a6da..d4b7c1d3c9 100644
--- a/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml
+++ b/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml
@@ -426,3 +426,63 @@
- type: Construction
graph: DisposalPipe
node: bend
+
+- type: entity
+ parent: DisposalJunction
+ id: DisposalSignalRouter
+ name: disposal signal router
+ description: A signal-controlled three-way router.
+ components:
+ - type: Sprite
+ drawdepth: ThickPipe
+ layers:
+ - map: [ "pipe" ]
+ state: signal-router-free
+ - type: DisposalTube
+ containerId: DisposalSignalRouter
+ - type: DisposalSignalRouter
+ - type: DeviceLinkSink
+ ports:
+ - On
+ - Off
+ - Toggle
+ - type: DeviceNetwork
+ deviceNetId: Wireless
+ receiveFrequencyId: BasicDevice
+ - type: WirelessNetworkConnection
+ range: 200
+ - type: ContainerContainer
+ containers:
+ DisposalSignalRouter: !type:Container
+ - type: GenericVisualizer
+ visuals:
+ enum.DisposalTubeVisuals.VisualState:
+ pipe:
+ Free: { state: signal-router-free }
+ Anchored: { state: signal-router }
+ - type: Flippable
+ mirrorEntity: DisposalSignalRouterFlipped
+ - type: Construction
+ graph: DisposalPipe
+ node: signal_router
+
+- type: entity
+ parent: DisposalSignalRouter
+ id: DisposalSignalRouterFlipped
+ suffix: flipped
+ components:
+ - type: Sprite
+ layers:
+ - map: [ "pipe" ]
+ state: signal-router-flipped-free
+ - type: DisposalJunction
+ degrees:
+ - 0
+ - 90
+ - 180
+ - type: GenericVisualizer
+ visuals:
+ enum.DisposalTubeVisuals.VisualState:
+ pipe:
+ Free: { state: signal-router-flipped-free }
+ Anchored: { state: signal-router-flipped }
diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/disposal_pipes.yml b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/disposal_pipes.yml
index b626105532..1b3aa3105b 100644
--- a/Resources/Prototypes/Recipes/Construction/Graphs/utilities/disposal_pipes.yml
+++ b/Resources/Prototypes/Recipes/Construction/Graphs/utilities/disposal_pipes.yml
@@ -51,6 +51,23 @@
- material: Steel
amount: 2
doAfter: 1
+ # DisposalSignalRouter
+ - to: signal_router
+ steps:
+ - material: Steel
+ amount: 2
+ doAfter: 1
+ - material: Cable
+ amount: 1
+ doAfter: 1
+ - to: signal_router_flipped
+ steps:
+ - material: Steel
+ amount: 2
+ doAfter: 1
+ - material: Cable
+ amount: 1
+ doAfter: 1
- node: broken
entity: DisposalPipeBroken
edges:
@@ -187,4 +204,33 @@
- !type:DeleteEntity
steps:
- tool: Welding
- doAfter: 1
\ No newline at end of file
+ doAfter: 1
+ # DisposalRouter
+ - node: signal_router
+ entity: DisposalSignalRouter
+ edges:
+ - to: start
+ completed:
+ - !type:SpawnPrototype
+ prototype: SheetSteel1
+ amount: 2
+ - !type:SpawnPrototype
+ prototype: CableApcStack1
+ - !type:DeleteEntity
+ steps:
+ - tool: Welding
+ doAfter: 1
+ - node: signal_router_flipped
+ entity: DisposalSignalRouterFlipped
+ edges:
+ - to: start
+ completed:
+ - !type:SpawnPrototype
+ prototype: SheetSteel1
+ amount: 2
+ - !type:SpawnPrototype
+ prototype: CableApcStack1
+ - !type:DeleteEntity
+ steps:
+ - tool: Welding
+ doAfter: 1
diff --git a/Resources/Prototypes/Recipes/Construction/utilities.yml b/Resources/Prototypes/Recipes/Construction/utilities.yml
index d1dac1d1b0..5bd28f9b5b 100644
--- a/Resources/Prototypes/Recipes/Construction/utilities.yml
+++ b/Resources/Prototypes/Recipes/Construction/utilities.yml
@@ -242,6 +242,37 @@
state: conpipe-j2s
mirror: DisposalRouter
+- type: construction
+ name: disposal signal router
+ description: A signal-controlled three-way router.
+ id: DisposalSignalRouter
+ graph: DisposalPipe
+ startNode: start
+ targetNode: signal_router
+ category: construction-category-utilities
+ placementMode: SnapgridCenter
+ canBuildInImpassable: false
+ icon:
+ sprite: Structures/Piping/disposal.rsi
+ state: signal-router-free
+ mirror: DisposalSignalRouterFlipped
+
+- type: construction
+ hide: true
+ name: disposal signal router
+ description: A signal-controlled three-way router.
+ id: DisposalSignalRouterFlipped
+ graph: DisposalPipe
+ startNode: start
+ targetNode: signal_router_flipped
+ category: construction-category-utilities
+ placementMode: SnapgridCenter
+ canBuildInImpassable: false
+ icon:
+ sprite: Structures/Piping/disposal.rsi
+ state: signal-router-flipped-free
+ mirror: DisposalSignalRouter
+
- type: construction
name: disposal junction
description: A three-way junction. The arrow indicates where items exit.
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/meta.json b/Resources/Textures/Structures/Piping/disposal.rsi/meta.json
index fd0ed2ac25..87655b6b86 100644
--- a/Resources/Textures/Structures/Piping/disposal.rsi/meta.json
+++ b/Resources/Textures/Structures/Piping/disposal.rsi/meta.json
@@ -5,7 +5,7 @@
"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",
+ "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).",
"states": [
{
"name": "condisposal",
@@ -827,6 +827,78 @@
1.0
]
]
+ },
+ {
+ "name": "signal-router",
+ "directions": 4,
+ "delays": [
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ]
+ ]
+ },
+ {
+ "name": "signal-router-free",
+ "directions": 4,
+ "delays": [
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ]
+ ]
+ },
+ {
+ "name": "signal-router-flipped",
+ "directions": 4,
+ "delays": [
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ]
+ ]
+ },
+ {
+ "name": "signal-router-flipped-free",
+ "directions": 4,
+ "delays": [
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ],
+ [
+ 1.0
+ ]
+ ]
}
]
-}
\ No newline at end of file
+}
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-flipped-free.png b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-flipped-free.png
new file mode 100644
index 0000000000..c8f27f8731
Binary files /dev/null and b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-flipped-free.png differ
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-flipped.png b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-flipped.png
new file mode 100644
index 0000000000..8ea007cf87
Binary files /dev/null and b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-flipped.png differ
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-free.png b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-free.png
new file mode 100644
index 0000000000..672aa5658d
Binary files /dev/null and b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router-free.png differ
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/signal-router.png b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router.png
new file mode 100644
index 0000000000..2c9d4dd682
Binary files /dev/null and b/Resources/Textures/Structures/Piping/disposal.rsi/signal-router.png differ