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

@@ -100,7 +100,7 @@ namespace Content.Server.GameObjects.Components.Singularity
private SpriteComponent? _spriteComponent;
private RadiationPulseComponent? _radiationPulseComponent;
private AudioSystem _audioSystem = null!;
private AudioSystem.AudioSourceServer? _playingSound;
private IPlayingAudioStream? _playingSound;
public override void Initialize()
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -20,6 +20,7 @@ using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
@@ -211,12 +212,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
/// <param name="targetPos">Target position on the map to shoot at.</param>
private void Fire(IEntity shooter, Vector2 targetPos)
{
var soundSystem = EntitySystem.Get<AudioSystem>();
if (ShotsLeft == 0)
{
if (_soundEmpty != null)
{
soundSystem.PlayAtCoords(_soundEmpty, Owner.Transform.Coordinates);
SoundSystem.Play(Filter.Broadcast(), _soundEmpty, Owner.Transform.Coordinates);
}
return;
}
@@ -225,7 +225,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
var projectile = TakeProjectile(shooter.Transform.Coordinates);
if (projectile == null)
{
soundSystem.PlayAtCoords(_soundEmpty, Owner.Transform.Coordinates);
SoundSystem.Play(Filter.Broadcast(), _soundEmpty, Owner.Transform.Coordinates);
return;
}
@@ -266,7 +266,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
throw new InvalidOperationException();
}
soundSystem.PlayAtCoords(_soundGunshot, Owner.Transform.Coordinates);
SoundSystem.Play(Filter.Broadcast(), _soundGunshot, Owner.Transform.Coordinates);
_lastFire = _gameTiming.CurTime;
return;
@@ -316,7 +316,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
var soundCollection = prototypeManager.Index<SoundCollectionPrototype>(ammo.SoundCollectionEject);
var randomFile = robustRandom.Pick(soundCollection.PickFiles);
EntitySystem.Get<AudioSystem>().PlayAtCoords(randomFile, entity.Transform.Coordinates, AudioParams.Default.WithVolume(-1));
SoundSystem.Play(Filter.Broadcast(), randomFile, entity.Transform.Coordinates, AudioParams.Default.WithVolume(-1));
}
/// <summary>

View File

@@ -4,9 +4,11 @@ using Content.Server.Interfaces.Chat;
using Content.Server.Interfaces.GameTicking;
using Content.Shared.GameTicking;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Timing;
using Timer = Robust.Shared.Timing.Timer;
@@ -80,7 +82,7 @@ namespace Content.Server.GameObjects.EntitySystems
_chatManager.DispatchStationAnnouncement(Loc.GetString("An emergency shuttle has been sent. ETA: {0} minutes.", RoundEndCountdownTime.Minutes), Loc.GetString("Station"));
Get<AudioSystem>().PlayGlobal("/Audio/Announcements/shuttlecalled.ogg");
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/shuttlecalled.ogg");
ExpectedCountdownEnd = _gameTiming.CurTime + RoundEndCountdownTime;
Timer.Spawn(RoundEndCountdownTime, EndRound, _roundEndCancellationTokenSource.Token);
@@ -104,7 +106,7 @@ namespace Content.Server.GameObjects.EntitySystems
_chatManager.DispatchStationAnnouncement(Loc.GetString("The emergency shuttle has been recalled."), Loc.GetString("Station"));
Get<AudioSystem>().PlayGlobal("/Audio/Announcements/shuttlerecalled.ogg");
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/shuttlerecalled.ogg");
_roundEndCancellationTokenSource.Cancel();
_roundEndCancellationTokenSource = new CancellationTokenSource();