PowerNetworkBatteryComponent.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using Content.Server.Power.Pow3r;
  2. using Content.Shared.Guidebook;
  3. namespace Content.Server.Power.Components
  4. {
  5. /// <summary>
  6. /// Glue component that manages the pow3r network node for batteries that are connected to the power network.
  7. /// </summary>
  8. /// <remarks>
  9. /// This needs components like <see cref="BatteryChargerComponent"/> to work correctly,
  10. /// and battery storage should be handed off to components like <see cref="BatteryComponent"/>.
  11. /// </remarks>
  12. [RegisterComponent]
  13. public sealed partial class PowerNetworkBatteryComponent : Component
  14. {
  15. [ViewVariables] public float LastSupply = 0f;
  16. [DataField("maxChargeRate")]
  17. [ViewVariables(VVAccess.ReadWrite)]
  18. public float MaxChargeRate
  19. {
  20. get => NetworkBattery.MaxChargeRate;
  21. set => NetworkBattery.MaxChargeRate = value;
  22. }
  23. [DataField("maxSupply")]
  24. [ViewVariables(VVAccess.ReadWrite)]
  25. [GuidebookData]
  26. public float MaxSupply
  27. {
  28. get => NetworkBattery.MaxSupply;
  29. set => NetworkBattery.MaxSupply = value;
  30. }
  31. [DataField("supplyRampTolerance")]
  32. [ViewVariables(VVAccess.ReadWrite)]
  33. public float SupplyRampTolerance
  34. {
  35. get => NetworkBattery.SupplyRampTolerance;
  36. set => NetworkBattery.SupplyRampTolerance = value;
  37. }
  38. [DataField("supplyRampRate")]
  39. [ViewVariables(VVAccess.ReadWrite)]
  40. public float SupplyRampRate
  41. {
  42. get => NetworkBattery.SupplyRampRate;
  43. set => NetworkBattery.SupplyRampRate = value;
  44. }
  45. [DataField("supplyRampPosition")]
  46. [ViewVariables(VVAccess.ReadWrite)]
  47. public float SupplyRampPosition
  48. {
  49. get => NetworkBattery.SupplyRampPosition;
  50. set => NetworkBattery.SupplyRampPosition = value;
  51. }
  52. [DataField("currentSupply")]
  53. [ViewVariables(VVAccess.ReadWrite)]
  54. public float CurrentSupply
  55. {
  56. get => NetworkBattery.CurrentSupply;
  57. set => NetworkBattery.CurrentSupply = value;
  58. }
  59. [DataField("currentReceiving")]
  60. [ViewVariables(VVAccess.ReadWrite)]
  61. public float CurrentReceiving
  62. {
  63. get => NetworkBattery.CurrentReceiving;
  64. set => NetworkBattery.CurrentReceiving = value;
  65. }
  66. [DataField("loadingNetworkDemand")]
  67. [ViewVariables(VVAccess.ReadWrite)]
  68. public float LoadingNetworkDemand
  69. {
  70. get => NetworkBattery.LoadingNetworkDemand;
  71. set => NetworkBattery.LoadingNetworkDemand = value;
  72. }
  73. [DataField("enabled")]
  74. [ViewVariables(VVAccess.ReadWrite)]
  75. public bool Enabled
  76. {
  77. get => NetworkBattery.Enabled;
  78. set => NetworkBattery.Enabled = value;
  79. }
  80. [DataField("canCharge")]
  81. [ViewVariables(VVAccess.ReadWrite)]
  82. public bool CanCharge
  83. {
  84. get => NetworkBattery.CanCharge;
  85. set => NetworkBattery.CanCharge = value;
  86. }
  87. [DataField("canDischarge")]
  88. [ViewVariables(VVAccess.ReadWrite)]
  89. public bool CanDischarge
  90. {
  91. get => NetworkBattery.CanDischarge;
  92. set => NetworkBattery.CanDischarge = value;
  93. }
  94. [DataField("efficiency")]
  95. [ViewVariables(VVAccess.ReadWrite)]
  96. public float Efficiency
  97. {
  98. get => NetworkBattery.Efficiency;
  99. set => NetworkBattery.Efficiency = value;
  100. }
  101. [ViewVariables]
  102. public PowerState.Battery NetworkBattery { get; } = new();
  103. }
  104. }