using Content.IntegrationTests;
using Content.IntegrationTests.Pair;
using Content.IntegrationTests.Tests.DeviceNetwork;
-using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
+using Content.Shared.DeviceNetwork;
using Robust.Shared;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
--- /dev/null
+using Content.Shared.DeviceLinking;
+
+namespace Content.Client.DeviceLinking;
+
+public sealed class DeviceLinkSystem : SharedDeviceLinkSystem
+{
+
+}
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
+using Content.Shared.DeviceNetwork;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
-
-using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
+using Content.Shared.DeviceNetwork;
using Robust.Shared.GameObjects;
using Robust.Shared.Reflection;
using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.DeviceLinking;
+using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Systems;
using Content.Shared.Interaction;
using Content.Shared.Wires;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Components;
using Content.Shared.Atmos.Monitor;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Tag;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
using Content.Shared.Atmos.Monitor.Components;
+using Content.Shared.DeviceNetwork;
namespace Content.Server.Atmos.Monitor.Systems;
using Content.Server.Power.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
using Content.Shared.Atmos.Visuals;
using Content.Shared.Audio;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.UserInterface;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Examine;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Atmos.Visuals;
using Content.Shared.Audio;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Examine;
using Content.Shared.Tools.Systems;
using JetBrains.Annotations;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Audio;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Tools.Systems;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Content.Shared.Chat;
using Content.Shared.Communications;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Emag.Components;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
+++ /dev/null
-using Content.Shared.DeviceLinking;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
-
-namespace Content.Server.DeviceLinking.Components
-{
- [RegisterComponent]
- public sealed partial class TwoWayLeverComponent : Component
- {
- [DataField("state")]
- public TwoWayLeverState State;
-
- [DataField("nextSignalLeft")]
- public bool NextSignalLeft;
-
- [DataField("leftPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
- public string LeftPort = "Left";
-
- [DataField("rightPort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
- public string RightPort = "Right";
-
- [DataField("middlePort", customTypeSerializer: typeof(PrototypeIdSerializer<SourcePortPrototype>))]
- public string MiddlePort = "Middle";
- }
-}
using Content.Server.DeviceNetwork;
+using Content.Shared.DeviceNetwork;
namespace Content.Server.DeviceLinking.Events;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Shared.DeviceLinking;
+using Content.Shared.DeviceNetwork;
namespace Content.Server.DeviceLinking.Systems;
}
#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"/>
- /// </summary>
- /// <param name="uid">The source uid that invokes the port</param>
- /// <param name="port">The port to invoke</param>
- /// <param name="data">Optional data to send along</param>
- /// <param name="sourceComponent"></param>
- public void InvokePort(EntityUid uid, string port, NetworkPayload? data = null, DeviceLinkSourceComponent? sourceComponent = null)
+ public override void InvokePort(EntityUid uid, string port, NetworkPayload? data = null, DeviceLinkSourceComponent? sourceComponent = null)
{
if (!Resolve(uid, ref sourceComponent) || !sourceComponent.Outputs.TryGetValue(port, out var sinks))
return;
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Server.Doors.Systems;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Doors.Components;
using Content.Shared.Doors;
using JetBrains.Annotations;
+++ /dev/null
-using Robust.Shared.Utility;
-using System.Diagnostics.CodeAnalysis;
-
-namespace Content.Server.DeviceNetwork
-{
- public sealed class NetworkPayload : Dictionary<string, object?>
- {
- /// <summary>
- /// Tries to get a value from the payload and checks if that value is of type T.
- /// </summary>
- /// <typeparam name="T">The type that should be casted to</typeparam>
- /// <returns>Whether the value was present in the payload and of the required type</returns>
- public bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value)
- {
- if (this.TryCastValue(key, out T? result))
- {
- value = result;
- return true;
- }
-
- value = default;
- return false;
- }
- }
-
-}
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Components.Devices;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Interaction;
namespace Content.Server.DeviceNetwork.Systems.Devices
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Disposal.Unit.EntitySystems;
using Content.Server.Power.Components;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Disposal;
using Content.Shared.Interaction;
using Robust.Server.GameObjects;
using Content.Shared.Administration.Logs;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.Fax;
using Content.Server.Medical.SuitSensors;
using Content.Server.Power.Components;
using Content.Server.Station.Systems;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Medical.SuitSensor;
using Robust.Shared.Timing;
using Content.Server.Popups;
using Content.Server.Station.Systems;
using Content.Shared.Damage;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Emp;
using Content.Shared.Examine;
using Content.Shared.Inventory.Events;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Examine;
using Content.Shared.Power.Generation.Teg;
using Content.Shared.Rounding;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.GameTicking;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Components;
+using Content.Shared.DeviceNetwork;
namespace Content.Server.SensorMonitoring;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
+using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Components;
using Content.Shared.DeviceNetwork.Systems;
using Content.Shared.SensorMonitoring;
using Robust.Server.GameObjects;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
-using ConsoleUIState = Content.Shared.SensorMonitoring.SensorMonitoringConsoleBoundInterfaceState;
namespace Content.Server.SensorMonitoring;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
using Content.Shared.CCVar;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Mobs.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Access;
using Content.Shared.CCVar;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Popups;
using Content.Shared.Shuttles.BUIStates;
using Content.Shared.Shuttles.Events;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Systems;
using Content.Server.Communications;
-using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.GameTicking.Events;
using Content.Shared.Access.Systems;
using Content.Shared.CCVar;
using Content.Shared.Database;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Events;
using Content.Shared.Tag;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Components;
+using Content.Shared.DeviceNetwork;
using Content.Shared.UserInterface;
using Content.Shared.SurveillanceCamera;
using Robust.Server.GameObjects;
--- /dev/null
+using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.DeviceLinking.Components;
+
+/// <summary>
+/// Simple ternary state for device linking.
+/// </summary>
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
+public sealed partial class TwoWayLeverComponent : Component
+{
+ [DataField, AutoNetworkedField]
+ public TwoWayLeverState State;
+
+ [DataField, AutoNetworkedField]
+ public bool NextSignalLeft;
+
+ [DataField]
+ public ProtoId<SourcePortPrototype> LeftPort = "Left";
+
+ [DataField]
+ public ProtoId<SourcePortPrototype> RightPort = "Right";
+
+ [DataField]
+ public ProtoId<SourcePortPrototype> MiddlePort = "Middle";
+}
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.DeviceLinking.Events;
+using Content.Shared.DeviceNetwork;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
/// </summary>
public void EnsureSourcePorts(EntityUid uid, params string[] ports)
{
+ if (ports.Length == 0)
+ return;
+
var comp = EnsureComp<DeviceLinkSourceComponent>(uid);
comp.Ports ??= new HashSet<string>();
/// </summary>
public void EnsureSinkPorts(EntityUid uid, params string[] ports)
{
+ if (ports.Length == 0)
+ return;
+
var comp = EnsureComp<DeviceLinkSinkComponent>(uid);
comp.Ports ??= new HashSet<string>();
("machine2", sinkUid), ("port2", PortName<SinkPortPrototype>(sink))), userId.Value, PopupType.Medium);
}
#endregion
+
+ #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"/>
+ /// </summary>
+ /// <param name="uid">The source uid that invokes the port</param>
+ /// <param name="port">The port to invoke</param>
+ /// <param name="data">Optional data to send along</param>
+ /// <param name="sourceComponent"></param>
+ public virtual void InvokePort(EntityUid uid, string port, NetworkPayload? data = null,
+ DeviceLinkSourceComponent? sourceComponent = null)
+ {
+ // NOOP on client for the moment.
+ }
+ #endregion
}
-using Content.Server.DeviceLinking.Components;
-using Content.Shared.DeviceLinking;
+using Content.Shared.DeviceLinking.Components;
using Content.Shared.Interaction;
using Content.Shared.Verbs;
using Robust.Shared.Utility;
-namespace Content.Server.DeviceLinking.Systems
+namespace Content.Shared.DeviceLinking.Systems
{
public sealed class TwoWayLeverSystem : EntitySystem
{
- [Dependency] private readonly DeviceLinkSystem _signalSystem = default!;
+ [Dependency] private readonly SharedDeviceLinkSystem _signalSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
const string _leftToggleImage = "rotate_ccw.svg.192dpi.png";
_ => throw new ArgumentOutOfRangeException()
};
+ Dirty(uid, component);
_signalSystem.InvokePort(uid, port);
}
}
--- /dev/null
+using System.Diagnostics.CodeAnalysis;
+using Robust.Shared.Utility;
+
+namespace Content.Shared.DeviceNetwork;
+
+public sealed class NetworkPayload : Dictionary<string, object?>
+{
+ /// <summary>
+ /// Tries to get a value from the payload and checks if that value is of type T.
+ /// </summary>
+ /// <typeparam name="T">The type that should be casted to</typeparam>
+ /// <returns>Whether the value was present in the payload and of the required type</returns>
+ public bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value)
+ {
+ if (this.TryCastValue(key, out T? result))
+ {
+ value = result;
+ return true;
+ }
+
+ value = default;
+ return false;
+ }
+}