]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add disposal signalers (#37535)
authorWolfkey-SomeoneElseTookMyUsername <wolfkey75@gmail.com>
Thu, 22 May 2025 02:18:57 +0000 (21:18 -0500)
committerGitHub <noreply@github.com>
Thu, 22 May 2025 02:18:57 +0000 (22:18 -0400)
* Add disposal signalers

* Sprite changes

* Some requested changes

* Requested changes + change spelling to be with two l's to be consistent with the remote signaller

Content.Server/Disposal/Tube/DisposalSignallerComponent.cs [new file with mode: 0644]
Content.Server/Disposal/Tube/DisposalSignallerSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/machine-linking/transmitter_ports.ftl
Resources/Prototypes/DeviceLinking/source_ports.yml
Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml
Resources/Prototypes/Recipes/Construction/Graphs/utilities/disposal_pipes.yml
Resources/Prototypes/Recipes/Construction/utilities.yml
Resources/Textures/Structures/Piping/disposal.rsi/conpipe-signaller.png [new file with mode: 0644]
Resources/Textures/Structures/Piping/disposal.rsi/meta.json
Resources/Textures/Structures/Piping/disposal.rsi/pipe-signaller.png [new file with mode: 0644]

diff --git a/Content.Server/Disposal/Tube/DisposalSignallerComponent.cs b/Content.Server/Disposal/Tube/DisposalSignallerComponent.cs
new file mode 100644 (file)
index 0000000..ff13a94
--- /dev/null
@@ -0,0 +1,14 @@
+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";
+}
diff --git a/Content.Server/Disposal/Tube/DisposalSignallerSystem.cs b/Content.Server/Disposal/Tube/DisposalSignallerSystem.cs
new file mode 100644 (file)
index 0000000..76c3c47
--- /dev/null
@@ -0,0 +1,25 @@
+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);
+    }
+}
index 1d879fcee9db31496d07c5a12080d73234284914..89a978479eb532523dcbd44e089ccea895efa8a5 100644 (file)
@@ -69,3 +69,6 @@ signal-port-description-power-charging = This port is invoked with HIGH when the
 
 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.
index ae7fb31408224176dc015e522af30a6e3d60b700..4a460e722d1f163bda68614975517431fc17ea83 100644 (file)
   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 ]
index bb7b08cc2cdc04beaea4e19e9639bf5613f0a776..839247fc3fd4c50ebf498b99b80aedd3b6a07401 100644 (file)
     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
index 41ec858a1a35b0fa9f43ba117a136b1a80944431..83c562fc9688bdc676b60b6a44761721dc5894c5 100644 (file)
       - 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:
index 0feffe998d5433d642d4804b0d969792a37ceb79..575ca3ae4e5d343d2f690d6e211ce3664c6ef43c 100644 (file)
   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
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/conpipe-signaller.png b/Resources/Textures/Structures/Piping/disposal.rsi/conpipe-signaller.png
new file mode 100644 (file)
index 0000000..fe84a89
Binary files /dev/null and b/Resources/Textures/Structures/Piping/disposal.rsi/conpipe-signaller.png differ
index 7fce39e69473107fa1aa5cc96df8dfaa9a444a4a..55d687bc2e39f8bdbcf46ed93e61982abaff943f 100644 (file)
@@ -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. 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
diff --git a/Resources/Textures/Structures/Piping/disposal.rsi/pipe-signaller.png b/Resources/Textures/Structures/Piping/disposal.rsi/pipe-signaller.png
new file mode 100644 (file)
index 0000000..76b1772
Binary files /dev/null and b/Resources/Textures/Structures/Piping/disposal.rsi/pipe-signaller.png differ