Convert AtmosphereSystem sound path strings to SoundSpecifiers (#38403)
* Convert AtmosphereSystem sound path strings to SoundSpecifiers * Convert to SoundCollections
This commit is contained in:
@@ -7,6 +7,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -14,12 +15,14 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
public sealed partial class AtmosphereSystem
|
||||
{
|
||||
private static readonly ProtoId<SoundCollectionPrototype> DefaultSpaceWindSounds = "SpaceWind";
|
||||
|
||||
private const int SpaceWindSoundCooldownCycles = 75;
|
||||
|
||||
private int _spaceWindSoundCooldown = 0;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? SpaceWindSound { get; private set; } = "/Audio/Effects/space_wind.ogg";
|
||||
public SoundSpecifier? SpaceWindSound { get; private set; } = new SoundCollectionSpecifier(DefaultSpaceWindSounds, AudioParams.Default.WithVariation(0.125f));
|
||||
|
||||
private readonly HashSet<Entity<MovedByPressureComponent>> _activePressures = new(8);
|
||||
|
||||
@@ -105,10 +108,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// Don't play the space wind sound on tiles that are on fire...
|
||||
if (tile.PressureDifference > 15 && !tile.Hotspot.Valid)
|
||||
{
|
||||
if (_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
|
||||
if (_spaceWindSoundCooldown == 0 && SpaceWindSound != null)
|
||||
{
|
||||
var coordinates = _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.GridIndices);
|
||||
_audio.PlayPvs(SpaceWindSound, coordinates, AudioParams.Default.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
|
||||
_audio.PlayPvs(SpaceWindSound, coordinates, SpaceWindSound.Params.WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user