2024-02-12 06:45:51 +00:00
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
2023-05-07 08:07:24 +02:00
|
|
|
|
|
|
|
|
namespace Content.Shared.DeviceLinking;
|
|
|
|
|
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
[NetworkedComponent] // for interactions. Actual state isn't currently synced.
|
|
|
|
|
[Access(typeof(SharedDeviceLinkSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class DeviceLinkSourceComponent : Component
|
2023-05-07 08:07:24 +02:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The ports the device link source sends signals from
|
|
|
|
|
/// </summary>
|
2024-02-12 06:45:51 +00:00
|
|
|
[DataField]
|
|
|
|
|
public HashSet<ProtoId<SourcePortPrototype>>? Ports;
|
2023-05-07 08:07:24 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A list of sink uids that got linked for each port
|
|
|
|
|
/// </summary>
|
2023-07-24 12:35:09 +12:00
|
|
|
[ViewVariables]
|
2024-02-12 06:45:51 +00:00
|
|
|
public Dictionary<ProtoId<SourcePortPrototype>, HashSet<EntityUid>> Outputs = new();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// If set to High or Low, the last signal state for a given port.
|
|
|
|
|
/// Used when linking ports of devices that are currently outputting a signal.
|
|
|
|
|
/// Only set by <c>DeviceLinkSystem.SendSignal</c>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public Dictionary<ProtoId<SourcePortPrototype>, bool> LastSignals = new();
|
2023-05-07 08:07:24 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The list of source to sink ports for each linked sink entity for easier managing of links
|
|
|
|
|
/// </summary>
|
2024-02-12 06:45:51 +00:00
|
|
|
[DataField]
|
|
|
|
|
public Dictionary<EntityUid, HashSet<(ProtoId<SourcePortPrototype> source, ProtoId<SinkPortPrototype> sink)>> LinkedPorts = new();
|
2023-05-07 08:07:24 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Limits the range devices can be linked across.
|
|
|
|
|
/// </summary>
|
2024-02-12 06:45:51 +00:00
|
|
|
[DataField]
|
2023-05-07 08:07:24 +02:00
|
|
|
public float Range = 30f;
|
|
|
|
|
}
|