DevicePortPrototype.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Robust.Shared.Prototypes;
  2. using Robust.Shared.Serialization;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
  4. namespace Content.Shared.DeviceLinking;
  5. /// <summary>
  6. /// A prototype for a device port, for use with device linking.
  7. /// </summary>
  8. [Serializable, NetSerializable]
  9. public abstract class DevicePortPrototype
  10. {
  11. [IdDataField]
  12. public string ID { get; private set; } = default!;
  13. /// <summary>
  14. /// Localization string for the port name. Displayed in the linking UI.
  15. /// </summary>
  16. [DataField("name", required:true)]
  17. public string Name = default!;
  18. /// <summary>
  19. /// Localization string for a description of the ports functionality. Should either indicate when a source
  20. /// port is fired, or what function a sink port serves. Displayed as a tooltip in the linking UI.
  21. /// </summary>
  22. [DataField("description", required: true)]
  23. public string Description = default!;
  24. }
  25. [Prototype]
  26. [Serializable, NetSerializable]
  27. public sealed partial class SinkPortPrototype : DevicePortPrototype, IPrototype
  28. {
  29. }
  30. [Prototype]
  31. [Serializable, NetSerializable]
  32. public sealed partial class SourcePortPrototype : DevicePortPrototype, IPrototype
  33. {
  34. /// <summary>
  35. /// This is a set of sink ports that this source port will attempt to link to when using the
  36. /// default-link functionality.
  37. /// </summary>
  38. [DataField("defaultLinks", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<SinkPortPrototype>))]
  39. public HashSet<string>? DefaultLinks;
  40. }