AutoRechargeComponent.cs 983 B

123456789101112131415161718192021222324252627
  1. using Content.Server.Charges.Systems;
  2. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  3. namespace Content.Server.Charges.Components;
  4. /// <summary>
  5. /// Something with limited charges that can be recharged automatically.
  6. /// Requires LimitedChargesComponent to function.
  7. /// </summary>
  8. // TODO: no reason this cant be predicted and server system deleted
  9. [RegisterComponent, AutoGenerateComponentPause]
  10. [Access(typeof(ChargesSystem))]
  11. public sealed partial class AutoRechargeComponent : Component
  12. {
  13. /// <summary>
  14. /// The time it takes to regain a single charge
  15. /// </summary>
  16. [DataField("rechargeDuration"), ViewVariables(VVAccess.ReadWrite)]
  17. public TimeSpan RechargeDuration = TimeSpan.FromSeconds(90);
  18. /// <summary>
  19. /// The time when the next charge will be added
  20. /// </summary>
  21. [DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
  22. [AutoPausedField]
  23. public TimeSpan NextChargeTime;
  24. }