Cleanup: Use `SoundCollectionSpecifier instead of string literals in PowerGridCheckRule` (#35449)
* Cleanup * Update * . * Volume
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user