diff --git a/Content.Server/StationEvents/Components/GasLeakRuleComponent.cs b/Content.Server/StationEvents/Components/GasLeakRuleComponent.cs index 171aca12c27..22164b9c9cb 100644 --- a/Content.Server/StationEvents/Components/GasLeakRuleComponent.cs +++ b/Content.Server/StationEvents/Components/GasLeakRuleComponent.cs @@ -7,41 +7,100 @@ namespace Content.Server.StationEvents.Components; [RegisterComponent, Access(typeof(GasLeakRule))] public sealed partial class GasLeakRuleComponent : Component { - public readonly Gas[] LeakableGases = + /// + /// Gas types that can be selected for the leak event. + /// + [DataField] + public Gas[] LeakableGases = { Gas.Ammonia, Gas.Plasma, Gas.Tritium, Gas.Frezon, - Gas.WaterVapor, // the fog + Gas.WaterVapor, }; /// - /// Running cooldown of how much time until another leak. + /// Time remaining until the next gas addition to the leak tile. /// + [DataField] public float TimeUntilLeak; /// - /// How long between more gas being added to the tile. + /// Fixed interval in seconds between gas additions to the leak tile. /// + [DataField] public float LeakCooldown = 1.0f; - // Event variables + /// + /// The station where the leak is located. + /// + [DataField] public EntityUid TargetStation; - public EntityUid TargetGrid; - public Vector2i TargetTile; - public EntityCoordinates TargetCoords; - public bool FoundTile; - public Gas LeakGas; - public float MolesPerSecond; - public readonly int MinimumMolesPerSecond = 80; /// - /// Don't want to make it too fast to give people time to flee. + /// The specific grid where the leak is located. /// + [DataField] + public EntityUid TargetGrid; + + /// + /// The tile coordinates where the leak is located. + /// + [DataField] + public Vector2i TargetTile; + + /// + /// The world coordinates of the leak location. + /// + [DataField] + public EntityCoordinates TargetCoords; + + /// + /// Whether a suitable tile for leaking has been found. + /// + [DataField] + public bool FoundTile; + + /// + /// The specific gas type currently leaking. + /// + [DataField] + public Gas LeakGas; + + /// + /// Current leak rate in moles per second. + /// + [DataField] + public float MolesPerSecond; + + /// + /// Minimum leak rate in moles per second. + /// + [DataField] + public int MinimumMolesPerSecond = 80; + + /// + /// Maximum leak rate in moles per second. Limited to give people time to flee. + /// + [DataField] public int MaximumMolesPerSecond = 200; + /// + /// Minimum total amount of gas to leak over the entire event duration. + /// + [DataField] public int MinimumGas = 1000; + + /// + /// Maximum total amount of gas to leak over the entire event duration. + /// + [DataField] public int MaximumGas = 4000; + + /// + /// Chance to create an ignition spark when the event ends. + /// + [DataField] public float SparkChance = 0.05f; } diff --git a/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs b/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs index 757a4f18b5d..fcf0d483ab3 100644 --- a/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs +++ b/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs @@ -9,25 +9,59 @@ namespace Content.Server.StationEvents.Components; public sealed partial class PowerGridCheckRuleComponent : Component { /// - /// Default sound of the announcement when power is back on. + /// Default sound for power restoration announcement. /// private static readonly ProtoId DefaultPowerOn = new("PowerOn"); /// - /// Sound of the announcement to play when power is back on. + /// Sound to play when power is restored. /// [DataField] public SoundSpecifier PowerOnSound = new SoundCollectionSpecifier(DefaultPowerOn, AudioParams.Default.WithVolume(-4f)); + /// + /// Token source for cancelling the power restoration announcement. + /// public CancellationTokenSource? AnnounceCancelToken; + /// + /// Station affected by the power grid event. + /// + [DataField] public EntityUid AffectedStation; - public readonly List Powered = new(); - public readonly List Unpowered = new(); + /// + /// List of APC entities that will be sequentially turned off during the event. + /// + [DataField] + public List Powered = new(); + + /// + /// List of APC entities that have been turned off. + /// + [DataField] + public List Unpowered = new(); + + /// + /// Time delay in seconds before starting to turn off APCs. + /// + [DataField] public float SecondsUntilOff = 30.0f; + /// + /// Number of APC toggles to process per second during the shutdown phase. + /// Dynamically calculated based on total APC count and . + /// public int NumberPerSecond = 0; + + /// + /// Computed time interval between APC toggles. + /// public float UpdateRate => 1.0f / NumberPerSecond; + + /// + /// Accumulated frame time to track when to process the next APC toggle. + /// + [DataField] public float FrameTimeAccumulator = 0.0f; }