SoundSystem (#3467)

* Converted some audio calls over to the new system.

* Update Submodule.
This commit is contained in:
Acruid
2021-03-01 20:42:54 -08:00
committed by GitHub
parent 609fcf25ac
commit 91cea56a5a
10 changed files with 37 additions and 37 deletions

View File

@@ -1,10 +1,11 @@
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Sound;
using Content.Shared.Physics;
using Robust.Client.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
@@ -17,7 +18,6 @@ namespace Content.Client.GameObjects.Components.Sound
[Dependency] private readonly IRobustRandom _random = default!;
private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new();
private AudioSystem _audioSystem;
public override void StopAllSounds()
{
@@ -52,15 +52,14 @@ namespace Content.Client.GameObjects.Components.Sound
Owner.SpawnTimer((int) schedule.Delay + (_random.Next((int) schedule.RandomDelay)),() =>
{
if (!schedule.Play) return; // We make sure this hasn't changed.
if (_audioSystem == null) _audioSystem = EntitySystem.Get<AudioSystem>();
if (!_audioStreams.ContainsKey(schedule))
{
_audioStreams.Add(schedule,_audioSystem.Play(schedule.Filename, Owner, schedule.AudioParams));
_audioStreams.Add(schedule,SoundSystem.Play(Filter.Local(), schedule.Filename, Owner, schedule.AudioParams));
}
else
{
_audioStreams[schedule] = _audioSystem.Play(schedule.Filename, Owner, schedule.AudioParams);
_audioStreams[schedule] = SoundSystem.Play(Filter.Local(), schedule.Filename, Owner, schedule.AudioParams);
}
if (schedule.Times == 0) return;
@@ -93,7 +92,7 @@ namespace Content.Client.GameObjects.Components.Sound
public override void Initialize()
{
base.Initialize();
if (EntitySystem.TryGet(out _audioSystem)) _audioSystem.OcclusionCollisionMask = (int) CollisionGroup.Impassable;
SoundSystem.OcclusionCollisionMask = (int) CollisionGroup.Impassable;
}
public override void ExposeData(ObjectSerializer serializer)