Attempt to reduce audio helper resolves (#8493)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Content.Shared.Audio;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -13,7 +15,8 @@ namespace Content.Shared.Sound
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("params")]
|
||||
public AudioParams Params = AudioParams.Default;
|
||||
|
||||
public abstract string GetSound();
|
||||
// TODO: remove most uses of this function, and just make the audio-system take in a SoundSpecifier
|
||||
public abstract string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null);
|
||||
}
|
||||
|
||||
public sealed class SoundPathSpecifier : SoundSpecifier
|
||||
@@ -38,7 +41,7 @@ namespace Content.Shared.Sound
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public override string GetSound()
|
||||
public override string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null)
|
||||
{
|
||||
return Path == null ? string.Empty : Path.ToString();
|
||||
}
|
||||
@@ -61,9 +64,9 @@ namespace Content.Shared.Sound
|
||||
Collection = collection;
|
||||
}
|
||||
|
||||
public override string GetSound()
|
||||
public override string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null)
|
||||
{
|
||||
return Collection == null ? string.Empty : AudioHelpers.GetRandomFileFromSoundCollection(Collection);
|
||||
return Collection == null ? string.Empty : AudioHelpers.GetRandomFileFromSoundCollection(Collection, rand, proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user