Stop network serializing prototypes (#38602)

* Stop network serializing prototypes

Send the damn proto ID instead.

* Fix sandbox violation
This commit is contained in:
Pieter-Jan Briers
2025-06-27 01:27:23 +02:00
committed by GitHub
parent bb7e7c3e5f
commit 73df3b1593
28 changed files with 120 additions and 59 deletions

View File

@@ -7,7 +7,6 @@ namespace Content.Shared.DeviceLinking;
/// <summary>
/// A prototype for a device port, for use with device linking.
/// </summary>
[Serializable, NetSerializable]
public abstract class DevicePortPrototype
{
[IdDataField]
@@ -28,13 +27,11 @@ public abstract class DevicePortPrototype
}
[Prototype]
[Serializable, NetSerializable]
public sealed partial class SinkPortPrototype : DevicePortPrototype, IPrototype
{
}
[Prototype]
[Serializable, NetSerializable]
public sealed partial class SourcePortPrototype : DevicePortPrototype, IPrototype
{
/// <summary>

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.DeviceLinking.Events;
@@ -142,6 +143,11 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
}
}
public ProtoId<SourcePortPrototype>[] GetSourcePortIds(Entity<DeviceLinkSourceComponent> source)
{
return source.Comp.Ports.ToArray();
}
/// <summary>
/// Retrieves the available ports from a source
/// </summary>
@@ -160,6 +166,11 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
return sourcePorts;
}
public ProtoId<SinkPortPrototype>[] GetSinkPortIds(Entity<DeviceLinkSinkComponent> source)
{
return source.Comp.Ports.ToArray();
}
/// <summary>
/// Retrieves the available ports from a sink
/// </summary>