SolutionRegenerationComponent.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Content.Server.Chemistry.EntitySystems;
  2. using Content.Shared.Chemistry.Components;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  4. namespace Content.Server.Chemistry.Components;
  5. /// <summary>
  6. /// Passively increases a solution's quantity of a reagent.
  7. /// </summary>
  8. [RegisterComponent, AutoGenerateComponentPause]
  9. [Access(typeof(SolutionRegenerationSystem))]
  10. public sealed partial class SolutionRegenerationComponent : Component
  11. {
  12. /// <summary>
  13. /// The name of the solution to add to.
  14. /// </summary>
  15. [DataField("solution", required: true)]
  16. public string SolutionName = string.Empty;
  17. /// <summary>
  18. /// The solution to add reagents to.
  19. /// </summary>
  20. [ViewVariables]
  21. public Entity<SolutionComponent>? SolutionRef = null;
  22. /// <summary>
  23. /// The reagent(s) to be regenerated in the solution.
  24. /// </summary>
  25. [DataField(required: true)]
  26. public Solution Generated = default!;
  27. /// <summary>
  28. /// How long it takes to regenerate once.
  29. /// </summary>
  30. [DataField]
  31. public TimeSpan Duration = TimeSpan.FromSeconds(1);
  32. /// <summary>
  33. /// The time when the next regeneration will occur.
  34. /// </summary>
  35. [DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
  36. [AutoPausedField]
  37. public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0);
  38. }