mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
This system is only actually touched by the game a tiny handful of times during a round, yet it was the 4th top frametime consumer, because it was querrying every potentially networkable entity in existence on the maybe off-chance it was interacted with by a remote signaller. On a typical station, this is tens of thousands of entities, with strong linear scaling as the round time increases due to creation of new entities. I have tested this PR to verify that device links and signals still work, except now with 99.99% less frametime cost. <details><summary><h1>Media</h1></summary> <p>  </p> </details> 🆑 - tweak: Made significant performance improvements to device network systems. Co-authored-by: Eris <eris@erisws.com>
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
|
|
|
namespace Content.Shared.DeviceLinking;
|
|
|
|
[RegisterComponent, NetworkedComponent]
|
|
[Access(typeof(SharedDeviceLinkSystem))]
|
|
public sealed partial class DeviceLinkSinkComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// The ports this sink has
|
|
/// </summary>
|
|
[DataField]
|
|
public HashSet<ProtoId<SinkPortPrototype>> Ports = new();
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
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]
|
|
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 0 or less, the limit is ignored.
|
|
/// </summary>
|
|
[DataField]
|
|
public int InvokeLimit = 10;
|
|
}
|