1
0

SmesComponent.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Content.Server.Power.Components;
  2. using Content.Shared.Power;
  3. namespace Content.Server.Power.SMES;
  4. /// <summary>
  5. /// Handles the "user-facing" side of the actual SMES object.
  6. /// This is operations that are specific to the SMES, like UI and visuals.
  7. /// Logic is handled in <see cref="SmesSystem"/>
  8. /// Code interfacing with the powernet is handled in <see cref="BatteryStorageComponent"/> and <see cref="BatteryDischargerComponent"/>.
  9. /// </summary>
  10. [RegisterComponent, Access(typeof(SmesSystem))]
  11. public sealed partial class SmesComponent : Component
  12. {
  13. [ViewVariables]
  14. public ChargeState LastChargeState;
  15. [ViewVariables]
  16. public TimeSpan LastChargeStateTime;
  17. [ViewVariables]
  18. public int LastChargeLevel;
  19. [ViewVariables]
  20. public TimeSpan LastChargeLevelTime;
  21. [ViewVariables]
  22. public TimeSpan VisualsChangeDelay = TimeSpan.FromSeconds(1);
  23. /// <summary>
  24. /// The number of distinct charge levels a SMES has.
  25. /// 0 is empty max is full.
  26. /// </summary>
  27. [DataField("numChargeLevels")]
  28. public int NumChargeLevels = 6;
  29. /// <summary>
  30. /// The charge level of the SMES as of the most recent update.
  31. /// </summary>
  32. [ViewVariables]
  33. public int ChargeLevel = 0;
  34. /// <summary>
  35. /// Whether the SMES is being charged/discharged/neither.
  36. /// </summary>
  37. [ViewVariables]
  38. public ChargeState ChargeState = ChargeState.Still;
  39. }