CatStation/Content.Server/StationEvents/Components/StationEventComponent.cs
Princess Cheeseballs f8a29e834b
Fix Infinite Sleeper Agents + Tests (#46065)
* would you rather have infinite traitors but no game or infinite game but no game

* whitespace of doom

* also don't need that anymore!

* I'm fucking stupid actually :P

* fix that bug before someone else has to dive it in 2030

* pish

* merge my fixes!!!
2026-09-22 18:30:24 +00:00

91 lines
2.5 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.StationEvents.Components;
/// <summary>
/// Defines basic data for a station event
/// // TODO: Cut this component into pieces, much of it already exists in GameRuleComponent, and we don't need activation conditions in the same component as Announcements
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class StationEventComponent : Component
{
public const float WeightVeryLow = 0.0f;
public const float WeightLow = 5.0f;
public const float WeightNormal = 10.0f;
public const float WeightHigh = 15.0f;
public const float WeightVeryHigh = 20.0f;
[DataField]
public float Weight = WeightNormal;
[DataField]
public string? StartAnnouncement;
[DataField]
public string? EndAnnouncement;
[DataField]
public Color StartAnnouncementColor = Color.Gold;
[DataField]
public Color EndAnnouncementColor = Color.Gold;
[DataField]
public SoundSpecifier? StartAudio;
[DataField]
public SoundSpecifier? EndAudio;
/// <summary>
/// In minutes, when is the first round time this event can start
/// </summary>
[DataField]
public int EarliestStart = 5;
/// <summary>
/// In minutes, the amount of time before the same event can occur again
/// </summary>
[DataField]
public int ReoccurrenceDelay = 30;
/// <summary>
/// How long the event lasts.
/// </summary>
[DataField]
public TimeSpan? Duration = TimeSpan.FromSeconds(1);
/// <summary>
/// The max amount of time the event lasts.
/// </summary>
[DataField]
public TimeSpan? MaxDuration;
/// <summary>
/// How many players need to be present on station for the event to run
/// </summary>
/// <remarks>
/// To avoid running deadly events with low-pop
/// </remarks>
[DataField]
public int MinimumPlayers;
/// <summary>
/// How many times this even can occur in a single round
/// </summary>
[DataField]
public int? MaxOccurrences;
/// <summary>
/// When the station event ends.
/// </summary>
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan? EndTime;
/// <summary>
/// If false, the event won't trigger after the evacuation shuttle is called and cannot be recalled anymore.
/// </summary>
[DataField]
public bool OccursDuringRoundEnd = true;
}