StationEventComponent.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  3. namespace Content.Server.StationEvents.Components;
  4. /// <summary>
  5. /// Defines basic data for a station event
  6. /// </summary>
  7. [RegisterComponent, AutoGenerateComponentPause]
  8. public sealed partial class StationEventComponent : Component
  9. {
  10. public const float WeightVeryLow = 0.0f;
  11. public const float WeightLow = 5.0f;
  12. public const float WeightNormal = 10.0f;
  13. public const float WeightHigh = 15.0f;
  14. public const float WeightVeryHigh = 20.0f;
  15. [DataField]
  16. public float Weight = WeightNormal;
  17. [DataField]
  18. public string? StartAnnouncement;
  19. [DataField]
  20. public string? EndAnnouncement;
  21. [DataField]
  22. public Color StartAnnouncementColor = Color.Gold;
  23. [DataField]
  24. public Color EndAnnouncementColor = Color.Gold;
  25. [DataField]
  26. public SoundSpecifier? StartAudio;
  27. [DataField]
  28. public SoundSpecifier? EndAudio;
  29. /// <summary>
  30. /// In minutes, when is the first round time this event can start
  31. /// </summary>
  32. [DataField]
  33. public int EarliestStart = 5;
  34. /// <summary>
  35. /// In minutes, the amount of time before the same event can occur again
  36. /// </summary>
  37. [DataField]
  38. public int ReoccurrenceDelay = 30;
  39. /// <summary>
  40. /// How long the event lasts.
  41. /// </summary>
  42. [DataField]
  43. public TimeSpan? Duration = TimeSpan.FromSeconds(1);
  44. /// <summary>
  45. /// The max amount of time the event lasts.
  46. /// </summary>
  47. [DataField]
  48. public TimeSpan? MaxDuration;
  49. /// <summary>
  50. /// How many players need to be present on station for the event to run
  51. /// </summary>
  52. /// <remarks>
  53. /// To avoid running deadly events with low-pop
  54. /// </remarks>
  55. [DataField]
  56. public int MinimumPlayers;
  57. /// <summary>
  58. /// How many times this even can occur in a single round
  59. /// </summary>
  60. [DataField]
  61. public int? MaxOccurrences;
  62. /// <summary>
  63. /// When the station event ends.
  64. /// </summary>
  65. [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
  66. [AutoPausedField]
  67. public TimeSpan? EndTime;
  68. /// <summary>
  69. /// If false, the event won't trigger during ongoing evacuation.
  70. /// </summary>
  71. [DataField]
  72. public bool OccursDuringRoundEnd = true;
  73. }