Remove superseded machine linking code (#18244)

This commit is contained in:
Leon Friedrich
2023-07-24 14:07:35 +12:00
committed by GitHub
parent a4063a5e33
commit f2bfdd8e17
44 changed files with 58 additions and 1259 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.MachineLinking;
using Content.Shared.DeviceLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceLinking.Components
@@ -6,19 +6,19 @@ namespace Content.Server.DeviceLinking.Components
[RegisterComponent]
public sealed class DoorSignalControlComponent : Component
{
[DataField("openPort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
[DataField("openPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string OpenPort = "Open";
[DataField("closePort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
[DataField("closePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string ClosePort = "Close";
[DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
[DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string TogglePort = "Toggle";
[DataField("boltPort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
[DataField("boltPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string InBolt = "DoorBolt";
[DataField("onOpenPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("onOpenPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string OutOpen = "DoorStatus";
}
}

View File

@@ -1,6 +1,5 @@
using Content.Server.DeviceLinking.Systems;
using Content.Shared.DeviceLinking;
using Content.Shared.MachineLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceLinking.Components;
@@ -15,19 +14,19 @@ public sealed class EdgeDetectorComponent : Component
/// <summary>
/// Name of the input port.
/// </summary>
[DataField("inputPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
[DataField("inputPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string InputPort = "Input";
/// <summary>
/// Name of the rising edge output port.
/// </summary>
[DataField("outputHighPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("outputHighPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string OutputHighPort = "OutputHigh";
/// <summary>
/// Name of the falling edge output port.
/// </summary>
[DataField("outputLowPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("outputLowPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string OutputLowPort = "OutputLow";
// Initial state

View File

@@ -1,6 +1,5 @@
using Content.Server.DeviceLinking.Systems;
using Content.Shared.DeviceLinking;
using Content.Shared.MachineLinking;
using Content.Shared.Tools;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -36,19 +35,19 @@ public sealed class LogicGateComponent : Component
/// <summary>
/// Name of the first input port.
/// </summary>
[DataField("inputPortA", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
[DataField("inputPortA", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string InputPortA = "InputA";
/// <summary>
/// Name of the second input port.
/// </summary>
[DataField("inputPortB", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
[DataField("inputPortB", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string InputPortB = "InputB";
/// <summary>
/// Name of the output port.
/// </summary>
[DataField("outputPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("outputPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string OutputPort = "Output";
// Initial state

View File

@@ -1,5 +1,5 @@
using Content.Server.DeviceLinking.Systems;
using Content.Shared.MachineLinking;
using Content.Shared.DeviceLinking;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -15,20 +15,20 @@ public sealed class SignalSwitchComponent : Component
/// <summary>
/// The port that gets signaled when the switch turns on.
/// </summary>
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string OnPort = "On";
/// <summary>
/// The port that gets signaled when the switch turns off.
/// </summary>
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string OffPort = "Off";
/// <summary>
/// The port that gets signaled with the switch's current status.
/// This is only used if OnPort is different from OffPort, not in the case of a toggle switch.
/// </summary>
[DataField("statusPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("statusPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string StatusPort = "Status";
[DataField("state")]

View File

@@ -1,4 +1,4 @@
using Content.Shared.MachineLinking;
using Content.Shared.DeviceLinking;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -25,13 +25,13 @@ public sealed class SignalTimerComponent : Component
/// <summary>
/// The port that gets signaled when the timer triggers.
/// </summary>
[DataField("triggerPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>)), ViewVariables(VVAccess.ReadWrite)]
[DataField("triggerPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>)), ViewVariables(VVAccess.ReadWrite)]
public string TriggerPort = "Timer";
/// <summary>
/// The port that gets signaled when the timer starts.
/// </summary>
[DataField("startPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>)), ViewVariables(VVAccess.ReadWrite)]
[DataField("startPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>)), ViewVariables(VVAccess.ReadWrite)]
public string StartPort = "Start";
/// <summary>

View File

@@ -1,4 +1,4 @@
using Content.Shared.MachineLinking;
using Content.Shared.DeviceLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceLinking.Components
@@ -12,7 +12,7 @@ namespace Content.Server.DeviceLinking.Components
/// <summary>
/// The port that gets signaled when the switch turns on.
/// </summary>
[DataField("port", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("port", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string Port = "Pressed";
}
}

View File

@@ -1,5 +1,4 @@
using Content.Shared.DeviceLinking;
using Content.Shared.MachineLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceLinking.Components
@@ -13,13 +12,13 @@ namespace Content.Server.DeviceLinking.Components
[DataField("nextSignalLeft")]
public bool NextSignalLeft;
[DataField("leftPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("leftPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string LeftPort = "Left";
[DataField("rightPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("rightPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string RightPort = "Right";
[DataField("middlePort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
[DataField("middlePort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
public string MiddlePort = "Middle";
}
}

View File

@@ -1,5 +1,4 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.MachineLinking.System;
namespace Content.Server.DeviceLinking.Systems;

View File

@@ -2,9 +2,7 @@
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.MachineLinking.Components;
using Content.Shared.DeviceLinking;
using Robust.Shared.Utility;
namespace Content.Server.DeviceLinking.Systems;
@@ -15,7 +13,6 @@ public sealed class DeviceLinkSystem : SharedDeviceLinkSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SignalTransmitterComponent, ComponentStartup>(OnTransmitterStartup);
SubscribeLocalEvent<DeviceLinkSinkComponent, DeviceNetworkPacketEvent>(OnPacketReceived);
}
@@ -36,33 +33,7 @@ public sealed class DeviceLinkSystem : SharedDeviceLinkSystem
}
}
/// <summary>
/// Moves existing links from machine linking to device linking to ensure linked things still work even when the map wasn't updated yet
/// </summary>
public void OnTransmitterStartup(EntityUid sourceUid, SignalTransmitterComponent transmitterComponent, ComponentStartup args)
{
var sourceComponent = EnsureComp<DeviceLinkSourceComponent>(sourceUid);
Dictionary<EntityUid, List<(string, string)>> outputs = new();
foreach (var (transmitterPort, receiverPorts) in transmitterComponent.Outputs)
{
foreach (var receiverPort in receiverPorts)
{
// Throw error if component is missing.
EnsureComp<DeviceLinkSinkComponent>(receiverPort.Uid);
outputs.GetOrNew(receiverPort.Uid).Add((transmitterPort, receiverPort.Port));
}
}
foreach (var (sinkUid, links) in outputs)
{
SaveLinks(null, sourceUid, sinkUid, links, sourceComponent);
}
RemCompDeferred<SignalTransmitterComponent>(sourceUid);
}
#region Sending & Receiving
#region Sending & Receiving
/// <summary>
/// Sends a network payload directed at the sink entity.
/// Just raises a <see cref="SignalReceivedEvent"/> without data if the source or the sink doesn't have a <see cref="DeviceNetworkComponent"/>

View File

@@ -1,6 +1,5 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Server.MachineLinking.Events;
using SignalReceivedEvent = Content.Server.DeviceLinking.Events.SignalReceivedEvent;
namespace Content.Server.DeviceLinking.Systems;

View File

@@ -1,13 +1,10 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Server.MachineLinking.Events;
using Content.Shared.DeviceLinking;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Tools;
using Content.Shared.Popups;
using Robust.Shared.Audio;
using Robust.Shared.Utility;
using SignalReceivedEvent = Content.Server.DeviceLinking.Events.SignalReceivedEvent;
namespace Content.Server.DeviceLinking.Systems;

View File

@@ -1,10 +1,7 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Server.MachineLinking.System;
using Content.Shared.Audio;
using Content.Shared.Interaction;
using Robust.Shared.Audio;
using Robust.Shared.Player;
namespace Content.Server.DeviceLinking.Systems;