SoundSystem (#3467)
* Converted some audio calls over to the new system. * Update Submodule.
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -9,13 +9,13 @@ using Content.Server.Mobs.Roles.Suspicion;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Configuration;
|
||||
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;
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace Content.Server.GameTicking.GameRules
|
||||
|
||||
_chatManager.DispatchServerAnnouncement(Loc.GetString("There are traitors on the station! Find them, and kill them!"));
|
||||
|
||||
bool Predicate(IPlayerSession session) => session.ContentData()?.Mind?.HasRole<SuspicionTraitorRole>() ?? false;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayGlobal("/Audio/Misc/tatoralert.ogg", AudioParams.Default, Predicate);
|
||||
var filter = Filter.Empty()
|
||||
.AddWhere(session => ((IPlayerSession)session).ContentData()?.Mind?.HasRole<SuspicionTraitorRole>() ?? false);
|
||||
SoundSystem.Play(filter, "/Audio/Misc/tatoralert.ogg", AudioParams.Default);
|
||||
EntitySystem.Get<SuspicionEndTimerSystem>().EndTime = _endTime;
|
||||
|
||||
EntitySystem.Get<ServerDoorSystem>().AccessType = ServerDoorSystem.AccessTypes.AllowAllNoExternal;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Mobs.Roles.Traitor;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.GameTicking.GameRules
|
||||
{
|
||||
@@ -18,9 +17,9 @@ namespace Content.Server.GameTicking.GameRules
|
||||
{
|
||||
_chatManager.DispatchServerAnnouncement(Loc.GetString("Hello crew! Have a good shift!"));
|
||||
|
||||
bool Predicate(IPlayerSession session) => session.ContentData()?.Mind?.HasRole<TraitorRole>() ?? false;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayGlobal("/Audio/Misc/tatoralert.ogg", AudioParams.Default, Predicate);
|
||||
var filter = Filter.Empty()
|
||||
.AddWhere(session => ((IPlayerSession)session).ContentData()?.Mind?.HasRole<TraitorRole>() ?? false);
|
||||
SoundSystem.Play(filter, "/Audio/Misc/tatoralert.ogg", AudioParams.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using JetBrains.Annotations;
|
||||
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.Random;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
@@ -68,7 +69,7 @@ namespace Content.Server.StationEvents
|
||||
_announceCancelToken = new CancellationTokenSource();
|
||||
Timer.Spawn(3000, () =>
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayGlobal("/Audio/Announcements/power_on.ogg");
|
||||
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/power_on.ogg");
|
||||
}, _announceCancelToken.Token);
|
||||
_powered.Clear();
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.StationEvents
|
||||
{
|
||||
@@ -121,7 +120,7 @@ namespace Content.Server.StationEvents
|
||||
|
||||
if (StartAudio != null)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayGlobal(StartAudio, AudioParams.Default.WithVolume(-10f));
|
||||
SoundSystem.Play(Filter.Broadcast(), StartAudio, AudioParams.Default.WithVolume(-10f));
|
||||
}
|
||||
|
||||
Announced = true;
|
||||
@@ -141,7 +140,7 @@ namespace Content.Server.StationEvents
|
||||
|
||||
if (EndAudio != null)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayGlobal(EndAudio, AudioParams.Default.WithVolume(-10f));
|
||||
SoundSystem.Play(Filter.Broadcast(), EndAudio, AudioParams.Default.WithVolume(-10f));
|
||||
}
|
||||
|
||||
Started = false;
|
||||
|
||||
Reference in New Issue
Block a user