Audio System Rejig (#9635)

This commit is contained in:
Leon Friedrich
2022-07-29 14:13:12 +12:00
committed by GitHub
parent 05ee746efb
commit c7ad6b709e
191 changed files with 211 additions and 540 deletions

View File

@@ -3,16 +3,15 @@ using Content.Server.Interaction.Components;
using Content.Server.Sound.Components;
using Content.Server.Throwing;
using Content.Server.UserInterface;
using Content.Server.Popups;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Maps;
using Content.Shared.Throwing;
using JetBrains.Annotations;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Content.Server.Popups;
namespace Content.Server.Sound
{
@@ -23,8 +22,9 @@ namespace Content.Server.Sound
public sealed class EmitSoundSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefMan = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
/// <inheritdoc />
@@ -108,8 +108,7 @@ namespace Content.Server.Sound
private void TryEmitSound(BaseEmitSoundComponent component)
{
var audioParams = component.AudioParams.WithPitchScale((float) _random.NextGaussian(1, component.PitchVariation));
SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, audioParams);
_audioSystem.PlayPvs(component.Sound, component.Owner, component.Sound.Params.AddVolume(-2f));
}
}
}