PowerMonitoringDeviceComponent.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using Content.Server.NodeContainer;
  2. using Content.Server.NodeContainer.NodeGroups;
  3. using Content.Server.Power.EntitySystems;
  4. using Content.Shared.Power;
  5. namespace Content.Server.Power.Components;
  6. /// <summary>
  7. /// Used to flag any entities that should appear on a power monitoring console
  8. /// </summary>
  9. [RegisterComponent, Access(typeof(PowerMonitoringConsoleSystem))]
  10. public sealed partial class PowerMonitoringDeviceComponent : Component
  11. {
  12. /// <summary>
  13. /// Name of the node that this device draws its power from (see <see cref="NodeContainerComponent"/>)
  14. /// </summary>
  15. [DataField("sourceNode"), ViewVariables]
  16. public string SourceNode = string.Empty;
  17. /// <summary>
  18. /// Name of the node that this device distributes power to (see <see cref="NodeContainerComponent"/>)
  19. /// </summary>
  20. [DataField("loadNode"), ViewVariables]
  21. public string LoadNode = string.Empty;
  22. /// <summary>
  23. /// Names of the nodes that this device can potentially distributes power to (see <see cref="NodeContainerComponent"/>)
  24. /// </summary>
  25. [DataField("loadNodes"), ViewVariables]
  26. public List<string>? LoadNodes;
  27. /// <summary>
  28. /// This entity will be grouped with entities that have the same collection name
  29. /// </summary>
  30. [DataField("collectionName"), ViewVariables]
  31. public string CollectionName = string.Empty;
  32. [ViewVariables]
  33. public BaseNodeGroup? NodeGroup = null;
  34. /// <summary>
  35. /// Indicates whether the entity is/should be part of a collection
  36. /// </summary>
  37. public bool IsCollectionMasterOrChild { get { return CollectionName != string.Empty; } }
  38. /// <summary>
  39. /// Specifies the uid of the master that represents this entity
  40. /// </summary>
  41. /// <remarks>
  42. /// Used when grouping multiple entities into a single power monitoring console entry
  43. /// </remarks>
  44. [ViewVariables]
  45. public EntityUid CollectionMaster;
  46. /// <summary>
  47. /// Indicates if this entity represents a group of entities
  48. /// </summary>
  49. /// <remarks>
  50. /// Used when grouping multiple entities into a single power monitoring console entry
  51. /// </remarks>
  52. public bool IsCollectionMaster { get { return Owner == CollectionMaster; } }
  53. /// <summary>
  54. /// A list of other entities that are to be represented by this entity
  55. /// </summary>
  56. /// /// <remarks>
  57. /// Used when grouping multiple entities into a single power monitoring console entry
  58. /// </remarks>
  59. [ViewVariables]
  60. public Dictionary<EntityUid, PowerMonitoringDeviceComponent> ChildDevices = new();
  61. /// <summary>
  62. /// Path to the .rsi folder
  63. /// </summary>
  64. [DataField("sprite"), ViewVariables]
  65. public string SpritePath = string.Empty;
  66. /// <summary>
  67. /// The .rsi state
  68. /// </summary>
  69. [DataField("state"), ViewVariables]
  70. public string SpriteState = string.Empty;
  71. /// <summary>
  72. /// Determines what power monitoring group this entity should belong to
  73. /// </summary>
  74. [DataField("group", required: true), ViewVariables]
  75. public PowerMonitoringConsoleGroup Group;
  76. }