replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -30,22 +30,15 @@ namespace Content.Server.Sound
private void HandleEmitSoundOn(BaseEmitSoundComponent component)
{
var soundName = component.Sound.GetSound();
if (!string.IsNullOrWhiteSpace(soundName))
{
PlaySingleSound(soundName, component);
if (component.Sound.TryGetSound(out var soundName))
{
SoundSystem.Play(Filter.Pvs(component.Owner), soundName, component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f));
}
else
{
Logger.Warning($"{nameof(component)} Uid:{component.Owner.Uid} has no {nameof(component.Sound)} to play.");
}
}
private static void PlaySingleSound(string soundName, BaseEmitSoundComponent component)
{
SoundSystem.Play(Filter.Pvs(component.Owner), soundName, component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f));
}
}
}