GhostRoleRaffleComponent.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using Content.Server.Ghost.Roles.Raffles;
  2. using Robust.Shared.Player;
  3. namespace Content.Server.Ghost.Roles.Components;
  4. /// <summary>
  5. /// Indicates that a ghost role is currently being raffled, and stores data about the raffle in progress.
  6. /// Raffles start when the first player joins a raffle.
  7. /// </summary>
  8. [RegisterComponent]
  9. [Access(typeof(GhostRoleSystem))]
  10. public sealed partial class GhostRoleRaffleComponent : Component
  11. {
  12. /// <summary>
  13. /// Identifier of the <see cref="GhostRoleComponent">Ghost Role</see> this raffle is for.
  14. /// </summary>
  15. [ViewVariables(VVAccess.ReadOnly)]
  16. [DataField]
  17. public uint Identifier { get; set; }
  18. /// <summary>
  19. /// List of sessions that are currently in the raffle.
  20. /// </summary>
  21. [ViewVariables(VVAccess.ReadOnly)]
  22. public HashSet<ICommonSession> CurrentMembers = [];
  23. /// <summary>
  24. /// List of sessions that are currently or were previously in the raffle.
  25. /// </summary>
  26. [ViewVariables(VVAccess.ReadOnly)]
  27. public HashSet<ICommonSession> AllMembers = [];
  28. /// <summary>
  29. /// Time left in the raffle in seconds. This must be initialized to a positive value.
  30. /// </summary>
  31. [ViewVariables(VVAccess.ReadOnly)]
  32. [DataField]
  33. public TimeSpan Countdown = TimeSpan.MaxValue;
  34. /// <summary>
  35. /// The cumulative time, i.e. how much time the raffle will take in total. Added to when the time is extended
  36. /// by someone joining the raffle.
  37. /// Must be set to the same value as <see cref="Countdown"/> on initialization.
  38. /// </summary>
  39. [ViewVariables(VVAccess.ReadOnly)]
  40. [DataField("cumulativeTime")]
  41. public TimeSpan CumulativeTime = TimeSpan.MaxValue;
  42. /// <inheritdoc cref="GhostRoleRaffleSettings.JoinExtendsDurationBy"/>
  43. [ViewVariables(VVAccess.ReadOnly)]
  44. [DataField("joinExtendsDurationBy")]
  45. public TimeSpan JoinExtendsDurationBy { get; set; }
  46. /// <inheritdoc cref="GhostRoleRaffleSettings.MaxDuration"/>
  47. [ViewVariables(VVAccess.ReadOnly)]
  48. [DataField("maxDuration")]
  49. public TimeSpan MaxDuration { get; set; }
  50. }