From: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Date: Mon, 24 Feb 2025 21:16:10 +0000 (+0300)
Subject: Cleanup: Use ``SoundCollectionSpecifier`` instead of string literals in ``PowerGridCh...
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=ebc1bff4cb5847ed28432d626fe7772b8b503dc9;p=space-station-14.git
Cleanup: Use ``SoundCollectionSpecifier`` instead of string literals in ``PowerGridCheckRule`` (#35449)
* Cleanup
* Update
* .
* Volume
---
diff --git a/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs b/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs
index 98c60346c7..757a4f18b5 100644
--- a/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs
+++ b/Content.Server/StationEvents/Components/PowerGridCheckRuleComponent.cs
@@ -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
{
+ ///
+ /// Default sound of the announcement when power is back on.
+ ///
+ private static readonly ProtoId DefaultPowerOn = new("PowerOn");
+
+ ///
+ /// Sound of the announcement to play when power is back on.
+ ///
+ [DataField]
+ public SoundSpecifier PowerOnSound = new SoundCollectionSpecifier(DefaultPowerOn, AudioParams.Default.WithVolume(-4f));
+
public CancellationTokenSource? AnnounceCancelToken;
public EntityUid AffectedStation;
diff --git a/Content.Server/StationEvents/Events/PowerGridCheckRule.cs b/Content.Server/StationEvents/Events/PowerGridCheckRule.cs
index a4594e1387..3a86f694ab 100644
--- a/Content.Server/StationEvents/Events/PowerGridCheckRule.cs
+++ b/Content.Server/StationEvents/Events/PowerGridCheckRule.cs
@@ -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();
}
diff --git a/Resources/Prototypes/SoundCollections/announcements.yml b/Resources/Prototypes/SoundCollections/announcements.yml
index cb90b2282c..25abb2457a 100644
--- a/Resources/Prototypes/SoundCollections/announcements.yml
+++ b/Resources/Prototypes/SoundCollections/announcements.yml
@@ -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