Unrevert audio (#21330)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
metalgearsloth
2023-11-27 22:12:34 +11:00
committed by GitHub
parent d3486d3b25
commit 269c93245d
288 changed files with 848 additions and 427 deletions

View File

@@ -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);
/// <summary>
/// How many times we can be playing 1 particular sound at once.
/// </summary>
private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f));
private readonly Dictionary<Entity<AmbientSoundComponent>, (IPlayingAudioStream? Stream, SoundSpecifier Sound, string Path)> _playingSounds = new();
private readonly Dictionary<AmbientSoundComponent, (EntityUid? Stream, SoundSpecifier Sound, string Path)> _playingSounds = new();
private readonly Dictionary<string, int> _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<string, List<(float Importance, Entity<AmbientSoundComponent>)>> SourceDict = new();
public readonly Dictionary<string, List<(float Importance, AmbientSoundComponent)>> SourceDict = new();
public readonly Vector2 MapPos;
public readonly TransformComponent Player;
public readonly EntityQuery<TransformComponent> 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)

View File

@@ -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);
}
}

View File

@@ -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<IPlayingAudioStream?> _adminAudio = new(1);
private List<EntityUid?> _adminAudio = new(1);
// Event sounds (e.g. nuke timer)
private bool _eventAudioEnabled = true;
private Dictionary<StationEventMusicType, IPlayingAudioStream?> _eventAudio = new(1);
private Dictionary<StationEventMusicType, EntityUid?> _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();
}

View File

@@ -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;
/// <summary>
@@ -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<RulesPrototype>(_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

View File

@@ -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<AudioSystem.PlayingStream, float> _fadingOut = new();
private readonly Dictionary<EntityUid, float> _fadingOut = new();
// Need volume change per tick + target volume.
private readonly Dictionary<AudioSystem.PlayingStream, (float VolumeChange, float TargetVolume)> _fadingIn = new();
private readonly Dictionary<EntityUid, (float VolumeChange, float TargetVolume)> _fadingIn = new();
private readonly List<AudioSystem.PlayingStream> _fadeToRemove = new();
private readonly List<EntityUid> _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);
}

View File

@@ -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;

View File

@@ -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<string, int> 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});

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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()

View File

@@ -1,4 +1,5 @@
using Robust.Client.ResourceManagement;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
namespace Content.Client.IoC

View File

@@ -44,7 +44,7 @@ public sealed partial class ExpendableLightComponent : SharedExpendableLightComp
/// The sound that plays when the expendable light is lit.
/// </summary>
[Access(typeof(ExpendableLightSystem))]
public IPlayingAudioStream? PlayingStream;
public EntityUid? PlayingStream;
}
public enum ExpendableLightVisualLayers : byte

View File

