diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index aebacb94f6..10065b6583 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -1,16 +1,21 @@ -using System.Linq; -using System.Numerics; using Content.Shared.Audio; using Content.Shared.CCVar; -using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Audio; +using Robust.Shared.Log; using Robust.Shared.Configuration; +using Robust.Shared.Map; using Robust.Shared.Physics; using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; +using System.Linq; +using System.Numerics; +using Robust.Client.GameObjects; +using Robust.Shared.Audio.Effects; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Player; namespace Content.Client.Audio; //TODO: This is using a incomplete version of the whole "only play nearest sounds" algo, that breaks down a bit should the ambient sound cap get hit. @@ -41,14 +46,18 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem private TimeSpan _targetTime = TimeSpan.Zero; private float _ambienceVolume = 0.0f; - private static AudioParams _params = AudioParams.Default.WithVariation(0.01f).WithLoop(true).WithAttenuation(Attenuation.LinearDistance); + private static AudioParams _params = AudioParams.Default + .WithVariation(0.01f) + .WithLoop(true) + .WithAttenuation(Attenuation.LinearDistance) + .WithMaxDistance(7f); /// /// How many times we can be playing 1 particular sound at once. /// private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f)); - private readonly Dictionary, (IPlayingAudioStream? Stream, SoundSpecifier Sound, string Path)> _playingSounds = new(); + private readonly Dictionary _playingSounds = new(); private readonly Dictionary _playingCount = new(); public bool OverlayEnabled @@ -98,10 +107,10 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem private void OnShutdown(EntityUid uid, AmbientSoundComponent component, ComponentShutdown args) { - if (!_playingSounds.Remove((uid, component), out var sound)) + if (!_playingSounds.Remove(component, out var sound)) return; - sound.Stream?.Stop(); + _audio.Stop(sound.Stream); _playingCount[sound.Path] -= 1; if (_playingCount[sound.Path] == 0) _playingCount.Remove(sound.Path); @@ -111,13 +120,13 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem { _ambienceVolume = value; - foreach (var ((_, comp), values) in _playingSounds) + foreach (var (comp, values) in _playingSounds) { if (values.Stream == null) continue; - var stream = (AudioSystem.PlayingStream) values.Stream; - stream.Volume = _params.Volume + comp.Volume + _ambienceVolume; + var stream = values.Stream; + _audio.SetVolume(stream, _params.Volume + comp.Volume + _ambienceVolume); } } private void SetCooldown(float value) => _cooldown = value; @@ -177,7 +186,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem { foreach (var (stream, _, _) in _playingSounds.Values) { - stream?.Stop(); + _audio.Stop(stream); } _playingSounds.Clear(); @@ -186,7 +195,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem private readonly struct QueryState { - public readonly Dictionary)>> SourceDict = new(); + public readonly Dictionary> SourceDict = new(); public readonly Vector2 MapPos; public readonly TransformComponent Player; public readonly EntityQuery Query; @@ -224,7 +233,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem // Prioritize far away & loud sounds. var importance = range * (ambientComp.Volume + 32); - state.SourceDict.GetOrNew(key).Add((importance, (ambientComp.Owner, ambientComp))); + state.SourceDict.GetOrNew(key).Add((importance, ambientComp)); return true; } @@ -238,10 +247,9 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem var mapPos = playerXform.MapPosition; // Remove out-of-range ambiences - foreach (var (ent, sound) in _playingSounds) + foreach (var (comp, sound) in _playingSounds) { - var entity = ent.Owner; - var comp = ent.Comp; + var entity = comp.Owner; if (comp.Enabled && // Don't keep playing sounds that have changed since. @@ -258,8 +266,8 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem continue; } - sound.Stream?.Stop(); - _playingSounds.Remove((entity, comp)); + _audio.Stop(sound.Stream); + _playingSounds.Remove(comp); _playingCount[sound.Path] -= 1; if (_playingCount[sound.Path] == 0) _playingCount.Remove(sound.Path); @@ -284,12 +292,11 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem sources.Sort(static (a, b) => b.Importance.CompareTo(a.Importance)); - foreach (var (_, ent) in sources) + foreach (var (_, comp) in sources) { - var uid = ent.Owner; - var comp = ent.Comp; + var uid = comp.Owner; - if (_playingSounds.ContainsKey(ent) || + if (_playingSounds.ContainsKey(comp) || metaQuery.GetComponent(uid).EntityPaused) continue; @@ -299,11 +306,8 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem .WithPlayOffset(_random.NextFloat(0.0f, 100.0f)) .WithMaxDistance(comp.Range); - var stream = _audio.PlayPvs(comp.Sound, uid, audioParams); - if (stream == null) - continue; - - _playingSounds[ent] = (stream, comp.Sound, key); + var stream = _audio.PlayEntity(comp.Sound, Filter.Local(), uid, false, audioParams); + _playingSounds[comp] = (stream.Value.Entity, comp.Sound, key); playingCount++; if (_playingSounds.Count >= _maxAmbientCount) diff --git a/Content.Client/Audio/BackgroundAudioSystem.cs b/Content.Client/Audio/BackgroundAudioSystem.cs index 0b31db2463..a26603bf74 100644 --- a/Content.Client/Audio/BackgroundAudioSystem.cs +++ b/Content.Client/Audio/BackgroundAudioSystem.cs @@ -5,6 +5,7 @@ using JetBrains.Annotations; using Robust.Client; using Robust.Client.State; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; @@ -21,7 +22,7 @@ public sealed class BackgroundAudioSystem : EntitySystem private readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f); - private IPlayingAudioStream? _lobbyStream; + private EntityUid? _lobbyStream; public override void Initialize() { @@ -118,12 +119,11 @@ public sealed class BackgroundAudioSystem : EntitySystem } _lobbyStream = _audio.PlayGlobal(file, Filter.Local(), false, - _lobbyParams.WithVolume(_lobbyParams.Volume + _configManager.GetCVar(CCVars.LobbyMusicVolume))); + _lobbyParams.WithVolume(_lobbyParams.Volume + _configManager.GetCVar(CCVars.LobbyMusicVolume)))?.Entity; } private void EndLobbyMusic() { - _lobbyStream?.Stop(); - _lobbyStream = null; + _lobbyStream = _audio.Stop(_lobbyStream); } } diff --git a/Content.Client/Audio/ClientGlobalSoundSystem.cs b/Content.Client/Audio/ClientGlobalSoundSystem.cs index 792f149d18..1d98564090 100644 --- a/Content.Client/Audio/ClientGlobalSoundSystem.cs +++ b/Content.Client/Audio/ClientGlobalSoundSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.CCVar; using Content.Shared.GameTicking; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; @@ -14,11 +15,11 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem // Admin music private bool _adminAudioEnabled = true; - private List _adminAudio = new(1); + private List _adminAudio = new(1); // Event sounds (e.g. nuke timer) private bool _eventAudioEnabled = true; - private Dictionary _eventAudio = new(1); + private Dictionary _eventAudio = new(1); public override void Initialize() { @@ -49,13 +50,13 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem { foreach (var stream in _adminAudio) { - stream?.Stop(); + _audio.Stop(stream); } _adminAudio.Clear(); - foreach (var (_, stream) in _eventAudio) + foreach (var stream in _eventAudio.Values) { - stream?.Stop(); + _audio.Stop(stream); } _eventAudio.Clear(); @@ -66,7 +67,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem if(!_adminAudioEnabled) return; var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams); - _adminAudio.Add(stream); + _adminAudio.Add(stream.Value.Entity); } private void PlayStationEventMusic(StationEventMusicEvent soundEvent) @@ -75,7 +76,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return; var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams); - _eventAudio.Add(soundEvent.Type, stream); + _eventAudio.Add(soundEvent.Type, stream.Value.Entity); } private void PlayGameSound(GameGlobalSoundEvent soundEvent) @@ -85,8 +86,10 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem private void StopStationEventMusic(StopStationEventMusic soundEvent) { - if (!_eventAudio.TryGetValue(soundEvent.Type, out var stream)) return; - stream?.Stop(); + if (!_eventAudio.TryGetValue(soundEvent.Type, out var stream)) + return; + + _audio.Stop(stream); _eventAudio.Remove(soundEvent.Type); } @@ -96,7 +99,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem if (_adminAudioEnabled) return; foreach (var stream in _adminAudio) { - stream?.Stop(); + _audio.Stop(stream); } _adminAudio.Clear(); } @@ -107,7 +110,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem if (_eventAudioEnabled) return; foreach (var stream in _eventAudio) { - stream.Value?.Stop(); + _audio.Stop(stream.Value); } _eventAudio.Clear(); } diff --git a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs index 15fc53222e..cdf4c71e82 100644 --- a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs +++ b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs @@ -9,6 +9,7 @@ using Robust.Client.Player; using Robust.Client.ResourceManagement; using Robust.Client.State; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -39,7 +40,7 @@ public sealed partial class ContentAudioSystem // Don't need to worry about this being serializable or pauseable as it doesn't affect the sim. private TimeSpan _nextAudio; - private AudioSystem.PlayingStream? _ambientMusicStream; + private EntityUid? _ambientMusicStream; private AmbientMusicPrototype? _musicProto; /// @@ -83,7 +84,7 @@ public sealed partial class ContentAudioSystem if (_ambientMusicStream != null && _musicProto != null) { - _ambientMusicStream.Volume = _musicProto.Sound.Params.Volume + _volumeSlider; + _audio.SetVolume(_ambientMusicStream, _musicProto.Sound.Params.Volume + _volumeSlider); } } @@ -92,7 +93,7 @@ public sealed partial class ContentAudioSystem _configManager.UnsubValueChanged(CCVars.AmbientMusicVolume, AmbienceCVarChanged); _proto.PrototypesReloaded -= OnProtoReload; _state.OnStateChanged -= OnStateChange; - _ambientMusicStream?.Stop(); + _ambientMusicStream = _audio.Stop(_ambientMusicStream); } private void OnProtoReload(PrototypesReloadedEventArgs obj) @@ -129,8 +130,7 @@ public sealed partial class ContentAudioSystem private void OnRoundEndMessage(RoundEndMessageEvent ev) { // If scoreboard shows then just stop the music - _ambientMusicStream?.Stop(); - _ambientMusicStream = null; + _ambientMusicStream = _audio.Stop(_ambientMusicStream); _nextAudio = TimeSpan.FromMinutes(3); } @@ -170,7 +170,7 @@ public sealed partial class ContentAudioSystem return; } - var isDone = _ambientMusicStream?.Done; + var isDone = !Exists(_ambientMusicStream); if (_interruptable) { @@ -178,7 +178,7 @@ public sealed partial class ContentAudioSystem if (player == null || _musicProto == null || !_rules.IsTrue(player.Value, _proto.Index(_musicProto.Rules))) { - FadeOut(_ambientMusicStream, AmbientMusicFadeTime); + FadeOut(_ambientMusicStream, duration: AmbientMusicFadeTime); _musicProto = null; _interruptable = false; isDone = true; @@ -221,14 +221,11 @@ public sealed partial class ContentAudioSystem false, AudioParams.Default.WithVolume(_musicProto.Sound.Params.Volume + _volumeSlider)); - if (strim != null) - { - _ambientMusicStream = (AudioSystem.PlayingStream) strim; + _ambientMusicStream = strim.Value.Entity; - if (_musicProto.FadeIn) - { - FadeIn(_ambientMusicStream, AmbientMusicFadeTime); - } + if (_musicProto.FadeIn) + { + FadeIn(_ambientMusicStream, strim.Value.Component, AmbientMusicFadeTime); } // Refresh the list diff --git a/Content.Client/Audio/ContentAudioSystem.cs b/Content.Client/Audio/ContentAudioSystem.cs index 696a5eb32d..726493fdab 100644 --- a/Content.Client/Audio/ContentAudioSystem.cs +++ b/Content.Client/Audio/ContentAudioSystem.cs @@ -1,17 +1,19 @@ using Content.Shared.Audio; using Robust.Client.GameObjects; +using Robust.Shared.Audio; +using AudioComponent = Robust.Shared.Audio.Components.AudioComponent; namespace Content.Client.Audio; public sealed partial class ContentAudioSystem : SharedContentAudioSystem { // Need how much volume to change per tick and just remove it when it drops below "0" - private readonly Dictionary _fadingOut = new(); + private readonly Dictionary _fadingOut = new(); // Need volume change per tick + target volume. - private readonly Dictionary _fadingIn = new(); + private readonly Dictionary _fadingIn = new(); - private readonly List _fadeToRemove = new(); + private readonly List _fadeToRemove = new(); private const float MinVolume = -32f; private const float DefaultDuration = 2f; @@ -42,28 +44,28 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem #region Fades - public void FadeOut(AudioSystem.PlayingStream? stream, float duration = DefaultDuration) + public void FadeOut(EntityUid? stream, AudioComponent? component = null, float duration = DefaultDuration) { - if (stream == null || duration <= 0f) + if (stream == null || duration <= 0f || !Resolve(stream.Value, ref component)) return; // Just in case // TODO: Maybe handle the removals by making it seamless? - _fadingIn.Remove(stream); - var diff = stream.Volume - MinVolume; - _fadingOut.Add(stream, diff / duration); + _fadingIn.Remove(stream.Value); + var diff = component.Volume - MinVolume; + _fadingOut.Add(stream.Value, diff / duration); } - public void FadeIn(AudioSystem.PlayingStream? stream, float duration = DefaultDuration) + public void FadeIn(EntityUid? stream, AudioComponent? component = null, float duration = DefaultDuration) { - if (stream == null || duration <= 0f || stream.Volume < MinVolume) + if (stream == null || duration <= 0f || !Resolve(stream.Value, ref component) || component.Volume < MinVolume) return; - _fadingOut.Remove(stream); - var curVolume = stream.Volume; + _fadingOut.Remove(stream.Value); + var curVolume = component.Volume; var change = (curVolume - MinVolume) / duration; - _fadingIn.Add(stream, (change, stream.Volume)); - stream.Volume = MinVolume; + _fadingIn.Add(stream.Value, (change, component.Volume)); + component.Volume = MinVolume; } private void UpdateFades(float frameTime) @@ -72,19 +74,18 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem foreach (var (stream, change) in _fadingOut) { - // Cancelled elsewhere - if (stream.Done) + if (!TryComp(stream, out AudioComponent? component)) { _fadeToRemove.Add(stream); continue; } - var volume = stream.Volume - change * frameTime; - stream.Volume = MathF.Max(MinVolume, volume); + var volume = component.Volume - change * frameTime; + component.Volume = MathF.Max(MinVolume, volume); - if (stream.Volume.Equals(MinVolume)) + if (component.Volume.Equals(MinVolume)) { - stream.Stop(); + _audio.Stop(stream); _fadeToRemove.Add(stream); } } @@ -99,16 +100,16 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem foreach (var (stream, (change, target)) in _fadingIn) { // Cancelled elsewhere - if (stream.Done) + if (!TryComp(stream, out AudioComponent? component)) { _fadeToRemove.Add(stream); continue; } - var volume = stream.Volume + change * frameTime; - stream.Volume = MathF.Min(target, volume); + var volume = component.Volume + change * frameTime; + component.Volume = MathF.Min(target, volume); - if (stream.Volume.Equals(target)) + if (component.Volume.Equals(target)) { _fadeToRemove.Add(stream); } diff --git a/Content.Client/Changelog/ChangelogTab.xaml.cs b/Content.Client/Changelog/ChangelogTab.xaml.cs index d1e2bc7533..8fbeaab5f4 100644 --- a/Content.Client/Changelog/ChangelogTab.xaml.cs +++ b/Content.Client/Changelog/ChangelogTab.xaml.cs @@ -7,6 +7,7 @@ using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.ContentPack; using Robust.Shared.Utility; using static Content.Client.Changelog.ChangelogManager; using static Robust.Client.UserInterface.Controls.BoxContainer; diff --git a/Content.Client/Credits/CreditsWindow.xaml.cs b/Content.Client/Credits/CreditsWindow.xaml.cs index 666ff2aa48..60ac579845 100644 --- a/Content.Client/Credits/CreditsWindow.xaml.cs +++ b/Content.Client/Credits/CreditsWindow.xaml.cs @@ -11,6 +11,7 @@ using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; using Robust.Shared.Configuration; +using Robust.Shared.ContentPack; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; @@ -23,7 +24,7 @@ namespace Content.Client.Credits [GenerateTypedNameReferences] public sealed partial class CreditsWindow : DefaultWindow { - [Dependency] private readonly IResourceCache _resourceManager = default!; + [Dependency] private readonly IResourceManager _resourceManager = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; private static readonly Dictionary PatronTierPriority = new() @@ -49,7 +50,7 @@ namespace Content.Client.Credits private void PopulateLicenses(BoxContainer licensesContainer) { - foreach (var entry in CreditsManager.GetLicenses().OrderBy(p => p.Name)) + foreach (var entry in CreditsManager.GetLicenses(_resourceManager).OrderBy(p => p.Name)) { licensesContainer.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = entry.Name}); diff --git a/Content.Client/Disposal/Systems/DisposalUnitSystem.cs b/Content.Client/Disposal/Systems/DisposalUnitSystem.cs index d10101754c..344bd2ec97 100644 --- a/Content.Client/Disposal/Systems/DisposalUnitSystem.cs +++ b/Content.Client/Disposal/Systems/DisposalUnitSystem.cs @@ -6,6 +6,8 @@ using Content.Shared.Emag.Systems; using Robust.Client.GameObjects; using Robust.Client.Animations; using Robust.Client.Graphics; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameStates; using Robust.Shared.Physics.Events; using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent; diff --git a/Content.Client/Doors/DoorSystem.cs b/Content.Client/Doors/DoorSystem.cs index 4b82d3506a..80ce47e0c2 100644 --- a/Content.Client/Doors/DoorSystem.cs +++ b/Content.Client/Doors/DoorSystem.cs @@ -138,6 +138,6 @@ public sealed class DoorSystem : SharedDoorSystem protected override void PlaySound(EntityUid uid, SoundSpecifier soundSpecifier, AudioParams audioParams, EntityUid? predictingPlayer, bool predicted) { if (GameTiming.InPrediction && GameTiming.IsFirstTimePredicted) - Audio.Play(soundSpecifier, Filter.Local(), uid, false, audioParams); + Audio.PlayEntity(soundSpecifier, Filter.Local(), uid, false, audioParams); } } diff --git a/Content.Client/GameTicking/Managers/ClientGameTicker.cs b/Content.Client/GameTicking/Managers/ClientGameTicker.cs index e363ae764b..a25b592f57 100644 --- a/Content.Client/GameTicking/Managers/ClientGameTicker.cs +++ b/Content.Client/GameTicking/Managers/ClientGameTicker.cs @@ -7,6 +7,8 @@ using Content.Shared.GameWindow; using JetBrains.Annotations; using Robust.Client.Graphics; using Robust.Client.State; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Utility; diff --git a/Content.Client/Gravity/GravitySystem.Shake.cs b/Content.Client/Gravity/GravitySystem.Shake.cs index fee072051a..55becdd395 100644 --- a/Content.Client/Gravity/GravitySystem.Shake.cs +++ b/Content.Client/Gravity/GravitySystem.Shake.cs @@ -3,6 +3,7 @@ using Content.Shared.Camera; using Content.Shared.Gravity; using Robust.Client.Player; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Client/Guidebook/GuidebookSystem.cs b/Content.Client/Guidebook/GuidebookSystem.cs index 8ef6f13e31..dffc625cb8 100644 --- a/Content.Client/Guidebook/GuidebookSystem.cs +++ b/Content.Client/Guidebook/GuidebookSystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Tag; using Content.Shared.Verbs; using Robust.Client.GameObjects; using Robust.Client.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Timing; diff --git a/Content.Client/Info/RulesAndInfoWindow.cs b/Content.Client/Info/RulesAndInfoWindow.cs index 2905857b39..7a763a1d6f 100644 --- a/Content.Client/Info/RulesAndInfoWindow.cs +++ b/Content.Client/Info/RulesAndInfoWindow.cs @@ -11,7 +11,7 @@ namespace Content.Client.Info { public sealed class RulesAndInfoWindow : DefaultWindow { - [Dependency] private readonly IResourceCache _resourceManager = default!; + [Dependency] private readonly IResourceManager _resourceManager = default!; [Dependency] private readonly RulesManager _rules = default!; public RulesAndInfoWindow() diff --git a/Content.Client/IoC/StaticIoC.cs b/Content.Client/IoC/StaticIoC.cs index 9cbe8053e3..cc78ac4873 100644 --- a/Content.Client/IoC/StaticIoC.cs +++ b/Content.Client/IoC/StaticIoC.cs @@ -1,4 +1,5 @@ using Robust.Client.ResourceManagement; +using Robust.Shared.ContentPack; using Robust.Shared.IoC; namespace Content.Client.IoC diff --git a/Content.Client/Light/Components/ExpendableLightComponent.cs b/Content.Client/Light/Components/ExpendableLightComponent.cs index 2ce0249fc1..f5dbcc297e 100644 --- a/Content.Client/Light/Components/ExpendableLightComponent.cs +++ b/Content.Client/Light/Components/ExpendableLightComponent.cs @@ -44,7 +44,7 @@ public sealed partial class ExpendableLightComponent : SharedExpendableLightComp /// The sound that plays when the expendable light is lit. /// [Access(typeof(ExpendableLightSystem))] - public IPlayingAudioStream? PlayingStream; + public EntityUid? PlayingStream; } public enum ExpendableLightVisualLayers : byte diff --git a/Content.Client/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Client/Light/EntitySystems/ExpendableLightSystem.cs index 6e9e546dfa..a2a7fb2531 100644 --- a/Content.Client/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Client/Light/EntitySystems/ExpendableLightSystem.cs @@ -2,6 +2,8 @@ using Content.Client.Light.Components; using Content.Shared.Light.Components; using Robust.Client.GameObjects; using Robust.Client.Graphics; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Client.Light.EntitySystems; @@ -19,7 +21,7 @@ public sealed class ExpendableLightSystem : VisualizerSystem().System(); LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled); RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled); EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled); @@ -79,7 +82,7 @@ namespace Content.Client.Options.UI.Tabs private void OnMasterVolumeSliderChanged(Range range) { - _clydeAudio.SetMasterVolume(MasterVolumeSlider.Value / 100); + _audio.SetMasterVolume(MasterVolumeSlider.Value / 100); UpdateChanges(); } @@ -108,7 +111,7 @@ namespace Content.Client.Options.UI.Tabs private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args) { - _cfg.SetCVar(CVars.AudioMasterVolume, MasterVolumeSlider.Value / 100); + _cfg.SetCVar(CVars.AudioMasterVolume, LV100ToDB(MasterVolumeSlider.Value, CCVars.MasterMultiplier)); // Want the CVar updated values to have the multiplier applied // For the UI we just display 0-100 still elsewhere _cfg.SetCVar(CVars.MidiVolume, LV100ToDB(MidiVolumeSlider.Value, CCVars.MidiMultiplier)); @@ -132,7 +135,7 @@ namespace Content.Client.Options.UI.Tabs private void Reset() { - MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100; + MasterVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CVars.AudioMasterVolume), CCVars.MasterMultiplier); MidiVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CVars.MidiVolume), CCVars.MidiMultiplier); AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume), CCVars.AmbienceMultiplier); AmbientMusicVolumeSlider.Value = @@ -150,8 +153,8 @@ namespace Content.Client.Options.UI.Tabs // Do be sure to rename the setting though private float DBToLV100(float db, float multiplier = 1f) { - var weh = (float) (Math.Pow(10, db / 10) * 100 / multiplier); - return weh; + var beri = (float) (Math.Pow(10, db / 10) * 100 / multiplier); + return beri; } private float LV100ToDB(float lv100, float multiplier = 1f) @@ -164,7 +167,7 @@ namespace Content.Client.Options.UI.Tabs private void UpdateChanges() { var isMasterVolumeSame = - Math.Abs(MasterVolumeSlider.Value - _cfg.GetCVar(CVars.AudioMasterVolume) * 100) < 0.01f; + Math.Abs(MasterVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CVars.AudioMasterVolume), CCVars.MasterMultiplier)) < 0.01f; var isMidiVolumeSame = Math.Abs(MidiVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CVars.MidiVolume), CCVars.MidiMultiplier)) < 0.01f; var isAmbientVolumeSame = diff --git a/Content.Client/Parallax/Data/GeneratedParallaxTextureSource.cs b/Content.Client/Parallax/Data/GeneratedParallaxTextureSource.cs index 81f012d93c..2e69a5a562 100644 --- a/Content.Client/Parallax/Data/GeneratedParallaxTextureSource.cs +++ b/Content.Client/Parallax/Data/GeneratedParallaxTextureSource.cs @@ -57,16 +57,17 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou } var debugParallax = IoCManager.Resolve().GetCVar(CCVars.ParallaxDebug); + var resManager = IoCManager.Resolve(); if (debugParallax - || !StaticIoC.ResC.UserData.TryReadAllText(PreviousParallaxConfigPath, out var previousParallaxConfig) + || !resManager.UserData.TryReadAllText(PreviousParallaxConfigPath, out var previousParallaxConfig) || previousParallaxConfig != parallaxConfig) { var table = Toml.ReadString(parallaxConfig); await UpdateCachedTexture(table, debugParallax, cancel); //Update the previous config - using var writer = StaticIoC.ResC.UserData.OpenWriteText(PreviousParallaxConfigPath); + using var writer = resManager.UserData.OpenWriteText(PreviousParallaxConfigPath); writer.Write(parallaxConfig); } @@ -81,7 +82,7 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou try { // Also try to at least sort of fix this if we've been fooled by a config backup - StaticIoC.ResC.UserData.Delete(PreviousParallaxConfigPath); + resManager.UserData.Delete(PreviousParallaxConfigPath); } catch (Exception) { @@ -104,31 +105,34 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou // And load it in the main thread for safety reasons. // But before spending time saving it, make sure to exit out early if it's not wanted. cancel.ThrowIfCancellationRequested(); + var resManager = IoCManager.Resolve(); // Store it and CRC so further game starts don't need to regenerate it. - using var imageStream = StaticIoC.ResC.UserData.OpenWrite(ParallaxCachedImagePath); - newParallexImage.SaveAsPng(imageStream); + await using var imageStream = resManager.UserData.OpenWrite(ParallaxCachedImagePath); + await newParallexImage.SaveAsPngAsync(imageStream, cancel); if (saveDebugLayers) { for (var i = 0; i < debugImages!.Count; i++) { var debugImage = debugImages[i]; - using var debugImageStream = StaticIoC.ResC.UserData.OpenWrite(new ResPath($"/parallax_{Identifier}debug_{i}.png")); - debugImage.SaveAsPng(debugImageStream); + await using var debugImageStream = resManager.UserData.OpenWrite(new ResPath($"/parallax_{Identifier}debug_{i}.png")); + await debugImage.SaveAsPngAsync(debugImageStream, cancel); } } } private Texture GetCachedTexture() { - using var imageStream = StaticIoC.ResC.UserData.OpenRead(ParallaxCachedImagePath); + var resManager = IoCManager.Resolve(); + using var imageStream = resManager.UserData.OpenRead(ParallaxCachedImagePath); return Texture.LoadFromPNGStream(imageStream, "Parallax"); } private string? GetParallaxConfig() { - if (!StaticIoC.ResC.TryContentFileRead(ParallaxConfigPath, out var configStream)) + var resManager = IoCManager.Resolve(); + if (!resManager.TryContentFileRead(ParallaxConfigPath, out var configStream)) { return null; } diff --git a/Content.Client/Replay/ContentReplayPlaybackManager.cs b/Content.Client/Replay/ContentReplayPlaybackManager.cs index 2b4e8ddc7d..37c066f594 100644 --- a/Content.Client/Replay/ContentReplayPlaybackManager.cs +++ b/Content.Client/Replay/ContentReplayPlaybackManager.cs @@ -139,7 +139,6 @@ public sealed class ContentReplayPlaybackManager { case RoundEndMessageEvent: case PopupEvent: - case AudioMessage: case PickupAnimationEvent: case MeleeLungeEvent: case SharedGunSystem.HitscanEvent: diff --git a/Content.Client/Traits/ParacusiaSystem.cs b/Content.Client/Traits/ParacusiaSystem.cs index dad274bf96..c661254bc9 100644 --- a/Content.Client/Traits/ParacusiaSystem.cs +++ b/Content.Client/Traits/ParacusiaSystem.cs @@ -3,6 +3,8 @@ using Content.Shared.Traits.Assorted; using Robust.Shared.Random; using Robust.Client.Player; using Robust.Shared.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Client.Traits; @@ -41,7 +43,7 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem private void OnPlayerDetach(EntityUid uid, ParacusiaComponent component, LocalPlayerDetachedEvent args) { - component.Stream?.Stop(); + component.Stream = _audio.Stop(component.Stream); } private void PlayParacusiaSounds(EntityUid uid) @@ -67,7 +69,7 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem var newCoords = Transform(uid).Coordinates.Offset(randomOffset); // Play the sound - paracusia.Stream = _audio.PlayStatic(paracusia.Sounds, uid, newCoords); + paracusia.Stream = _audio.PlayStatic(paracusia.Sounds, uid, newCoords).Value.Entity; } } diff --git a/Content.Client/Trigger/TimerTriggerVisualizerSystem.cs b/Content.Client/Trigger/TimerTriggerVisualizerSystem.cs index 1c91565858..44c92456a1 100644 --- a/Content.Client/Trigger/TimerTriggerVisualizerSystem.cs +++ b/Content.Client/Trigger/TimerTriggerVisualizerSystem.cs @@ -1,6 +1,8 @@ using Content.Shared.Trigger; using Robust.Client.Animations; using Robust.Client.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameObjects; namespace Content.Client.Trigger; diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index 87d4b8072f..659792f967 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -20,6 +20,7 @@ using Robust.Client.UserInterface.Controllers; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Input.Binding; using Robust.Shared.Network; using Robust.Shared.Player; @@ -34,6 +35,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged UIManager.GetActiveUIWidgetOrNull()?.AHelpButton; @@ -128,7 +130,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged(); ChatInput.Input.OnTextEntered += OnTextEntered; ChatInput.Input.OnKeyBindDown += OnKeyBindDown; @@ -52,8 +56,8 @@ public partial class ChatBox : UIWidget return; } - if (msg is { Read: false, AudioPath: not null }) - SoundSystem.Play(msg.AudioPath, Filter.Local(), new AudioParams().WithVolume(msg.AudioVolume)); + if (msg is { Read: false, AudioPath: { } }) + _entManager.System().PlayGlobal(msg.AudioPath, Filter.Local(), false, AudioParams.Default.WithVolume(msg.AudioVolume)); msg.Read = true; diff --git a/Content.Client/Voting/VoteManager.cs b/Content.Client/Voting/VoteManager.cs index 3220f2bdb2..63c706c86b 100644 --- a/Content.Client/Voting/VoteManager.cs +++ b/Content.Client/Voting/VoteManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using Content.Shared.Voting; using Robust.Client; +using Robust.Client.Audio; using Robust.Client.Console; using Robust.Client.GameObjects; using Robust.Client.UserInterface; diff --git a/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs b/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs index 4e4df4a156..565672ad38 100644 --- a/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs @@ -2,6 +2,8 @@ using Content.Shared.Projectiles; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Systems; using Robust.Client.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Physics.Events; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Client/Weather/WeatherSystem.cs b/Content.Client/Weather/WeatherSystem.cs index 888942363a..df7ccce451 100644 --- a/Content.Client/Weather/WeatherSystem.cs +++ b/Content.Client/Weather/WeatherSystem.cs @@ -1,8 +1,10 @@ using System.Numerics; using Content.Shared.Weather; +using Robust.Client.Audio; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Player; +using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -10,6 +12,7 @@ using Robust.Shared.Physics; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; using Robust.Shared.Player; +using AudioComponent = Robust.Shared.Audio.Components.AudioComponent; namespace Content.Client.Weather; @@ -47,18 +50,18 @@ public sealed class WeatherSystem : SharedWeatherSystem { weather.LastOcclusion = 0f; weather.LastAlpha = 0f; - weather.Stream?.Stop(); - weather.Stream = null; + weather.Stream = _audio.Stop(weather.Stream); return; } if (!Timing.IsFirstTimePredicted || weatherProto.Sound == null) return; - weather.Stream ??= _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true); + weather.Stream ??= _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true).Value.Entity; var volumeMod = MathF.Pow(10, weatherProto.Sound.Params.Volume / 10f); - var stream = (AudioSystem.PlayingStream) weather.Stream!; + var stream = weather.Stream.Value; + var comp = Comp(stream); var alpha = weather.LastAlpha; alpha = MathF.Pow(alpha, 2f) * volumeMod; // TODO: Lerp this occlusion. @@ -124,7 +127,7 @@ public sealed class WeatherSystem : SharedWeatherSystem { occlusion = _physics.IntersectRayPenetration(entXform.MapID, new CollisionRay(entPos, sourceRelative.Normalized(), _audio.OcclusionCollisionMask), - sourceRelative.Length(), stream.TrackingEntity); + sourceRelative.Length(), stream); } } } @@ -140,8 +143,8 @@ public sealed class WeatherSystem : SharedWeatherSystem weather.LastAlpha += (alpha - weather.LastAlpha) * AlphaLerpRate * frameTime; // Full volume if not on grid - stream.Source.SetVolumeDirect(weather.LastAlpha); - stream.Source.SetOcclusion(weather.LastOcclusion); + comp.Gain = weather.LastAlpha; + comp.Occlusion = weather.LastOcclusion; } protected override void EndWeather(EntityUid uid, WeatherComponent component, string proto) @@ -164,9 +167,8 @@ public sealed class WeatherSystem : SharedWeatherSystem return true; // TODO: Fades (properly) - weather.Stream?.Stop(); - weather.Stream = null; - weather.Stream = _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true); + weather.Stream = _audio.Stop(weather.Stream); + weather.Stream = _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true)?.Entity; return true; } diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs index 34692aa082..47c0d84977 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs @@ -6,6 +6,8 @@ using Content.Server.Destructible.Thresholds.Triggers; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameObjects; using Robust.Shared.Prototypes; using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes; diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs index 25171e1ea2..f59952afec 100644 --- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs +++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs @@ -619,6 +619,9 @@ public abstract partial class InteractionTest { foreach (var (proto, quantity) in expected.Entities) { + if (proto == "Audio") + continue; + if (quantity < 0 && failOnExcess) Assert.Fail($"Unexpected entity/stack: {proto}, quantity: {-quantity}"); diff --git a/Content.MapRenderer/Painters/DecalPainter.cs b/Content.MapRenderer/Painters/DecalPainter.cs index ffcd140a6e..f863595f9a 100644 --- a/Content.MapRenderer/Painters/DecalPainter.cs +++ b/Content.MapRenderer/Painters/DecalPainter.cs @@ -4,6 +4,7 @@ using System.IO; using Content.Shared.Decals; using Robust.Client.ResourceManagement; using Robust.Client.Utility; +using Robust.Shared.ContentPack; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -16,7 +17,7 @@ namespace Content.MapRenderer.Painters; public sealed class DecalPainter { - private readonly IResourceCache _cResourceCache; + private readonly IResourceManager _resManager; private readonly IPrototypeManager _sPrototypeManager; @@ -24,7 +25,7 @@ public sealed class DecalPainter public DecalPainter(ClientIntegrationInstance client, ServerIntegrationInstance server) { - _cResourceCache = client.ResolveDependency(); + _resManager = client.ResolveDependency(); _sPrototypeManager = server.ResolveDependency(); } @@ -63,7 +64,7 @@ public sealed class DecalPainter Stream stream; if (sprite is SpriteSpecifier.Texture texture) { - stream = _cResourceCache.ContentFileRead(texture.TexturePath); + stream = _resManager.ContentFileRead(texture.TexturePath); } else if (sprite is SpriteSpecifier.Rsi rsi) { @@ -73,7 +74,7 @@ public sealed class DecalPainter path = $"/Textures/{path}"; } - stream = _cResourceCache.ContentFileRead(path); + stream = _resManager.ContentFileRead(path); } else { diff --git a/Content.MapRenderer/Painters/EntityPainter.cs b/Content.MapRenderer/Painters/EntityPainter.cs index 79f2ed7679..de6b98711f 100644 --- a/Content.MapRenderer/Painters/EntityPainter.cs +++ b/Content.MapRenderer/Painters/EntityPainter.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; +using Robust.Shared.ContentPack; using Robust.Shared.GameObjects; using Robust.Shared.Timing; using SixLabors.ImageSharp; @@ -14,7 +15,7 @@ namespace Content.MapRenderer.Painters; public sealed class EntityPainter { - private readonly IResourceCache _cResourceCache; + private readonly IResourceManager _resManager; private readonly Dictionary<(string path, string state), Image> _images; private readonly Image _errorImage; @@ -23,12 +24,12 @@ public sealed class EntityPainter public EntityPainter(ClientIntegrationInstance client, ServerIntegrationInstance server) { - _cResourceCache = client.ResolveDependency(); + _resManager = client.ResolveDependency(); _sEntityManager = server.ResolveDependency(); _images = new Dictionary<(string path, string state), Image>(); - _errorImage = Image.Load(_cResourceCache.ContentFileRead("/Textures/error.rsi/error.png")); + _errorImage = Image.Load(_resManager.ContentFileRead("/Textures/error.rsi/error.png")); } public void Run(Image canvas, List entities) @@ -81,7 +82,7 @@ public sealed class EntityPainter if (!_images.TryGetValue(key, out image!)) { - var stream = _cResourceCache.ContentFileRead($"{rsi.Path}/{state.StateId}.png"); + var stream = _resManager.ContentFileRead($"{rsi.Path}/{state.StateId}.png"); image = Image.Load(stream); _images[key] = image; diff --git a/Content.MapRenderer/Painters/TilePainter.cs b/Content.MapRenderer/Painters/TilePainter.cs index 461bad9f21..cac0f960c4 100644 --- a/Content.MapRenderer/Painters/TilePainter.cs +++ b/Content.MapRenderer/Painters/TilePainter.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; +using Robust.Shared.ContentPack; using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -19,12 +20,12 @@ namespace Content.MapRenderer.Painters public const int TileImageSize = EyeManager.PixelsPerMeter; private readonly ITileDefinitionManager _sTileDefinitionManager; - private readonly IResourceCache _cResourceCache; + private readonly IResourceManager _resManager; public TilePainter(ClientIntegrationInstance client, ServerIntegrationInstance server) { _sTileDefinitionManager = server.ResolveDependency(); - _cResourceCache = client.ResolveDependency(); + _resManager = client.ResolveDependency(); } public void Run(Image gridCanvas, EntityUid gridUid, MapGridComponent grid) @@ -37,7 +38,7 @@ namespace Content.MapRenderer.Painters var yOffset = -bounds.Bottom; var tileSize = grid.TileSize * TileImageSize; - var images = GetTileImages(_sTileDefinitionManager, _cResourceCache, tileSize); + var images = GetTileImages(_sTileDefinitionManager, _resManager, tileSize); var i = 0; grid.GetAllTiles().AsParallel().ForAll(tile => @@ -61,7 +62,7 @@ namespace Content.MapRenderer.Painters private Dictionary> GetTileImages( ITileDefinitionManager tileDefinitionManager, - IResourceCache resourceCache, + IResourceManager resManager, int tileSize) { var stopwatch = new Stopwatch(); @@ -78,7 +79,7 @@ namespace Content.MapRenderer.Painters images[path] = new List(definition.Variants); - using var stream = resourceCache.ContentFileRead(path); + using var stream = resManager.ContentFileRead(path); Image tileSheet = Image.Load(stream); if (tileSheet.Width != tileSize * definition.Variants || tileSheet.Height != tileSize) diff --git a/Content.Packaging/Content.Packaging.csproj b/Content.Packaging/Content.Packaging.csproj index 82edfb4add..dcbac5066d 100644 --- a/Content.Packaging/Content.Packaging.csproj +++ b/Content.Packaging/Content.Packaging.csproj @@ -3,10 +3,11 @@ Exe enable enable + True - + diff --git a/Content.Packaging/ServerPackaging.cs b/Content.Packaging/ServerPackaging.cs index d75b425561..ba489629f7 100644 --- a/Content.Packaging/ServerPackaging.cs +++ b/Content.Packaging/ServerPackaging.cs @@ -1,15 +1,10 @@ using System.Diagnostics; -using System.Globalization; using System.IO.Compression; using Robust.Packaging; using Robust.Packaging.AssetProcessing; using Robust.Packaging.AssetProcessing.Passes; using Robust.Packaging.Utility; -using Robust.Shared.Audio; -using Robust.Shared.Serialization; using Robust.Shared.Timing; -using YamlDotNet.Core; -using YamlDotNet.RepresentationModel; namespace Content.Packaging; @@ -169,7 +164,7 @@ public static class ServerPackaging bool hybridAcz, CancellationToken cancel) { - var graph = new RobustClientAssetGraph(); + var graph = new RobustServerAssetGraph(); var passes = graph.AllPasses.ToList(); pass.Dependencies.Add(new AssetPassDependency(graph.Output.Name)); @@ -177,7 +172,8 @@ public static class ServerPackaging AssetGraph.CalculateGraph(passes, logger); - var inputPass = graph.Input; + var inputPassCore = graph.InputCore; + var inputPassResources = graph.InputResources; var contentAssemblies = new List(ServerContentAssemblies); // Additional assemblies that need to be copied such as EFCore. @@ -200,26 +196,26 @@ public static class ServerPackaging Path.Combine("RobustToolbox", "bin", "Server", platform.Rid, "publish"), - inputPass, + inputPassCore, BinSkipFolders, cancel: cancel); await RobustSharedPackaging.WriteContentAssemblies( - inputPass, + inputPassResources, contentDir, "Content.Server", contentAssemblies, - Path.Combine("Resources", "Assemblies"), - cancel); + cancel: cancel); - await RobustServerPackaging.WriteServerResources(contentDir, inputPass, cancel); + await RobustServerPackaging.WriteServerResources(contentDir, inputPassResources, cancel); if (hybridAcz) { - inputPass.InjectFileFromDisk("Content.Client.zip", Path.Combine("release", "SS14.Client.zip")); + inputPassCore.InjectFileFromDisk("Content.Client.zip", Path.Combine("release", "SS14.Client.zip")); } - inputPass.InjectFinished(); + inputPassCore.InjectFinished(); + inputPassResources.InjectFinished(); } private readonly record struct PlatformReg(string Rid, string TargetOs, bool BuildByDefault); diff --git a/Content.Server/Access/Systems/AccessOverriderSystem.cs b/Content.Server/Access/Systems/AccessOverriderSystem.cs index 147ac70a6d..41bb84ab6b 100644 --- a/Content.Server/Access/Systems/AccessOverriderSystem.cs +++ b/Content.Server/Access/Systems/AccessOverriderSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.DoAfter; using Content.Shared.Interaction; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; using static Content.Shared.Access.Components.AccessOverriderComponent; diff --git a/Content.Server/Administration/Systems/AdminSystem.cs b/Content.Server/Administration/Systems/AdminSystem.cs index feabaa2aad..cc31071fe8 100644 --- a/Content.Server/Administration/Systems/AdminSystem.cs +++ b/Content.Server/Administration/Systems/AdminSystem.cs @@ -26,6 +26,7 @@ using Content.Shared.Throwing; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Enums; using Robust.Shared.Network; @@ -39,7 +40,6 @@ namespace Content.Server.Administration.Systems [Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; - [Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly HandsSystem _hands = default!; [Dependency] private readonly SharedJobSystem _jobs = default!; [Dependency] private readonly InventorySystem _inventory = default!; @@ -49,6 +49,7 @@ namespace Content.Server.Administration.Systems [Dependency] private readonly PlayTimeTrackingManager _playTime = default!; [Dependency] private readonly SharedRoleSystem _role = default!; [Dependency] private readonly GameTicker _gameTicker = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly StationRecordsSystem _stationRecords = default!; [Dependency] private readonly TransformSystem _transform = default!; @@ -340,7 +341,7 @@ namespace Content.Server.Administration.Systems _popup.PopupCoordinates(Loc.GetString("admin-erase-popup", ("user", name)), coordinates, PopupType.LargeCaution); var filter = Filter.Pvs(coordinates, 1, EntityManager, _playerManager); var audioParams = new AudioParams().WithVolume(3); - _audio.Play("/Audio/Effects/pop_high.ogg", filter, coordinates, true, audioParams); + _audio.PlayStatic("/Audio/Effects/pop_high.ogg", filter, coordinates, true, audioParams); } foreach (var item in _inventory.GetHandOrInventoryEntities(entity.Value)) diff --git a/Content.Server/AlertLevel/AlertLevelSystem.cs b/Content.Server/AlertLevel/AlertLevelSystem.cs index 66e09d34e0..b2b63e618e 100644 --- a/Content.Server/AlertLevel/AlertLevelSystem.cs +++ b/Content.Server/AlertLevel/AlertLevelSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Chat.Systems; using Content.Server.Station.Systems; using Content.Shared.CCVar; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Prototypes; @@ -10,10 +11,11 @@ namespace Content.Server.AlertLevel; public sealed class AlertLevelSystem : EntitySystem { + [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly ChatSystem _chatSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly StationSystem _stationSystem = default!; - [Dependency] private readonly IConfigurationManager _cfg = default!; // Until stations are a prototype, this is how it's going to have to be. public const string DefaultAlertLevelSet = "stationAlerts"; @@ -174,7 +176,7 @@ public sealed class AlertLevelSystem : EntitySystem if (detail.Sound != null) { var filter = _stationSystem.GetInOwningStation(station); - SoundSystem.Play(detail.Sound.GetSound(), filter, detail.Sound.Params); + _audio.PlayGlobal(detail.Sound.GetSound(), filter, true, detail.Sound.Params); } else { diff --git a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs index 0dddff3637..2e46134504 100644 --- a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs +++ b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs @@ -16,6 +16,7 @@ using Content.Shared.Popups; using Robust.Server.Containers; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Timing; diff --git a/Content.Server/Ame/EntitySystems/AmePartSystem.cs b/Content.Server/Ame/EntitySystems/AmePartSystem.cs index 54a379f693..a75c092e2e 100644 --- a/Content.Server/Ame/EntitySystems/AmePartSystem.cs +++ b/Content.Server/Ame/EntitySystems/AmePartSystem.cs @@ -6,6 +6,8 @@ using Content.Server.Tools; using Content.Shared.Database; using Content.Shared.Hands.Components; using Content.Shared.Interaction; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; namespace Content.Server.Ame.EntitySystems; diff --git a/Content.Server/Animals/Systems/EggLayerSystem.cs b/Content.Server/Animals/Systems/EggLayerSystem.cs index 5189adb031..35c3bab01d 100644 --- a/Content.Server/Animals/Systems/EggLayerSystem.cs +++ b/Content.Server/Animals/Systems/EggLayerSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Actions.Events; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Storage; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Server/Anomaly/AnomalySynchronizerSystem.cs b/Content.Server/Anomaly/AnomalySynchronizerSystem.cs index 6e881aa3d1..59c1aa8565 100644 --- a/Content.Server/Anomaly/AnomalySynchronizerSystem.cs +++ b/Content.Server/Anomaly/AnomalySynchronizerSystem.cs @@ -5,6 +5,7 @@ using Content.Server.Power.EntitySystems; using Content.Shared.Anomaly.Components; using Content.Shared.Interaction; using Content.Shared.Popups; +using Robust.Shared.Audio.Systems; namespace Content.Server.Anomaly; diff --git a/Content.Server/Anomaly/AnomalySystem.Generator.cs b/Content.Server/Anomaly/AnomalySystem.Generator.cs index f1b147ac80..769558a7ad 100644 --- a/Content.Server/Anomaly/AnomalySystem.Generator.cs +++ b/Content.Server/Anomaly/AnomalySystem.Generator.cs @@ -81,7 +81,7 @@ public sealed partial class AnomalySystem var generating = EnsureComp(uid); generating.EndTime = Timing.CurTime + component.GenerationLength; - generating.AudioStream = Audio.PlayPvs(component.GeneratingSound, uid, AudioParams.Default.WithLoop(true)); + generating.AudioStream = Audio.PlayPvs(component.GeneratingSound, uid, AudioParams.Default.WithLoop(true))?.Entity; component.CooldownEndTime = Timing.CurTime + component.CooldownLength; UpdateGeneratorUi(uid, component); } @@ -174,7 +174,8 @@ public sealed partial class AnomalySystem { if (Timing.CurTime < active.EndTime) continue; - active.AudioStream?.Stop(); + + active.AudioStream = _audio.Stop(active.AudioStream); OnGeneratingFinished(ent, gen); } } diff --git a/Content.Server/Anomaly/AnomalySystem.cs b/Content.Server/Anomaly/AnomalySystem.cs index 5f6220f386..bb7a7304d9 100644 --- a/Content.Server/Anomaly/AnomalySystem.cs +++ b/Content.Server/Anomaly/AnomalySystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Anomaly; using Content.Shared.Anomaly.Components; using Content.Shared.DoAfter; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Physics.Events; using Robust.Shared.Prototypes; @@ -31,6 +33,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem [Dependency] private readonly SharedPointLightSystem _pointLight = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly RadioSystem _radio = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly UserInterfaceSystem _ui = default!; public const float MinParticleVariation = 0.8f; diff --git a/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs b/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs index d768f905ce..4233bfd7e1 100644 --- a/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs +++ b/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs @@ -13,5 +13,5 @@ public sealed partial class GeneratingAnomalyGeneratorComponent : Component [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan EndTime = TimeSpan.Zero; - public IPlayingAudioStream? AudioStream; + public EntityUid? AudioStream; } diff --git a/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs b/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs index 964a42234d..603396e31a 100644 --- a/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs @@ -4,6 +4,8 @@ using Content.Server.Anomaly.Components; using Content.Shared.Anomaly.Components; using Content.Shared.Mobs.Components; using Content.Shared.Teleportation.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Anomaly.Effects; diff --git a/Content.Server/Anomaly/Effects/ReagentProducerAnomalySystem.cs b/Content.Server/Anomaly/Effects/ReagentProducerAnomalySystem.cs index c87dcf4eae..487d20f43f 100644 --- a/Content.Server/Anomaly/Effects/ReagentProducerAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/ReagentProducerAnomalySystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Chemistry.EntitySystems; using Robust.Shared.Prototypes; using Content.Shared.Sprite; using Robust.Server.GameObjects; +using Robust.Shared.Audio.Systems; namespace Content.Server.Anomaly.Effects; @@ -75,7 +76,7 @@ public sealed class ReagentProducerAnomalySystem : EntitySystem if (anomaly.Severity >= 0.97) reagentProducingAmount *= component.SupercriticalReagentProducingModifier; newSol.AddReagent(component.ProducingReagent, reagentProducingAmount); - _solutionContainer.TryAddSolution(uid, producerSol, newSol); //TO DO - the container is not fully filled. + _solutionContainer.TryAddSolution(uid, producerSol, newSol); //TO DO - the container is not fully filled. component.AccumulatedFrametime = 0; diff --git a/Content.Server/Antag/AntagSelectionSystem.cs b/Content.Server/Antag/AntagSelectionSystem.cs index 737b723d39..b3b8a37508 100644 --- a/Content.Server/Antag/AntagSelectionSystem.cs +++ b/Content.Server/Antag/AntagSelectionSystem.cs @@ -21,6 +21,7 @@ using Content.Shared.Mobs.Components; using Content.Server.Station.Systems; using Content.Server.Shuttles.Systems; using Content.Shared.Mobs; +using Robust.Server.Audio; using Robust.Server.Containers; using Robust.Shared.Player; using Robust.Shared.Prototypes; diff --git a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs index 5e4d7d5ec6..eae9b94964 100644 --- a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs +++ b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs @@ -3,6 +3,7 @@ using Content.Server.UserInterface; using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Arcade.SpaceVillain; diff --git a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.cs b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.cs index 18dc32282b..ae4c15f2db 100644 --- a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.cs +++ b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.cs @@ -1,6 +1,7 @@ using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Arcade.SpaceVillain; diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index a649e57b45..2d6b073e9d 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -30,8 +30,8 @@ namespace Content.Server.Atmos.Components // Cancel toggles sounds if we re-toggle again. - public IPlayingAudioStream? ConnectStream; - public IPlayingAudioStream? DisconnectStream; + public EntityUid? ConnectStream; + public EntityUid? DisconnectStream; [DataField("air"), ViewVariables(VVAccess.ReadWrite)] public GasMixture Air { get; set; } = new(); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index 020684aa3b..989fed945f 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -101,8 +101,7 @@ namespace Content.Server.Atmos.EntitySystems if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound)) { var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager); - SoundSystem.Play(SpaceWindSound, Filter.Pvs(coordinates), - coordinates, AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100))); + _audio.PlayPvs(SpaceWindSound, coordinates, AudioParams.Default.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100))); } } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs index 1b44f6e819..5b3d869229 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs @@ -85,8 +85,7 @@ namespace Content.Server.Atmos.EntitySystems // A few details on the audio parameters for fire. // The greater the fire state, the lesser the pitch variation. // The greater the fire state, the greater the volume. - SoundSystem.Play(HotspotSound, Filter.Pvs(coordinates), - coordinates, AudioHelpers.WithVariation(0.15f/tile.Hotspot.State).WithVolume(-5f + 5f * tile.Hotspot.State)); + _audio.PlayPvs(HotspotSound, coordinates, AudioParams.Default.WithVariation(0.15f/tile.Hotspot.State).WithVolume(-5f + 5f * tile.Hotspot.State)); } if (_hotspotSoundCooldown > HotspotSoundCooldownCycles) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index d8364b652b..19855a71e5 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Atmos.EntitySystems; using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Physics.Systems; @@ -28,6 +30,7 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem [Dependency] private readonly SharedContainerSystem _containers = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly GasTileOverlaySystem _gasTileOverlaySystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly TileSystem _tile = default!; diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index e045b552a2..a0b85a26fa 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -20,6 +20,7 @@ using Content.Shared.Throwing; using Content.Shared.Timing; using Content.Shared.Toggleable; using Content.Shared.Weapons.Melee.Events; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index c91900fec2..881d27c585 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Verbs; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Physics.Systems; using Robust.Shared.Player; @@ -239,10 +240,8 @@ namespace Content.Server.Atmos.EntitySystems if (!component.IsConnected) return; - component.ConnectStream?.Stop(); - - if (component.ConnectSound != null) - component.ConnectStream = _audioSys.PlayPvs(component.ConnectSound, owner); + component.ConnectStream = _audioSys.Stop(component.ConnectStream); + component.ConnectStream = _audioSys.PlayPvs(component.ConnectSound, component.Owner)?.Entity; UpdateUserInterface(ent); } @@ -259,10 +258,8 @@ namespace Content.Server.Atmos.EntitySystems _actions.SetToggled(component.ToggleActionEntity, false); _internals.DisconnectTank(internals); - component.DisconnectStream?.Stop(); - - if (component.DisconnectSound != null) - component.DisconnectStream = _audioSys.PlayPvs(component.DisconnectSound, owner); + component.DisconnectStream = _audioSys.Stop(component.DisconnectStream); + component.DisconnectStream = _audioSys.PlayPvs(component.DisconnectSound, component.Owner)?.Entity; UpdateUserInterface(ent); } @@ -322,7 +319,7 @@ namespace Content.Server.Atmos.EntitySystems if(environment != null) _atmosphereSystem.Merge(environment, component.Air); - _audioSys.Play(component.RuptureSound, Filter.Pvs(owner), Transform(owner).Coordinates, true, AudioParams.Default.WithVariation(0.125f)); + _audioSys.PlayPvs(component.RuptureSound, Transform(component.Owner).Coordinates, AudioParams.Default.WithVariation(0.125f)); QueueDel(owner); return; diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs index b674f86442..27e64a9956 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs @@ -7,6 +7,7 @@ using Content.Server.DeviceNetwork.Systems; using Content.Server.Power.Components; using Content.Shared.Atmos.Monitor; using Content.Shared.Tag; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Utility; diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs index 914e732991..934ce8a7a4 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs @@ -8,6 +8,7 @@ using Content.Shared.Examine; using Content.Shared.Interaction; using JetBrains.Annotations; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Atmos.Piping.Binary.EntitySystems @@ -17,6 +18,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly NodeContainerSystem _nodeContainer = default!; public override void Initialize() @@ -35,10 +37,11 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems return; if (Loc.TryGetString("gas-valve-system-examined", out var str, - ("statusColor", valve.Open ? "green" : "orange"), - ("open", valve.Open) - )) + ("statusColor", valve.Open ? "green" : "orange"), + ("open", valve.Open))) + { args.PushMarkup(str); + } } private void OnStartup(EntityUid uid, GasValveComponent component, ComponentStartup args) @@ -50,7 +53,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args) { Toggle(uid, component); - SoundSystem.Play(component.ValveSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.25f)); + _audio.PlayPvs(component.ValveSound, uid, AudioParams.Default.WithVariation(0.25f)); } public void Set(EntityUid uid, GasValveComponent component, bool value) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index 14a1e5e456..1ec1bdb1c1 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -16,6 +16,8 @@ using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Lock; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; diff --git a/Content.Server/Audio/ContentAudioSystem.cs b/Content.Server/Audio/ContentAudioSystem.cs index b1e7dcb187..1c5625b0b8 100644 --- a/Content.Server/Audio/ContentAudioSystem.cs +++ b/Content.Server/Audio/ContentAudioSystem.cs @@ -1,8 +1,41 @@ +using Content.Server.GameTicking.Events; using Content.Shared.Audio; +using Robust.Server.Audio; +using Robust.Shared.Audio; +using Robust.Shared.Prototypes; namespace Content.Server.Audio; public sealed class ContentAudioSystem : SharedContentAudioSystem { + [Dependency] private readonly AudioSystem _serverAudio = default!; + [Dependency] private readonly IPrototypeManager _protoManager = default!; + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnRoundStart); + _protoManager.PrototypesReloaded += OnProtoReload; + } + + private void OnProtoReload(PrototypesReloadedEventArgs obj) + { + if (!obj.ByType.ContainsKey(typeof(AudioPresetPrototype))) + return; + + _serverAudio.ReloadPresets(); + } + + public override void Shutdown() + { + base.Shutdown(); + _protoManager.PrototypesReloaded -= OnProtoReload; + } + + private void OnRoundStart(RoundStartingEvent ev) + { + // On cleanup all entities get purged so need to ensure audio presets are still loaded + // yeah it's whacky af. + _serverAudio.ReloadPresets(); + } } diff --git a/Content.Server/Beam/BeamSystem.cs b/Content.Server/Beam/BeamSystem.cs index a9f994ed56..33f2f252d9 100644 --- a/Content.Server/Beam/BeamSystem.cs +++ b/Content.Server/Beam/BeamSystem.cs @@ -3,6 +3,8 @@ using Content.Server.Beam.Components; using Content.Shared.Beam; using Content.Shared.Beam.Components; using Content.Shared.Physics; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision.Shapes; diff --git a/Content.Server/Bed/Sleep/SleepingSystem.cs b/Content.Server/Bed/Sleep/SleepingSystem.cs index 17fe4d5eff..4a6874bccc 100644 --- a/Content.Server/Bed/Sleep/SleepingSystem.cs +++ b/Content.Server/Bed/Sleep/SleepingSystem.cs @@ -13,6 +13,8 @@ using Content.Shared.Slippery; using Content.Shared.StatusEffect; using Content.Shared.Stunnable; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/Bible/BibleSystem.cs b/Content.Server/Bible/BibleSystem.cs index b3b41e2f32..5c153bb464 100644 --- a/Content.Server/Bible/BibleSystem.cs +++ b/Content.Server/Bible/BibleSystem.cs @@ -15,6 +15,7 @@ using Content.Shared.Popups; using Content.Shared.Timing; using Content.Shared.Verbs; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; @@ -29,6 +30,7 @@ namespace Content.Server.Bible [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly UseDelaySystem _delay = default!; public override void Initialize() @@ -80,8 +82,8 @@ namespace Content.Server.Bible summonableComp.Summon = null; } summonableComp.AlreadySummoned = false; - _popupSystem.PopupEntity(Loc.GetString("bible-summon-respawn-ready", ("book", uid)), uid, PopupType.Medium); - SoundSystem.Play("/Audio/Effects/radpulse9.ogg", Filter.Pvs(uid), uid, AudioParams.Default.WithVolume(-4f)); + _popupSystem.PopupEntity(Loc.GetString("bible-summon-respawn-ready", ("book", summonableComp.Owner)), summonableComp.Owner, PopupType.Medium); + _audio.PlayPvs("/Audio/Effects/radpulse9.ogg", summonableComp.Owner, AudioParams.Default.WithVolume(-4f)); // Clean up the accumulator and respawn tracking component summonableComp.Accumulator = 0; _remQueue.Enqueue(uid); @@ -107,7 +109,7 @@ namespace Content.Server.Bible { _popupSystem.PopupEntity(Loc.GetString("bible-sizzle"), args.User, args.User); - SoundSystem.Play(component.SizzleSoundPath.GetSound(), Filter.Pvs(args.User), args.User); + _audio.PlayPvs(component.SizzleSoundPath, args.User); _damageableSystem.TryChangeDamage(args.User, component.DamageOnUntrainedUse, true, origin: uid); _delay.BeginDelay(uid, delay); @@ -125,7 +127,7 @@ namespace Content.Server.Bible var selfFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); _popupSystem.PopupEntity(selfFailMessage, args.User, args.User, PopupType.MediumCaution); - SoundSystem.Play("/Audio/Effects/hit_kick.ogg", Filter.Pvs(args.Target.Value), args.User); + _audio.PlayPvs("/Audio/Effects/hit_kick.ogg", args.User); _damageableSystem.TryChangeDamage(args.Target.Value, component.DamageOnFail, true, origin: uid); _delay.BeginDelay(uid, delay); return; @@ -149,7 +151,7 @@ namespace Content.Server.Bible var selfMessage = Loc.GetString(component.LocPrefix + "-heal-success-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); _popupSystem.PopupEntity(selfMessage, args.User, args.User, PopupType.Large); - SoundSystem.Play(component.HealSoundPath.GetSound(), Filter.Pvs(args.Target.Value), args.User); + _audio.PlayPvs(component.HealSoundPath, args.User); _delay.BeginDelay(uid, delay); } } diff --git a/Content.Server/Body/Systems/BloodstreamSystem.cs b/Content.Server/Body/Systems/BloodstreamSystem.cs index ddc32ab015..f1ab5702e5 100644 --- a/Content.Server/Body/Systems/BloodstreamSystem.cs +++ b/Content.Server/Body/Systems/BloodstreamSystem.cs @@ -20,6 +20,8 @@ using Content.Shared.Speech.EntitySystems; using Robust.Server.GameObjects; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using Content.Shared.Speech.EntitySystems; +using Robust.Server.Audio; namespace Content.Server.Body.Systems; diff --git a/Content.Server/Body/Systems/BodySystem.cs b/Content.Server/Body/Systems/BodySystem.cs index 242b02d78c..763e53de00 100644 --- a/Content.Server/Body/Systems/BodySystem.cs +++ b/Content.Server/Body/Systems/BodySystem.cs @@ -15,6 +15,7 @@ using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; using System.Numerics; +using Robust.Shared.Audio.Systems; namespace Content.Server.Body.Systems; @@ -129,7 +130,7 @@ public sealed class BodySystem : SharedBodySystem var filter = Filter.Pvs(bodyId, entityManager: EntityManager); var audio = AudioParams.Default.WithVariation(0.025f); - _audio.Play(body.GibSound, filter, coordinates, true, audio); + _audio.PlayStatic(body.GibSound, filter, coordinates, true, audio); foreach (var entity in gibs) { diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index 817064c651..027ca9b038 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Random; using Content.Shared.Tag; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/CardboardBox/CardboardBoxSystem.cs b/Content.Server/CardboardBox/CardboardBoxSystem.cs index df9743a21a..83445d2ae4 100644 --- a/Content.Server/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Server/CardboardBox/CardboardBoxSystem.cs @@ -10,6 +10,8 @@ using Content.Shared.Stealth; using Content.Shared.Stealth.Components; using Content.Shared.Storage.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Timing; diff --git a/Content.Server/Cargo/Systems/CargoSystem.cs b/Content.Server/Cargo/Systems/CargoSystem.cs index 32b63f7105..51cfc9791c 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.cs @@ -13,6 +13,8 @@ using Content.Shared.Containers.ItemSlots; using Content.Shared.Mobs.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Prototypes; diff --git a/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs b/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs index b115e658bb..f01be1fc71 100644 --- a/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs +++ b/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.CartridgeLoader; using Content.Shared.CartridgeLoader.Cartridges; using Content.Shared.Popups; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 578444a464..5fcbf6a051 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -21,6 +21,7 @@ using Content.Shared.Players; using Content.Shared.Radio; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Console; using Robust.Shared.Network; @@ -322,7 +323,7 @@ public sealed partial class ChatSystem : SharedChatSystem _chatManager.ChatMessageToAll(ChatChannel.Radio, message, wrappedMessage, default, false, true, colorOverride); if (playSound) { - SoundSystem.Play(announcementSound?.GetSound() ?? DefaultAnnouncementSound, Filter.Broadcast(), AudioParams.Default.WithVolume(-2f)); + _audio.PlayGlobal(announcementSound?.GetSound() ?? DefaultAnnouncementSound, Filter.Broadcast(), true, AudioParams.Default.WithVolume(-2f)); } _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Global station announcement from {sender}: {message}"); } @@ -360,7 +361,7 @@ public sealed partial class ChatSystem : SharedChatSystem if (playDefaultSound) { - SoundSystem.Play(announcementSound?.GetSound() ?? DefaultAnnouncementSound, filter, AudioParams.Default.WithVolume(-2f)); + _audio.PlayGlobal(announcementSound?.GetSound() ?? DefaultAnnouncementSound, filter, true, AudioParams.Default.WithVolume(-2f)); } _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement on {station} from {sender}: {message}"); diff --git a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs index 5e4ba355cf..5b91d9456b 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs @@ -14,6 +14,7 @@ using Content.Shared.Database; using Content.Shared.FixedPoint; using Content.Shared.Storage; using JetBrains.Annotations; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; diff --git a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs index fc4ea0a0b2..759d403ace 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Chemistry; using Content.Shared.Chemistry.EntitySystems; using Content.Shared.DoAfter; using Content.Shared.Mobs.Systems; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Chemistry.EntitySystems; diff --git a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs index daa2ac80b7..3768ee1051 100644 --- a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs @@ -10,6 +10,7 @@ using Content.Shared.Database; using Content.Shared.Emag.Components; using Content.Shared.Emag.Systems; using JetBrains.Annotations; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; diff --git a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs index 291a654422..fc807069f7 100644 --- a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs @@ -8,6 +8,7 @@ using Content.Shared.FixedPoint; using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; @@ -72,7 +73,8 @@ namespace Content.Server.Chemistry.ReactionEffects var smoke = args.EntityManager.System(); smoke.StartSmoke(ent, splitSolution, _duration, spreadAmount); - args.EntityManager.System().PlayPvs(_sound, args.SolutionEntity, AudioHelpers.WithVariation(0.125f)); + var audio = args.EntityManager.System(); + audio.PlayPvs(_sound, args.SolutionEntity, AudioHelpers.WithVariation(0.125f)); } } } diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 6d34e0e6f7..8bfd6250ef 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -29,6 +29,8 @@ using Content.Shared.Roles.Jobs; using Robust.Server.Containers; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Containers; using Robust.Shared.Physics.Components; diff --git a/Content.Server/Cluwne/CluwneSystem.cs b/Content.Server/Cluwne/CluwneSystem.cs index 9ce50137bf..c170886a80 100644 --- a/Content.Server/Cluwne/CluwneSystem.cs +++ b/Content.Server/Cluwne/CluwneSystem.cs @@ -14,6 +14,8 @@ using Content.Server.Emoting.Systems; using Content.Server.Speech.EntitySystems; using Content.Shared.Cluwne; using Content.Shared.Interaction.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Cluwne; diff --git a/Content.Server/Construction/Completions/PlaySound.cs b/Content.Server/Construction/Completions/PlaySound.cs index 9fa3c43ae4..50b705ddfe 100644 --- a/Content.Server/Construction/Completions/PlaySound.cs +++ b/Content.Server/Construction/Completions/PlaySound.cs @@ -1,6 +1,7 @@ using Content.Shared.Construction; using JetBrains.Annotations; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Construction.Completions diff --git a/Content.Server/Construction/Components/PartExchangerComponent.cs b/Content.Server/Construction/Components/PartExchangerComponent.cs index 6cf32a5e46..a2579c92e8 100644 --- a/Content.Server/Construction/Components/PartExchangerComponent.cs +++ b/Content.Server/Construction/Components/PartExchangerComponent.cs @@ -25,5 +25,5 @@ public sealed partial class PartExchangerComponent : Component [DataField("exchangeSound")] public SoundSpecifier ExchangeSound = new SoundPathSpecifier("/Audio/Items/rped.ogg"); - public IPlayingAudioStream? AudioStream; + public EntityUid? AudioStream; } diff --git a/Content.Server/Construction/PartExchangerSystem.cs b/Content.Server/Construction/PartExchangerSystem.cs index 4b543a0247..75629146a4 100644 --- a/Content.Server/Construction/PartExchangerSystem.cs +++ b/Content.Server/Construction/PartExchangerSystem.cs @@ -10,6 +10,8 @@ using Content.Shared.Storage; using Robust.Shared.Containers; using Robust.Shared.Utility; using Content.Shared.Wires; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Collections; namespace Content.Server.Construction; @@ -34,7 +36,7 @@ public sealed class PartExchangerSystem : EntitySystem { if (args.Cancelled) { - component.AudioStream?.Stop(); + component.AudioStream = _audio.Stop(component.AudioStream); return; } @@ -168,7 +170,7 @@ public sealed class PartExchangerSystem : EntitySystem return; } - component.AudioStream = _audio.PlayPvs(component.ExchangeSound, uid); + component.AudioStream = _audio.PlayPvs(component.ExchangeSound, uid).Value.Entity; _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ExchangeDuration, new ExchangerDoAfterEvent(), uid, target: args.Target, used: uid) { diff --git a/Content.Server/Crayon/CrayonSystem.cs b/Content.Server/Crayon/CrayonSystem.cs index 16385d4d7e..32bb96e9e2 100644 --- a/Content.Server/Crayon/CrayonSystem.cs +++ b/Content.Server/Crayon/CrayonSystem.cs @@ -11,6 +11,7 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameStates; using Robust.Shared.Player; using Robust.Shared.Prototypes; diff --git a/Content.Server/Defusable/Systems/DefusableSystem.cs b/Content.Server/Defusable/Systems/DefusableSystem.cs index ca5c6f5a09..e9b074268f 100644 --- a/Content.Server/Defusable/Systems/DefusableSystem.cs +++ b/Content.Server/Defusable/Systems/DefusableSystem.cs @@ -12,6 +12,8 @@ using Content.Shared.Popups; using Content.Shared.Verbs; using Content.Shared.Wires; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Defusable.Systems; diff --git a/Content.Server/Destructible/DestructibleSystem.cs b/Content.Server/Destructible/DestructibleSystem.cs index 74e88292df..7e43e72007 100644 --- a/Content.Server/Destructible/DestructibleSystem.cs +++ b/Content.Server/Destructible/DestructibleSystem.cs @@ -15,6 +15,7 @@ using Content.Shared.Database; using Content.Shared.Destructible; using Content.Shared.FixedPoint; using JetBrains.Annotations; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Containers; using Robust.Shared.Prototypes; diff --git a/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs index 74a4cdfb1b..26ba01c359 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs @@ -1,5 +1,6 @@ using Content.Shared.Audio; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Destructible.Thresholds.Behaviors diff --git a/Content.Server/DeviceLinking/Systems/DeviceLinkOverloadSystem.cs b/Content.Server/DeviceLinking/Systems/DeviceLinkOverloadSystem.cs index 8f4bade83a..8ca6fd75c2 100644 --- a/Content.Server/DeviceLinking/Systems/DeviceLinkOverloadSystem.cs +++ b/Content.Server/DeviceLinking/Systems/DeviceLinkOverloadSystem.cs @@ -1,6 +1,7 @@ using Content.Server.DeviceLinking.Components; using Content.Server.DeviceLinking.Components.Overload; using Content.Server.DeviceLinking.Events; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; diff --git a/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs b/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs index 5641b0b4ae..60d13b78fc 100644 --- a/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs +++ b/Content.Server/DeviceLinking/Systems/LogicGateSystem.cs @@ -5,7 +5,9 @@ using Content.Shared.Examine; using Content.Shared.Interaction; using Content.Shared.Tools; using Content.Shared.Popups; -using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem; +using Content.Shared.Tools.Systems; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using SignalReceivedEvent = Content.Server.DeviceLinking.Events.SignalReceivedEvent; namespace Content.Server.DeviceLinking.Systems; diff --git a/Content.Server/DeviceLinking/Systems/SignalSwitchSystem.cs b/Content.Server/DeviceLinking/Systems/SignalSwitchSystem.cs index 7bcc438b92..f6469d68b9 100644 --- a/Content.Server/DeviceLinking/Systems/SignalSwitchSystem.cs +++ b/Content.Server/DeviceLinking/Systems/SignalSwitchSystem.cs @@ -2,6 +2,7 @@ using Content.Server.DeviceLinking.Components; using Content.Server.DeviceNetwork; using Content.Shared.Interaction; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.DeviceLinking.Systems; diff --git a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs index 3a7fd6bec9..63bf5854d9 100644 --- a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs +++ b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs @@ -4,6 +4,8 @@ using Content.Shared.Access.Systems; using Content.Shared.MachineLinking; using Content.Shared.TextScreen; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Server.DeviceLinking.Systems; diff --git a/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs b/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs index a977a44287..4deb08ec3d 100644 --- a/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs @@ -15,6 +15,7 @@ using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Verbs; using JetBrains.Annotations; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; diff --git a/Content.Server/Dice/DiceSystem.cs b/Content.Server/Dice/DiceSystem.cs index beb2a28489..2d13679bd0 100644 --- a/Content.Server/Dice/DiceSystem.cs +++ b/Content.Server/Dice/DiceSystem.cs @@ -1,6 +1,8 @@ using Content.Shared.Dice; using Content.Shared.Popups; using JetBrains.Annotations; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Dice; diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index 33b260aa94..2bf00c5008 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Hands.Components; using Content.Shared.Movement.Events; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Physics; diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs index 7c4827f8c8..0811be059b 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs @@ -8,6 +8,7 @@ using Content.Shared.Damage; using Content.Shared.Item; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Components; diff --git a/Content.Server/Dragon/DragonRiftSystem.cs b/Content.Server/Dragon/DragonRiftSystem.cs index 52137f2ee6..f7d5cd783d 100644 --- a/Content.Server/Dragon/DragonRiftSystem.cs +++ b/Content.Server/Dragon/DragonRiftSystem.cs @@ -11,6 +11,8 @@ using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Serialization.Manager; using System.Numerics; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Dragon; diff --git a/Content.Server/Dragon/DragonSystem.cs b/Content.Server/Dragon/DragonSystem.cs index ed17ba8bdc..93d6bc8db0 100644 --- a/Content.Server/Dragon/DragonSystem.cs +++ b/Content.Server/Dragon/DragonSystem.cs @@ -10,6 +10,8 @@ using Content.Shared.Mind; using Content.Shared.Mind.Components; using Content.Shared.Mobs; using Content.Shared.Movement.Systems; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Player; @@ -203,7 +205,7 @@ public sealed partial class DragonSystem : EntitySystem private void Roar(EntityUid uid, DragonComponent comp) { if (comp.SoundRoar != null) - _audio.Play(comp.SoundRoar, Filter.Pvs(uid, 4f, EntityManager), uid, true); + _audio.PlayPvs(comp.SoundRoar, uid); } /// diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index 8ddc8540c0..4dc4f198a5 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -26,6 +26,7 @@ using Content.Shared.Stunnable; using Content.Shared.Tag; using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Physics.Events; using Robust.Shared.Player; diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs index 08374d7392..ef8e1ffd98 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs @@ -50,11 +50,11 @@ public sealed partial class ExplosionSystem : EntitySystem comp.Intensity = iterationIntensity; comp.SpaceMatrix = spaceMatrix; comp.SpaceTileSize = spaceData?.TileSize ?? DefaultTileSize; - Dirty(comp); + Dirty(explosionEntity, comp); // Light, sound & visuals may extend well beyond normal PVS range. In principle, this should probably still be // restricted to something like the same map, but whatever. - _pvsSys.AddGlobalOverride(explosionEntity); + _pvsSys.AddGlobalOverride(GetNetEntity(explosionEntity)); var appearance = AddComp(explosionEntity); _appearance.SetData(explosionEntity, ExplosionAppearanceData.Progress, 1, appearance); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index be62aeb5ed..a246b94085 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -20,6 +20,7 @@ using Content.Shared.Throwing; using Robust.Server.GameStates; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Physics.Components; @@ -48,6 +49,7 @@ public sealed partial class ExplosionSystem : EntitySystem [Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!; [Dependency] private readonly PvsOverrideSystem _pvsSys = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!; [Dependency] private readonly SharedMapSystem _map = default!; @@ -333,7 +335,7 @@ public sealed partial class ExplosionSystem : EntitySystem // play sound. var audioRange = iterationIntensity.Count * 5; var filter = Filter.Pvs(epicenter).AddInRange(epicenter, audioRange); - SoundSystem.Play(type.Sound.GetSound(), filter, mapEntityCoords, _audioParams); + _audio.PlayStatic(type.Sound.GetSound(), filter, mapEntityCoords, true, _audioParams); return new Explosion(this, type, diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index b57e9bd298..854fa7f661 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -24,6 +24,7 @@ using Robust.Shared.Physics.Systems; using Content.Shared.Mobs; using Content.Shared.Mobs.Components; using Content.Shared.Weapons.Ranged.Events; +using Robust.Shared.Audio.Systems; namespace Content.Server.Explosion.EntitySystems { diff --git a/Content.Server/Extinguisher/FireExtinguisherSystem.cs b/Content.Server/Extinguisher/FireExtinguisherSystem.cs index 7b96b8b921..30895deb4c 100644 --- a/Content.Server/Extinguisher/FireExtinguisherSystem.cs +++ b/Content.Server/Extinguisher/FireExtinguisherSystem.cs @@ -9,6 +9,7 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Verbs; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Extinguisher; @@ -18,6 +19,7 @@ public sealed class FireExtinguisherSystem : EntitySystem [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -86,7 +88,7 @@ public sealed class FireExtinguisherSystem : EntitySystem var drained = _solutionContainerSystem.Drain(target, targetSolution, transfer); _solutionContainerSystem.TryAddSolution(uid, container, drained); - SoundSystem.Play(component.RefillSound.GetSound(), Filter.Pvs(uid), uid); + _audio.PlayPvs(component.RefillSound, uid); _popupSystem.PopupEntity(Loc.GetString("fire-extinguisher-component-after-interact-refilled-message", ("owner", uid)), uid, args.Target.Value); } @@ -135,8 +137,7 @@ public sealed class FireExtinguisherSystem : EntitySystem return; extinguisher.Safety = !extinguisher.Safety; - SoundSystem.Play(extinguisher.SafetySound.GetSound(), Filter.Pvs(uid), - uid, AudioHelpers.WithVariation(0.125f).WithVolume(-4f)); + _audio.PlayPvs(extinguisher.SafetySound, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-4f)); UpdateAppearance(uid, extinguisher); } } diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index ec95d71dcf..647f73bad3 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Interaction; using Content.Shared.Paper; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index bc2c4ddaba..29d603bfc6 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -15,6 +15,7 @@ using Content.Shared.Physics; using Content.Shared.Tag; using Content.Shared.Traits.Assorted; using Content.Shared.Weapons.Melee.Events; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; @@ -172,7 +173,7 @@ namespace Content.Server.Flash } if (sound != null) { - SoundSystem.Play(sound.GetSound(), Filter.Pvs(transform), source); + _audio.PlayPvs(sound, source); } } diff --git a/Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs b/Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs index 7483199bc6..55f56ab9d1 100644 --- a/Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs +++ b/Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Fluids.Components; using Content.Shared.Interaction; using Content.Shared.Timing; using Content.Shared.Weapons.Melee; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Map; using Robust.Shared.Prototypes; diff --git a/Content.Server/Fluids/EntitySystems/DrainSystem.cs b/Content.Server/Fluids/EntitySystems/DrainSystem.cs index ea3df2f8c4..505ce71261 100644 --- a/Content.Server/Fluids/EntitySystems/DrainSystem.cs +++ b/Content.Server/Fluids/EntitySystems/DrainSystem.cs @@ -13,6 +13,9 @@ using Content.Shared.Fluids.Components; using Content.Shared.Interaction; using Content.Shared.Tag; using Content.Shared.Verbs; +using Content.Shared.Fluids.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Collections; using Robust.Shared.Random; using Robust.Shared.Utility; diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index b56e1f9308..05d0809bb2 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -30,6 +30,11 @@ using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; +using Content.Shared.Movement.Components; +using Content.Shared.Movement.Systems; +using Content.Shared.Maps; +using Content.Shared.Effects; +using Robust.Server.Audio; namespace Content.Server.Fluids.EntitySystems; @@ -446,8 +451,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem return true; } - SoundSystem.Play(puddleComponent.SpillSound.GetSound(), - Filter.Pvs(puddleUid), puddleUid); + _audio.PlayPvs(puddleComponent.SpillSound, puddleUid); return true; } diff --git a/Content.Server/Fluids/EntitySystems/SpraySystem.cs b/Content.Server/Fluids/EntitySystems/SpraySystem.cs index f0afd43dd2..1b87b3ef24 100644 --- a/Content.Server/Fluids/EntitySystems/SpraySystem.cs +++ b/Content.Server/Fluids/EntitySystems/SpraySystem.cs @@ -12,6 +12,8 @@ using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Vapor; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Physics.Components; using Robust.Shared.Prototypes; using Robust.Shared.Timing; diff --git a/Content.Server/Forensics/Systems/ForensicScannerSystem.cs b/Content.Server/Forensics/Systems/ForensicScannerSystem.cs index acf7cbd80d..a073574e1d 100644 --- a/Content.Server/Forensics/Systems/ForensicScannerSystem.cs +++ b/Content.Server/Forensics/Systems/ForensicScannerSystem.cs @@ -8,6 +8,7 @@ using Content.Shared.Forensics; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Verbs; +using Robust.Shared.Audio.Systems; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; diff --git a/Content.Server/GameTicking/GameTicker.Player.cs b/Content.Server/GameTicking/GameTicker.Player.cs index d994faec66..a333e68d05 100644 --- a/Content.Server/GameTicking/GameTicker.Player.cs +++ b/Content.Server/GameTicking/GameTicker.Player.cs @@ -32,7 +32,7 @@ namespace Content.Server.GameTicking if (args.NewStatus != SessionStatus.Disconnected) { mind.Session = session; - _pvsOverride.AddSessionOverride(mindId.Value, session); + _pvsOverride.AddSessionOverride(GetNetEntity(mindId.Value), session); } DebugTools.Assert(mind.Session == session); @@ -120,7 +120,7 @@ namespace Content.Server.GameTicking _chatManager.SendAdminAnnouncement(Loc.GetString("player-leave-message", ("name", args.Session.Name))); if (mind != null) { - _pvsOverride.ClearOverride(mindId!.Value); + _pvsOverride.ClearOverride(GetNetEntity(mindId!.Value)); mind.Session = null; } diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 1d35413662..7efcf796ad 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -362,7 +362,7 @@ namespace Content.Server.GameTicking playerIcName = icName; if (TryGetEntity(mind.OriginalOwnedEntity, out var entity)) - _pvsOverride.AddGlobalOverride(entity.Value, recursive: true); + _pvsOverride.AddGlobalOverride(GetNetEntity(entity.Value), recursive: true); var roles = _roles.MindGetAllRoles(mindId); @@ -611,7 +611,7 @@ namespace Content.Server.GameTicking _chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true); if (proto.Sound != null) - SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast()); + _audio.PlayGlobal(proto.Sound, Filter.Broadcast(), true); } private async void SendRoundStartedDiscordMessage() diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 14819fb0ac..8da271e1a8 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -19,6 +19,8 @@ using Content.Shared.Roles; using Robust.Server; using Robust.Server.GameObjects; using Robust.Server.GameStates; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Console; using Robust.Shared.Map; @@ -61,6 +63,7 @@ namespace Content.Server.GameTicking [Dependency] private readonly PlayTimeTrackingSystem _playTimeTrackings = default!; [Dependency] private readonly PvsOverrideSystem _pvsOverride = default!; [Dependency] private readonly ServerUpdateManager _serverUpdates = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly StationJobsSystem _stationJobs = default!; [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index 2c3136d577..c1773b3140 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -45,6 +45,7 @@ using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Prototypes; diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index f94fbace9c..1c04835c55 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -16,6 +16,9 @@ using Content.Shared.Preferences; using Content.Shared.Roles; using Robust.Server.GameObjects; using Robust.Server.Maps; +using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Enums; using Robust.Shared.Map; diff --git a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs index e58fe2275d..13369ff8d0 100644 --- a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs @@ -24,6 +24,7 @@ using Content.Shared.Revolutionary.Components; using Content.Shared.Roles; using Content.Shared.Stunnable; using Content.Shared.Zombies; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Timing; diff --git a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs index 52a5881083..60a35d704b 100644 --- a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs @@ -17,6 +17,9 @@ using Content.Shared.PDA; using Content.Shared.Preferences; using Content.Shared.Roles; using Content.Shared.Roles.Jobs; +using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Prototypes; diff --git a/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs b/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs index a4febc385c..f4319815a7 100644 --- a/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/ZombieRuleSystem.cs @@ -22,6 +22,8 @@ using Content.Shared.Roles; using Content.Shared.Zombies; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Server/Gateway/Systems/GatewaySystem.cs b/Content.Server/Gateway/Systems/GatewaySystem.cs index 34ca80eaf5..d05cca3af6 100644 --- a/Content.Server/Gateway/Systems/GatewaySystem.cs +++ b/Content.Server/Gateway/Systems/GatewaySystem.cs @@ -8,6 +8,9 @@ using Content.Shared.Teleportation.Components; using Content.Shared.Teleportation.Systems; using Content.Shared.Verbs; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; +using Robust.Shared.GameObjects; using Robust.Shared.Timing; using Robust.Shared.Utility; diff --git a/Content.Server/Gatherable/GatherableSystem.cs b/Content.Server/Gatherable/GatherableSystem.cs index 4f7d19b0a8..7fbbf7f4f6 100644 --- a/Content.Server/Gatherable/GatherableSystem.cs +++ b/Content.Server/Gatherable/GatherableSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Interaction; using Content.Shared.Tag; using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/Glue/GlueSystem.cs b/Content.Server/Glue/GlueSystem.cs index eaf95a1f1d..58eed00c49 100644 --- a/Content.Server/Glue/GlueSystem.cs +++ b/Content.Server/Glue/GlueSystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Database; using Content.Shared.Hands; using Robust.Shared.Timing; using Content.Shared.Interaction.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Glue; diff --git a/Content.Server/Guardian/GuardianSystem.cs b/Content.Server/Guardian/GuardianSystem.cs index 2847b45ba1..1b3cbd1fc3 100644 --- a/Content.Server/Guardian/GuardianSystem.cs +++ b/Content.Server/Guardian/GuardianSystem.cs @@ -13,6 +13,8 @@ using Content.Shared.Interaction.Events; using Content.Shared.Mobs; using Content.Shared.Popups; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Utility; @@ -217,8 +219,7 @@ namespace Content.Server.Guardian if (TryComp(guardian, out var guardianComp)) { guardianComp.Host = args.Args.Target.Value; - // TODO this should be a data field, not a hardcoded path - _audio.Play("/Audio/Effects/guardian_inject.ogg", Filter.Pvs(args.Args.Target.Value), args.Args.Target.Value, true); + _audio.PlayPvs("/Audio/Effects/guardian_inject.ogg", args.Args.Target.Value); _popupSystem.PopupEntity(Loc.GetString("guardian-created"), args.Args.Target.Value, args.Args.Target.Value); // Exhaust the activator component.Used = true; @@ -243,13 +244,12 @@ namespace Content.Server.Guardian if (args.NewMobState == MobState.Critical) { _popupSystem.PopupEntity(Loc.GetString("guardian-host-critical-warn"), component.HostedGuardian.Value, component.HostedGuardian.Value); - // TODO this should be a data field, not a hardcoded path - _audio.Play("/Audio/Effects/guardian_warn.ogg", Filter.Pvs(component.HostedGuardian.Value), component.HostedGuardian.Value, true); + _audio.PlayPvs("/Audio/Effects/guardian_warn.ogg", component.HostedGuardian.Value); } else if (args.NewMobState == MobState.Dead) { //TODO: Replace WithVariation with datafield - _audio.Play("/Audio/Voice/Human/malescream_guardian.ogg", Filter.Pvs(uid), uid, true, AudioHelpers.WithVariation(0.20f)); + _audio.PlayPvs("/Audio/Voice/Human/malescream_guardian.ogg", uid, AudioParams.Default.WithVariation(0.20f)); RemComp(uid); } } diff --git a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs index 4581d378f6..40b365105d 100644 --- a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs +++ b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Database; using Content.Shared.Examine; using Content.Shared.Interaction.Events; using Content.Shared.Item; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Components; diff --git a/Content.Server/IgnitionSource/IgniteOnTriggerSystem.cs b/Content.Server/IgnitionSource/IgniteOnTriggerSystem.cs index 256a857864..d80d7ecbfc 100644 --- a/Content.Server/IgnitionSource/IgniteOnTriggerSystem.cs +++ b/Content.Server/IgnitionSource/IgniteOnTriggerSystem.cs @@ -1,6 +1,7 @@ using Content.Server.Explosion.EntitySystems; using Content.Shared.Timing; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Server.IgnitionSource; diff --git a/Content.Server/ImmovableRod/ImmovableRodSystem.cs b/Content.Server/ImmovableRod/ImmovableRodSystem.cs index d688941abf..0fa8f7d292 100644 --- a/Content.Server/ImmovableRod/ImmovableRodSystem.cs +++ b/Content.Server/ImmovableRod/ImmovableRodSystem.cs @@ -3,6 +3,8 @@ using Content.Server.Popups; using Content.Shared.Body.Components; using Content.Shared.Examine; using Content.Shared.Popups; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; diff --git a/Content.Server/Interaction/InteractionPopupSystem.cs b/Content.Server/Interaction/InteractionPopupSystem.cs index 86158fb7a8..474284cf80 100644 --- a/Content.Server/Interaction/InteractionPopupSystem.cs +++ b/Content.Server/Interaction/InteractionPopupSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Interaction; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -18,6 +19,7 @@ public sealed class InteractionPopupSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -41,15 +43,17 @@ public sealed class InteractionPopupSystem : EntitySystem if (curTime < component.LastInteractTime + component.InteractDelay) return; - if (TryComp(uid, out var state) // if it has a MobStateComponent, - && !_mobStateSystem.IsAlive(uid, state)) // AND if that state is not Alive (e.g. dead/incapacitated/critical) + if (TryComp(uid, out var state) + && !_mobStateSystem.IsAlive(uid, state)) + { return; + } // TODO: Should be an attempt event // TODO: Need to handle pausing with an accumulator. string msg = ""; // Stores the text to be shown in the popup message - string? sfx = null; // Stores the filepath of the sound to be played + SoundSpecifier? sfx = null; // Stores the filepath of the sound to be played if (_random.Prob(component.SuccessChance)) { @@ -57,7 +61,7 @@ public sealed class InteractionPopupSystem : EntitySystem msg = Loc.GetString(component.InteractSuccessString, ("target", Identity.Entity(uid, EntityManager))); // Success message (localized). if (component.InteractSuccessSound != null) - sfx = component.InteractSuccessSound.GetSound(); + sfx = component.InteractSuccessSound; if (component.InteractSuccessSpawn != null) Spawn(component.InteractSuccessSpawn, Transform(uid).MapPosition); @@ -68,7 +72,7 @@ public sealed class InteractionPopupSystem : EntitySystem msg = Loc.GetString(component.InteractFailureString, ("target", Identity.Entity(uid, EntityManager))); // Failure message (localized). if (component.InteractFailureSound != null) - sfx = component.InteractFailureSound.GetSound(); + sfx = component.InteractFailureSound; if (component.InteractFailureSpawn != null) Spawn(component.InteractFailureSpawn, Transform(uid).MapPosition); @@ -76,7 +80,7 @@ public sealed class InteractionPopupSystem : EntitySystem if (component.MessagePerceivedByOthers != null) { - string msgOthers = Loc.GetString(component.MessagePerceivedByOthers, + var msgOthers = Loc.GetString(component.MessagePerceivedByOthers, ("user", Identity.Entity(args.User, EntityManager)), ("target", Identity.Entity(uid, EntityManager))); _popupSystem.PopupEntity(msg, uid, args.User); _popupSystem.PopupEntity(msgOthers, uid, Filter.PvsExcept(args.User, entityManager: EntityManager), true); @@ -87,9 +91,9 @@ public sealed class InteractionPopupSystem : EntitySystem if (sfx is not null) //not all cases will have sound. { if (component.SoundPerceivedByOthers) - SoundSystem.Play(sfx, Filter.Pvs(args.Target), args.Target); //play for everyone in range + _audio.PlayPvs(sfx, args.Target); //play for everyone in range else - SoundSystem.Play(sfx, Filter.Entities(args.User, args.Target), args.Target); //play only for the initiating entity and its target. + _audio.PlayEntity(sfx, Filter.Entities(args.User, args.Target), args.Target, true); //play only for the initiating entity and its target. } component.LastInteractTime = curTime; diff --git a/Content.Server/Item/ItemToggleSystem.cs b/Content.Server/Item/ItemToggleSystem.cs index 5610582007..fb72148b88 100644 --- a/Content.Server/Item/ItemToggleSystem.cs +++ b/Content.Server/Item/ItemToggleSystem.cs @@ -4,6 +4,8 @@ using Content.Shared.Interaction.Events; using Content.Shared.Item; using Content.Shared.Toggleable; using Content.Shared.Tools.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Weapons.Melee.ItemToggle; @@ -53,7 +55,7 @@ public sealed class ItemToggleSystem : EntitySystem if (TryComp(uid, out var malus)) malus.Malus -= comp.ActivatedDisarmMalus; - _audio.Play(comp.DeActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.DeActivateSound.Params); + _audio.PlayEntity(comp.DeActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.DeActivateSound.Params); comp.Activated = false; } @@ -66,7 +68,7 @@ public sealed class ItemToggleSystem : EntitySystem if (TryComp(uid, out var malus)) malus.Malus += comp.ActivatedDisarmMalus; - _audio.Play(comp.ActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.ActivateSound.Params); + _audio.PlayEntity(comp.ActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.ActivateSound.Params); comp.Activated = true; } diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index 56ea23e27e..45f927389e 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -30,7 +30,8 @@ namespace Content.Server.Kitchen.Components [DataField("ItemBreakSound")] public SoundSpecifier ItemBreakSound = new SoundPathSpecifier("/Audio/Effects/clang.ogg"); - public IPlayingAudioStream? PlayingStream { get; set; } + public EntityUid? PlayingStream; + [DataField("loopingSound")] public SoundSpecifier LoopingSound = new SoundPathSpecifier("/Audio/Machines/microwave_loop.ogg"); #endregion diff --git a/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs b/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs index 4b53049086..2a028a8580 100644 --- a/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs +++ b/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs @@ -48,7 +48,7 @@ namespace Content.Server.Kitchen.Components [DataField("juiceSound"), ViewVariables(VVAccess.ReadWrite)] public SoundSpecifier JuiceSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/juicer.ogg"); - public IPlayingAudioStream? AudioStream; + public EntityUid? AudioStream; } [Access(typeof(ReagentGrinderSystem)), RegisterComponent] diff --git a/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs b/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs index 6e563ff45f..0419e13d23 100644 --- a/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs @@ -16,6 +16,8 @@ using Content.Shared.Nutrition.Components; using Content.Shared.Popups; using Content.Shared.Storage; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; using static Content.Shared.Kitchen.Components.KitchenSpikeComponent; @@ -154,7 +156,7 @@ namespace Content.Server.Kitchen.EntitySystems QueueDel(gib); } - _audio.Play(component.SpikeSound, Filter.Pvs(uid), uid, true); + _audio.PlayEntity(component.SpikeSound, Filter.Pvs(uid), uid, true); } private bool TryGetPiece(EntityUid uid, EntityUid user, EntityUid used, diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index 5cee960df8..436f040acf 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -28,6 +28,7 @@ using Content.Shared.Tag; using Robust.Server.Containers; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; @@ -82,7 +83,7 @@ namespace Content.Server.Kitchen.EntitySystems SetAppearance(uid, MicrowaveVisualState.Cooking, microwaveComponent); microwaveComponent.PlayingStream = - _audio.PlayPvs(microwaveComponent.LoopingSound, uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5)); + _audio.PlayPvs(microwaveComponent.LoopingSound, uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5)).Value.Entity; } private void OnCookStop(EntityUid uid, ActiveMicrowaveComponent component, ComponentShutdown args) @@ -91,7 +92,7 @@ namespace Content.Server.Kitchen.EntitySystems return; SetAppearance(uid, MicrowaveVisualState.Idle, microwaveComponent); - microwaveComponent.PlayingStream?.Stop(); + microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream); } /// diff --git a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs index 6ce53dc530..3a6d5e4134 100644 --- a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs @@ -16,6 +16,7 @@ using Content.Shared.Stacks; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Timing; @@ -64,7 +65,7 @@ namespace Content.Server.Kitchen.EntitySystems if (active.EndTime > _timing.CurTime) continue; - reagentGrinder.AudioStream?.Stop(); + reagentGrinder.AudioStream = _audioSystem.Stop(reagentGrinder.AudioStream); RemCompDeferred(uid); var inputContainer = _containerSystem.EnsureContainer(uid, SharedReagentGrinder.InputContainerId); @@ -284,7 +285,7 @@ namespace Content.Server.Kitchen.EntitySystems active.Program = program; reagentGrinder.AudioStream = _audioSystem.PlayPvs(sound, uid, - AudioParams.Default.WithPitchScale(1 / reagentGrinder.WorkTimeMultiplier)); //slightly higher pitched + AudioParams.Default.WithPitchScale(1 / reagentGrinder.WorkTimeMultiplier)).Value.Entity; //slightly higher pitched _userInterfaceSystem.TrySendUiMessage(uid, ReagentGrinderUiKey.Key, new ReagentGrinderWorkStartedMessage(program)); } diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 309ee58316..c6614fcd4f 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -16,6 +16,8 @@ using Content.Shared.Research.Components; using Content.Shared.Research.Prototypes; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Timing; diff --git a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs index f4db4216cf..40d212c6ad 100644 --- a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs @@ -9,6 +9,9 @@ using Content.Shared.Temperature; using Content.Shared.Verbs; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Player; using Robust.Shared.Utility; namespace Content.Server.Light.EntitySystems diff --git a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs index f3e7eaca0e..70ce3c7488 100644 --- a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs +++ b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs @@ -9,6 +9,10 @@ using Content.Shared.Light.Components; using Content.Shared.Rounding; using Content.Shared.Toggleable; using Content.Shared.Verbs; +using JetBrains.Annotations; +using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Utility; diff --git a/Content.Server/Light/EntitySystems/LightBulbSystem.cs b/Content.Server/Light/EntitySystems/LightBulbSystem.cs index 43b0b4662c..5714bde3e5 100644 --- a/Content.Server/Light/EntitySystems/LightBulbSystem.cs +++ b/Content.Server/Light/EntitySystems/LightBulbSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Light.Components; using Content.Shared.Throwing; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Light.EntitySystems @@ -11,6 +12,7 @@ namespace Content.Server.Light.EntitySystems public sealed class LightBulbSystem : EntitySystem { [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -68,7 +70,7 @@ namespace Content.Server.Light.EntitySystems if (!Resolve(uid, ref bulb)) return; - SoundSystem.Play(bulb.BreakSound.GetSound(), Filter.Pvs(uid), uid); + _audio.PlayPvs(bulb.BreakSound, uid); } private void UpdateAppearance(EntityUid uid, LightBulbComponent? bulb = null, diff --git a/Content.Server/Light/EntitySystems/LightReplacerSystem.cs b/Content.Server/Light/EntitySystems/LightReplacerSystem.cs index d37080a1e1..8347f14ea4 100644 --- a/Content.Server/Light/EntitySystems/LightReplacerSystem.cs +++ b/Content.Server/Light/EntitySystems/LightReplacerSystem.cs @@ -6,6 +6,8 @@ using Content.Shared.Light.Components; using Content.Shared.Popups; using Content.Shared.Storage; using JetBrains.Annotations; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; namespace Content.Server.Light.EntitySystems; diff --git a/Content.Server/Light/EntitySystems/MatchstickSystem.cs b/Content.Server/Light/EntitySystems/MatchstickSystem.cs index 88f416ce9d..2195c69b18 100644 --- a/Content.Server/Light/EntitySystems/MatchstickSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchstickSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Smoking; using Content.Shared.Temperature; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Light.EntitySystems @@ -15,6 +16,7 @@ namespace Content.Server.Light.EntitySystems { [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedItemSystem _item = default!; [Dependency] private readonly SharedPointLightSystem _lights = default!; [Dependency] private readonly TransformSystem _transformSystem = default!; @@ -79,8 +81,7 @@ namespace Content.Server.Light.EntitySystems var component = matchstick.Comp; // Play Sound - SoundSystem.Play(component.IgniteSound.GetSound(), Filter.Pvs(matchstick), - matchstick, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); + _audio.PlayPvs(component.IgniteSound, matchstick, AudioParams.Default.WithVariation(0.125f).WithVolume(-0.125f)); // Change state SetState(matchstick, component, SmokableState.Lit); diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index cd4322aa26..b92fc247d0 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -23,6 +23,12 @@ using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Timing; +using Content.Shared.DoAfter; +using Content.Server.Emp; +using Content.Server.DeviceLinking.Events; +using Content.Server.DeviceLinking.Systems; +using Content.Shared.Inventory; +using Robust.Shared.Audio.Systems; namespace Content.Server.Light.EntitySystems { @@ -130,7 +136,7 @@ namespace Content.Server.Light.EntitySystems if (damage != null) _adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} burned their hand on {ToPrettyString(args.Target):target} and received {damage.Total:damage} damage"); - _audio.Play(light.BurnHandSound, Filter.Pvs(uid), uid, true); + _audio.PlayEntity(light.BurnHandSound, Filter.Pvs(uid), uid, true); args.Handled = true; return; @@ -281,7 +287,7 @@ namespace Content.Server.Light.EntitySystems if (time > light.LastThunk + ThunkDelay) { light.LastThunk = time; - _audio.Play(light.TurnOnSound, Filter.Pvs(uid), uid, true, AudioParams.Default.WithVolume(-10f)); + _audio.PlayEntity(light.TurnOnSound, Filter.Pvs(uid), uid, true, AudioParams.Default.WithVolume(-10f)); } } else @@ -343,7 +349,9 @@ namespace Content.Server.Light.EntitySystems private void OnPowerChanged(EntityUid uid, PoweredLightComponent component, ref PowerChangedEvent args) { // TODO: Power moment - if (MetaData(uid).EntityPaused) + var metadata = MetaData(uid); + + if (metadata.EntityPaused || TerminatingOrDeleted(uid, metadata)) return; UpdateLight(uid, component); diff --git a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs index c24966aba8..a1ed71ee4c 100644 --- a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs +++ b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Light.Components; using Content.Shared.Mind.Components; using Content.Shared.Toggleable; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Utility; diff --git a/Content.Server/Lube/LubeSystem.cs b/Content.Server/Lube/LubeSystem.cs index 10a30dc25c..86921d222c 100644 --- a/Content.Server/Lube/LubeSystem.cs +++ b/Content.Server/Lube/LubeSystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Interaction; using Content.Shared.Item; using Content.Shared.Lube; using Content.Shared.Popups; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Lube; diff --git a/Content.Server/Magic/MagicSystem.cs b/Content.Server/Magic/MagicSystem.cs index 4fbd9e3ec7..42bae2ba6f 100644 --- a/Content.Server/Magic/MagicSystem.cs +++ b/Content.Server/Magic/MagicSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Physics; using Content.Shared.Storage; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager; diff --git a/Content.Server/MassMedia/Systems/NewsSystem.cs b/Content.Server/MassMedia/Systems/NewsSystem.cs index a36d8b0afd..30de1d21d9 100644 --- a/Content.Server/MassMedia/Systems/NewsSystem.cs +++ b/Content.Server/MassMedia/Systems/NewsSystem.cs @@ -17,6 +17,19 @@ using Content.Shared.MassMedia.Components; using Content.Shared.MassMedia.Systems; using Content.Shared.PDA; using Robust.Server.GameObjects; +using System.Linq; +using Content.Server.Administration.Logs; +using Content.Server.CartridgeLoader.Cartridges; +using Content.Shared.CartridgeLoader; +using Content.Shared.CartridgeLoader.Cartridges; +using Content.Server.CartridgeLoader; +using Content.Server.GameTicking; +using Robust.Shared.Timing; +using Content.Server.Popups; +using Content.Server.StationRecords.Systems; +using Content.Shared.Database; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; using Robust.Shared.Timing; diff --git a/Content.Server/Materials/MaterialStorageSystem.cs b/Content.Server/Materials/MaterialStorageSystem.cs index f485c4af3c..5d581220e2 100644 --- a/Content.Server/Materials/MaterialStorageSystem.cs +++ b/Content.Server/Materials/MaterialStorageSystem.cs @@ -8,6 +8,8 @@ using Content.Server.Stack; using Content.Shared.Construction; using Content.Shared.Database; using JetBrains.Annotations; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Prototypes; diff --git a/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs b/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs index 1424f880f3..df94bc94ee 100644 --- a/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs +++ b/Content.Server/Mech/Equipment/Components/MechGrabberComponent.cs @@ -43,7 +43,7 @@ public sealed partial class MechGrabberComponent : Component [DataField("grabSound")] public SoundSpecifier GrabSound = new SoundPathSpecifier("/Audio/Mecha/sound_mecha_hydraulic.ogg"); - public IPlayingAudioStream? AudioStream; + public EntityUid? AudioStream; [ViewVariables(VVAccess.ReadWrite)] public Container ItemContainer = default!; diff --git a/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs b/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs index 499f833ac8..8b7a4c6204 100644 --- a/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs +++ b/Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs @@ -10,6 +10,8 @@ using Content.Shared.Mech.Equipment.Components; using Content.Shared.Mobs.Components; using Content.Shared.Wall; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Physics; @@ -149,7 +151,7 @@ public sealed class MechGrabberSystem : EntitySystem return; args.Handled = true; - component.AudioStream = _audio.PlayPvs(component.GrabSound, uid); + component.AudioStream = _audio.PlayPvs(component.GrabSound, uid).Value.Entity; _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.GrabDelay, new GrabberDoAfterEvent(), uid, target: target, used: uid) { BreakOnTargetMove = true, @@ -161,7 +163,7 @@ public sealed class MechGrabberSystem : EntitySystem { if (args.Cancelled) { - component.AudioStream?.Stop(); + component.AudioStream = _audio.Stop(component.AudioStream); return; } diff --git a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs index f16d13c23c..20ac9420aa 100644 --- a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs +++ b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs @@ -24,6 +24,8 @@ using Content.Shared.Nutrition.Components; using Content.Shared.Popups; using Content.Shared.Throwing; using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Physics.Components; using Robust.Shared.Random; diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index a1e2d53d17..e2bd1926d4 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Mobs.Systems; using Content.Shared.PowerCell; using Content.Shared.Timing; using Content.Shared.Toggleable; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Timing; diff --git a/Content.Server/Medical/HealingSystem.cs b/Content.Server/Medical/HealingSystem.cs index 2e04e1b03c..57f66f2378 100644 --- a/Content.Server/Medical/HealingSystem.cs +++ b/Content.Server/Medical/HealingSystem.cs @@ -16,6 +16,8 @@ using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Stacks; using Content.Server.Popups; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; namespace Content.Server.Medical; diff --git a/Content.Server/Medical/HealthAnalyzerSystem.cs b/Content.Server/Medical/HealthAnalyzerSystem.cs index cde361ec74..fe3944b21e 100644 --- a/Content.Server/Medical/HealthAnalyzerSystem.cs +++ b/Content.Server/Medical/HealthAnalyzerSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Mobs.Components; using Robust.Server.GameObjects; using Content.Server.Temperature.Components; using Content.Server.Body.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Medical diff --git a/Content.Server/Medical/VomitSystem.cs b/Content.Server/Medical/VomitSystem.cs index d754bfd05e..974c1981b5 100644 --- a/Content.Server/Medical/VomitSystem.cs +++ b/Content.Server/Medical/VomitSystem.cs @@ -10,6 +10,7 @@ using Content.Shared.IdentityManagement; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; using Content.Shared.StatusEffect; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Prototypes; diff --git a/Content.Server/Mind/MindSystem.cs b/Content.Server/Mind/MindSystem.cs index 46ddb072cd..3039cad25a 100644 --- a/Content.Server/Mind/MindSystem.cs +++ b/Content.Server/Mind/MindSystem.cs @@ -320,7 +320,8 @@ public sealed class MindSystem : SharedMindSystem return; Dirty(mindId, mind); - _pvsOverride.ClearOverride(mindId); + var netMind = GetNetEntity(mindId); + _pvsOverride.ClearOverride(netMind); if (userId != null && !_players.TryGetPlayerData(userId.Value, out _)) { Log.Error($"Attempted to set mind user to invalid value {userId}"); @@ -362,7 +363,7 @@ public sealed class MindSystem : SharedMindSystem if (_players.TryGetSessionById(userId.Value, out var ret)) { mind.Session = ret; - _pvsOverride.AddSessionOverride(mindId, ret); + _pvsOverride.AddSessionOverride(netMind, ret); _players.SetAttachedEntity(ret, mind.CurrentEntity); } diff --git a/Content.Server/Morgue/CrematoriumSystem.cs b/Content.Server/Morgue/CrematoriumSystem.cs index 8d05d0abd1..7f3c7aa1e9 100644 --- a/Content.Server/Morgue/CrematoriumSystem.cs +++ b/Content.Server/Morgue/CrematoriumSystem.cs @@ -14,6 +14,8 @@ using Content.Shared.Storage; using Content.Shared.Storage.Components; using Content.Shared.Verbs; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Morgue; diff --git a/Content.Server/Morgue/MorgueSystem.cs b/Content.Server/Morgue/MorgueSystem.cs index 91fb0ab9f1..b05c4414bc 100644 --- a/Content.Server/Morgue/MorgueSystem.cs +++ b/Content.Server/Morgue/MorgueSystem.cs @@ -3,6 +3,9 @@ using Content.Shared.Body.Components; using Content.Shared.Examine; using Content.Shared.Morgue; using Content.Shared.Morgue.Components; +using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Morgue; diff --git a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Specific/MedibotInjectOperator.cs b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Specific/MedibotInjectOperator.cs index 311fd23468..052262cac5 100644 --- a/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Specific/MedibotInjectOperator.cs +++ b/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Specific/MedibotInjectOperator.cs @@ -5,6 +5,9 @@ using Content.Shared.Damage; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Silicons.Bots; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Player; namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Specific; diff --git a/Content.Server/NPC/Systems/NPCCombatSystem.cs b/Content.Server/NPC/Systems/NPCCombatSystem.cs index fe01b2fcbe..7b012300da 100644 --- a/Content.Server/NPC/Systems/NPCCombatSystem.cs +++ b/Content.Server/NPC/Systems/NPCCombatSystem.cs @@ -1,6 +1,8 @@ using Content.Server.Interaction; using Content.Server.Weapons.Ranged.Systems; using Content.Shared.Weapons.Melee; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Physics.Systems; using Robust.Shared.Random; diff --git a/Content.Server/Ninja/Systems/BatteryDrainerSystem.cs b/Content.Server/Ninja/Systems/BatteryDrainerSystem.cs index 37bf0eade1..bae999faff 100644 --- a/Content.Server/Ninja/Systems/BatteryDrainerSystem.cs +++ b/Content.Server/Ninja/Systems/BatteryDrainerSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Ninja.Components; using Content.Shared.Ninja.Systems; using Content.Shared.Popups; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Ninja.Systems; diff --git a/Content.Server/Ninja/Systems/SpaceNinjaSystem.cs b/Content.Server/Ninja/Systems/SpaceNinjaSystem.cs index a5b78570db..a1b1032105 100644 --- a/Content.Server/Ninja/Systems/SpaceNinjaSystem.cs +++ b/Content.Server/Ninja/Systems/SpaceNinjaSystem.cs @@ -24,7 +24,9 @@ using Robust.Shared.Audio; using Robust.Shared.Player; using Robust.Shared.Random; using System.Diagnostics.CodeAnalysis; +using System.Linq; using Content.Server.Objectives.Components; +using Robust.Shared.Audio.Systems; namespace Content.Server.Ninja.Systems; diff --git a/Content.Server/Ninja/Systems/StunProviderSystem.cs b/Content.Server/Ninja/Systems/StunProviderSystem.cs index 097058f4d3..636037060a 100644 --- a/Content.Server/Ninja/Systems/StunProviderSystem.cs +++ b/Content.Server/Ninja/Systems/StunProviderSystem.cs @@ -10,6 +10,7 @@ using Content.Shared.Stunnable; using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.Prototypes; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Server.Ninja.Systems; diff --git a/Content.Server/Nuke/NukeComponent.cs b/Content.Server/Nuke/NukeComponent.cs index 2b9c9fe01e..16377d5f75 100644 --- a/Content.Server/Nuke/NukeComponent.cs +++ b/Content.Server/Nuke/NukeComponent.cs @@ -174,7 +174,7 @@ namespace Content.Server.Nuke /// public bool PlayedAlertSound = false; - public IPlayingAudioStream? AlertAudioStream = default; + public EntityUid? AlertAudioStream = default; /// /// The radius from the nuke for which there must be floor tiles for it to be anchorable. diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index ca0b0e0113..77689c4e2b 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -14,6 +14,7 @@ using Content.Shared.Nuke; using Content.Shared.Popups; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Player; @@ -216,7 +217,7 @@ public sealed class NukeSystem : EntitySystem private void OnClearButtonPressed(EntityUid uid, NukeComponent component, NukeKeypadClearMessage args) { - _audio.Play(component.KeypadPressSound, Filter.Pvs(uid), uid, true); + _audio.PlayEntity(component.KeypadPressSound, Filter.Pvs(uid), uid, true); if (component.Status != NukeStatus.AWAIT_CODE) return; @@ -334,12 +335,12 @@ public sealed class NukeSystem : EntitySystem { component.Status = NukeStatus.AWAIT_ARM; component.RemainingTime = component.Timer; - _audio.Play(component.AccessGrantedSound, Filter.Pvs(uid), uid, true); + _audio.PlayEntity(component.AccessGrantedSound, Filter.Pvs(uid), uid, true); } else { component.EnteredCode = ""; - _audio.Play(component.AccessDeniedSound, Filter.Pvs(uid), uid, true); + _audio.PlayEntity(component.AccessDeniedSound, Filter.Pvs(uid), uid, true); } break; @@ -409,7 +410,7 @@ public sealed class NukeSystem : EntitySystem // Don't double-dip on the octave shifting component.LastPlayedKeypadSemitones = number == 0 ? component.LastPlayedKeypadSemitones : semitoneShift; - _audio.Play(component.KeypadPressSound, Filter.Pvs(uid), uid, true, AudioHelpers.ShiftSemitone(semitoneShift).WithVolume(-5f)); + _audio.PlayEntity(component.KeypadPressSound, Filter.Pvs(uid), uid, true, AudioHelpers.ShiftSemitone(semitoneShift).WithVolume(-5f)); } public string GenerateRandomNumberString(int length) @@ -500,7 +501,7 @@ public sealed class NukeSystem : EntitySystem // disable sound and reset it component.PlayedAlertSound = false; - component.AlertAudioStream?.Stop(); + component.AlertAudioStream = _audio.Stop(component.AlertAudioStream); // turn off the spinny light _pointLight.SetEnabled(uid, false); diff --git a/Content.Server/Nutrition/Components/FatExtractorComponent.cs b/Content.Server/Nutrition/Components/FatExtractorComponent.cs index 61bb85f9ec..7bd9b85c79 100644 --- a/Content.Server/Nutrition/Components/FatExtractorComponent.cs +++ b/Content.Server/Nutrition/Components/FatExtractorComponent.cs @@ -83,7 +83,7 @@ public sealed partial class FatExtractorComponent : Component [DataField("processSound")] public SoundSpecifier? ProcessSound; - public IPlayingAudioStream? Stream; + public EntityUid? Stream; /// /// A minium hunger threshold for extracting nutrition. diff --git a/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs b/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs index e8e456c0ea..1271c57a23 100644 --- a/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs +++ b/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs @@ -9,6 +9,9 @@ using Content.Shared.Nutrition.AnimalHusbandry; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Storage; +using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -32,6 +35,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem [Dependency] private readonly SharedTransformSystem _transform = default!; private readonly HashSet _failedAttempts = new(); + private readonly HashSet _birthQueue = new(); /// public override void Initialize() @@ -222,7 +226,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem { base.Update(frameTime); - HashSet birthQueue = new(); + _birthQueue.Clear(); _failedAttempts.Clear(); var query = EntityQueryEnumerator(); @@ -230,7 +234,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem { if (reproductive.GestationEndTime != null && _timing.CurTime >= reproductive.GestationEndTime) { - birthQueue.Add(uid); + _birthQueue.Add(uid); } if (_timing.CurTime < reproductive.NextBreedAttempt) @@ -244,7 +248,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem TryReproduceNearby(uid, reproductive); } - foreach (var queued in birthQueue) + foreach (var queued in _birthQueue) { Birth(queued); } diff --git a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs index 586f965096..eebe7f98d8 100644 --- a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Nutrition.EntitySystems @@ -37,7 +38,7 @@ namespace Content.Server.Nutrition.EntitySystems protected override void SplattedCreamPie(EntityUid uid, CreamPieComponent creamPie) { - _audio.Play(_audio.GetSound(creamPie.Sound), Filter.Pvs(uid), uid, false, new AudioParams().WithVariation(0.125f)); + _audio.PlayPvs(_audio.GetSound(creamPie.Sound), uid, AudioParams.Default.WithVariation(0.125f)); if (EntityManager.TryGetComponent(uid, out FoodComponent? foodComp)) { diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index e493a18ae7..1829dc32c8 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -27,6 +27,7 @@ using Content.Shared.Nutrition.Components; using Content.Shared.Throwing; using Content.Shared.Verbs; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs b/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs index 6ab432d490..63ca590f5d 100644 --- a/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs @@ -10,6 +10,8 @@ using Content.Shared.Emag.Systems; using Content.Shared.Nutrition.Components; using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Storage.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Server.Nutrition.EntitySystems; @@ -90,7 +92,7 @@ public sealed class FatExtractorSystem : EntitySystem component.Processing = true; _appearance.SetData(uid, FatExtractorVisuals.Processing, true); - component.Stream = _audio.PlayPvs(component.ProcessSound, uid); + component.Stream = _audio.PlayPvs(component.ProcessSound, uid)?.Entity; component.NextUpdate = _timing.CurTime + component.UpdateTime; } @@ -104,7 +106,7 @@ public sealed class FatExtractorSystem : EntitySystem component.Processing = false; _appearance.SetData(uid, FatExtractorVisuals.Processing, false); - component.Stream?.Stop(); + component.Stream = _audio.Stop(component.Stream); } public bool TryGetValidOccupant(EntityUid uid, [NotNullWhen(true)] out EntityUid? occupant, FatExtractorComponent? component = null, EntityStorageComponent? storage = null) diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index 51f75a2e19..b18c77fffb 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -29,6 +29,9 @@ using Content.Shared.Verbs; using Robust.Shared.Audio; using Robust.Shared.Player; using Robust.Shared.Utility; +using Content.Shared.Tag; +using Content.Shared.Storage; +using Robust.Shared.Audio.Systems; namespace Content.Server.Nutrition.EntitySystems; @@ -279,7 +282,7 @@ public sealed class FoodSystem : EntitySystem _adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} ate {ToPrettyString(uid):food}"); } - _audio.Play(component.UseSound, Filter.Pvs(args.Target.Value), args.Target.Value, true, AudioParams.Default.WithVolume(-1f)); + _audio.PlayPvs(component.UseSound, args.Target.Value, AudioParams.Default.WithVolume(-1f)); // Try to break all used utensils foreach (var utensil in utensils) diff --git a/Content.Server/Nutrition/EntitySystems/OpenableSystem.cs b/Content.Server/Nutrition/EntitySystems/OpenableSystem.cs index dd6474bc74..fbe617eff4 100644 --- a/Content.Server/Nutrition/EntitySystems/OpenableSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/OpenableSystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Interaction.Events; using Content.Shared.Nutrition.Components; using Content.Shared.Popups; using Content.Shared.Weapons.Melee.Events; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameObjects; namespace Content.Server.Nutrition.EntitySystems; diff --git a/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs b/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs index 88916e4cf2..9d255e013c 100644 --- a/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs @@ -7,16 +7,18 @@ using Content.Shared.FixedPoint; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; namespace Content.Server.Nutrition.EntitySystems { - internal sealed class SliceableFoodSystem : EntitySystem + public sealed class SliceableFoodSystem : EntitySystem { [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; - [Dependency] private readonly SharedHandsSystem _handsSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; + [Dependency] private readonly SharedHandsSystem _handsSystem = default!; public override void Initialize() { @@ -75,8 +77,7 @@ namespace Content.Server.Nutrition.EntitySystems xform.LocalRotation = 0; } - SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(uid), - transform.Coordinates, AudioParams.Default.WithVolume(-2)); + _audio.PlayPvs(component.Sound, transform.Coordinates, AudioParams.Default.WithVolume(-2)); // Decrease size of item based on count - Could implement in the future // Bug with this currently is the size in a container is not updated diff --git a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs index 0f1576658b..f5f34080cb 100644 --- a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Nutrition.Components; using Content.Server.Popups; using Content.Shared.Interaction; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; @@ -15,6 +16,7 @@ namespace Content.Server.Nutrition.EntitySystems [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly FoodSystem _foodSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; public override void Initialize() @@ -66,8 +68,8 @@ namespace Content.Server.Nutrition.EntitySystems if (_robustRandom.Prob(component.BreakChance)) { - SoundSystem.Play(component.BreakSound.GetSound(), Filter.Pvs(userUid), userUid, AudioParams.Default.WithVolume(-2f)); - EntityManager.DeleteEntity(component.Owner); + _audio.PlayPvs(component.BreakSound, userUid, AudioParams.Default.WithVolume(-2f)); + EntityManager.DeleteEntity(uid); } } } diff --git a/Content.Server/PDA/Ringer/RingerSystem.cs b/Content.Server/PDA/Ringer/RingerSystem.cs index 7494d5e12c..f8aadac461 100644 --- a/Content.Server/PDA/Ringer/RingerSystem.cs +++ b/Content.Server/PDA/Ringer/RingerSystem.cs @@ -13,6 +13,8 @@ using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; +using System.Linq; +using Robust.Server.Audio; namespace Content.Server.PDA.Ringer { @@ -203,7 +205,7 @@ namespace Content.Server.PDA.Ringer ringer.TimeElapsed -= NoteDelay; var ringerXform = Transform(uid); - _audio.Play( + _audio.PlayEntity( GetSound(ringer.Ringtone[ringer.NoteCount]), Filter.Empty().AddInRange(ringerXform.MapPosition, ringer.Range), uid, diff --git a/Content.Server/Paper/PaperSystem.cs b/Content.Server/Paper/PaperSystem.cs index 0b19daa8a1..5e1a076af3 100644 --- a/Content.Server/Paper/PaperSystem.cs +++ b/Content.Server/Paper/PaperSystem.cs @@ -9,6 +9,9 @@ using Content.Shared.Paper; using Content.Shared.Tag; using Robust.Server.GameObjects; using Robust.Shared.Player; +using Robust.Shared.Utility; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using static Content.Shared.Paper.SharedPaperComponent; namespace Content.Server.Paper diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs index 5900dc55b3..5d373652a9 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using Content.Server.Administration.Managers; using Content.Shared.CCVar; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; using Robust.Shared.Player; @@ -17,6 +18,7 @@ public sealed partial class ParticleAcceleratorSystem [Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly IGameTiming _timing = default!; + private void InitializeControlBoxSystem() { SubscribeLocalEvent(OnComponentStartup); diff --git a/Content.Server/Pinpointer/ProximityBeeperSystem.cs b/Content.Server/Pinpointer/ProximityBeeperSystem.cs index d52223e2b4..d4175a1af5 100644 --- a/Content.Server/Pinpointer/ProximityBeeperSystem.cs +++ b/Content.Server/Pinpointer/ProximityBeeperSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Interaction.Events; using Content.Shared.Pinpointer; using Content.Shared.PowerCell; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Timing; diff --git a/Content.Server/Plants/Systems/PottedPlantHideSystem.cs b/Content.Server/Plants/Systems/PottedPlantHideSystem.cs index 91e544b796..09571c60a1 100644 --- a/Content.Server/Plants/Systems/PottedPlantHideSystem.cs +++ b/Content.Server/Plants/Systems/PottedPlantHideSystem.cs @@ -5,14 +5,16 @@ using Content.Server.Storage.EntitySystems; using Content.Shared.Audio; using Content.Shared.Interaction; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Plants.Systems { public sealed class PottedPlantHideSystem : EntitySystem { - [Dependency] private readonly SecretStashSystem _stashSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SecretStashSystem _stashSystem = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -58,7 +60,7 @@ namespace Content.Server.Plants.Systems if (!Resolve(uid, ref component)) return; - SoundSystem.Play(component.RustleSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.25f)); + _audio.PlayPvs(component.RustleSound, uid, AudioParams.Default.WithVariation(0.25f)); } } } diff --git a/Content.Server/Points/PointSystem.cs b/Content.Server/Points/PointSystem.cs index a71294db9d..b5f94d097e 100644 --- a/Content.Server/Points/PointSystem.cs +++ b/Content.Server/Points/PointSystem.cs @@ -25,7 +25,7 @@ public sealed class PointSystem : SharedPointSystem private void OnStartup(EntityUid uid, PointManagerComponent component, ComponentStartup args) { - _pvsOverride.AddGlobalOverride(uid); + _pvsOverride.AddGlobalOverride(GetNetEntity(uid)); } /// diff --git a/Content.Server/Polymorph/Systems/PolymorphSystem.cs b/Content.Server/Polymorph/Systems/PolymorphSystem.cs index fbf4961f4f..5531f65409 100644 --- a/Content.Server/Polymorph/Systems/PolymorphSystem.cs +++ b/Content.Server/Polymorph/Systems/PolymorphSystem.cs @@ -15,6 +15,7 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Polymorph; using Content.Shared.Popups; using JetBrains.Annotations; +using Robust.Server.Audio; using Robust.Server.Containers; using Robust.Server.GameObjects; using Robust.Shared.Map; diff --git a/Content.Server/Power/EntitySystems/ApcSystem.cs b/Content.Server/Power/EntitySystems/ApcSystem.cs index 8d9a62cd73..95b5d74a94 100644 --- a/Content.Server/Power/EntitySystems/ApcSystem.cs +++ b/Content.Server/Power/EntitySystems/ApcSystem.cs @@ -10,6 +10,7 @@ using Content.Shared.Emag.Systems; using Content.Shared.Popups; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Server.Power.EntitySystems; diff --git a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs index f1f8bf0616..5ed39d5178 100644 --- a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Examine; using Content.Shared.Hands.Components; using Content.Shared.Power; using Content.Shared.Verbs; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Utility; diff --git a/Content.Server/Power/Generator/PortableGeneratorSystem.cs b/Content.Server/Power/Generator/PortableGeneratorSystem.cs index 1180665ad1..031e19b65d 100644 --- a/Content.Server/Power/Generator/PortableGeneratorSystem.cs +++ b/Content.Server/Power/Generator/PortableGeneratorSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Popups; using Content.Shared.DoAfter; using Content.Shared.Power.Generator; using Content.Shared.Verbs; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Player; using Robust.Shared.Random; @@ -97,7 +98,7 @@ public sealed class PortableGeneratorSystem : SharedPortableGeneratorSystem var clogged = _generator.GetIsClogged(uid); var sound = empty ? component.StartSoundEmpty : component.StartSound; - _audio.Play(sound, Filter.Pvs(uid), uid, true); + _audio.PlayEntity(sound, Filter.Pvs(uid), uid, true); if (!clogged && !empty && _random.Prob(component.StartChance)) { diff --git a/Content.Server/Power/Generator/PowerSwitchableSystem.cs b/Content.Server/Power/Generator/PowerSwitchableSystem.cs index ae7960cf8f..7c377ef66e 100644 --- a/Content.Server/Power/Generator/PowerSwitchableSystem.cs +++ b/Content.Server/Power/Generator/PowerSwitchableSystem.cs @@ -6,8 +6,7 @@ using Content.Server.Power.Nodes; using Content.Shared.Power.Generator; using Content.Shared.Timing; using Content.Shared.Verbs; -using Robust.Server.GameObjects; -using Robust.Shared.Player; +using Robust.Shared.Audio.Systems; using Robust.Shared.Utility; namespace Content.Server.Power.Generator; @@ -20,9 +19,9 @@ namespace Content.Server.Power.Generator; /// public sealed class PowerSwitchableSystem : SharedPowerSwitchableSystem { - [Dependency] private readonly AudioSystem _audio = default!; [Dependency] private readonly NodeGroupSystem _nodeGroup = default!; [Dependency] private readonly PopupSystem _popup = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly UseDelaySystem _useDelay = default!; public override void Initialize() diff --git a/Content.Server/PowerSink/PowerSinkSystem.cs b/Content.Server/PowerSink/PowerSinkSystem.cs index e5a118b07e..deb6693500 100644 --- a/Content.Server/PowerSink/PowerSinkSystem.cs +++ b/Content.Server/PowerSink/PowerSinkSystem.cs @@ -6,6 +6,7 @@ using Content.Server.Chat.Systems; using Content.Server.Station.Systems; using Robust.Shared.Timing; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.PowerSink { diff --git a/Content.Server/Radiation/Systems/GeigerSystem.cs b/Content.Server/Radiation/Systems/GeigerSystem.cs index 3a2fe12549..f889336a06 100644 --- a/Content.Server/Radiation/Systems/GeigerSystem.cs +++ b/Content.Server/Radiation/Systems/GeigerSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Interaction; using Content.Shared.Inventory.Events; using Content.Shared.Radiation.Components; using Content.Shared.Radiation.Systems; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Server.Player; @@ -149,7 +150,7 @@ public sealed class GeigerSystem : SharedGeigerSystem if (!Resolve(uid, ref component, false)) return; - component.Stream?.Stop(); + component.Stream = _audio.Stop(component.Stream); if (!component.Sounds.TryGetValue(component.DangerLevel, out var sounds)) return; @@ -163,7 +164,7 @@ public sealed class GeigerSystem : SharedGeigerSystem var sound = _audio.GetSound(sounds); var param = sounds.Params.WithLoop(true).WithVolume(-4f); - component.Stream = _audio.PlayGlobal(sound, session, param); + component.Stream = _audio.PlayGlobal(sound, session, param)?.Entity; } public static GeigerDangerLevel RadsToLevel(float rads) diff --git a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs index 0d60f0af4f..8a65e0a8bc 100644 --- a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs +++ b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Research.TechnologyDisk.Components; using Content.Server.UserInterface; using Content.Shared.Research; using Content.Shared.Research.Components; +using Robust.Server.Audio; using Robust.Server.GameObjects; using Robust.Shared.Timing; diff --git a/Content.Server/RoundEnd/RoundEndSystem.cs b/Content.Server/RoundEnd/RoundEndSystem.cs index 6043f3fbf9..5068a1a232 100644 --- a/Content.Server/RoundEnd/RoundEndSystem.cs +++ b/Content.Server/RoundEnd/RoundEndSystem.cs @@ -11,6 +11,7 @@ using Content.Server.Station.Systems; using Content.Shared.Database; using Content.Shared.GameTicking; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -33,6 +34,7 @@ namespace Content.Server.RoundEnd [Dependency] private readonly ChatSystem _chatSystem = default!; [Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly EmergencyShuttleSystem _shuttle = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly StationSystem _stationSystem = default!; public TimeSpan DefaultCooldownDuration { get; set; } = TimeSpan.FromSeconds(30); @@ -154,7 +156,7 @@ namespace Content.Server.RoundEnd null, Color.Gold); - SoundSystem.Play("/Audio/Announcements/shuttlecalled.ogg", Filter.Broadcast()); + _audio.PlayGlobal("/Audio/Announcements/shuttlecalled.ogg", Filter.Broadcast(), true); LastCountdownStart = _gameTiming.CurTime; ExpectedCountdownEnd = _gameTiming.CurTime + countdownTime; @@ -185,7 +187,7 @@ namespace Content.Server.RoundEnd _chatSystem.DispatchGlobalAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"), Loc.GetString("Station"), false, colorOverride: Color.Gold); - SoundSystem.Play("/Audio/Announcements/shuttlerecalled.ogg", Filter.Broadcast()); + _audio.PlayGlobal("/Audio/Announcements/shuttlerecalled.ogg", Filter.Broadcast(), true); LastCountdownStart = null; ExpectedCountdownEnd = null; diff --git a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs index 2bc00397bc..6d3d831a2d 100644 --- a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs +++ b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs @@ -39,7 +39,7 @@ public sealed partial class SalvageExpeditionComponent : SharedSalvageExpedition /// /// Countdown audio stream. /// - public IPlayingAudioStream? Stream = null; + public EntityUid? Stream = null; /// /// Sound that plays when the mission end is imminent. diff --git a/Content.Server/Salvage/SalvageSystem.Expeditions.cs b/Content.Server/Salvage/SalvageSystem.Expeditions.cs index f2be8cd500..f0d4661a07 100644 --- a/Content.Server/Salvage/SalvageSystem.Expeditions.cs +++ b/Content.Server/Salvage/SalvageSystem.Expeditions.cs @@ -73,7 +73,7 @@ public sealed partial class SalvageSystem private void OnExpeditionShutdown(EntityUid uid, SalvageExpeditionComponent component, ComponentShutdown args) { - component.Stream?.Stop(); + component.Stream = _audio.Stop(component.Stream); foreach (var (job, cancelToken) in _salvageJobs.ToArray()) { diff --git a/Content.Server/Salvage/SalvageSystem.Runner.cs b/Content.Server/Salvage/SalvageSystem.Runner.cs index 0863362131..3b89135c58 100644 --- a/Content.Server/Salvage/SalvageSystem.Runner.cs +++ b/Content.Server/Salvage/SalvageSystem.Runner.cs @@ -153,7 +153,7 @@ public sealed partial class SalvageSystem else if (comp.Stage < ExpeditionStage.MusicCountdown && remaining < TimeSpan.FromMinutes(2)) { // TODO: Some way to play audio attached to a map for players. - comp.Stream = _audio.PlayGlobal(comp.Sound, Filter.BroadcastMap(Comp(uid).MapId), true); + comp.Stream = _audio.PlayGlobal(comp.Sound, Filter.BroadcastMap(Comp(uid).MapId), true).Value.Entity; comp.Stage = ExpeditionStage.MusicCountdown; Dirty(uid, comp); Announce(uid, Loc.GetString("salvage-expedition-announcement-countdown-minutes", ("duration", TimeSpan.FromMinutes(2).Minutes))); diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index 0da6207289..eb98e1f2e1 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -27,6 +27,8 @@ using Content.Shared.Random; using Content.Shared.Random.Helpers; using Content.Shared.Tools.Components; using Robust.Server.Maps; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map.Components; using Robust.Shared.Timing; diff --git a/Content.Server/Shuttles/Components/FTLComponent.cs b/Content.Server/Shuttles/Components/FTLComponent.cs index 43b702cd39..105b9eae6d 100644 --- a/Content.Server/Shuttles/Components/FTLComponent.cs +++ b/Content.Server/Shuttles/Components/FTLComponent.cs @@ -51,5 +51,5 @@ public sealed partial class FTLComponent : Component Params = AudioParams.Default.WithVolume(-3f).WithLoop(true) }; - public IPlayingAudioStream? TravelStream; + public EntityUid? TravelStream; } diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 3ef3d97a21..0f2b8b847c 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -20,6 +20,9 @@ using Content.Shared.Tag; using Content.Shared.Tiles; using Robust.Server.GameObjects; using Robust.Server.Maps; +using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 7ccadd9495..f505ce5960 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -230,8 +230,7 @@ public sealed partial class ShuttleSystem component = AddComp(uid); component.State = FTLState.Starting; - // TODO: Need BroadcastGrid to not be bad. - SoundSystem.Play(_startupSound.GetSound(), Filter.Empty().AddInRange(Transform(uid).MapPosition, GetSoundRange(uid)), _startupSound.Params); + _audio.PlayPvs(_startupSound, uid); // Make sure the map is setup before we leave to avoid pop-in (e.g. parallax). SetupHyperspace(); return true; @@ -287,11 +286,8 @@ public sealed partial class ShuttleSystem var ev = new FTLStartedEvent(uid, target, fromMapUid, fromMatrix, fromRotation); RaiseLocalEvent(uid, ref ev, true); - if (comp.TravelSound != null) - { - comp.TravelStream = SoundSystem.Play(comp.TravelSound.GetSound(), - Filter.Pvs(uid, 4f, entityManager: EntityManager), comp.TravelSound.Params); - } + comp.TravelStream = _audio.PlayPvs(comp.TravelSound, uid)?.Entity; + break; // Arriving, play effects case FTLState.Travelling: @@ -377,13 +373,8 @@ public sealed partial class ShuttleSystem _thruster.DisableLinearThrusters(shuttle); } - if (comp.TravelStream != null) - { - comp.TravelStream?.Stop(); - comp.TravelStream = null; - } - - _audio.PlayGlobal(_arrivalSound, Filter.Empty().AddInRange(Transform(uid).MapPosition, GetSoundRange(uid)), true); + comp.TravelStream = _audio.Stop(comp.TravelStream); + _audio.PlayPvs(_arrivalSound, uid); if (TryComp(uid, out var dest)) { diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs index 73dc4b208c..f346398cda 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs @@ -54,6 +54,6 @@ public sealed partial class ShuttleSystem var volume = MathF.Min(10f, 1f * MathF.Pow(jungleDiff, 0.5f) - 5f); var audioParams = AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation).WithVolume(volume); - _audio.Play(_shuttleImpactSound, Filter.Pvs(coordinates, rangeMultiplier: 4f, entityMan: EntityManager), coordinates, true, audioParams); + _audio.PlayPvs(_shuttleImpactSound, coordinates, audioParams); } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index 2252d71d67..97bfdc1756 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Shuttles.Systems; using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Server/Silicons/Laws/SiliconLawSystem.cs b/Content.Server/Silicons/Laws/SiliconLawSystem.cs index 182ab6c947..e1366fb1eb 100644 --- a/Content.Server/Silicons/Laws/SiliconLawSystem.cs +++ b/Content.Server/Silicons/Laws/SiliconLawSystem.cs @@ -18,6 +18,7 @@ using Content.Shared.Silicons.Laws.Components; using Content.Shared.Stunnable; using Content.Shared.Wires; using Robust.Server.GameObjects; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Toolshed; diff --git a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs index ddc63156bf..6b4347740a 100644 --- a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs @@ -5,6 +5,8 @@ using Content.Shared.Singularity.Components; using Content.Shared.Singularity.EntitySystems; using Content.Shared.Singularity.Events; using Robust.Server.GameStates; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameStates; using Robust.Shared.Player; using Robust.Shared.Timing; @@ -204,9 +206,9 @@ public sealed class SingularitySystem : SharedSingularitySystem MetaDataComponent? metaData = null; if (Resolve(uid, ref metaData) && metaData.EntityLifeStage <= EntityLifeStage.Initializing) - _audio.Play(comp.FormationSound, Filter.Pvs(uid), uid, true); + _audio.PlayPvs(comp.FormationSound, uid); - comp.AmbientSoundStream = _audio.Play(comp.AmbientSound, Filter.Pvs(uid), uid, true); + comp.AmbientSoundStream = _audio.PlayPvs(comp.AmbientSound, uid)?.Entity; UpdateSingularityLevel(uid, comp); } @@ -219,7 +221,7 @@ public sealed class SingularitySystem : SharedSingularitySystem /// The event arguments. public void OnDistortionStartup(EntityUid uid, SingularityDistortionComponent comp, ComponentStartup args) { - _pvs.AddGlobalOverride(uid); + _pvs.AddGlobalOverride(GetNetEntity(uid)); } /// @@ -232,11 +234,18 @@ public sealed class SingularitySystem : SharedSingularitySystem /// The event arguments. public void OnSingularityShutdown(EntityUid uid, SingularityComponent comp, ComponentShutdown args) { - comp.AmbientSoundStream?.Stop(); + comp.AmbientSoundStream = _audio.Stop(comp.AmbientSoundStream); MetaDataComponent? metaData = null; if (Resolve(uid, ref metaData) && metaData.EntityLifeStage >= EntityLifeStage.Terminating) - _audio.Play(comp.DissipationSound, Filter.Pvs(uid), uid, true); + { + var xform = Transform(uid); + var coordinates = xform.Coordinates; + + // I feel like IsValid should be checking this or something idk. + if (!TerminatingOrDeleted(coordinates.EntityId)) + _audio.PlayPvs(comp.DissipationSound, coordinates); + } } /// diff --git a/Content.Server/Speech/EntitySystems/VocalSystem.cs b/Content.Server/Speech/EntitySystems/VocalSystem.cs index 5dccb8bf9c..aedcbbd099 100644 --- a/Content.Server/Speech/EntitySystems/VocalSystem.cs +++ b/Content.Server/Speech/EntitySystems/VocalSystem.cs @@ -4,6 +4,8 @@ using Content.Server.Speech.Components; using Content.Shared.Chat.Prototypes; using Content.Shared.Humanoid; using Content.Shared.Speech; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/Speech/SpeechNoiseSystem.cs b/Content.Server/Speech/SpeechNoiseSystem.cs index c81d17caf2..4f66a0828b 100644 --- a/Content.Server/Speech/SpeechNoiseSystem.cs +++ b/Content.Server/Speech/SpeechNoiseSystem.cs @@ -2,6 +2,7 @@ using Robust.Shared.Audio; using Content.Server.Chat; using Content.Server.Chat.Systems; using Content.Shared.Speech; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Timing; @@ -14,6 +15,7 @@ namespace Content.Server.Speech [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -66,7 +68,7 @@ namespace Content.Server.Speech var pitchedAudioParams = component.AudioParams.WithPitchScale(scale); component.LastTimeSoundPlayed = currentTime; - SoundSystem.Play(contextSound, Filter.Pvs(uid, entityManager: EntityManager), uid, pitchedAudioParams); + _audio.PlayPvs(contextSound, uid, pitchedAudioParams); } } } diff --git a/Content.Server/SprayPainter/SprayPainterSystem.cs b/Content.Server/SprayPainter/SprayPainterSystem.cs index 763b7697d3..fd8ff9ea28 100644 --- a/Content.Server/SprayPainter/SprayPainterSystem.cs +++ b/Content.Server/SprayPainter/SprayPainterSystem.cs @@ -11,6 +11,8 @@ using Content.Shared.SprayPainter; using Content.Shared.Interaction; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.SprayPainter; diff --git a/Content.Server/StationEvents/Events/StationEventSystem.cs b/Content.Server/StationEvents/Events/StationEventSystem.cs index 41a7b153f5..537a7e7c22 100644 --- a/Content.Server/StationEvents/Events/StationEventSystem.cs +++ b/Content.Server/StationEvents/Events/StationEventSystem.cs @@ -8,6 +8,8 @@ using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Server.StationEvents.Components; using Content.Shared.Database; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Collections; using Robust.Shared.Map; using Robust.Shared.Map.Components; diff --git a/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs b/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs index f51c215c6e..a8144311bb 100644 --- a/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/CursedEntityStorageSystem.cs @@ -5,6 +5,9 @@ using Content.Shared.Storage.Components; using Robust.Shared.Audio; using Robust.Shared.Player; using Robust.Shared.Random; +using System.Linq; +using Content.Shared.Storage.Components; +using Robust.Shared.Audio.Systems; namespace Content.Server.Storage.EntitySystems; @@ -12,6 +15,7 @@ public sealed class CursedEntityStorageSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly EntityStorageSystem _entityStorage = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -47,6 +51,7 @@ public sealed class CursedEntityStorageSystem : EntitySystem storage.Contents.Remove(entity); _entityStorage.AddToContents(entity, lockerEnt); } - SoundSystem.Play(component.CursedSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.125f, _random)); + + _audio.PlayPvs(component.CursedSound, uid, AudioHelpers.WithVariation(0.125f, _random)); } } diff --git a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs index 25c31e48ca..c49bfdec93 100644 --- a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs +++ b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Database; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction.Events; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Random; @@ -18,6 +19,7 @@ namespace Content.Server.Storage.EntitySystems [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedHandsSystem _hands = default!; [Dependency] private readonly PricingSystem _pricing = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -79,7 +81,9 @@ namespace Content.Server.Storage.EntitySystems } if (component.Sound != null) - SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(uid), uid); + { + _audio.PlayPvs(component.Sound, uid); + } component.Uses--; diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index a38577edfa..2afd57ca1f 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -95,7 +95,7 @@ public sealed partial class StorageSystem : SharedStorageSystem UpdateAppearance((uid, storageComp, null)); if (storageComp.StorageCloseSound is not null) - Audio.Play(storageComp.StorageCloseSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, storageComp.StorageCloseSound.Params); + Audio.PlayEntity(storageComp.StorageCloseSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, storageComp.StorageCloseSound.Params); } } diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index 0435a6bea6..32c9a05043 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -10,6 +10,8 @@ using Content.Shared.FixedPoint; using Content.Shared.Hands.EntitySystems; using Content.Shared.Store; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Store.Systems; diff --git a/Content.Server/Stunnable/Systems/StunbatonSystem.cs b/Content.Server/Stunnable/Systems/StunbatonSystem.cs index f4a7448fa2..da2391a86b 100644 --- a/Content.Server/Stunnable/Systems/StunbatonSystem.cs +++ b/Content.Server/Stunnable/Systems/StunbatonSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.Stunnable; using Content.Shared.Toggleable; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; namespace Content.Server.Stunnable.Systems @@ -24,7 +25,7 @@ namespace Content.Server.Stunnable.Systems [Dependency] private readonly RiggableSystem _riggableSystem = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly BatterySystem _battery = default!; - [Dependency] private readonly AudioSystem _audio = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -97,7 +98,6 @@ namespace Content.Server.Stunnable.Systems private void TurnOn(EntityUid uid, StunbatonComponent comp, EntityUid user) { - if (comp.Activated) return; diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSpeakerSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSpeakerSystem.cs index d40303ab31..ce3d8568ab 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSpeakerSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSpeakerSystem.cs @@ -1,5 +1,7 @@ using Content.Server.Chat.Systems; using Content.Shared.Speech; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; diff --git a/Content.Server/Teleportation/HandTeleporterSystem.cs b/Content.Server/Teleportation/HandTeleporterSystem.cs index 4bfe03ba42..29cde5d741 100644 --- a/Content.Server/Teleportation/HandTeleporterSystem.cs +++ b/Content.Server/Teleportation/HandTeleporterSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Database; using Content.Shared.Interaction.Events; using Content.Shared.Teleportation.Components; using Content.Shared.Teleportation.Systems; +using Robust.Server.Audio; using Robust.Server.GameObjects; namespace Content.Server.Teleportation; diff --git a/Content.Server/Toilet/ToiletSystem.cs b/Content.Server/Toilet/ToiletSystem.cs index b10feae453..8bf8457e07 100644 --- a/Content.Server/Toilet/ToiletSystem.cs +++ b/Content.Server/Toilet/ToiletSystem.cs @@ -17,6 +17,7 @@ using Content.Shared.Tools; using Content.Shared.Tools.Components; using Content.Shared.Verbs; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem; diff --git a/Content.Server/Tools/ToolSystem.cs b/Content.Server/Tools/ToolSystem.cs index 88a96dc1e8..de6a7fefc1 100644 --- a/Content.Server/Tools/ToolSystem.cs +++ b/Content.Server/Tools/ToolSystem.cs @@ -5,6 +5,8 @@ using Content.Shared.Chemistry.EntitySystems; using Content.Shared.Maps; using Content.Shared.Tools; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem; diff --git a/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs b/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs index d7864ba16c..45c6a3d9d5 100644 --- a/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs +++ b/Content.Server/Weapons/Melee/Balloon/BalloonPopperSystem.cs @@ -4,6 +4,8 @@ using Content.Shared.IdentityManagement; using Content.Shared.Popups; using Content.Shared.Tag; using Content.Shared.Weapons.Melee.Events; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Weapons.Melee.Balloon; diff --git a/Content.Server/Weapons/Melee/EnergySword/EnergySwordSystem.cs b/Content.Server/Weapons/Melee/EnergySword/EnergySwordSystem.cs index c943aeb7f0..a08ff17ec8 100644 --- a/Content.Server/Weapons/Melee/EnergySword/EnergySwordSystem.cs +++ b/Content.Server/Weapons/Melee/EnergySword/EnergySwordSystem.cs @@ -12,6 +12,8 @@ using Content.Shared.Weapons.Melee; using Content.Shared.Weapons.Melee.Events; using Content.Shared.Wieldable; using Content.Shared.Wieldable.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Random; @@ -116,7 +118,7 @@ public sealed class EnergySwordSystem : EntitySystem if (comp.IsSharp) RemComp(uid); - _audio.Play(comp.DeActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.DeActivateSound.Params); + _audio.PlayEntity(comp.DeActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.DeActivateSound.Params); comp.Activated = false; } @@ -143,7 +145,7 @@ public sealed class EnergySwordSystem : EntitySystem malus.Malus += comp.LitDisarmMalus; } - _audio.Play(comp.ActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.ActivateSound.Params); + _audio.PlayEntity(comp.ActivateSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, comp.ActivateSound.Params); comp.Activated = true; } diff --git a/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs b/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs index 6236040a83..8cb22ca8bd 100644 --- a/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs +++ b/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs @@ -1,6 +1,8 @@ using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Random; using Content.Shared.Cluwne; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Server.Weapons.Melee.WeaponRandom; diff --git a/Content.Server/Wires/WiresSystem.cs b/Content.Server/Wires/WiresSystem.cs index b6452efa8a..cb019e3d64 100644 --- a/Content.Server/Wires/WiresSystem.cs +++ b/Content.Server/Wires/WiresSystem.cs @@ -16,6 +16,9 @@ using Content.Shared.Tools; using Content.Shared.Tools.Components; using Content.Shared.Wires; using Robust.Server.GameObjects; +using Robust.Server.Player; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs b/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs index 9200928d66..63095c7827 100644 --- a/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs +++ b/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs @@ -18,6 +18,7 @@ using Content.Shared.Xenoarchaeology.XenoArtifacts; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Robust.Shared.Utility; diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs index 0791924caa..b8b2fba9d3 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs @@ -9,6 +9,8 @@ using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components; using Content.Shared.CCVar; using Content.Shared.Xenoarchaeology.XenoArtifacts; using JetBrains.Annotations; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Random; using Robust.Shared.Timing; diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs index ba2786f32d..662abfee62 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; using Content.Shared.Humanoid; using Content.Shared.Mobs.Systems; +using Robust.Shared.Audio.Systems; namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; diff --git a/Content.Server/Zombies/ZombieSystem.Transform.cs b/Content.Server/Zombies/ZombieSystem.Transform.cs index 9c51b052fe..8b351a5901 100644 --- a/Content.Server/Zombies/ZombieSystem.Transform.cs +++ b/Content.Server/Zombies/ZombieSystem.Transform.cs @@ -33,6 +33,7 @@ using Content.Shared.Weapons.Melee; using Content.Shared.Zombies; using Robust.Shared.Audio; using Content.Shared.Prying.Components; +using Robust.Shared.Audio.Systems; namespace Content.Server.Zombies { diff --git a/Content.Shared/Actions/SharedActionsSystem.cs b/Content.Shared/Actions/SharedActionsSystem.cs index e66fe01791..471e00a572 100644 --- a/Content.Shared/Actions/SharedActionsSystem.cs +++ b/Content.Shared/Actions/SharedActionsSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Hands; using Content.Shared.Interaction; using Content.Shared.Inventory.Events; using Content.Shared.Mind; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Map; diff --git a/Content.Shared/Anomaly/SharedAnomalySystem.cs b/Content.Shared/Anomaly/SharedAnomalySystem.cs index 48413ac001..cf937b761e 100644 --- a/Content.Shared/Anomaly/SharedAnomalySystem.cs +++ b/Content.Shared/Anomaly/SharedAnomalySystem.cs @@ -5,6 +5,8 @@ using Content.Shared.Database; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Weapons.Melee.Events; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Random; using Robust.Shared.Timing; diff --git a/Content.Shared/Audio/SharedAmbientSoundSystem.cs b/Content.Shared/Audio/SharedAmbientSoundSystem.cs index 30fdc946ed..6318ba2557 100644 --- a/Content.Shared/Audio/SharedAmbientSoundSystem.cs +++ b/Content.Shared/Audio/SharedAmbientSoundSystem.cs @@ -19,7 +19,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem ambience.Enabled = value; QueueUpdate(uid, ambience); - Dirty(ambience); + Dirty(uid, ambience); } public virtual void SetRange(EntityUid uid, float value, AmbientSoundComponent? ambience = null) @@ -29,7 +29,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem ambience.Range = value; QueueUpdate(uid, ambience); - Dirty(ambience); + Dirty(uid, ambience); } protected virtual void QueueUpdate(EntityUid uid, AmbientSoundComponent ambience) @@ -43,7 +43,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem return; ambience.Volume = value; - Dirty(ambience); + Dirty(uid, ambience); } public virtual void SetSound(EntityUid uid, SoundSpecifier sound, AmbientSoundComponent? ambience = null) @@ -53,7 +53,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem ambience.Sound = sound; QueueUpdate(uid, ambience); - Dirty(ambience); + Dirty(uid, ambience); } private void HandleCompState(EntityUid uid, AmbientSoundComponent component, ref ComponentHandleState args) diff --git a/Content.Shared/Audio/SharedContentAudioSystem.cs b/Content.Shared/Audio/SharedContentAudioSystem.cs index 7151ef2c17..3563f2f846 100644 --- a/Content.Shared/Audio/SharedContentAudioSystem.cs +++ b/Content.Shared/Audio/SharedContentAudioSystem.cs @@ -1,10 +1,12 @@ using Content.Shared.Physics; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Shared.Audio; public abstract class SharedContentAudioSystem : EntitySystem { - [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] protected readonly SharedAudioSystem Audio = default!; /// /// Standard variation to use for sounds. @@ -14,6 +16,6 @@ public abstract class SharedContentAudioSystem : EntitySystem public override void Initialize() { base.Initialize(); - _audio.OcclusionCollisionMask = (int) CollisionGroup.Impassable; + Audio.OcclusionCollisionMask = (int) CollisionGroup.Impassable; } } diff --git a/Content.Shared/Blocking/BlockingSystem.User.cs b/Content.Shared/Blocking/BlockingSystem.User.cs index bfefaf2b92..2d721390e6 100644 --- a/Content.Shared/Blocking/BlockingSystem.User.cs +++ b/Content.Shared/Blocking/BlockingSystem.User.cs @@ -1,6 +1,7 @@ using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; namespace Content.Shared.Blocking; @@ -51,7 +52,7 @@ public sealed partial class BlockingSystem if (blocking.IsBlocking) { - _audio.PlayPvs(blocking.BlockSound, uid, AudioParams.Default.WithVariation(0.2f)); + _audio.PlayPvs(blocking.BlockSound, uid); } } } diff --git a/Content.Shared/Blocking/Components/BlockingComponent.cs b/Content.Shared/Blocking/Components/BlockingComponent.cs index 9a379a29e9..f869c20679 100644 --- a/Content.Shared/Blocking/Components/BlockingComponent.cs +++ b/Content.Shared/Blocking/Components/BlockingComponent.cs @@ -57,8 +57,11 @@ public sealed partial class BlockingComponent : Component /// /// The sound to be played when you get hit while actively blocking /// - [DataField("blockSound")] - public SoundSpecifier BlockSound = new SoundPathSpecifier("/Audio/Weapons/block_metal1.ogg"); + [DataField("blockSound")] public SoundSpecifier BlockSound = + new SoundPathSpecifier("/Audio/Weapons/block_metal1.ogg") + { + Params = AudioParams.Default.WithVariation(0.25f) + }; /// /// Fraction of original damage shield will take instead of user diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index 9795a6f3dc..9b31d0899c 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -496,8 +496,10 @@ public abstract partial class SharedBuckleSystem _joints.RefreshRelay(buckleUid); Appearance.SetData(strapUid, StrapVisuals.State, strapComp.BuckledEntities.Count != 0); - var audioSourceUid = userUid != buckleUid ? userUid : strapUid; - _audio.PlayPredicted(strapComp.UnbuckleSound, strapUid, audioSourceUid); + + // TODO: Buckle listening to moveevents is sussy anyway. + if (!TerminatingOrDeleted(strapUid)) + _audio.PlayPredicted(strapComp.UnbuckleSound, strapUid, userUid); var ev = new BuckleChangeEvent(strapUid, buckleUid, false); RaiseLocalEvent(buckleUid, ref ev); diff --git a/Content.Shared/Buckle/SharedBuckleSystem.cs b/Content.Shared/Buckle/SharedBuckleSystem.cs index 1441745b5d..8f68335663 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Popups; using Content.Shared.Pulling; using Content.Shared.Standing; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Network; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index a6f3f5df72..7d7a3e6872 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -69,6 +69,8 @@ namespace Content.Shared.CCVar public static readonly CVarDef AmbienceVolume = CVarDef.Create("ambience.volume", 0.0f, CVar.ARCHIVE | CVar.CLIENTONLY); + public const float MasterMultiplier = 2f; + // Midi is on engine so deal public const float MidiMultiplier = 3f; diff --git a/Content.Shared/Cabinet/SharedItemCabinetSystem.cs b/Content.Shared/Cabinet/SharedItemCabinetSystem.cs index f2f03c1334..92af6a4f8a 100644 --- a/Content.Shared/Cabinet/SharedItemCabinetSystem.cs +++ b/Content.Shared/Cabinet/SharedItemCabinetSystem.cs @@ -3,6 +3,7 @@ using Content.Shared.Interaction; using Content.Shared.Lock; using Content.Shared.Verbs; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -117,7 +118,7 @@ public abstract class SharedItemCabinetSystem : EntitySystem return; cabinet.Opened = !cabinet.Opened; - Dirty(cabinet); + Dirty(uid, cabinet); _itemSlots.SetLock(uid, cabinet.CabinetSlot, !cabinet.Opened); if (_timing.IsFirstTimePredicted) diff --git a/Content.Shared/Chasm/ChasmSystem.cs b/Content.Shared/Chasm/ChasmSystem.cs index 7353bd0e9c..4045a27078 100644 --- a/Content.Shared/Chasm/ChasmSystem.cs +++ b/Content.Shared/Chasm/ChasmSystem.cs @@ -2,6 +2,8 @@ using Content.Shared.Buckle.Components; using Content.Shared.Movement.Events; using Content.Shared.StepTrigger.Systems; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Physics.Components; using Robust.Shared.Timing; diff --git a/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs index ed53b78466..1a55408916 100644 --- a/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs @@ -4,6 +4,8 @@ using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; using Content.Shared.Database; using Content.Shared.FixedPoint; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; namespace Content.Shared.Chemistry.Reaction diff --git a/Content.Shared/Climbing/Systems/BonkSystem.cs b/Content.Shared/Climbing/Systems/BonkSystem.cs index 6ded524b19..b18d54cf78 100644 --- a/Content.Shared/Climbing/Systems/BonkSystem.cs +++ b/Content.Shared/Climbing/Systems/BonkSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Components; using Content.Shared.Popups; using Content.Shared.Stunnable; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Player; using Robust.Shared.Serialization; diff --git a/Content.Shared/Climbing/Systems/ClimbSystem.cs b/Content.Shared/Climbing/Systems/ClimbSystem.cs index f065d19dd3..c960b8e619 100644 --- a/Content.Shared/Climbing/Systems/ClimbSystem.cs +++ b/Content.Shared/Climbing/Systems/ClimbSystem.cs @@ -18,6 +18,7 @@ using Content.Shared.Physics; using Content.Shared.Popups; using Content.Shared.Stunnable; using Content.Shared.Verbs; +using Robust.Shared.Audio.Systems; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Components; diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 9194a8208e..ad27101cc1 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Popups; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Network; diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 5dbe62aa6a..93ef4e4213 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -29,6 +29,8 @@ using Content.Shared.Rejuvenate; using Content.Shared.Stunnable; using Content.Shared.Verbs; using Content.Shared.Weapons.Melee.Events; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Network; using Robust.Shared.Player; diff --git a/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs b/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs index 4371ac83a8..12bca52274 100644 --- a/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs +++ b/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Stunnable; using Content.Shared.Damage.Components; using Content.Shared.Effects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Physics.Events; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Shared/Damage/Systems/StaminaSystem.cs b/Content.Shared/Damage/Systems/StaminaSystem.cs index 40c4f7eb8f..33f1b0375b 100644 --- a/Content.Shared/Damage/Systems/StaminaSystem.cs +++ b/Content.Shared/Damage/Systems/StaminaSystem.cs @@ -16,6 +16,7 @@ using Content.Shared.Throwing; using Content.Shared.Weapons.Melee.Events; using JetBrains.Annotations; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Player; using Robust.Shared.Random; diff --git a/Content.Shared/Devour/SharedDevourSystem.cs b/Content.Shared/Devour/SharedDevourSystem.cs index 192fd20078..3d406843f5 100644 --- a/Content.Shared/Devour/SharedDevourSystem.cs +++ b/Content.Shared/Devour/SharedDevourSystem.cs @@ -4,6 +4,8 @@ using Content.Shared.DoAfter; using Content.Shared.Mobs; using Content.Shared.Mobs.Components; using Content.Shared.Popups; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Serialization; diff --git a/Content.Shared/Doors/Systems/SharedDoorBoltSystem.cs b/Content.Shared/Doors/Systems/SharedDoorBoltSystem.cs index a9a52010fd..7c5ef45275 100644 --- a/Content.Shared/Doors/Systems/SharedDoorBoltSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorBoltSystem.cs @@ -1,6 +1,8 @@ using Content.Shared.Doors.Components; using Content.Shared.Popups; using Content.Shared.Prying.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Shared.Doors.Systems; diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index 084c3b4ea2..85bb399b48 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -14,6 +14,8 @@ using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Systems; using Robust.Shared.Timing; +using Content.Shared.Prying.Components; +using Robust.Shared.Audio.Systems; namespace Content.Shared.Doors.Systems; diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 7b6ccaf0d4..44d9c5de3e 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -11,6 +11,7 @@ using Content.Shared.Movement.Systems; using Content.Shared.Popups; using Content.Shared.Strip.Components; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Network; using Robust.Shared.Player; @@ -25,6 +26,7 @@ public abstract partial class InventorySystem [Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedItemSystem _item = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; @@ -211,10 +213,10 @@ public abstract partial class InventorySystem filter.RemoveWhereAttachedEntity(entity => entity == actor); } - SoundSystem.Play(clothing.EquipSound.GetSound(), filter, target, clothing.EquipSound.Params.WithVolume(-2f)); + _audio.PlayPredicted(clothing.EquipSound, target, actor); } - inventory.Dirty(); + Dirty(target, inventory); _movementSpeed.RefreshMovementSpeedModifiers(target); @@ -400,10 +402,11 @@ public abstract partial class InventorySystem filter.RemoveWhereAttachedEntity(entity => entity == actor); } - SoundSystem.Play(clothing.UnequipSound.GetSound(), filter, target, clothing.UnequipSound.Params.WithVolume(-2f)); + _audio.PlayPredicted(clothing.UnequipSound, target, actor); } Dirty(target, inventory); + _movementSpeed.RefreshMovementSpeedModifiers(target); return true; diff --git a/Content.Shared/Light/SharedHandheldLightSystem.cs b/Content.Shared/Light/SharedHandheldLightSystem.cs index d530b07b18..2fa15800a3 100644 --- a/Content.Shared/Light/SharedHandheldLightSystem.cs +++ b/Content.Shared/Light/SharedHandheldLightSystem.cs @@ -3,6 +3,8 @@ using Content.Shared.Clothing.EntitySystems; using Content.Shared.Item; using Content.Shared.Light.Components; using Content.Shared.Toggleable; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameStates; namespace Content.Shared.Light; diff --git a/Content.Shared/Lock/LockComponent.cs b/Content.Shared/Lock/LockComponent.cs index 31187a96cb..174818c4e8 100644 --- a/Content.Shared/Lock/LockComponent.cs +++ b/Content.Shared/Lock/LockComponent.cs @@ -30,13 +30,19 @@ public sealed partial class LockComponent : Component /// The sound played when unlocked. /// [DataField("unlockingSound"), ViewVariables(VVAccess.ReadWrite)] - public SoundSpecifier UnlockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg"); + public SoundSpecifier UnlockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg") + { + Params = AudioParams.Default.WithVolume(-5f), + }; /// /// The sound played when locked. /// [DataField("lockingSound"), ViewVariables(VVAccess.ReadWrite)] - public SoundSpecifier LockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_on.ogg"); + public SoundSpecifier LockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_on.ogg") + { + Params = AudioParams.Default.WithVolume(-5f) + }; /// /// Whether or not an emag disables it. diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index 97baa28bf9..7babc6a9c0 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -11,6 +11,7 @@ using Content.Shared.Storage.Components; using Content.Shared.Verbs; using JetBrains.Annotations; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Utility; namespace Content.Shared.Lock; @@ -102,11 +103,11 @@ public sealed class LockSystem : EntitySystem _sharedPopupSystem.PopupClient(Loc.GetString("lock-comp-do-lock-success", ("entityName", Identity.Name(uid, EntityManager))), uid, user); - _audio.PlayPredicted(lockComp.LockSound, uid, user, AudioParams.Default.WithVolume(-5)); + _audio.PlayPredicted(lockComp.LockSound, uid, user); lockComp.Locked = true; _appearanceSystem.SetData(uid, StorageVisuals.Locked, true); - Dirty(lockComp); + Dirty(uid, lockComp); var ev = new LockToggledEvent(true); RaiseLocalEvent(uid, ref ev, true); @@ -130,11 +131,11 @@ public sealed class LockSystem : EntitySystem ("entityName", Identity.Name(uid, EntityManager))), uid, user.Value); } - _audio.PlayPredicted(lockComp.UnlockSound, uid, user, AudioParams.Default.WithVolume(-5)); + _audio.PlayPredicted(lockComp.UnlockSound, uid, user); lockComp.Locked = false; _appearanceSystem.SetData(uid, StorageVisuals.Locked, false); - Dirty(lockComp); + Dirty(uid, lockComp); var ev = new LockToggledEvent(false); RaiseLocalEvent(uid, ref ev, true); @@ -213,7 +214,7 @@ public sealed class LockSystem : EntitySystem { if (!component.Locked || !component.BreakOnEmag) return; - _audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); + _audio.PlayPredicted(component.UnlockSound, uid, null); _appearanceSystem.SetData(uid, StorageVisuals.Locked, false); RemComp(uid); //Literally destroys the lock as a tell it was emagged args.Handled = true; diff --git a/Content.Shared/Materials/MaterialReclaimerComponent.cs b/Content.Shared/Materials/MaterialReclaimerComponent.cs index 761469f99a..eda5cc4058 100644 --- a/Content.Shared/Materials/MaterialReclaimerComponent.cs +++ b/Content.Shared/Materials/MaterialReclaimerComponent.cs @@ -126,7 +126,7 @@ public sealed partial class MaterialReclaimerComponent : Component [DataField] public TimeSpan SoundCooldown = TimeSpan.FromSeconds(0.8f); - public IPlayingAudioStream? Stream; + public EntityUid? Stream; /// /// A counter of how many items have been processed diff --git a/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs b/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs index c3c712b617..31df11fa8b 100644 --- a/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs +++ b/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Emag.Systems; using Content.Shared.Examine; using Content.Shared.Mobs.Components; using Content.Shared.Stacks; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Physics.Events; using Robust.Shared.Timing; @@ -48,7 +50,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem private void OnShutdown(EntityUid uid, MaterialReclaimerComponent component, ComponentShutdown args) { - component.Stream?.Stop(); + _audio.Stop(component.Stream); } private void OnUnpaused(EntityUid uid, MaterialReclaimerComponent component, ref EntityUnpausedEvent args) @@ -116,8 +118,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem if (Timing.CurTime > component.NextSound) { - component.Stream = _audio.PlayPredicted(component.Sound, uid, user); - + component.Stream = _audio.PlayPredicted(component.Sound, uid, user)?.Entity; component.NextSound = Timing.CurTime + component.SoundCooldown; } @@ -167,9 +168,11 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem component.ItemsProcessed++; if (component.CutOffSound) - component.Stream?.Stop(); + { + _audio.Stop(component.Stream); + } - Dirty(component); + Dirty(uid, component); } /// @@ -181,7 +184,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem return; component.Enabled = enabled; AmbientSound.SetAmbience(uid, enabled && component.Powered); - Dirty(component); + Dirty(uid, component); } /// diff --git a/Content.Shared/Mech/Equipment/Systems/MechSoundboardSystem.cs b/Content.Shared/Mech/Equipment/Systems/MechSoundboardSystem.cs index b4254fe079..1440a6ef1f 100644 --- a/Content.Shared/Mech/Equipment/Systems/MechSoundboardSystem.cs +++ b/Content.Shared/Mech/Equipment/Systems/MechSoundboardSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Mech.Equipment.Systems; using Content.Shared.Timing; using Robust.Shared.Audio; using System.Linq; +using Robust.Shared.Audio.Systems; namespace Content.Shared.Mech.Equipment.Systems; diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index af065d0dec..6e8d47fd3e 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -12,6 +12,7 @@ using Content.Shared.Movement.Events; using Content.Shared.Pulling.Components; using Content.Shared.Tag; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Containers; using Robust.Shared.Map; diff --git a/Content.Shared/Ninja/Systems/DashAbilitySystem.cs b/Content.Shared/Ninja/Systems/DashAbilitySystem.cs index d376d05724..f9e5d4a1f6 100644 --- a/Content.Shared/Ninja/Systems/DashAbilitySystem.cs +++ b/Content.Shared/Ninja/Systems/DashAbilitySystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Interaction; using Content.Shared.Ninja.Components; using Content.Shared.Physics; using Content.Shared.Popups; +using Robust.Shared.Audio.Systems; using Robust.Shared.Timing; namespace Content.Shared.Ninja.Systems; diff --git a/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs b/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs index 473e29cc94..224152a402 100644 --- a/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs +++ b/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Clothing.EntitySystems; using Content.Shared.Inventory.Events; using Content.Shared.Ninja.Components; using Content.Shared.Timing; +using Robust.Shared.Audio.Systems; namespace Content.Shared.Ninja.Systems; diff --git a/Content.Shared/Projectiles/SharedProjectileSystem.cs b/Content.Shared/Projectiles/SharedProjectileSystem.cs index 63b4cb13aa..3b9eded288 100644 --- a/Content.Shared/Projectiles/SharedProjectileSystem.cs +++ b/Content.Shared/Projectiles/SharedProjectileSystem.cs @@ -4,6 +4,9 @@ using Content.Shared.DoAfter; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Throwing; +using Content.Shared.Weapons.Ranged.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Network; using Robust.Shared.Physics; diff --git a/Content.Shared/Prying/Systems/PryingSystem.cs b/Content.Shared/Prying/Systems/PryingSystem.cs index 5fd94c3438..bc37ab035a 100644 --- a/Content.Shared/Prying/Systems/PryingSystem.cs +++ b/Content.Shared/Prying/Systems/PryingSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Doors.Components; using System.Diagnostics.CodeAnalysis; using Content.Shared.Interaction; using Content.Shared.Popups; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using PryUnpoweredComponent = Content.Shared.Prying.Components.PryUnpoweredComponent; namespace Content.Shared.Prying.Systems; diff --git a/Content.Shared/RCD/Systems/RCDSystem.cs b/Content.Shared/RCD/Systems/RCDSystem.cs index ccc47a2fde..d7126716ed 100644 --- a/Content.Shared/RCD/Systems/RCDSystem.cs +++ b/Content.Shared/RCD/Systems/RCDSystem.cs @@ -13,6 +13,7 @@ using Content.Shared.RCD.Components; using Content.Shared.Tag; using Content.Shared.Tiles; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Network; diff --git a/Content.Shared/Radiation/Components/GeigerComponent.cs b/Content.Shared/Radiation/Components/GeigerComponent.cs index 585c1a51dc..71edb70b37 100644 --- a/Content.Shared/Radiation/Components/GeigerComponent.cs +++ b/Content.Shared/Radiation/Components/GeigerComponent.cs @@ -82,7 +82,7 @@ public sealed partial class GeigerComponent : Component /// Current stream of geiger counter audio. /// Played only for current user. /// - public IPlayingAudioStream? Stream; + public EntityUid? Stream; } [Serializable, NetSerializable] diff --git a/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs b/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs index eb97fe4113..31856eefac 100644 --- a/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs +++ b/Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Radio.Components; using Content.Shared.Tools; using Content.Shared.Tools.Components; using Content.Shared.Wires; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Network; using Robust.Shared.Prototypes; diff --git a/Content.Shared/RatKing/SharedRatKingSystem.cs b/Content.Shared/RatKing/SharedRatKingSystem.cs index 93293d09be..5ae01ebb98 100644 --- a/Content.Shared/RatKing/SharedRatKingSystem.cs +++ b/Content.Shared/RatKing/SharedRatKingSystem.cs @@ -3,6 +3,8 @@ using Content.Shared.DoAfter; using Content.Shared.Random; using Content.Shared.Random.Helpers; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Prototypes; using Robust.Shared.Random; diff --git a/Content.Shared/Roles/SharedRoleSystem.cs b/Content.Shared/Roles/SharedRoleSystem.cs index ae49289eb8..05d6ab9f37 100644 --- a/Content.Shared/Roles/SharedRoleSystem.cs +++ b/Content.Shared/Roles/SharedRoleSystem.cs @@ -3,6 +3,7 @@ using Content.Shared.Database; using Content.Shared.Mind; using Content.Shared.Roles.Jobs; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; namespace Content.Shared.Roles; diff --git a/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs b/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs index cbc54c91e3..d678b14b92 100644 --- a/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs +++ b/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs @@ -6,6 +6,8 @@ using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Stacks; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Prototypes; diff --git a/Content.Shared/Silicons/Bots/EmaggableMedibotComponent.cs b/Content.Shared/Silicons/Bots/EmaggableMedibotComponent.cs index 47fb940786..a75d6113c9 100644 --- a/Content.Shared/Silicons/Bots/EmaggableMedibotComponent.cs +++ b/Content.Shared/Silicons/Bots/EmaggableMedibotComponent.cs @@ -33,6 +33,8 @@ public sealed partial class EmaggableMedibotComponent : Component /// /// Sound to play when the bot has been emagged /// - [DataField("sparkSound")] - public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks"); + [DataField("sparkSound")] public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks") + { + Params = AudioParams.Default.WithVolume(8f), + }; } diff --git a/Content.Shared/Silicons/Bots/MedibotSystem.cs b/Content.Shared/Silicons/Bots/MedibotSystem.cs index fe88cbae5c..464e95b77f 100644 --- a/Content.Shared/Silicons/Bots/MedibotSystem.cs +++ b/Content.Shared/Silicons/Bots/MedibotSystem.cs @@ -1,5 +1,6 @@ using Content.Shared.Emag.Systems; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; namespace Content.Shared.Silicons.Bots; @@ -22,7 +23,7 @@ public sealed class MedibotSystem : EntitySystem if (!TryComp(uid, out var medibot)) return; - _audio.PlayPredicted(comp.SparkSound, uid, args.UserUid, AudioParams.Default.WithVolume(8)); + _audio.PlayPredicted(comp.SparkSound, uid, args.UserUid); medibot.StandardMed = comp.StandardMed; medibot.StandardMedAmount = comp.StandardMedAmount; diff --git a/Content.Shared/Singularity/Components/SingularityComponent.cs b/Content.Shared/Singularity/Components/SingularityComponent.cs index fe5cd0377f..3bab8d80b0 100644 --- a/Content.Shared/Singularity/Components/SingularityComponent.cs +++ b/Content.Shared/Singularity/Components/SingularityComponent.cs @@ -61,7 +61,7 @@ public sealed partial class SingularityComponent : Component /// The audio stream that plays the sound specified by on loop. /// [ViewVariables(VVAccess.ReadWrite)] - public IPlayingAudioStream? AmbientSoundStream = null; + public EntityUid? AmbientSoundStream = null; /// /// The sound that the singularity produces when it forms. diff --git a/Content.Shared/Slippery/SlipperySystem.cs b/Content.Shared/Slippery/SlipperySystem.cs index 00f023f9a3..60d53eb16f 100644 --- a/Content.Shared/Slippery/SlipperySystem.cs +++ b/Content.Shared/Slippery/SlipperySystem.cs @@ -5,6 +5,8 @@ using Content.Shared.StatusEffect; using Content.Shared.StepTrigger.Systems; using Content.Shared.Stunnable; using JetBrains.Annotations; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; diff --git a/Content.Shared/Sound/SharedEmitSoundSystem.cs b/Content.Shared/Sound/SharedEmitSoundSystem.cs index ea42b4bff9..c7fcfc6469 100644 --- a/Content.Shared/Sound/SharedEmitSoundSystem.cs +++ b/Content.Shared/Sound/SharedEmitSoundSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Sound.Components; using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Network; using Robust.Shared.Physics.Components; @@ -33,7 +34,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnEmitSpawnOnInit); + SubscribeLocalEvent(OnEmitSpawnOnInit); SubscribeLocalEvent(OnEmitSoundOnLand); SubscribeLocalEvent(OnEmitSoundOnUseInHand); SubscribeLocalEvent(OnEmitSoundOnThrown); @@ -45,7 +46,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem SubscribeLocalEvent(OnEmitSoundOnCollide); } - private void OnEmitSpawnOnInit(EntityUid uid, EmitSoundOnSpawnComponent component, ComponentInit args) + private void OnEmitSpawnOnInit(EntityUid uid, EmitSoundOnSpawnComponent component, MapInitEvent args) { TryEmitSound(uid, component, predict: false); } @@ -142,8 +143,11 @@ public abstract class SharedEmitSoundSystem : EntitySystem var fraction = MathF.Min(1f, (physics.LinearVelocity.Length() - component.MinimumVelocity) / MaxVolumeVelocity); var volume = MinVolume + (MaxVolume - MinVolume) * fraction; component.NextSound = _timing.CurTime + EmitSoundOnCollideComponent.CollideCooldown; + var sound = component.Sound; - if (_netMan.IsServer) - _audioSystem.PlayPvs(component.Sound, uid, AudioParams.Default.WithVolume(volume)); + if (_netMan.IsServer && sound != null) + { + _audioSystem.PlayPvs(_audioSystem.GetSound(sound), uid, AudioParams.Default.WithVolume(volume)); + } } } diff --git a/Content.Shared/Standing/StandingStateSystem.cs b/Content.Shared/Standing/StandingStateSystem.cs index bb74a088b3..517831b8a1 100644 --- a/Content.Shared/Standing/StandingStateSystem.cs +++ b/Content.Shared/Standing/StandingStateSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Hands.Components; using Content.Shared.Physics; using Content.Shared.Rotation; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Physics; using Robust.Shared.Physics.Systems; @@ -81,7 +82,7 @@ namespace Content.Shared.Standing if (playSound) { - _audio.PlayPredicted(standingState.DownSound, uid, uid, AudioParams.Default.WithVariation(0.25f)); + _audio.PlayPredicted(standingState.DownSound, uid, uid); } return true; diff --git a/Content.Shared/Storage/EntitySystems/DumpableSystem.cs b/Content.Shared/Storage/EntitySystems/DumpableSystem.cs index ad86a52665..1672e27214 100644 --- a/Content.Shared/Storage/EntitySystems/DumpableSystem.cs +++ b/Content.Shared/Storage/EntitySystems/DumpableSystem.cs @@ -5,6 +5,8 @@ using Content.Shared.Interaction; using Content.Shared.Placeable; using Content.Shared.Storage.Components; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Random; using Robust.Shared.Utility; diff --git a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs index f84a65398d..1e3320e7db 100644 --- a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs @@ -15,6 +15,8 @@ using Content.Shared.Storage.Components; using Content.Shared.Tools.Systems; using Content.Shared.Verbs; using Content.Shared.Wall; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Map; diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index ef7930fe2b..31f6ae5c7b 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -17,6 +17,8 @@ using Content.Shared.Stacks; using Content.Shared.Storage.Components; using Content.Shared.Timing; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Prototypes; diff --git a/Content.Shared/Stunnable/SharedStunSystem.cs b/Content.Shared/Stunnable/SharedStunSystem.cs index 4875f2f68f..c447f8c8bc 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.cs @@ -18,6 +18,7 @@ using Content.Shared.Standing; using Content.Shared.StatusEffect; using Content.Shared.Throwing; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.GameStates; using Robust.Shared.Player; diff --git a/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs b/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs index 13deb869bc..ebd8362411 100644 --- a/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs +++ b/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs @@ -6,6 +6,8 @@ using Content.Shared.Pulling; using Content.Shared.Pulling.Components; using Content.Shared.Teleportation.Components; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Network; using Robust.Shared.Physics.Dynamics; diff --git a/Content.Shared/Tiles/FloorTileComponent.cs b/Content.Shared/Tiles/FloorTileComponent.cs index 6d497c003d..92208a76d4 100644 --- a/Content.Shared/Tiles/FloorTileComponent.cs +++ b/Content.Shared/Tiles/FloorTileComponent.cs @@ -15,7 +15,10 @@ namespace Content.Shared.Tiles [DataField("outputs", customTypeSerializer: typeof(PrototypeIdListSerializer))] public List? OutputTiles; - [DataField("placeTileSound")] - public SoundSpecifier PlaceTileSound = new SoundPathSpecifier("/Audio/Items/genhit.ogg"); + [DataField("placeTileSound")] public SoundSpecifier PlaceTileSound = + new SoundPathSpecifier("/Audio/Items/genhit.ogg") + { + Params = AudioParams.Default.WithVariation(0.125f), + }; } } diff --git a/Content.Shared/Tiles/FloorTileSystem.cs b/Content.Shared/Tiles/FloorTileSystem.cs index dcf914ccf8..21e21fa9e9 100644 --- a/Content.Shared/Tiles/FloorTileSystem.cs +++ b/Content.Shared/Tiles/FloorTileSystem.cs @@ -10,6 +10,7 @@ using Content.Shared.Physics; using Content.Shared.Popups; using Content.Shared.Stacks; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Network; @@ -178,7 +179,7 @@ public sealed class FloorTileSystem : EntitySystem var variant = (byte) (_timing.CurTick.Value % ((ContentTileDefinition) _tileDefinitionManager[tileId]).Variants); mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant)); - _audio.PlayPredicted(placeSound, location, user, AudioHelpers.WithVariation(0.125f, _random)); + _audio.PlayPredicted(placeSound, location, user); } public bool CanPlaceTile(EntityUid gridUid, MapGridComponent component, [NotNullWhen(false)] out string? reason) diff --git a/Content.Shared/Tools/Systems/SharedToolSystem.cs b/Content.Shared/Tools/Systems/SharedToolSystem.cs index c1a2bdc2dd..91984d29e3 100644 --- a/Content.Shared/Tools/Systems/SharedToolSystem.cs +++ b/Content.Shared/Tools/Systems/SharedToolSystem.cs @@ -3,6 +3,8 @@ using Content.Shared.DoAfter; using Content.Shared.Interaction; using Content.Shared.Maps; using Content.Shared.Tools.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Network; using Robust.Shared.Prototypes; @@ -52,7 +54,7 @@ public abstract partial class SharedToolSystem : EntitySystem if (tool.UseSound == null) return; - _audioSystem.PlayPredicted(tool.UseSound, uid, user, tool.UseSound.Params.WithVariation(0.175f).AddVolume(-5f)); + _audioSystem.PlayPredicted(tool.UseSound, uid, user); } /// diff --git a/Content.Shared/Traits/Assorted/ParacusiaComponent.cs b/Content.Shared/Traits/Assorted/ParacusiaComponent.cs index 51a7471f1e..1db698359b 100644 --- a/Content.Shared/Traits/Assorted/ParacusiaComponent.cs +++ b/Content.Shared/Traits/Assorted/ParacusiaComponent.cs @@ -43,5 +43,5 @@ public sealed partial class ParacusiaComponent : Component [DataField("timeBetweenIncidents", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] public TimeSpan NextIncidentTime; - public IPlayingAudioStream? Stream; + public EntityUid? Stream; } diff --git a/Content.Shared/Vehicle/Components/VehicleComponent.cs b/Content.Shared/Vehicle/Components/VehicleComponent.cs index 509581cc32..a4a4d89a25 100644 --- a/Content.Shared/Vehicle/Components/VehicleComponent.cs +++ b/Content.Shared/Vehicle/Components/VehicleComponent.cs @@ -45,7 +45,7 @@ public sealed partial class VehicleComponent : Component }; [ViewVariables] - public IPlayingAudioStream? HonkPlayingStream; + public EntityUid? HonkPlayingStream; /// Use ambient sound component for the idle sound. diff --git a/Content.Shared/Vehicle/SharedVehicleSystem.cs b/Content.Shared/Vehicle/SharedVehicleSystem.cs index c211ec57f0..475675f22e 100644 --- a/Content.Shared/Vehicle/SharedVehicleSystem.cs +++ b/Content.Shared/Vehicle/SharedVehicleSystem.cs @@ -12,6 +12,8 @@ using Content.Shared.Movement.Systems; using Content.Shared.Popups; using Content.Shared.Tag; using Content.Shared.Vehicle.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Network; using Robust.Shared.Physics.Systems; @@ -174,8 +176,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem // TODO: Need audio refactor maybe, just some way to null it when the stream is over. // For now better to just not loop to keep the code much cleaner. - vehicle.HonkPlayingStream?.Stop(); - vehicle.HonkPlayingStream = _audioSystem.PlayPredicted(vehicle.HornSound, uid, uid); + vehicle.HonkPlayingStream = _audioSystem.PlayPredicted(vehicle.HornSound, uid, uid)?.Entity; args.Handled = true; } diff --git a/Content.Shared/VendingMachines/SharedVendingMachineSystem.cs b/Content.Shared/VendingMachines/SharedVendingMachineSystem.cs index 522138eb8b..50803e8ee2 100644 --- a/Content.Shared/VendingMachines/SharedVendingMachineSystem.cs +++ b/Content.Shared/VendingMachines/SharedVendingMachineSystem.cs @@ -4,6 +4,8 @@ using System.Linq; using Content.Shared.DoAfter; using Content.Shared.Interaction; using Content.Shared.Popups; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; namespace Content.Shared.VendingMachines; diff --git a/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs b/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs index 119b10218d..3a6afce363 100644 --- a/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs +++ b/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs @@ -1,6 +1,8 @@ using Content.Shared.Damage; using Content.Shared.Projectiles; using Content.Shared.Weapons.Melee.Events; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Physics.Events; using Robust.Shared.Timing; diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 62af6067d0..5eac283ef1 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -20,6 +20,7 @@ using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Events; using Content.Shared.Weapons.Ranged.Systems; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Physics; using Robust.Shared.Physics.Systems; diff --git a/Content.Shared/Weapons/Misc/BaseForceGunComponent.cs b/Content.Shared/Weapons/Misc/BaseForceGunComponent.cs index 61c84f7d3d..9ee705061a 100644 --- a/Content.Shared/Weapons/Misc/BaseForceGunComponent.cs +++ b/Content.Shared/Weapons/Misc/BaseForceGunComponent.cs @@ -52,5 +52,5 @@ public abstract partial class BaseForceGunComponent : Component Params = AudioParams.Default.WithLoop(true).WithVolume(-8f), }; - public IPlayingAudioStream? Stream; + public EntityUid? Stream; } diff --git a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs index 7713c98955..3aa82c411c 100644 --- a/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedGrapplingGunSystem.cs @@ -9,6 +9,8 @@ using Content.Shared.Projectiles; using Content.Shared.Timing; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Systems; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; @@ -61,13 +63,13 @@ public abstract class SharedGrapplingGunSystem : EntitySystem // At least show the visuals. component.Projectile = shotUid.Value; - Dirty(component); + Dirty(uid, component); var visuals = EnsureComp(shotUid.Value); visuals.Sprite = new SpriteSpecifier.Rsi(new ResPath("Objects/Weapons/Guns/Launchers/grappling_gun.rsi"), "rope"); visuals.OffsetA = new Vector2(0f, 0.5f); visuals.Target = uid; - Dirty(visuals); + Dirty(shotUid.Value, visuals); } TryComp(uid, out var appearance); @@ -133,7 +135,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem } component.Projectile = null; - Dirty(component); + Dirty(uid, component); } } @@ -145,19 +147,18 @@ public abstract class SharedGrapplingGunSystem : EntitySystem if (value) { if (Timing.IsFirstTimePredicted) - component.Stream = _audio.PlayPredicted(component.ReelSound, uid, user); + component.Stream = _audio.PlayPredicted(component.ReelSound, uid, user)?.Entity; } else { if (Timing.IsFirstTimePredicted) { - component.Stream?.Stop(); - component.Stream = null; + component.Stream = _audio.Stop(component.Stream); } } component.Reeling = value; - Dirty(component); + Dirty(uid, component); } public override void Update(float frameTime) @@ -173,8 +174,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem if (Timing.IsFirstTimePredicted) { // Just in case. - grappling.Stream?.Stop(); - grappling.Stream = null; + grappling.Stream = _audio.Stop(grappling.Stream); } continue; @@ -200,7 +200,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem _physics.WakeBody(jointComp.Relay.Value); } - Dirty(jointComp); + Dirty(uid, jointComp); if (distance.MaxLength.Equals(distance.MinLength)) { @@ -221,7 +221,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem joint.MinLength = 0.35f; // Setting velocity directly for mob movement fucks this so need to make them aware of it. // joint.Breakpoint = 4000f; - Dirty(jointComp); + Dirty(uid, jointComp); } [Serializable, NetSerializable] diff --git a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs index 984ae832fb..177cb310d1 100644 --- a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs @@ -7,6 +7,8 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Movement.Events; using Content.Shared.Throwing; using Content.Shared.Toggleable; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Network; @@ -232,10 +234,10 @@ public abstract partial class SharedTetherGunSystem : EntitySystem // Sad... if (_netManager.IsServer && component.Stream == null) - component.Stream = _audio.PlayPredicted(component.Sound, gunUid, null); + component.Stream = _audio.PlayPredicted(component.Sound, gunUid, null)?.Entity; - Dirty(tethered); - Dirty(component); + Dirty(target, tethered); + Dirty(gunUid, component); } protected virtual void StopTether(EntityUid gunUid, BaseForceGunComponent component, bool land = true, bool transfer = false) @@ -269,7 +271,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem if (!transfer) { - component.Stream?.Stop(); + _audio.Stop(component.Stream); component.Stream = null; } diff --git a/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs b/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs index 51f3e835b7..3ca52b2878 100644 --- a/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/GrapplingGunComponent.cs @@ -24,5 +24,5 @@ public sealed partial class GrapplingGunComponent : Component [ViewVariables(VVAccess.ReadWrite), DataField("cycleSound"), AutoNetworkedField] public SoundSpecifier? CycleSound = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/kinetic_reload.ogg"); - public IPlayingAudioStream? Stream; + public EntityUid? Stream; } diff --git a/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs b/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs index ded4ce34a2..536f3da811 100644 --- a/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs @@ -1,5 +1,7 @@ using Content.Shared.Examine; using Content.Shared.Weapons.Ranged.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Player; using Robust.Shared.Timing; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 6f764bb9f4..06667857b3 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -20,6 +20,7 @@ using Content.Shared.Weapons.Melee.Events; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Events; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Network; diff --git a/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs b/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs index ffa8180e1a..4986f9a341 100644 --- a/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs +++ b/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs @@ -10,6 +10,8 @@ using Content.Shared.Popups; using Content.Shared.Projectiles; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Events; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Network; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; diff --git a/Content.Shared/Weather/SharedWeatherSystem.cs b/Content.Shared/Weather/SharedWeatherSystem.cs index c7040515c8..d34893f8aa 100644 --- a/Content.Shared/Weather/SharedWeatherSystem.cs +++ b/Content.Shared/Weather/SharedWeatherSystem.cs @@ -1,4 +1,6 @@ using Content.Shared.Maps; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Components; @@ -15,13 +17,11 @@ public abstract class SharedWeatherSystem : EntitySystem [Dependency] protected readonly IPrototypeManager ProtoMan = default!; [Dependency] private readonly ITileDefinitionManager _tileDefManager = default!; [Dependency] private readonly MetaDataSystem _metadata = default!; - - protected ISawmill Sawmill = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { base.Initialize(); - Sawmill = Logger.GetSawmill("weather"); SubscribeLocalEvent(OnWeatherUnpaused); } @@ -123,7 +123,7 @@ public abstract class SharedWeatherSystem : EntitySystem // Admin messed up or the likes. if (!ProtoMan.TryIndex(proto, out var weatherProto)) { - Sawmill.Error($"Unable to find weather prototype for {comp.Weather}, ending!"); + Log.Error($"Unable to find weather prototype for {comp.Weather}, ending!"); EndWeather(uid, comp, proto); continue; } @@ -156,7 +156,8 @@ public abstract class SharedWeatherSystem : EntitySystem /// public void SetWeather(MapId mapId, WeatherPrototype? proto, TimeSpan? endTime) { - var weatherComp = EnsureComp(MapManager.GetMapEntityId(mapId)); + var mapUid = MapManager.GetMapEntityId(mapId); + var weatherComp = EnsureComp(mapUid); foreach (var (eProto, weather) in weatherComp.Weather) { @@ -168,7 +169,7 @@ public abstract class SharedWeatherSystem : EntitySystem if (weather.State == WeatherState.Ending) weather.State = WeatherState.Running; - Dirty(weatherComp); + Dirty(mapUid, weatherComp); continue; } @@ -178,7 +179,7 @@ public abstract class SharedWeatherSystem : EntitySystem if (weather.EndTime == null || weather.EndTime > end) { weather.EndTime = end; - Dirty(weatherComp); + Dirty(mapUid, weatherComp); } } @@ -211,10 +212,10 @@ public abstract class SharedWeatherSystem : EntitySystem if (!component.Weather.TryGetValue(proto, out var data)) return; - data.Stream?.Stop(); + _audio.Stop(data.Stream); data.Stream = null; component.Weather.Remove(proto); - Dirty(component); + Dirty(uid, component); } protected virtual bool SetState(WeatherState state, WeatherComponent component, WeatherData weather, WeatherPrototype weatherProto) diff --git a/Content.Shared/Weather/WeatherComponent.cs b/Content.Shared/Weather/WeatherComponent.cs index 6166ea0c64..bdc7bfdbf9 100644 --- a/Content.Shared/Weather/WeatherComponent.cs +++ b/Content.Shared/Weather/WeatherComponent.cs @@ -24,7 +24,7 @@ public sealed partial class WeatherData { // Client audio stream. [NonSerialized] - public IPlayingAudioStream? Stream; + public EntityUid? Stream; /// /// When the weather started if relevant. diff --git a/Content.Shared/Wieldable/WieldableSystem.cs b/Content.Shared/Wieldable/WieldableSystem.cs index ba87d54aa2..399d9b5168 100644 --- a/Content.Shared/Wieldable/WieldableSystem.cs +++ b/Content.Shared/Wieldable/WieldableSystem.cs @@ -12,6 +12,8 @@ using Content.Shared.Weapons.Melee.Components; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Systems; using Content.Shared.Wieldable.Components; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Content.Shared.Timing; diff --git a/Resources/Maps/atlas.yml b/Resources/Maps/atlas.yml index 999d79e8c0..d21b4ec5d5 100644 --- a/Resources/Maps/atlas.yml +++ b/Resources/Maps/atlas.yml @@ -44589,46 +44589,6 @@ entities: - pos: -11.5,-13.5 parent: 30 type: Transform - - thresholds: - - trigger: !type:DamageTrigger - damage: 100 - triggersOnce: False - triggered: True - behaviors: - - !type:DoActsBehavior - acts: Breakage - - !type:EjectVendorItems - max: 3 - percent: 0.25 - - trigger: !type:DamageTrigger - damage: 200 - triggersOnce: False - triggered: False - behaviors: - - !type:SpawnEntitiesBehavior - offset: 0.5 - spawn: - SheetSteel1: - max: 1 - min: 1 - transferForensics: False - - !type:DoActsBehavior - acts: Destruction - - !type:PlaySoundBehavior - sound: !type:SoundPathSpecifier - params: - variation: null - playoffset: 0 - loop: False - referenceDistance: 1 - rolloffFactor: 1 - maxdistance: 25 - busname: Master - pitchscale: 1 - volume: 0 - attenuation: Default - path: /Audio/Effects/metalbreak.ogg - type: Destructible - proto: VendingMachineVendomat entities: - uid: 5434 diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index 139792b16e..71c5444dc3 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -533,13 +533,13 @@ path: /Audio/Machines/Nuke/nuke_alarm.ogg params: volume: -5 - maxdistance: 10 + maxDistance: 10 - type: EmitSoundOnActivate sound: path: /Audio/Machines/Nuke/nuke_alarm.ogg params: volume: -5 - maxdistance: 10 + maxDistance: 10 - type: entity parent: BasePlushie diff --git a/Resources/Prototypes/Entities/Objects/Misc/paper.yml b/Resources/Prototypes/Entities/Objects/Misc/paper.yml index 99dc9c07c6..34de8d7e30 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/paper.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/paper.yml @@ -583,7 +583,7 @@ path: /Audio/Items/Stamp/thick_stamp_sub.ogg params: volume: -2 - maxdistance: 5 + maxDistance: 5 - type: Sprite sprite: Objects/Misc/bureaucracy.rsi state: stamp-mime @@ -603,7 +603,7 @@ path: /Audio/Items/Stamp/automatic_stamp.ogg params: volume: -2 - maxdistance: 5 + maxDistance: 5 - type: entity name: captain's rubber stamp diff --git a/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml b/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml index e78d8dd150..69a81f9f46 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml @@ -50,7 +50,7 @@ beepSound: path: "/Audio/Items/locator_beep.ogg" params: - maxdistance: 1 + maxDistance: 1 volume: -8 - type: entity @@ -103,4 +103,4 @@ - type: ItemSlots slots: cell_slot: - name: power-cell-slot-component-slot-name-default \ No newline at end of file + name: power-cell-slot-component-slot-name-default diff --git a/Resources/Prototypes/Entities/Structures/Machines/fatextractor.yml b/Resources/Prototypes/Entities/Structures/Machines/fatextractor.yml index d574b286c4..33186f0a1d 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fatextractor.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fatextractor.yml @@ -9,7 +9,7 @@ path: /Audio/Machines/microwave_loop.ogg params: loop: true - maxdistance: 5 + maxDistance: 5 - type: Sprite sprite: Structures/Machines/fat_sucker.rsi snapCardinals: true diff --git a/Resources/Prototypes/Entities/Structures/Machines/material_reclaimer.yml b/Resources/Prototypes/Entities/Structures/Machines/material_reclaimer.yml index b7886b7ca5..699c3491f1 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/material_reclaimer.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/material_reclaimer.yml @@ -81,7 +81,7 @@ path: /Audio/Ambience/Objects/crushing.ogg params: volume: 5 - maxdistance: 5 + maxDistance: 5 loop: true - type: MaterialStorage insertOnInteract: false diff --git a/Resources/Prototypes/Voice/speech_emote_sounds.yml b/Resources/Prototypes/Voice/speech_emote_sounds.yml index 3cbb0665b8..e37f9c24c9 100644 --- a/Resources/Prototypes/Voice/speech_emote_sounds.yml +++ b/Resources/Prototypes/Voice/speech_emote_sounds.yml @@ -218,7 +218,7 @@ collection: Whistles params: variation: 0.125 - pitchscale: 0.75 + pitch: 0.75 - type: emoteSounds id: FemaleDwarf @@ -253,7 +253,7 @@ collection: Whistles params: variation: 0.125 - pitchscale: 0.75 + pitch: 0.75 - type: emoteSounds id: UnisexMoth diff --git a/Resources/engineCommandPerms.yml b/Resources/engineCommandPerms.yml index f8db432c3d..423da9cdc8 100644 --- a/Resources/engineCommandPerms.yml +++ b/Resources/engineCommandPerms.yml @@ -39,6 +39,7 @@ - addview - removeview - hwid + - showaudio - showpos - showray - showchunkbb