Machine Port Prototypes (#7659)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Leon Friedrich
2022-05-12 20:46:20 +12:00
committed by GitHub
parent 32c2eb7a02
commit c00b459e31
29 changed files with 422 additions and 220 deletions

View File

@@ -1,9 +1,18 @@
using Robust.Shared.GameObjects;
using Content.Shared.MachineLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.MachineLinking.Components
{
[RegisterComponent]
public sealed class DoorSignalControlComponent : Component
{
[DataField("openPort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
public string OpenPort = "Open";
[DataField("closePort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
public string ClosePort = "Close";
[DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
public string TogglePort = "Toggle";
}
}

View File

@@ -1,9 +0,0 @@
using Robust.Shared.GameObjects;
namespace Content.Server.MachineLinking.Components
{
[RegisterComponent]
public sealed class SignalButtonComponent : Component
{
}
}

View File

@@ -1,23 +1,12 @@
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using Content.Server.MachineLinking.System;
namespace Content.Server.MachineLinking.Components
{
[RegisterComponent]
[Friend(typeof(SignalLinkerSystem))]
public sealed class SignalReceiverComponent : Component
{
[DataField("inputs")]
private Dictionary<string, List<PortIdentifier>> _inputs = new();
public void AddPort(string name)
{
_inputs.Add(name, new());
}
[ViewVariables]
public IReadOnlyDictionary<string, List<PortIdentifier>> Inputs => _inputs;
public Dictionary<string, List<PortIdentifier>> Inputs = new();
}
}

View File

@@ -1,10 +1,28 @@
using Robust.Shared.GameObjects;
using Content.Shared.MachineLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.MachineLinking.Components
{
/// <summary>
/// Simple switch that will fire ports when toggled on or off. A button is jsut a switch that signals on the
/// same port regardless of its state.
/// </summary>
[RegisterComponent]
public sealed class SignalSwitchComponent : Component
{
/// <summary>
/// The port that gets signaled when the switch turns on.
/// </summary>
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string OnPort = "On";
/// <summary>
/// The port that gets signaled when the switch turns off.
/// </summary>
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string OffPort = "Off";
[DataField("state")]
public bool State;
}
}

View File

@@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using Content.Server.MachineLinking.System;
namespace Content.Server.MachineLinking.Components
@@ -24,6 +19,7 @@ namespace Content.Server.MachineLinking.Components
}
[RegisterComponent]
[Friend(typeof(SignalLinkerSystem))]
public sealed class SignalTransmitterComponent : Component
{
/// <summary>
@@ -35,14 +31,6 @@ namespace Content.Server.MachineLinking.Components
public float TransmissionRange = 30f;
[DataField("outputs")]
private Dictionary<string, List<PortIdentifier>> _outputs = new();
[ViewVariables]
public IReadOnlyDictionary<string, List<PortIdentifier>> Outputs => _outputs;
public void AddPort(string name)
{
_outputs.Add(name, new());
}
public Dictionary<string, List<PortIdentifier>> Outputs = new();
}
}

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
using Content.Shared.MachineLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.MachineLinking.Components
{
@@ -8,6 +9,10 @@ namespace Content.Server.MachineLinking.Components
[RegisterComponent]
public sealed class SignallerComponent : Component
{
public const string Port = "Pressed";
/// <summary>
/// The port that gets signaled when the switch turns on.
/// </summary>
[DataField("port", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string Port = "Pressed";
}
}

View File

@@ -1,13 +1,24 @@
using Content.Shared.MachineLinking;
using Robust.Shared.GameObjects;
using Content.Shared.MachineLinking;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.MachineLinking.Components
{
[RegisterComponent]
public sealed class TwoWayLeverComponent : Component
{
[DataField("state")]
public TwoWayLeverState State;
[DataField("nextSignalLeft")]
public bool NextSignalLeft;
[DataField("leftPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string LeftPort = "Left";
[DataField("rightPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string RightPort = "Right";
[DataField("middlePort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
public string MiddlePort = "Middle";
}
}