Files
tbd-station-14/Content.Server/StationEvents/Components/StationEventComponent.cs
MilenVolf 5d970b0861 Station event component and system tweaks (#28331)
* Make anomaly, artifact and gifts events announcement sound optional

* Requested changes + Added new "GameRuleAfterAddedEvent" for StationEventSystem

We need to call "Add" in "StationEventSystem" after others GameRule's in case if we need to change StationEventComponent variables.

* Fix margins

* Makes use of GameRuleComponent.Delay and remove station system handling of delays plus small cleanup

* Fix merge

---------

Co-authored-by: AJCM <AJCM@tutanota.com>
2024-06-01 16:34:58 -04:00

85 lines
2.2 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
/// </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;
}