Prevent infinite loops in device linking (#16856)

This commit is contained in:
Julian Giebel
2023-05-28 18:14:06 +02:00
committed by GitHub
parent 9c1fe530c1
commit 49cb9d0e1e
11 changed files with 185 additions and 14 deletions

View File

@@ -19,4 +19,20 @@ public sealed class DeviceLinkSinkComponent : Component
/// </summary>
[DataField("links")]
public HashSet<EntityUid> LinkedSources = new();
/// <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>
[DataField("invokeCounter")]
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>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("invokeLimit")]
public int InvokeLimit = 10;
}