2023-05-07 08:07:24 +02:00
|
|
|
|
using Robust.Shared.GameStates;
|
2024-06-20 03:03:32 +12:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2023-05-07 08:07:24 +02:00
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
|
|
|
|
|
|
|
|
|
|
|
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 DeviceLinkSinkComponent : Component
|
2023-05-07 08:07:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The ports this sink has
|
|
|
|
|
|
/// </summary>
|
2024-06-20 03:03:32 +12:00
|
|
|
|
[DataField]
|
|
|
|
|
|
public HashSet<ProtoId<SinkPortPrototype>> Ports = new();
|
2023-05-07 08:07:24 +02:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-06-20 03:03:32 +12:00
|
|
|
|
/// Used for removing a sink from all linked sources when this component gets removed.
|
|
|
|
|
|
/// This is not serialized to yaml as it can be inferred from source components.
|
2023-05-07 08:07:24 +02:00
|
|
|
|
/// </summary>
|
2024-06-20 03:03:32 +12:00
|
|
|
|
[ViewVariables]
|
2023-05-07 08:07:24 +02:00
|
|
|
|
public HashSet<EntityUid> LinkedSources = new();
|
2023-05-28 18:14:06 +02:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Counts the amount of times a sink has been invoked for severing the link if this counter gets to high
|
|
|
|
|
|
/// The counter is counted down by one every tick if it's higher than 0
|
|
|
|
|
|
/// This is for preventing infinite loops
|
|
|
|
|
|
/// </summary>
|
2024-06-20 03:03:32 +12:00
|
|
|
|
[DataField]
|
2023-05-28 18:14:06 +02:00
|
|
|
|
public int InvokeCounter;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// How high the invoke counter is allowed to get before the links to the sink are removed and the DeviceLinkOverloadedEvent gets raised
|
|
|
|
|
|
/// If the invoke limit is smaller than 1 the sink can't overload
|
|
|
|
|
|
/// </summary>
|
2024-06-20 03:03:32 +12:00
|
|
|
|
[DataField]
|
2023-05-28 18:14:06 +02:00
|
|
|
|
public int InvokeLimit = 10;
|
2023-05-07 08:07:24 +02:00
|
|
|
|
}
|