SolutionPurgeComponent.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Content.Server.Chemistry.EntitySystems;
  2. using Content.Shared.Chemistry.Reagent;
  3. using Content.Shared.FixedPoint;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
  6. namespace Content.Server.Chemistry.Components;
  7. /// <summary>
  8. /// Passively decreases a solution's quantity of reagent(s).
  9. /// </summary>
  10. [RegisterComponent, AutoGenerateComponentPause]
  11. [Access(typeof(SolutionPurgeSystem))]
  12. public sealed partial class SolutionPurgeComponent : Component
  13. {
  14. /// <summary>
  15. /// The name of the solution to detract from.
  16. /// </summary>
  17. [DataField("solution", required: true), ViewVariables(VVAccess.ReadWrite)]
  18. public string Solution = string.Empty;
  19. /// <summary>
  20. /// The reagent(s) to be ignored when purging the solution
  21. /// </summary>
  22. [DataField("preserve", customTypeSerializer: typeof(PrototypeIdListSerializer<ReagentPrototype>))]
  23. [ViewVariables(VVAccess.ReadWrite)]
  24. public List<string> Preserve = new();
  25. /// <summary>
  26. /// Amount of reagent(s) that are purged
  27. /// </summary>
  28. [DataField("quantity", required: true), ViewVariables(VVAccess.ReadWrite)]
  29. public FixedPoint2 Quantity = default!;
  30. /// <summary>
  31. /// How long it takes to purge once.
  32. /// </summary>
  33. [DataField("duration"), ViewVariables(VVAccess.ReadWrite)]
  34. public TimeSpan Duration = TimeSpan.FromSeconds(1);
  35. /// <summary>
  36. /// The time when the next purge will occur.
  37. /// </summary>
  38. [DataField("nextPurgeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
  39. [AutoPausedField]
  40. public TimeSpan NextPurgeTime = TimeSpan.FromSeconds(0);
  41. }