diff --git a/Content.Server/Cargo/CargoSystem.Console.cs b/Content.Server/Cargo/CargoSystem.Console.cs
index fd6a76c4c0..183e71e834 100644
--- a/Content.Server/Cargo/CargoSystem.Console.cs
+++ b/Content.Server/Cargo/CargoSystem.Console.cs
@@ -1,13 +1,13 @@
-using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Access.Systems;
using Content.Server.Cargo.Components;
+using Content.Server.MachineLinking.Components;
+using Content.Server.MachineLinking.Events;
+using Content.Server.MachineLinking.System;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Cargo;
using Content.Shared.GameTicking;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
namespace Content.Server.Cargo
{
@@ -35,7 +35,7 @@ namespace Content.Server.Cargo
///
/// Used to assign IDs to bank accounts. Incremental counter.
///
- private int _accountIndex = 0;
+ private int _accountIndex;
///
/// Enumeration of all bank accounts.
///
@@ -49,12 +49,18 @@ namespace Content.Server.Cargo
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
+ [Dependency] private readonly SignalLinkerSystem _linker = default!;
private void InitializeConsole()
{
+ SubscribeLocalEvent(OnInit);
SubscribeLocalEvent(Reset);
Reset();
}
+ private void OnInit(EntityUid uid, CargoConsoleComponent console, ComponentInit args)
+ {
+ _linker.EnsureTransmitterPorts(uid, console.SenderPort);
+ }
private void Reset(RoundRestartCleanupEvent ev)
{
diff --git a/Content.Server/Cargo/CargoSystem.Telepad.cs b/Content.Server/Cargo/CargoSystem.Telepad.cs
index 40adc59b92..a20d1eef06 100644
--- a/Content.Server/Cargo/CargoSystem.Telepad.cs
+++ b/Content.Server/Cargo/CargoSystem.Telepad.cs
@@ -2,7 +2,10 @@ using Content.Server.Cargo.Components;
using Content.Server.Labels.Components;
using Content.Server.Paper;
using Content.Server.Power.Components;
+using Content.Server.MachineLinking.Components;
+using Content.Server.MachineLinking.Events;
using Content.Shared.Cargo;
+using Content.Shared.Cargo.Components;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
@@ -16,6 +19,7 @@ public sealed partial class CargoSystem
private void InitializeTelepad()
{
+ SubscribeLocalEvent(OnInit);
SubscribeLocalEvent(OnTelepadPowerChange);
// Shouldn't need re-anchored event
SubscribeLocalEvent(OnTelepadAnchorChange);
@@ -57,6 +61,11 @@ public sealed partial class CargoSystem
}
}
+ private void OnInit(EntityUid uid, CargoTelepadComponent telepad, ComponentInit args)
+ {
+ _linker.EnsureReceiverPorts(uid, telepad.ReceiverPort);
+ }
+
private void SetEnabled(CargoTelepadComponent component, ApcPowerReceiverComponent? receiver = null,
TransformComponent? xform = null)
{
diff --git a/Content.Server/Cargo/Components/CargoConsoleComponent.cs b/Content.Server/Cargo/Components/CargoConsoleComponent.cs
index 5c13a5170c..73611ef6b2 100644
--- a/Content.Server/Cargo/Components/CargoConsoleComponent.cs
+++ b/Content.Server/Cargo/Components/CargoConsoleComponent.cs
@@ -1,27 +1,21 @@
-using System.Collections.Generic;
-using System.Linq;
-using Content.Server.Coordinates.Helpers;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.Cargo;
using Content.Shared.Cargo.Components;
using Content.Shared.Sound;
+using Content.Server.MachineLinking.Components;
+using Content.Shared.MachineLinking;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
using Robust.Shared.Map;
-using Robust.Shared.Maths;
using Robust.Shared.Player;
-using Robust.Shared.Serialization.Manager.Attributes;
-using Robust.Shared.ViewVariables;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Cargo.Components
{
[RegisterComponent]
public sealed class CargoConsoleComponent : SharedCargoConsoleComponent
{
- [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEntityManager _entMan = default!;
private CargoBankAccount? _bankAccount;
@@ -64,6 +58,9 @@ namespace Content.Server.Cargo.Components
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CargoConsoleUiKey.Key);
+ [DataField("senderPort", customTypeSerializer: typeof(PrototypeIdSerializer))]
+ public string SenderPort = "OrderSender";
+
protected override void Initialize()
{
base.Initialize();
@@ -160,23 +157,18 @@ namespace Content.Server.Cargo.Components
//orders.Database.ClearOrderCapacity();
// TODO replace with shuttle code
- // TEMPORARY loop for spawning stuff on telepad (looks for a telepad adjacent to the console)
EntityUid? cargoTelepad = null;
- var indices = _entMan.GetComponent(Owner).Coordinates.ToVector2i(_entMan, _mapManager);
- var offsets = new Vector2i[] { new Vector2i(0, 1), new Vector2i(1, 1), new Vector2i(1, 0), new Vector2i(1, -1),
- new Vector2i(0, -1), new Vector2i(-1, -1), new Vector2i(-1, 0), new Vector2i(-1, 1), };
- var lookup = EntitySystem.Get();
- var gridId = _entMan.GetComponent(Owner).GridID;
-
- // TODO: Should use anchoring.
- foreach (var entity in lookup.GetEntitiesIntersecting(gridId, offsets.Select(o => o + indices)))
+ if (_entMan.TryGetComponent(Owner, out var transmitter) &&
+ transmitter.Outputs.TryGetValue(SenderPort, out var telepad) &&
+ telepad.Count > 0)
{
- if (_entMan.HasComponent(entity) && _entMan.TryGetComponent(entity, out var powerReceiver) && powerReceiver.Powered)
- {
- cargoTelepad = entity;
- break;
- }
+ // use most recent link
+ var pad = telepad[^1].Uid;
+ if (_entMan.HasComponent(pad) &&
+ _entMan.TryGetComponent(pad, out var powerReceiver) &&
+ powerReceiver.Powered)
+ cargoTelepad = pad;
}
if (cargoTelepad != null)
diff --git a/Content.Server/Cargo/Components/CargoTelepadComponent.cs b/Content.Server/Cargo/Components/CargoTelepadComponent.cs
index 60fb585c3a..8b6ccbcd1c 100644
--- a/Content.Server/Cargo/Components/CargoTelepadComponent.cs
+++ b/Content.Server/Cargo/Components/CargoTelepadComponent.cs
@@ -1,5 +1,6 @@
using Content.Shared.Cargo;
using Content.Shared.Cargo.Components;
+using Content.Shared.MachineLinking;
using Content.Shared.Sound;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -35,5 +36,8 @@ namespace Content.Server.Cargo.Components
///
[DataField("printerOutput", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string PrinterOutput = "Paper";
+
+ [DataField("receiverPort", customTypeSerializer: typeof(PrototypeIdSerializer))]
+ public string ReceiverPort = "OrderReceiver";
}
}
diff --git a/Resources/Locale/en-US/machine-linking/receiver_ports.ftl b/Resources/Locale/en-US/machine-linking/receiver_ports.ftl
index 1cb2deb31f..1aa3505f43 100644
--- a/Resources/Locale/en-US/machine-linking/receiver_ports.ftl
+++ b/Resources/Locale/en-US/machine-linking/receiver_ports.ftl
@@ -20,4 +20,10 @@ signal-port-name-close = Close
signal-port-description-close = Closes a device.
signal-port-name-trigger = Trigger
-signal-port-description-trigger = Triggers some mechanism on the device.
\ No newline at end of file
+signal-port-description-trigger = Triggers some mechanism on the device.
+
+signal-port-name-order-sender = Order sender
+signal-port-description-order-sender = Cargo console order sender
+
+signal-port-name-order-receiver = Order receiver
+signal-port-description-order-receiver = Cargo console order receiver
diff --git a/Resources/Prototypes/MachineLinking/receiver_ports.yml b/Resources/Prototypes/MachineLinking/receiver_ports.yml
index 298e7fbbda..7a4385e70c 100644
--- a/Resources/Prototypes/MachineLinking/receiver_ports.yml
+++ b/Resources/Prototypes/MachineLinking/receiver_ports.yml
@@ -32,8 +32,13 @@
id: Close
name: signal-port-name-close
description: signal-port-description-close
-
+
- type: receiverPort
id: Trigger
name: signal-port-name-trigger
- description: signal-port-description-trigger
\ No newline at end of file
+ description: signal-port-description-trigger
+
+- type: receiverPort
+ id: OrderReceiver
+ name: signal-port-name-order-receiver
+ description: signal-port-description-order-receiver
diff --git a/Resources/Prototypes/MachineLinking/transmitter_ports.yml b/Resources/Prototypes/MachineLinking/transmitter_ports.yml
index 3e908ee035..9b1ce834ef 100644
--- a/Resources/Prototypes/MachineLinking/transmitter_ports.yml
+++ b/Resources/Prototypes/MachineLinking/transmitter_ports.yml
@@ -14,22 +14,28 @@
id: Off
name: signal-port-name-off-transmitter
description: signal-port-description-off-transmitter
- defaultLinks: [ Off, Close]
+ defaultLinks: [ Off, Close ]
- type: transmitterPort
id: Left
name: signal-port-name-left
description: signal-port-description-left
- defaultLinks: [ On, Open, Forward, Trigger]
+ defaultLinks: [ On, Open, Forward, Trigger ]
- type: transmitterPort
id: Right
name: signal-port-name-right
description: signal-port-description-right
- defaultLinks: [ On, Open, Reverse, Trigger]
+ defaultLinks: [ On, Open, Reverse, Trigger ]
- type: transmitterPort
id: Middle
name: signal-port-name-middle
description: signal-port-description-middle
- defaultLinks: [ Off, Close]
+ defaultLinks: [ Off, Close ]
+
+- type: transmitterPort
+ id: OrderSender
+ name: signal-port-name-order-sender
+ description: signal-port-description-order-sender
+ defaultLinks: [ OrderReceiver ]