Rejig device link sink & source startup & shutdown (#29035)

* Fix DeviceLinkSinkComponent not updating sources on shutdown

* Log error

* Misc link changes & fixes

* Fix core
This commit is contained in:
Leon Friedrich
2024-06-20 03:03:32 +12:00
committed by GitHub
parent 8a4ce13d1c
commit 20544b0c76
4 changed files with 63 additions and 112 deletions

View File

@@ -12,12 +12,12 @@ public sealed partial class DeviceLinkSourceComponent : Component
/// The ports the device link source sends signals from
/// </summary>
[DataField]
public HashSet<ProtoId<SourcePortPrototype>>? Ports;
public HashSet<ProtoId<SourcePortPrototype>> Ports = new();
/// <summary>
/// A list of sink uids that got linked for each port
/// Dictionary mapping each port to a set of linked sink entities.
/// </summary>
[ViewVariables]
[ViewVariables] // This is not serialized as it can be constructed from LinkedPorts
public Dictionary<ProtoId<SourcePortPrototype>, HashSet<EntityUid>> Outputs = new();
/// <summary>
@@ -32,7 +32,7 @@ public sealed partial class DeviceLinkSourceComponent : Component
/// The list of source to sink ports for each linked sink entity for easier managing of links
/// </summary>
[DataField]
public Dictionary<EntityUid, HashSet<(ProtoId<SourcePortPrototype> source, ProtoId<SinkPortPrototype> sink)>> LinkedPorts = new();
public Dictionary<EntityUid, HashSet<(ProtoId<SourcePortPrototype> Source, ProtoId<SinkPortPrototype> Sink)>> LinkedPorts = new();
/// <summary>
/// Limits the range devices can be linked across.