1
0

PowerChargeComponent.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Content.Server.Power.EntitySystems;
  2. using Content.Shared.Power;
  3. namespace Content.Server.Power.Components;
  4. /// <inheritdoc cref="Content.Shared.Power.SharedPowerChargeComponent" />
  5. [RegisterComponent]
  6. [Access(typeof(PowerChargeSystem))]
  7. public sealed partial class PowerChargeComponent : SharedPowerChargeComponent
  8. {
  9. /// <summary>
  10. /// Change in charge per second.
  11. /// </summary>
  12. [DataField]
  13. public float ChargeRate { get; set; } = 0.01f;
  14. /// <summary>
  15. /// Baseline power that this machine consumes.
  16. /// </summary>
  17. [DataField("idlePower")]
  18. public float IdlePowerUse { get; set; }
  19. /// <summary>
  20. /// Power consumed when <see cref="SwitchedOn"/> is true.
  21. /// </summary>
  22. [DataField("activePower")]
  23. public float ActivePowerUse { get; set; }
  24. /// <summary>
  25. /// Is the gravity generator intact?
  26. /// </summary>
  27. [DataField]
  28. public bool Intact { get; set; } = true;
  29. /// <summary>
  30. /// Is the power switch on?
  31. /// </summary>
  32. [DataField]
  33. public bool SwitchedOn { get; set; } = true;
  34. /// <summary>
  35. /// Whether or not the power is switched on and the entity has charged up.
  36. /// </summary>
  37. [DataField]
  38. public bool Active { get; set; }
  39. [DataField]
  40. public float MaxCharge { get; set; } = 1;
  41. /// <summary>
  42. /// The UI key of the UI that's used with this machine.<br/>
  43. /// This is used to allow machine power charging to be integrated into any ui
  44. /// </summary>
  45. [DataField, ViewVariables(VVAccess.ReadOnly)]
  46. public Enum UiKey { get; set; } = PowerChargeUiKey.Key;
  47. /// <summary>
  48. /// Current charge value.
  49. /// Goes from 0 to 1.
  50. /// </summary>
  51. [DataField]
  52. public float Charge { get; set; } = 1;
  53. [ViewVariables]
  54. public bool NeedUIUpdate { get; set; }
  55. }