@@ -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<ExpendableLightComp
private void OnLightShutdown(EntityUid uid, ExpendableLightComponent component, ComponentShutdown args)
{
component.PlayingStream?.Stop();
component.PlayingStream = _audioSystem.Stop(component.PlayingStream);
}
protected override void OnAppearanceChange(EntityUid uid, ExpendableLightComponent comp, ref AppearanceChangeEvent args)
@@ -48,12 +50,10 @@ public sealed class ExpendableLightSystem : VisualizerSystem<ExpendableLightComp
switch (state)
{
case ExpendableLightState.Lit:
comp.PlayingStream?.Stop();
_audioSystem.Stop(comp.PlayingStream);
comp.PlayingStream = _audioSystem.PlayPvs(
comp.LoopedSound,
uid,
SharedExpendableLightComponent.LoopedSoundParams
);
comp.LoopedSound, uid, SharedExpendableLightComponent.LoopedSoundParams)?.Entity;
if (args.Sprite.LayerMapTryGet(ExpendableLightVisualLayers.Overlay, out var layerIdx, true))
{
if (!string.IsNullOrWhiteSpace(comp.IconStateLit))
@@ -73,7 +73,7 @@ public sealed class ExpendableLightSystem : VisualizerSystem<ExpendableLightComp
break;
case ExpendableLightState.Dead:
comp.PlayingStream?.Stop();
comp.PlayingStream = _audioSystem.Stop(comp.PlayingStream);
if (args.Sprite.LayerMapTryGet(ExpendableLightVisualLayers.Overlay, out layerIdx, true))
{
if (!string.IsNullOrWhiteSpace(comp.IconStateSpent))

View File

@@ -2,6 +2,8 @@ using Content.Shared.Light;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Random;
namespace Content.Client.Light.Visualizers;

View File

@@ -1,5 +1,7 @@
using Content.Shared.CCVar;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -14,13 +16,14 @@ namespace Content.Client.Options.UI.Tabs
public sealed partial class AudioTab : Control
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClydeAudio _clydeAudio = default!;
private readonly AudioSystem _audio;
public AudioTab()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_audio = IoCManager.Resolve<IEntityManager>().System<AudioSystem>();
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 =

View File

@@ -57,16 +57,17 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou
}
var debugParallax = IoCManager.Resolve<IConfigurationManager>().GetCVar(CCVars.ParallaxDebug);
var resManager = IoCManager.Resolve<IResourceManager>();
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<IResourceManager>();
// 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<IResourceManager>();
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<IResourceManager>();
if (!resManager.TryContentFileRead(ParallaxConfigPath, out var configStream))
{
return null;
}

View File

@@ -139,7 +139,6 @@ public sealed class ContentReplayPlaybackManager
{
case RoundEndMessageEvent:
case PopupEvent:
case AudioMessage:
case PickupAnimationEvent:
case MeleeLungeEvent:
case SharedGunSystem.HitscanEvent:

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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<BwoinkSyst
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[UISystemDependency] private readonly SharedAudioSystem _audio = default!;
private BwoinkSystem? _bwoinkSystem;
private MenuButton? GameAHelpButton => UIManager.GetActiveUIWidgetOrNull<GameTopMenuBar>()?.AHelpButton;
@@ -128,7 +130,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
}
if (localPlayer.UserId != message.TrueSender)
{
SoundSystem.Play("/Audio/Effects/adminhelp.ogg", Filter.Local());
_audio.PlayGlobal("/Audio/Effects/adminhelp.ogg", Filter.Local(), false);
_clyde.RequestWindowAttention();
}

View File

@@ -1,7 +1,9 @@
using Content.Client.UserInterface.Systems.Chat.Controls;
using Content.Shared.Chat;
using Content.Shared.Input;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
@@ -19,6 +21,7 @@ public partial class ChatBox : UIWidget
#pragma warning restore RA0003
{
private readonly ChatUIController _controller;
private readonly IEntityManager _entManager;
public bool Main { get; set; }
@@ -27,6 +30,7 @@ public partial class ChatBox : UIWidget
public ChatBox()
{
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
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<AudioSystem>().PlayGlobal(msg.AudioPath, Filter.Local(), false, AudioParams.Default.WithVolume(msg.AudioVolume));
msg.Read = true;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<AudioComponent>(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;
}

View File

@@ -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;

View File

@@ -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}");

View File

@@ -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<IResourceCache>();
_resManager = client.ResolveDependency<IResourceManager>();
_sPrototypeManager = server.ResolveDependency<IPrototypeManager>();
}
@@ -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
{

View File

@@ -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<IResourceCache>();
_resManager = client.ResolveDependency<IResourceManager>();
_sEntityManager = server.ResolveDependency<IEntityManager>();
_images = new Dictionary<(string path, string state), Image>();
_errorImage = Image.Load<Rgba32>(_cResourceCache.ContentFileRead("/Textures/error.rsi/error.png"));
_errorImage = Image.Load<Rgba32>(_resManager.ContentFileRead("/Textures/error.rsi/error.png"));
}
public void Run(Image canvas, List<EntityData> 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<Rgba32>(stream);
_images[key] = image;

View File

@@ -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<ITileDefinitionManager>();
_cResourceCache = client.ResolveDependency<IResourceCache>();
_resManager = client.ResolveDependency<IResourceManager>();
}
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<string, List<Image>> 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<Image>(definition.Variants);
using var stream = resourceCache.ContentFileRead(path);
using var stream = resManager.ContentFileRead(path);
Image tileSheet = Image.Load<Rgba32>(stream);
if (tileSheet.Width != tileSize * definition.Variants || tileSheet.Height != tileSize)

View File

@@ -3,10 +3,11 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ServerGarbageCollection>True</ServerGarbageCollection>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NVorbis" Version="0.10.1" PrivateAssets="compile" />
<PackageReference Include="NVorbis" Version="0.10.5" PrivateAssets="compile" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RobustToolbox\Robust.Packaging\Robust.Packaging.csproj" />

View File

@@ -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<string>(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);

View File

@@ -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;

View File

@@ -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))

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -81,7 +81,7 @@ public sealed partial class AnomalySystem
var generating = EnsureComp<GeneratingAnomalyGeneratorComponent>(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);
}
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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)));
}
}

View File

@@ -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)

View File

@@ -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!;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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<RoundStartingEvent>(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();
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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}");

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<SmokeSystem>();
smoke.StartSmoke(ent, splitSolution, _duration, spreadAmount);
args.EntityManager.System<SharedAudioSystem>().PlayPvs(_sound, args.SolutionEntity, AudioHelpers.WithVariation(0.125f));
var audio = args.EntityManager.System<SharedAudioSystem>();
audio.PlayPvs(_sound, args.SolutionEntity, AudioHelpers.WithVariation(0.125f));
}
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
/// <summary>

View File

@@ -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;

View File

@@ -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<AppearanceComponent>(explosionEntity);
_appearance.SetData(explosionEntity, ExplosionAppearanceData.Progress, 1, appearance);

View File

@@ -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,

View File

@@ -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
{

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

Some files were not shown because too many files have changed in this diff Show More