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 System.Threading;
|
||||||
using Content.Server.StationEvents.Events;
|
using Content.Server.StationEvents.Events;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.StationEvents.Components;
|
namespace Content.Server.StationEvents.Components;
|
||||||
|
|
||||||
[RegisterComponent, Access(typeof(PowerGridCheckRule))]
|
[RegisterComponent, Access(typeof(PowerGridCheckRule))]
|
||||||
public sealed partial class PowerGridCheckRuleComponent : Component
|
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 CancellationTokenSource? AnnounceCancelToken;
|
||||||
|
|
||||||
public EntityUid AffectedStation;
|
public EntityUid AffectedStation;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Server.StationEvents.Events
|
|||||||
component.AnnounceCancelToken = new CancellationTokenSource();
|
component.AnnounceCancelToken = new CancellationTokenSource();
|
||||||
Timer.Spawn(3000, () =>
|
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.AnnounceCancelToken.Token);
|
||||||
component.Unpowered.Clear();
|
component.Unpowered.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,3 +4,8 @@
|
|||||||
- /Audio/Announcements/RoundEnd/apc_destroyed.ogg
|
- /Audio/Announcements/RoundEnd/apc_destroyed.ogg
|
||||||
- /Audio/Announcements/RoundEnd/disappointed.ogg
|
- /Audio/Announcements/RoundEnd/disappointed.ogg
|
||||||
- /Audio/Announcements/RoundEnd/notevenpaidforthis.ogg
|
- /Audio/Announcements/RoundEnd/notevenpaidforthis.ogg
|
||||||
|
|
||||||
|
- type: soundCollection
|
||||||
|
id: PowerOn
|
||||||
|
files:
|
||||||
|
- /Audio/Announcements/power_on.ogg
|
||||||
|
|||||||
Reference in New Issue
Block a user