]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup: Use ``SoundCollectionSpecifier`` instead of string literals in ``PowerGridCh...
authorWinkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Mon, 24 Feb 2025 21:16:10 +0000 (00:16 +0300)
committerGitHub <noreply@github.com>
Mon, 24 Feb 2025 21:16:10 +0000 (08:16 +1100)
* Cleanup

* Update

* .

* Volume

Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs
Content.Server/StationEvents/Events/PowerGridCheckRule.cs
Resources/Prototypes/SoundCollections/announcements.yml

index 98c60346c7f5dd4ddb54f132b31768625508b25d..757a4f18b5dcacc94e6d9588639c1b6928fa7251 100644 (file)
@@ -1,11 +1,24 @@
 using System.Threading;
 using Content.Server.StationEvents.Events;
+using Robust.Shared.Audio;
+using Robust.Shared.Prototypes;
 
 namespace Content.Server.StationEvents.Components;
 
 [RegisterComponent, Access(typeof(PowerGridCheckRule))]
 public sealed partial class PowerGridCheckRuleComponent : Component
 {
+    /// <summary>
+    /// Default sound of the announcement when power is back on.
+    /// </summary>
+    private static readonly ProtoId<SoundCollectionPrototype> DefaultPowerOn = new("PowerOn");
+
+    /// <summary>
+    /// Sound of the announcement to play when power is back on.
+    /// </summary>
+    [DataField]
+    public SoundSpecifier PowerOnSound = new SoundCollectionSpecifier(DefaultPowerOn, AudioParams.Default.WithVolume(-4f));
+
     public CancellationTokenSource? AnnounceCancelToken;
 
     public EntityUid AffectedStation;
index a4594e1387966d2bd92b73d20e76c48e1cb652a0..3a86f694ab845b81d52f1ebc9fd311d4b20b8eac 100644 (file)
@@ -59,7 +59,7 @@ namespace Content.Server.StationEvents.Events
             component.AnnounceCancelToken = new CancellationTokenSource();
             Timer.Spawn(3000, () =>
             {
-                Audio.PlayGlobal("/Audio/Announcements/power_on.ogg", Filter.Broadcast(), true, AudioParams.Default.WithVolume(-4f));
+                Audio.PlayGlobal(component.PowerOnSound, Filter.Broadcast(), true);
             }, component.AnnounceCancelToken.Token);
             component.Unpowered.Clear();
         }
index cb90b2282ce38fcbfabecd918b06c88189246ace..25abb2457aea6ef5421ed1aa73a8f9b0fab0738e 100644 (file)
@@ -4,3 +4,8 @@
   - /Audio/Announcements/RoundEnd/apc_destroyed.ogg
   - /Audio/Announcements/RoundEnd/disappointed.ogg
   - /Audio/Announcements/RoundEnd/notevenpaidforthis.ogg
+
+- type: soundCollection
+  id: PowerOn
+  files:
+  - /Audio/Announcements/power_on.ogg