Unrevert audio (#21330)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
@@ -1,16 +1,21 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Numerics;
|
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Robust.Client.GameObjects;
|
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
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;
|
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.
|
//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 TimeSpan _targetTime = TimeSpan.Zero;
|
||||||
private float _ambienceVolume = 0.0f;
|
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>
|
/// <summary>
|
||||||
/// How many times we can be playing 1 particular sound at once.
|
/// How many times we can be playing 1 particular sound at once.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f));
|
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();
|
private readonly Dictionary<string, int> _playingCount = new();
|
||||||
|
|
||||||
public bool OverlayEnabled
|
public bool OverlayEnabled
|
||||||
@@ -98,10 +107,10 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
|
|
||||||
private void OnShutdown(EntityUid uid, AmbientSoundComponent component, ComponentShutdown args)
|
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;
|
return;
|
||||||
|
|
||||||
sound.Stream?.Stop();
|
_audio.Stop(sound.Stream);
|
||||||
_playingCount[sound.Path] -= 1;
|
_playingCount[sound.Path] -= 1;
|
||||||
if (_playingCount[sound.Path] == 0)
|
if (_playingCount[sound.Path] == 0)
|
||||||
_playingCount.Remove(sound.Path);
|
_playingCount.Remove(sound.Path);
|
||||||
@@ -111,13 +120,13 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
{
|
{
|
||||||
_ambienceVolume = value;
|
_ambienceVolume = value;
|
||||||
|
|
||||||
foreach (var ((_, comp), values) in _playingSounds)
|
foreach (var (comp, values) in _playingSounds)
|
||||||
{
|
{
|
||||||
if (values.Stream == null)
|
if (values.Stream == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var stream = (AudioSystem.PlayingStream) values.Stream;
|
var stream = values.Stream;
|
||||||
stream.Volume = _params.Volume + comp.Volume + _ambienceVolume;
|
_audio.SetVolume(stream, _params.Volume + comp.Volume + _ambienceVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void SetCooldown(float value) => _cooldown = value;
|
private void SetCooldown(float value) => _cooldown = value;
|
||||||
@@ -177,7 +186,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
{
|
{
|
||||||
foreach (var (stream, _, _) in _playingSounds.Values)
|
foreach (var (stream, _, _) in _playingSounds.Values)
|
||||||
{
|
{
|
||||||
stream?.Stop();
|
_audio.Stop(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
_playingSounds.Clear();
|
_playingSounds.Clear();
|
||||||
@@ -186,7 +195,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
|
|
||||||
private readonly struct QueryState
|
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 Vector2 MapPos;
|
||||||
public readonly TransformComponent Player;
|
public readonly TransformComponent Player;
|
||||||
public readonly EntityQuery<TransformComponent> Query;
|
public readonly EntityQuery<TransformComponent> Query;
|
||||||
@@ -224,7 +233,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
|
|
||||||
// Prioritize far away & loud sounds.
|
// Prioritize far away & loud sounds.
|
||||||
var importance = range * (ambientComp.Volume + 32);
|
var importance = range * (ambientComp.Volume + 32);
|
||||||
state.SourceDict.GetOrNew(key).Add((importance, (ambientComp.Owner, ambientComp)));
|
state.SourceDict.GetOrNew(key).Add((importance, ambientComp));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,10 +247,9 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
var mapPos = playerXform.MapPosition;
|
var mapPos = playerXform.MapPosition;
|
||||||
|
|
||||||
// Remove out-of-range ambiences
|
// Remove out-of-range ambiences
|
||||||
foreach (var (ent, sound) in _playingSounds)
|
foreach (var (comp, sound) in _playingSounds)
|
||||||
{
|
{
|
||||||
var entity = ent.Owner;
|
var entity = comp.Owner;
|
||||||
var comp = ent.Comp;
|
|
||||||
|
|
||||||
if (comp.Enabled &&
|
if (comp.Enabled &&
|
||||||
// Don't keep playing sounds that have changed since.
|
// Don't keep playing sounds that have changed since.
|
||||||
@@ -258,8 +266,8 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sound.Stream?.Stop();
|
_audio.Stop(sound.Stream);
|
||||||
_playingSounds.Remove((entity, comp));
|
_playingSounds.Remove(comp);
|
||||||
_playingCount[sound.Path] -= 1;
|
_playingCount[sound.Path] -= 1;
|
||||||
if (_playingCount[sound.Path] == 0)
|
if (_playingCount[sound.Path] == 0)
|
||||||
_playingCount.Remove(sound.Path);
|
_playingCount.Remove(sound.Path);
|
||||||
@@ -284,12 +292,11 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
|
|
||||||
sources.Sort(static (a, b) => b.Importance.CompareTo(a.Importance));
|
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 uid = comp.Owner;
|
||||||
var comp = ent.Comp;
|
|
||||||
|
|
||||||
if (_playingSounds.ContainsKey(ent) ||
|
if (_playingSounds.ContainsKey(comp) ||
|
||||||
metaQuery.GetComponent(uid).EntityPaused)
|
metaQuery.GetComponent(uid).EntityPaused)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -299,11 +306,8 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
|||||||
.WithPlayOffset(_random.NextFloat(0.0f, 100.0f))
|
.WithPlayOffset(_random.NextFloat(0.0f, 100.0f))
|
||||||
.WithMaxDistance(comp.Range);
|
.WithMaxDistance(comp.Range);
|
||||||
|
|
||||||
var stream = _audio.PlayPvs(comp.Sound, uid, audioParams);
|
var stream = _audio.PlayEntity(comp.Sound, Filter.Local(), uid, false, audioParams);
|
||||||
if (stream == null)
|
_playingSounds[comp] = (stream.Value.Entity, comp.Sound, key);
|
||||||
continue;
|
|
||||||
|
|
||||||
_playingSounds[ent] = (stream, comp.Sound, key);
|
|
||||||
playingCount++;
|
playingCount++;
|
||||||
|
|
||||||
if (_playingSounds.Count >= _maxAmbientCount)
|
if (_playingSounds.Count >= _maxAmbientCount)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client;
|
using Robust.Client;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Player;
|
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 readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f);
|
||||||
|
|
||||||
private IPlayingAudioStream? _lobbyStream;
|
private EntityUid? _lobbyStream;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -118,12 +119,11 @@ public sealed class BackgroundAudioSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
_lobbyStream = _audio.PlayGlobal(file, Filter.Local(), false,
|
_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()
|
private void EndLobbyMusic()
|
||||||
{
|
{
|
||||||
_lobbyStream?.Stop();
|
_lobbyStream = _audio.Stop(_lobbyStream);
|
||||||
_lobbyStream = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
@@ -14,11 +15,11 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
|
|
||||||
// Admin music
|
// Admin music
|
||||||
private bool _adminAudioEnabled = true;
|
private bool _adminAudioEnabled = true;
|
||||||
private List<IPlayingAudioStream?> _adminAudio = new(1);
|
private List<EntityUid?> _adminAudio = new(1);
|
||||||
|
|
||||||
// Event sounds (e.g. nuke timer)
|
// Event sounds (e.g. nuke timer)
|
||||||
private bool _eventAudioEnabled = true;
|
private bool _eventAudioEnabled = true;
|
||||||
private Dictionary<StationEventMusicType, IPlayingAudioStream?> _eventAudio = new(1);
|
private Dictionary<StationEventMusicType, EntityUid?> _eventAudio = new(1);
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -49,13 +50,13 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
{
|
{
|
||||||
foreach (var stream in _adminAudio)
|
foreach (var stream in _adminAudio)
|
||||||
{
|
{
|
||||||
stream?.Stop();
|
_audio.Stop(stream);
|
||||||
}
|
}
|
||||||
_adminAudio.Clear();
|
_adminAudio.Clear();
|
||||||
|
|
||||||
foreach (var (_, stream) in _eventAudio)
|
foreach (var stream in _eventAudio.Values)
|
||||||
{
|
{
|
||||||
stream?.Stop();
|
_audio.Stop(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
_eventAudio.Clear();
|
_eventAudio.Clear();
|
||||||
@@ -66,7 +67,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
if(!_adminAudioEnabled) return;
|
if(!_adminAudioEnabled) return;
|
||||||
|
|
||||||
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams);
|
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams);
|
||||||
_adminAudio.Add(stream);
|
_adminAudio.Add(stream.Value.Entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayStationEventMusic(StationEventMusicEvent soundEvent)
|
private void PlayStationEventMusic(StationEventMusicEvent soundEvent)
|
||||||
@@ -75,7 +76,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return;
|
if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return;
|
||||||
|
|
||||||
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams);
|
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)
|
private void PlayGameSound(GameGlobalSoundEvent soundEvent)
|
||||||
@@ -85,8 +86,10 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
|
|
||||||
private void StopStationEventMusic(StopStationEventMusic soundEvent)
|
private void StopStationEventMusic(StopStationEventMusic soundEvent)
|
||||||
{
|
{
|
||||||
if (!_eventAudio.TryGetValue(soundEvent.Type, out var stream)) return;
|
if (!_eventAudio.TryGetValue(soundEvent.Type, out var stream))
|
||||||
stream?.Stop();
|
return;
|
||||||
|
|
||||||
|
_audio.Stop(stream);
|
||||||
_eventAudio.Remove(soundEvent.Type);
|
_eventAudio.Remove(soundEvent.Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +99,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
if (_adminAudioEnabled) return;
|
if (_adminAudioEnabled) return;
|
||||||
foreach (var stream in _adminAudio)
|
foreach (var stream in _adminAudio)
|
||||||
{
|
{
|
||||||
stream?.Stop();
|
_audio.Stop(stream);
|
||||||
}
|
}
|
||||||
_adminAudio.Clear();
|
_adminAudio.Clear();
|
||||||
}
|
}
|
||||||
@@ -107,7 +110,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
|||||||
if (_eventAudioEnabled) return;
|
if (_eventAudioEnabled) return;
|
||||||
foreach (var stream in _eventAudio)
|
foreach (var stream in _eventAudio)
|
||||||
{
|
{
|
||||||
stream.Value?.Stop();
|
_audio.Stop(stream.Value);
|
||||||
}
|
}
|
||||||
_eventAudio.Clear();
|
_eventAudio.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
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.
|
// Don't need to worry about this being serializable or pauseable as it doesn't affect the sim.
|
||||||
private TimeSpan _nextAudio;
|
private TimeSpan _nextAudio;
|
||||||
|
|
||||||
private AudioSystem.PlayingStream? _ambientMusicStream;
|
private EntityUid? _ambientMusicStream;
|
||||||
private AmbientMusicPrototype? _musicProto;
|
private AmbientMusicPrototype? _musicProto;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -83,7 +84,7 @@ public sealed partial class ContentAudioSystem
|
|||||||
|
|
||||||
if (_ambientMusicStream != null && _musicProto != null)
|
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);
|
_configManager.UnsubValueChanged(CCVars.AmbientMusicVolume, AmbienceCVarChanged);
|
||||||
_proto.PrototypesReloaded -= OnProtoReload;
|
_proto.PrototypesReloaded -= OnProtoReload;
|
||||||
_state.OnStateChanged -= OnStateChange;
|
_state.OnStateChanged -= OnStateChange;
|
||||||
_ambientMusicStream?.Stop();
|
_ambientMusicStream = _audio.Stop(_ambientMusicStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnProtoReload(PrototypesReloadedEventArgs obj)
|
private void OnProtoReload(PrototypesReloadedEventArgs obj)
|
||||||
@@ -129,8 +130,7 @@ public sealed partial class ContentAudioSystem
|
|||||||
private void OnRoundEndMessage(RoundEndMessageEvent ev)
|
private void OnRoundEndMessage(RoundEndMessageEvent ev)
|
||||||
{
|
{
|
||||||
// If scoreboard shows then just stop the music
|
// If scoreboard shows then just stop the music
|
||||||
_ambientMusicStream?.Stop();
|
_ambientMusicStream = _audio.Stop(_ambientMusicStream);
|
||||||
_ambientMusicStream = null;
|
|
||||||
_nextAudio = TimeSpan.FromMinutes(3);
|
_nextAudio = TimeSpan.FromMinutes(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ public sealed partial class ContentAudioSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isDone = _ambientMusicStream?.Done;
|
var isDone = !Exists(_ambientMusicStream);
|
||||||
|
|
||||||
if (_interruptable)
|
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)))
|
if (player == null || _musicProto == null || !_rules.IsTrue(player.Value, _proto.Index<RulesPrototype>(_musicProto.Rules)))
|
||||||
{
|
{
|
||||||
FadeOut(_ambientMusicStream, AmbientMusicFadeTime);
|
FadeOut(_ambientMusicStream, duration: AmbientMusicFadeTime);
|
||||||
_musicProto = null;
|
_musicProto = null;
|
||||||
_interruptable = false;
|
_interruptable = false;
|
||||||
isDone = true;
|
isDone = true;
|
||||||
@@ -221,14 +221,11 @@ public sealed partial class ContentAudioSystem
|
|||||||
false,
|
false,
|
||||||
AudioParams.Default.WithVolume(_musicProto.Sound.Params.Volume + _volumeSlider));
|
AudioParams.Default.WithVolume(_musicProto.Sound.Params.Volume + _volumeSlider));
|
||||||
|
|
||||||
if (strim != null)
|
_ambientMusicStream = strim.Value.Entity;
|
||||||
{
|
|
||||||
_ambientMusicStream = (AudioSystem.PlayingStream) strim;
|
|
||||||
|
|
||||||
if (_musicProto.FadeIn)
|
if (_musicProto.FadeIn)
|
||||||
{
|
{
|
||||||
FadeIn(_ambientMusicStream, AmbientMusicFadeTime);
|
FadeIn(_ambientMusicStream, strim.Value.Component, AmbientMusicFadeTime);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the list
|
// Refresh the list
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using AudioComponent = Robust.Shared.Audio.Components.AudioComponent;
|
||||||
|
|
||||||
namespace Content.Client.Audio;
|
namespace Content.Client.Audio;
|
||||||
|
|
||||||
public sealed partial class ContentAudioSystem : SharedContentAudioSystem
|
public sealed partial class ContentAudioSystem : SharedContentAudioSystem
|
||||||
{
|
{
|
||||||
// Need how much volume to change per tick and just remove it when it drops below "0"
|
// 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.
|
// 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 MinVolume = -32f;
|
||||||
private const float DefaultDuration = 2f;
|
private const float DefaultDuration = 2f;
|
||||||
@@ -42,28 +44,28 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem
|
|||||||
|
|
||||||
#region Fades
|
#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;
|
return;
|
||||||
|
|
||||||
// Just in case
|
// Just in case
|
||||||
// TODO: Maybe handle the removals by making it seamless?
|
// TODO: Maybe handle the removals by making it seamless?
|
||||||
_fadingIn.Remove(stream);
|
_fadingIn.Remove(stream.Value);
|
||||||
var diff = stream.Volume - MinVolume;
|
var diff = component.Volume - MinVolume;
|
||||||
_fadingOut.Add(stream, diff / duration);
|
_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;
|
return;
|
||||||
|
|
||||||
_fadingOut.Remove(stream);
|
_fadingOut.Remove(stream.Value);
|
||||||
var curVolume = stream.Volume;
|
var curVolume = component.Volume;
|
||||||
var change = (curVolume - MinVolume) / duration;
|
var change = (curVolume - MinVolume) / duration;
|
||||||
_fadingIn.Add(stream, (change, stream.Volume));
|
_fadingIn.Add(stream.Value, (change, component.Volume));
|
||||||
stream.Volume = MinVolume;
|
component.Volume = MinVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFades(float frameTime)
|
private void UpdateFades(float frameTime)
|
||||||
@@ -72,19 +74,18 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem
|
|||||||
|
|
||||||
foreach (var (stream, change) in _fadingOut)
|
foreach (var (stream, change) in _fadingOut)
|
||||||
{
|
{
|
||||||
// Cancelled elsewhere
|
if (!TryComp(stream, out AudioComponent? component))
|
||||||
if (stream.Done)
|
|
||||||
{
|
{
|
||||||
_fadeToRemove.Add(stream);
|
_fadeToRemove.Add(stream);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var volume = stream.Volume - change * frameTime;
|
var volume = component.Volume - change * frameTime;
|
||||||
stream.Volume = MathF.Max(MinVolume, volume);
|
component.Volume = MathF.Max(MinVolume, volume);
|
||||||
|
|
||||||
if (stream.Volume.Equals(MinVolume))
|
if (component.Volume.Equals(MinVolume))
|
||||||
{
|
{
|
||||||
stream.Stop();
|
_audio.Stop(stream);
|
||||||
_fadeToRemove.Add(stream);
|
_fadeToRemove.Add(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,16 +100,16 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem
|
|||||||
foreach (var (stream, (change, target)) in _fadingIn)
|
foreach (var (stream, (change, target)) in _fadingIn)
|
||||||
{
|
{
|
||||||
// Cancelled elsewhere
|
// Cancelled elsewhere
|
||||||
if (stream.Done)
|
if (!TryComp(stream, out AudioComponent? component))
|
||||||
{
|
{
|
||||||
_fadeToRemove.Add(stream);
|
_fadeToRemove.Add(stream);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var volume = stream.Volume + change * frameTime;
|
var volume = component.Volume + change * frameTime;
|
||||||
stream.Volume = MathF.Min(target, volume);
|
component.Volume = MathF.Min(target, volume);
|
||||||
|
|
||||||
if (stream.Volume.Equals(target))
|
if (component.Volume.Equals(target))
|
||||||
{
|
{
|
||||||
_fadeToRemove.Add(stream);
|
_fadeToRemove.Add(stream);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Robust.Client.ResourceManagement;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using static Content.Client.Changelog.ChangelogManager;
|
using static Content.Client.Changelog.ChangelogManager;
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Robust.Client.UserInterface.Controls;
|
|||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -23,7 +24,7 @@ namespace Content.Client.Credits
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class CreditsWindow : DefaultWindow
|
public sealed partial class CreditsWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IResourceCache _resourceManager = default!;
|
[Dependency] private readonly IResourceManager _resourceManager = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
private static readonly Dictionary<string, int> PatronTierPriority = new()
|
private static readonly Dictionary<string, int> PatronTierPriority = new()
|
||||||
@@ -49,7 +50,7 @@ namespace Content.Client.Credits
|
|||||||
|
|
||||||
private void PopulateLicenses(BoxContainer licensesContainer)
|
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});
|
licensesContainer.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = entry.Name});
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using Content.Shared.Emag.Systems;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent;
|
using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent;
|
||||||
|
|||||||
@@ -138,6 +138,6 @@ public sealed class DoorSystem : SharedDoorSystem
|
|||||||
protected override void PlaySound(EntityUid uid, SoundSpecifier soundSpecifier, AudioParams audioParams, EntityUid? predictingPlayer, bool predicted)
|
protected override void PlaySound(EntityUid uid, SoundSpecifier soundSpecifier, AudioParams audioParams, EntityUid? predictingPlayer, bool predicted)
|
||||||
{
|
{
|
||||||
if (GameTiming.InPrediction && GameTiming.IsFirstTimePredicted)
|
if (GameTiming.InPrediction && GameTiming.IsFirstTimePredicted)
|
||||||
Audio.Play(soundSpecifier, Filter.Local(), uid, false, audioParams);
|
Audio.PlayEntity(soundSpecifier, Filter.Local(), uid, false, audioParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ using Content.Shared.GameWindow;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Camera;
|
|||||||
using Content.Shared.Gravity;
|
using Content.Shared.Gravity;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ using Content.Shared.Tag;
|
|||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Content.Client.Info
|
|||||||
{
|
{
|
||||||
public sealed class RulesAndInfoWindow : DefaultWindow
|
public sealed class RulesAndInfoWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IResourceCache _resourceManager = default!;
|
[Dependency] private readonly IResourceManager _resourceManager = default!;
|
||||||
[Dependency] private readonly RulesManager _rules = default!;
|
[Dependency] private readonly RulesManager _rules = default!;
|
||||||
|
|
||||||
public RulesAndInfoWindow()
|
public RulesAndInfoWindow()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Client.IoC
|
namespace Content.Client.IoC
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public sealed partial class ExpendableLightComponent : SharedExpendableLightComp
|
|||||||
/// The sound that plays when the expendable light is lit.
|
/// The sound that plays when the expendable light is lit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Access(typeof(ExpendableLightSystem))]
|
[Access(typeof(ExpendableLightSystem))]
|
||||||
public IPlayingAudioStream? PlayingStream;
|
public EntityUid? PlayingStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ExpendableLightVisualLayers : byte
|
public enum ExpendableLightVisualLayers : byte
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using Content.Client.Light.Components;
|
|||||||
using Content.Shared.Light.Components;
|
using Content.Shared.Light.Components;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Client.Light.EntitySystems;
|
namespace Content.Client.Light.EntitySystems;
|
||||||
|
|
||||||
@@ -19,7 +21,7 @@ public sealed class ExpendableLightSystem : VisualizerSystem<ExpendableLightComp
|
|||||||
|
|
||||||
private void OnLightShutdown(EntityUid uid, ExpendableLightComponent component, ComponentShutdown args)
|
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)
|
protected override void OnAppearanceChange(EntityUid uid, ExpendableLightComponent comp, ref AppearanceChangeEvent args)
|
||||||
@@ -48,12 +50,10 @@ public sealed class ExpendableLightSystem : VisualizerSystem<ExpendableLightComp
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ExpendableLightState.Lit:
|
case ExpendableLightState.Lit:
|
||||||
comp.PlayingStream?.Stop();
|
_audioSystem.Stop(comp.PlayingStream);
|
||||||
comp.PlayingStream = _audioSystem.PlayPvs(
|
comp.PlayingStream = _audioSystem.PlayPvs(
|
||||||
comp.LoopedSound,
|
comp.LoopedSound, uid, SharedExpendableLightComponent.LoopedSoundParams)?.Entity;
|
||||||
uid,
|
|
||||||
SharedExpendableLightComponent.LoopedSoundParams
|
|
||||||
);
|
|
||||||
if (args.Sprite.LayerMapTryGet(ExpendableLightVisualLayers.Overlay, out var layerIdx, true))
|
if (args.Sprite.LayerMapTryGet(ExpendableLightVisualLayers.Overlay, out var layerIdx, true))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(comp.IconStateLit))
|
if (!string.IsNullOrWhiteSpace(comp.IconStateLit))
|
||||||
@@ -73,7 +73,7 @@ public sealed class ExpendableLightSystem : VisualizerSystem<ExpendableLightComp
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ExpendableLightState.Dead:
|
case ExpendableLightState.Dead:
|
||||||
comp.PlayingStream?.Stop();
|
comp.PlayingStream = _audioSystem.Stop(comp.PlayingStream);
|
||||||
if (args.Sprite.LayerMapTryGet(ExpendableLightVisualLayers.Overlay, out layerIdx, true))
|
if (args.Sprite.LayerMapTryGet(ExpendableLightVisualLayers.Overlay, out layerIdx, true))
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(comp.IconStateSpent))
|
if (!string.IsNullOrWhiteSpace(comp.IconStateSpent))
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using Content.Shared.Light;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Animations;
|
using Robust.Shared.Animations;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Client.Light.Visualizers;
|
namespace Content.Client.Light.Visualizers;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
|
using Robust.Client.Audio;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -14,13 +16,14 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
public sealed partial class AudioTab : Control
|
public sealed partial class AudioTab : Control
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
[Dependency] private readonly IClydeAudio _clydeAudio = default!;
|
private readonly AudioSystem _audio;
|
||||||
|
|
||||||
public AudioTab()
|
public AudioTab()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
|
_audio = IoCManager.Resolve<IEntityManager>().System<AudioSystem>();
|
||||||
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
|
||||||
RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
|
RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
|
||||||
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
|
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
|
||||||
@@ -79,7 +82,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
|
|
||||||
private void OnMasterVolumeSliderChanged(Range range)
|
private void OnMasterVolumeSliderChanged(Range range)
|
||||||
{
|
{
|
||||||
_clydeAudio.SetMasterVolume(MasterVolumeSlider.Value / 100);
|
_audio.SetMasterVolume(MasterVolumeSlider.Value / 100);
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +111,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
|
|
||||||
private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
|
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
|
// Want the CVar updated values to have the multiplier applied
|
||||||
// For the UI we just display 0-100 still elsewhere
|
// For the UI we just display 0-100 still elsewhere
|
||||||
_cfg.SetCVar(CVars.MidiVolume, LV100ToDB(MidiVolumeSlider.Value, CCVars.MidiMultiplier));
|
_cfg.SetCVar(CVars.MidiVolume, LV100ToDB(MidiVolumeSlider.Value, CCVars.MidiMultiplier));
|
||||||
@@ -132,7 +135,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
|
|
||||||
private void Reset()
|
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);
|
MidiVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CVars.MidiVolume), CCVars.MidiMultiplier);
|
||||||
AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume), CCVars.AmbienceMultiplier);
|
AmbienceVolumeSlider.Value = DBToLV100(_cfg.GetCVar(CCVars.AmbienceVolume), CCVars.AmbienceMultiplier);
|
||||||
AmbientMusicVolumeSlider.Value =
|
AmbientMusicVolumeSlider.Value =
|
||||||
@@ -150,8 +153,8 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
// Do be sure to rename the setting though
|
// Do be sure to rename the setting though
|
||||||
private float DBToLV100(float db, float multiplier = 1f)
|
private float DBToLV100(float db, float multiplier = 1f)
|
||||||
{
|
{
|
||||||
var weh = (float) (Math.Pow(10, db / 10) * 100 / multiplier);
|
var beri = (float) (Math.Pow(10, db / 10) * 100 / multiplier);
|
||||||
return weh;
|
return beri;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float LV100ToDB(float lv100, float multiplier = 1f)
|
private float LV100ToDB(float lv100, float multiplier = 1f)
|
||||||
@@ -164,7 +167,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
private void UpdateChanges()
|
private void UpdateChanges()
|
||||||
{
|
{
|
||||||
var isMasterVolumeSame =
|
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 =
|
var isMidiVolumeSame =
|
||||||
Math.Abs(MidiVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CVars.MidiVolume), CCVars.MidiMultiplier)) < 0.01f;
|
Math.Abs(MidiVolumeSlider.Value - DBToLV100(_cfg.GetCVar(CVars.MidiVolume), CCVars.MidiMultiplier)) < 0.01f;
|
||||||
var isAmbientVolumeSame =
|
var isAmbientVolumeSame =
|
||||||
|
|||||||
@@ -57,16 +57,17 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou
|
|||||||
}
|
}
|
||||||
|
|
||||||
var debugParallax = IoCManager.Resolve<IConfigurationManager>().GetCVar(CCVars.ParallaxDebug);
|
var debugParallax = IoCManager.Resolve<IConfigurationManager>().GetCVar(CCVars.ParallaxDebug);
|
||||||
|
var resManager = IoCManager.Resolve<IResourceManager>();
|
||||||
|
|
||||||
if (debugParallax
|
if (debugParallax
|
||||||
|| !StaticIoC.ResC.UserData.TryReadAllText(PreviousParallaxConfigPath, out var previousParallaxConfig)
|
|| !resManager.UserData.TryReadAllText(PreviousParallaxConfigPath, out var previousParallaxConfig)
|
||||||
|| previousParallaxConfig != parallaxConfig)
|
|| previousParallaxConfig != parallaxConfig)
|
||||||
{
|
{
|
||||||
var table = Toml.ReadString(parallaxConfig);
|
var table = Toml.ReadString(parallaxConfig);
|
||||||
await UpdateCachedTexture(table, debugParallax, cancel);
|
await UpdateCachedTexture(table, debugParallax, cancel);
|
||||||
|
|
||||||
//Update the previous config
|
//Update the previous config
|
||||||
using var writer = StaticIoC.ResC.UserData.OpenWriteText(PreviousParallaxConfigPath);
|
using var writer = resManager.UserData.OpenWriteText(PreviousParallaxConfigPath);
|
||||||
writer.Write(parallaxConfig);
|
writer.Write(parallaxConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Also try to at least sort of fix this if we've been fooled by a config backup
|
// 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)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -104,31 +105,34 @@ public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSou
|
|||||||
// And load it in the main thread for safety reasons.
|
// 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.
|
// But before spending time saving it, make sure to exit out early if it's not wanted.
|
||||||
cancel.ThrowIfCancellationRequested();
|
cancel.ThrowIfCancellationRequested();
|
||||||
|
var resManager = IoCManager.Resolve<IResourceManager>();
|
||||||
|
|
||||||
// Store it and CRC so further game starts don't need to regenerate it.
|
// Store it and CRC so further game starts don't need to regenerate it.
|
||||||
using var imageStream = StaticIoC.ResC.UserData.OpenWrite(ParallaxCachedImagePath);
|
await using var imageStream = resManager.UserData.OpenWrite(ParallaxCachedImagePath);
|
||||||
newParallexImage.SaveAsPng(imageStream);
|
await newParallexImage.SaveAsPngAsync(imageStream, cancel);
|
||||||
|
|
||||||
if (saveDebugLayers)
|
if (saveDebugLayers)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < debugImages!.Count; i++)
|
for (var i = 0; i < debugImages!.Count; i++)
|
||||||
{
|
{
|
||||||
var debugImage = debugImages[i];
|
var debugImage = debugImages[i];
|
||||||
using var debugImageStream = StaticIoC.ResC.UserData.OpenWrite(new ResPath($"/parallax_{Identifier}debug_{i}.png"));
|
await using var debugImageStream = resManager.UserData.OpenWrite(new ResPath($"/parallax_{Identifier}debug_{i}.png"));
|
||||||
debugImage.SaveAsPng(debugImageStream);
|
await debugImage.SaveAsPngAsync(debugImageStream, cancel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Texture GetCachedTexture()
|
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");
|
return Texture.LoadFromPNGStream(imageStream, "Parallax");
|
||||||
}
|
}
|
||||||
|
|
||||||
private string? GetParallaxConfig()
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ public sealed class ContentReplayPlaybackManager
|
|||||||
{
|
{
|
||||||
case RoundEndMessageEvent:
|
case RoundEndMessageEvent:
|
||||||
case PopupEvent:
|
case PopupEvent:
|
||||||
case AudioMessage:
|
|
||||||
case PickupAnimationEvent:
|
case PickupAnimationEvent:
|
||||||
case MeleeLungeEvent:
|
case MeleeLungeEvent:
|
||||||
case SharedGunSystem.HitscanEvent:
|
case SharedGunSystem.HitscanEvent:
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using Content.Shared.Traits.Assorted;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Traits;
|
namespace Content.Client.Traits;
|
||||||
@@ -41,7 +43,7 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem
|
|||||||
|
|
||||||
private void OnPlayerDetach(EntityUid uid, ParacusiaComponent component, LocalPlayerDetachedEvent args)
|
private void OnPlayerDetach(EntityUid uid, ParacusiaComponent component, LocalPlayerDetachedEvent args)
|
||||||
{
|
{
|
||||||
component.Stream?.Stop();
|
component.Stream = _audio.Stop(component.Stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayParacusiaSounds(EntityUid uid)
|
private void PlayParacusiaSounds(EntityUid uid)
|
||||||
@@ -67,7 +69,7 @@ public sealed class ParacusiaSystem : SharedParacusiaSystem
|
|||||||
var newCoords = Transform(uid).Coordinates.Offset(randomOffset);
|
var newCoords = Transform(uid).Coordinates.Offset(randomOffset);
|
||||||
|
|
||||||
// Play the sound
|
// Play the sound
|
||||||
paracusia.Stream = _audio.PlayStatic(paracusia.Sounds, uid, newCoords);
|
paracusia.Stream = _audio.PlayStatic(paracusia.Sounds, uid, newCoords).Value.Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Content.Shared.Trigger;
|
using Content.Shared.Trigger;
|
||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client.Trigger;
|
namespace Content.Client.Trigger;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Robust.Client.UserInterface.Controllers;
|
|||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -34,6 +35,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IClyde _clyde = default!;
|
[Dependency] private readonly IClyde _clyde = default!;
|
||||||
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
|
||||||
|
[UISystemDependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
|
||||||
private BwoinkSystem? _bwoinkSystem;
|
private BwoinkSystem? _bwoinkSystem;
|
||||||
private MenuButton? GameAHelpButton => UIManager.GetActiveUIWidgetOrNull<GameTopMenuBar>()?.AHelpButton;
|
private MenuButton? GameAHelpButton => UIManager.GetActiveUIWidgetOrNull<GameTopMenuBar>()?.AHelpButton;
|
||||||
@@ -128,7 +130,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
|
|||||||
}
|
}
|
||||||
if (localPlayer.UserId != message.TrueSender)
|
if (localPlayer.UserId != message.TrueSender)
|
||||||
{
|
{
|
||||||
SoundSystem.Play("/Audio/Effects/adminhelp.ogg", Filter.Local());
|
_audio.PlayGlobal("/Audio/Effects/adminhelp.ogg", Filter.Local(), false);
|
||||||
_clyde.RequestWindowAttention();
|
_clyde.RequestWindowAttention();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using Content.Client.UserInterface.Systems.Chat.Controls;
|
using Content.Client.UserInterface.Systems.Chat.Controls;
|
||||||
using Content.Shared.Chat;
|
using Content.Shared.Chat;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
|
using Robust.Client.Audio;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
@@ -19,6 +21,7 @@ public partial class ChatBox : UIWidget
|
|||||||
#pragma warning restore RA0003
|
#pragma warning restore RA0003
|
||||||
{
|
{
|
||||||
private readonly ChatUIController _controller;
|
private readonly ChatUIController _controller;
|
||||||
|
private readonly IEntityManager _entManager;
|
||||||
|
|
||||||
public bool Main { get; set; }
|
public bool Main { get; set; }
|
||||||
|
|
||||||
@@ -27,6 +30,7 @@ public partial class ChatBox : UIWidget
|
|||||||
public ChatBox()
|
public ChatBox()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
ChatInput.Input.OnTextEntered += OnTextEntered;
|
ChatInput.Input.OnTextEntered += OnTextEntered;
|
||||||
ChatInput.Input.OnKeyBindDown += OnKeyBindDown;
|
ChatInput.Input.OnKeyBindDown += OnKeyBindDown;
|
||||||
@@ -52,8 +56,8 @@ public partial class ChatBox : UIWidget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg is { Read: false, AudioPath: not null })
|
if (msg is { Read: false, AudioPath: { } })
|
||||||
SoundSystem.Play(msg.AudioPath, Filter.Local(), new AudioParams().WithVolume(msg.AudioVolume));
|
_entManager.System<AudioSystem>().PlayGlobal(msg.AudioPath, Filter.Local(), false, AudioParams.Default.WithVolume(msg.AudioVolume));
|
||||||
|
|
||||||
msg.Read = true;
|
msg.Read = true;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Voting;
|
using Content.Shared.Voting;
|
||||||
using Robust.Client;
|
using Robust.Client;
|
||||||
|
using Robust.Client.Audio;
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using Content.Shared.Projectiles;
|
|||||||
using Content.Shared.Weapons.Ranged.Components;
|
using Content.Shared.Weapons.Ranged.Components;
|
||||||
using Content.Shared.Weapons.Ranged.Systems;
|
using Content.Shared.Weapons.Ranged.Systems;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Shared.Weather;
|
using Content.Shared.Weather;
|
||||||
|
using Robust.Client.Audio;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
@@ -10,6 +12,7 @@ using Robust.Shared.Physics;
|
|||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using AudioComponent = Robust.Shared.Audio.Components.AudioComponent;
|
||||||
|
|
||||||
namespace Content.Client.Weather;
|
namespace Content.Client.Weather;
|
||||||
|
|
||||||
@@ -47,18 +50,18 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
|||||||
{
|
{
|
||||||
weather.LastOcclusion = 0f;
|
weather.LastOcclusion = 0f;
|
||||||
weather.LastAlpha = 0f;
|
weather.LastAlpha = 0f;
|
||||||
weather.Stream?.Stop();
|
weather.Stream = _audio.Stop(weather.Stream);
|
||||||
weather.Stream = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Timing.IsFirstTimePredicted || weatherProto.Sound == null)
|
if (!Timing.IsFirstTimePredicted || weatherProto.Sound == null)
|
||||||
return;
|
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 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;
|
var alpha = weather.LastAlpha;
|
||||||
alpha = MathF.Pow(alpha, 2f) * volumeMod;
|
alpha = MathF.Pow(alpha, 2f) * volumeMod;
|
||||||
// TODO: Lerp this occlusion.
|
// TODO: Lerp this occlusion.
|
||||||
@@ -124,7 +127,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
|||||||
{
|
{
|
||||||
occlusion = _physics.IntersectRayPenetration(entXform.MapID,
|
occlusion = _physics.IntersectRayPenetration(entXform.MapID,
|
||||||
new CollisionRay(entPos, sourceRelative.Normalized(), _audio.OcclusionCollisionMask),
|
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;
|
weather.LastAlpha += (alpha - weather.LastAlpha) * AlphaLerpRate * frameTime;
|
||||||
|
|
||||||
// Full volume if not on grid
|
// Full volume if not on grid
|
||||||
stream.Source.SetVolumeDirect(weather.LastAlpha);
|
comp.Gain = weather.LastAlpha;
|
||||||
stream.Source.SetOcclusion(weather.LastOcclusion);
|
comp.Occlusion = weather.LastOcclusion;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void EndWeather(EntityUid uid, WeatherComponent component, string proto)
|
protected override void EndWeather(EntityUid uid, WeatherComponent component, string proto)
|
||||||
@@ -164,9 +167,8 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// TODO: Fades (properly)
|
// TODO: Fades (properly)
|
||||||
weather.Stream?.Stop();
|
weather.Stream = _audio.Stop(weather.Stream);
|
||||||
weather.Stream = null;
|
weather.Stream = _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true)?.Entity;
|
||||||
weather.Stream = _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using Content.Server.Destructible.Thresholds.Triggers;
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Damage.Prototypes;
|
using Content.Shared.Damage.Prototypes;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||||
|
|||||||
@@ -619,6 +619,9 @@ public abstract partial class InteractionTest
|
|||||||
{
|
{
|
||||||
foreach (var (proto, quantity) in expected.Entities)
|
foreach (var (proto, quantity) in expected.Entities)
|
||||||
{
|
{
|
||||||
|
if (proto == "Audio")
|
||||||
|
continue;
|
||||||
|
|
||||||
if (quantity < 0 && failOnExcess)
|
if (quantity < 0 && failOnExcess)
|
||||||
Assert.Fail($"Unexpected entity/stack: {proto}, quantity: {-quantity}");
|
Assert.Fail($"Unexpected entity/stack: {proto}, quantity: {-quantity}");
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using Content.Shared.Decals;
|
using Content.Shared.Decals;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Client.Utility;
|
using Robust.Client.Utility;
|
||||||
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -16,7 +17,7 @@ namespace Content.MapRenderer.Painters;
|
|||||||
|
|
||||||
public sealed class DecalPainter
|
public sealed class DecalPainter
|
||||||
{
|
{
|
||||||
private readonly IResourceCache _cResourceCache;
|
private readonly IResourceManager _resManager;
|
||||||
|
|
||||||
private readonly IPrototypeManager _sPrototypeManager;
|
private readonly IPrototypeManager _sPrototypeManager;
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ public sealed class DecalPainter
|
|||||||
|
|
||||||
public DecalPainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
public DecalPainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
||||||
{
|
{
|
||||||
_cResourceCache = client.ResolveDependency<IResourceCache>();
|
_resManager = client.ResolveDependency<IResourceManager>();
|
||||||
_sPrototypeManager = server.ResolveDependency<IPrototypeManager>();
|
_sPrototypeManager = server.ResolveDependency<IPrototypeManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ public sealed class DecalPainter
|
|||||||
Stream stream;
|
Stream stream;
|
||||||
if (sprite is SpriteSpecifier.Texture texture)
|
if (sprite is SpriteSpecifier.Texture texture)
|
||||||
{
|
{
|
||||||
stream = _cResourceCache.ContentFileRead(texture.TexturePath);
|
stream = _resManager.ContentFileRead(texture.TexturePath);
|
||||||
}
|
}
|
||||||
else if (sprite is SpriteSpecifier.Rsi rsi)
|
else if (sprite is SpriteSpecifier.Rsi rsi)
|
||||||
{
|
{
|
||||||
@@ -73,7 +74,7 @@ public sealed class DecalPainter
|
|||||||
path = $"/Textures/{path}";
|
path = $"/Textures/{path}";
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = _cResourceCache.ContentFileRead(path);
|
stream = _resManager.ContentFileRead(path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
@@ -14,7 +15,7 @@ namespace Content.MapRenderer.Painters;
|
|||||||
|
|
||||||
public sealed class EntityPainter
|
public sealed class EntityPainter
|
||||||
{
|
{
|
||||||
private readonly IResourceCache _cResourceCache;
|
private readonly IResourceManager _resManager;
|
||||||
|
|
||||||
private readonly Dictionary<(string path, string state), Image> _images;
|
private readonly Dictionary<(string path, string state), Image> _images;
|
||||||
private readonly Image _errorImage;
|
private readonly Image _errorImage;
|
||||||
@@ -23,12 +24,12 @@ public sealed class EntityPainter
|
|||||||
|
|
||||||
public EntityPainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
public EntityPainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
||||||
{
|
{
|
||||||
_cResourceCache = client.ResolveDependency<IResourceCache>();
|
_resManager = client.ResolveDependency<IResourceManager>();
|
||||||
|
|
||||||
_sEntityManager = server.ResolveDependency<IEntityManager>();
|
_sEntityManager = server.ResolveDependency<IEntityManager>();
|
||||||
|
|
||||||
_images = new Dictionary<(string path, string state), Image>();
|
_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)
|
public void Run(Image canvas, List<EntityData> entities)
|
||||||
@@ -81,7 +82,7 @@ public sealed class EntityPainter
|
|||||||
|
|
||||||
if (!_images.TryGetValue(key, out image!))
|
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);
|
image = Image.Load<Rgba32>(stream);
|
||||||
|
|
||||||
_images[key] = image;
|
_images[key] = image;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
@@ -19,12 +20,12 @@ namespace Content.MapRenderer.Painters
|
|||||||
public const int TileImageSize = EyeManager.PixelsPerMeter;
|
public const int TileImageSize = EyeManager.PixelsPerMeter;
|
||||||
|
|
||||||
private readonly ITileDefinitionManager _sTileDefinitionManager;
|
private readonly ITileDefinitionManager _sTileDefinitionManager;
|
||||||
private readonly IResourceCache _cResourceCache;
|
private readonly IResourceManager _resManager;
|
||||||
|
|
||||||
public TilePainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
public TilePainter(ClientIntegrationInstance client, ServerIntegrationInstance server)
|
||||||
{
|
{
|
||||||
_sTileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
_sTileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
||||||
_cResourceCache = client.ResolveDependency<IResourceCache>();
|
_resManager = client.ResolveDependency<IResourceManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run(Image gridCanvas, EntityUid gridUid, MapGridComponent grid)
|
public void Run(Image gridCanvas, EntityUid gridUid, MapGridComponent grid)
|
||||||
@@ -37,7 +38,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
var yOffset = -bounds.Bottom;
|
var yOffset = -bounds.Bottom;
|
||||||
var tileSize = grid.TileSize * TileImageSize;
|
var tileSize = grid.TileSize * TileImageSize;
|
||||||
|
|
||||||
var images = GetTileImages(_sTileDefinitionManager, _cResourceCache, tileSize);
|
var images = GetTileImages(_sTileDefinitionManager, _resManager, tileSize);
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
grid.GetAllTiles().AsParallel().ForAll(tile =>
|
grid.GetAllTiles().AsParallel().ForAll(tile =>
|
||||||
@@ -61,7 +62,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
|
|
||||||
private Dictionary<string, List<Image>> GetTileImages(
|
private Dictionary<string, List<Image>> GetTileImages(
|
||||||
ITileDefinitionManager tileDefinitionManager,
|
ITileDefinitionManager tileDefinitionManager,
|
||||||
IResourceCache resourceCache,
|
IResourceManager resManager,
|
||||||
int tileSize)
|
int tileSize)
|
||||||
{
|
{
|
||||||
var stopwatch = new Stopwatch();
|
var stopwatch = new Stopwatch();
|
||||||
@@ -78,7 +79,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
|
|
||||||
images[path] = new List<Image>(definition.Variants);
|
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);
|
Image tileSheet = Image.Load<Rgba32>(stream);
|
||||||
|
|
||||||
if (tileSheet.Width != tileSize * definition.Variants || tileSheet.Height != tileSize)
|
if (tileSheet.Width != tileSize * definition.Variants || tileSheet.Height != tileSize)
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<ServerGarbageCollection>True</ServerGarbageCollection>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NVorbis" Version="0.10.1" PrivateAssets="compile" />
|
<PackageReference Include="NVorbis" Version="0.10.5" PrivateAssets="compile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\RobustToolbox\Robust.Packaging\Robust.Packaging.csproj" />
|
<ProjectReference Include="..\RobustToolbox\Robust.Packaging\Robust.Packaging.csproj" />
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using Robust.Packaging;
|
using Robust.Packaging;
|
||||||
using Robust.Packaging.AssetProcessing;
|
using Robust.Packaging.AssetProcessing;
|
||||||
using Robust.Packaging.AssetProcessing.Passes;
|
using Robust.Packaging.AssetProcessing.Passes;
|
||||||
using Robust.Packaging.Utility;
|
using Robust.Packaging.Utility;
|
||||||
using Robust.Shared.Audio;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using YamlDotNet.Core;
|
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.Packaging;
|
namespace Content.Packaging;
|
||||||
|
|
||||||
@@ -169,7 +164,7 @@ public static class ServerPackaging
|
|||||||
bool hybridAcz,
|
bool hybridAcz,
|
||||||
CancellationToken cancel)
|
CancellationToken cancel)
|
||||||
{
|
{
|
||||||
var graph = new RobustClientAssetGraph();
|
var graph = new RobustServerAssetGraph();
|
||||||
var passes = graph.AllPasses.ToList();
|
var passes = graph.AllPasses.ToList();
|
||||||
|
|
||||||
pass.Dependencies.Add(new AssetPassDependency(graph.Output.Name));
|
pass.Dependencies.Add(new AssetPassDependency(graph.Output.Name));
|
||||||
@@ -177,7 +172,8 @@ public static class ServerPackaging
|
|||||||
|
|
||||||
AssetGraph.CalculateGraph(passes, logger);
|
AssetGraph.CalculateGraph(passes, logger);
|
||||||
|
|
||||||
var inputPass = graph.Input;
|
var inputPassCore = graph.InputCore;
|
||||||
|
var inputPassResources = graph.InputResources;
|
||||||
var contentAssemblies = new List<string>(ServerContentAssemblies);
|
var contentAssemblies = new List<string>(ServerContentAssemblies);
|
||||||
|
|
||||||
// Additional assemblies that need to be copied such as EFCore.
|
// Additional assemblies that need to be copied such as EFCore.
|
||||||
@@ -200,26 +196,26 @@ public static class ServerPackaging
|
|||||||
Path.Combine("RobustToolbox", "bin", "Server",
|
Path.Combine("RobustToolbox", "bin", "Server",
|
||||||
platform.Rid,
|
platform.Rid,
|
||||||
"publish"),
|
"publish"),
|
||||||
inputPass,
|
inputPassCore,
|
||||||
BinSkipFolders,
|
BinSkipFolders,
|
||||||
cancel: cancel);
|
cancel: cancel);
|
||||||
|
|
||||||
await RobustSharedPackaging.WriteContentAssemblies(
|
await RobustSharedPackaging.WriteContentAssemblies(
|
||||||
inputPass,
|
inputPassResources,
|
||||||
contentDir,
|
contentDir,
|
||||||
"Content.Server",
|
"Content.Server",
|
||||||
contentAssemblies,
|
contentAssemblies,
|
||||||
Path.Combine("Resources", "Assemblies"),
|
cancel: cancel);
|
||||||
cancel);
|
|
||||||
|
|
||||||
await RobustServerPackaging.WriteServerResources(contentDir, inputPass, cancel);
|
await RobustServerPackaging.WriteServerResources(contentDir, inputPassResources, cancel);
|
||||||
|
|
||||||
if (hybridAcz)
|
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);
|
private readonly record struct PlatformReg(string Rid, string TargetOs, bool BuildByDefault);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using Content.Shared.DoAfter;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using static Content.Shared.Access.Components.AccessOverriderComponent;
|
using static Content.Shared.Access.Components.AccessOverriderComponent;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using Content.Shared.Throwing;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
@@ -39,7 +40,6 @@ namespace Content.Server.Administration.Systems
|
|||||||
[Dependency] private readonly IChatManager _chat = default!;
|
[Dependency] private readonly IChatManager _chat = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _config = default!;
|
[Dependency] private readonly IConfigurationManager _config = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly AudioSystem _audio = default!;
|
|
||||||
[Dependency] private readonly HandsSystem _hands = default!;
|
[Dependency] private readonly HandsSystem _hands = default!;
|
||||||
[Dependency] private readonly SharedJobSystem _jobs = default!;
|
[Dependency] private readonly SharedJobSystem _jobs = default!;
|
||||||
[Dependency] private readonly InventorySystem _inventory = 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 PlayTimeTrackingManager _playTime = default!;
|
||||||
[Dependency] private readonly SharedRoleSystem _role = default!;
|
[Dependency] private readonly SharedRoleSystem _role = default!;
|
||||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
|
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
|
||||||
[Dependency] private readonly TransformSystem _transform = 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);
|
_popup.PopupCoordinates(Loc.GetString("admin-erase-popup", ("user", name)), coordinates, PopupType.LargeCaution);
|
||||||
var filter = Filter.Pvs(coordinates, 1, EntityManager, _playerManager);
|
var filter = Filter.Pvs(coordinates, 1, EntityManager, _playerManager);
|
||||||
var audioParams = new AudioParams().WithVolume(3);
|
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))
|
foreach (var item in _inventory.GetHandOrInventoryEntities(entity.Value))
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Chat.Systems;
|
|||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
@@ -10,10 +11,11 @@ namespace Content.Server.AlertLevel;
|
|||||||
|
|
||||||
public sealed class AlertLevelSystem : EntitySystem
|
public sealed class AlertLevelSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly StationSystem _stationSystem = 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.
|
// Until stations are a prototype, this is how it's going to have to be.
|
||||||
public const string DefaultAlertLevelSet = "stationAlerts";
|
public const string DefaultAlertLevelSet = "stationAlerts";
|
||||||
@@ -174,7 +176,7 @@ public sealed class AlertLevelSystem : EntitySystem
|
|||||||
if (detail.Sound != null)
|
if (detail.Sound != null)
|
||||||
{
|
{
|
||||||
var filter = _stationSystem.GetInOwningStation(station);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.Popups;
|
|||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using Content.Server.Tools;
|
|||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.Ame.EntitySystems;
|
namespace Content.Server.Ame.EntitySystems;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Actions.Events;
|
|||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
using Content.Shared.Nutrition.EntitySystems;
|
using Content.Shared.Nutrition.EntitySystems;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.Power.EntitySystems;
|
|||||||
using Content.Shared.Anomaly.Components;
|
using Content.Shared.Anomaly.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Anomaly;
|
namespace Content.Server.Anomaly;
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public sealed partial class AnomalySystem
|
|||||||
|
|
||||||
var generating = EnsureComp<GeneratingAnomalyGeneratorComponent>(uid);
|
var generating = EnsureComp<GeneratingAnomalyGeneratorComponent>(uid);
|
||||||
generating.EndTime = Timing.CurTime + component.GenerationLength;
|
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;
|
component.CooldownEndTime = Timing.CurTime + component.CooldownLength;
|
||||||
UpdateGeneratorUi(uid, component);
|
UpdateGeneratorUi(uid, component);
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,8 @@ public sealed partial class AnomalySystem
|
|||||||
{
|
{
|
||||||
if (Timing.CurTime < active.EndTime)
|
if (Timing.CurTime < active.EndTime)
|
||||||
continue;
|
continue;
|
||||||
active.AudioStream?.Stop();
|
|
||||||
|
active.AudioStream = _audio.Stop(active.AudioStream);
|
||||||
OnGeneratingFinished(ent, gen);
|
OnGeneratingFinished(ent, gen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ using Content.Shared.Anomaly;
|
|||||||
using Content.Shared.Anomaly.Components;
|
using Content.Shared.Anomaly.Components;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -31,6 +33,7 @@ public sealed partial class AnomalySystem : SharedAnomalySystem
|
|||||||
[Dependency] private readonly SharedPointLightSystem _pointLight = default!;
|
[Dependency] private readonly SharedPointLightSystem _pointLight = default!;
|
||||||
[Dependency] private readonly StationSystem _station = default!;
|
[Dependency] private readonly StationSystem _station = default!;
|
||||||
[Dependency] private readonly RadioSystem _radio = default!;
|
[Dependency] private readonly RadioSystem _radio = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||||
|
|
||||||
public const float MinParticleVariation = 0.8f;
|
public const float MinParticleVariation = 0.8f;
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ public sealed partial class GeneratingAnomalyGeneratorComponent : Component
|
|||||||
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||||
public TimeSpan EndTime = TimeSpan.Zero;
|
public TimeSpan EndTime = TimeSpan.Zero;
|
||||||
|
|
||||||
public IPlayingAudioStream? AudioStream;
|
public EntityUid? AudioStream;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using Content.Server.Anomaly.Components;
|
|||||||
using Content.Shared.Anomaly.Components;
|
using Content.Shared.Anomaly.Components;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Teleportation.Components;
|
using Content.Shared.Teleportation.Components;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Anomaly.Effects;
|
namespace Content.Server.Anomaly.Effects;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Chemistry.EntitySystems;
|
|||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Content.Shared.Sprite;
|
using Content.Shared.Sprite;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Anomaly.Effects;
|
namespace Content.Server.Anomaly.Effects;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Content.Shared.Mobs.Components;
|
|||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
using Content.Server.Shuttles.Systems;
|
using Content.Server.Shuttles.Systems;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.UserInterface;
|
|||||||
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Arcade.SpaceVillain;
|
namespace Content.Server.Arcade.SpaceVillain;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Arcade.SpaceVillain;
|
namespace Content.Server.Arcade.SpaceVillain;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
// Cancel toggles sounds if we re-toggle again.
|
// Cancel toggles sounds if we re-toggle again.
|
||||||
|
|
||||||
public IPlayingAudioStream? ConnectStream;
|
public EntityUid? ConnectStream;
|
||||||
public IPlayingAudioStream? DisconnectStream;
|
public EntityUid? DisconnectStream;
|
||||||
|
|
||||||
[DataField("air"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("air"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public GasMixture Air { get; set; } = new();
|
public GasMixture Air { get; set; } = new();
|
||||||
|
|||||||
@@ -101,8 +101,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
|
if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
|
||||||
{
|
{
|
||||||
var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager);
|
var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager);
|
||||||
SoundSystem.Play(SpaceWindSound, Filter.Pvs(coordinates),
|
_audio.PlayPvs(SpaceWindSound, coordinates, AudioParams.Default.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
|
||||||
coordinates, AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
// A few details on the audio parameters for fire.
|
// 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 lesser the pitch variation.
|
||||||
// The greater the fire state, the greater the volume.
|
// The greater the fire state, the greater the volume.
|
||||||
SoundSystem.Play(HotspotSound, Filter.Pvs(coordinates),
|
_audio.PlayPvs(HotspotSound, coordinates, AudioParams.Default.WithVariation(0.15f/tile.Hotspot.State).WithVolume(-5f + 5f * tile.Hotspot.State));
|
||||||
coordinates, AudioHelpers.WithVariation(0.15f/tile.Hotspot.State).WithVolume(-5f + 5f * tile.Hotspot.State));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_hotspotSoundCooldown > HotspotSoundCooldownCycles)
|
if (_hotspotSoundCooldown > HotspotSoundCooldownCycles)
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ using Content.Shared.Atmos.EntitySystems;
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
@@ -28,6 +30,7 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
|
|||||||
[Dependency] private readonly SharedContainerSystem _containers = default!;
|
[Dependency] private readonly SharedContainerSystem _containers = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
[Dependency] private readonly GasTileOverlaySystem _gasTileOverlaySystem = default!;
|
[Dependency] private readonly GasTileOverlaySystem _gasTileOverlaySystem = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||||
[Dependency] private readonly TileSystem _tile = default!;
|
[Dependency] private readonly TileSystem _tile = default!;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Content.Shared.Throwing;
|
|||||||
using Content.Shared.Timing;
|
using Content.Shared.Timing;
|
||||||
using Content.Shared.Toggleable;
|
using Content.Shared.Toggleable;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.Verbs;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -239,10 +240,8 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!component.IsConnected)
|
if (!component.IsConnected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.ConnectStream?.Stop();
|
component.ConnectStream = _audioSys.Stop(component.ConnectStream);
|
||||||
|
component.ConnectStream = _audioSys.PlayPvs(component.ConnectSound, component.Owner)?.Entity;
|
||||||
if (component.ConnectSound != null)
|
|
||||||
component.ConnectStream = _audioSys.PlayPvs(component.ConnectSound, owner);
|
|
||||||
|
|
||||||
UpdateUserInterface(ent);
|
UpdateUserInterface(ent);
|
||||||
}
|
}
|
||||||
@@ -259,10 +258,8 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
_actions.SetToggled(component.ToggleActionEntity, false);
|
_actions.SetToggled(component.ToggleActionEntity, false);
|
||||||
|
|
||||||
_internals.DisconnectTank(internals);
|
_internals.DisconnectTank(internals);
|
||||||
component.DisconnectStream?.Stop();
|
component.DisconnectStream = _audioSys.Stop(component.DisconnectStream);
|
||||||
|
component.DisconnectStream = _audioSys.PlayPvs(component.DisconnectSound, component.Owner)?.Entity;
|
||||||
if (component.DisconnectSound != null)
|
|
||||||
component.DisconnectStream = _audioSys.PlayPvs(component.DisconnectSound, owner);
|
|
||||||
|
|
||||||
UpdateUserInterface(ent);
|
UpdateUserInterface(ent);
|
||||||
}
|
}
|
||||||
@@ -322,7 +319,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if(environment != null)
|
if(environment != null)
|
||||||
_atmosphereSystem.Merge(environment, component.Air);
|
_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);
|
QueueDel(owner);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Server.DeviceNetwork.Systems;
|
|||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Atmos.Monitor;
|
using Content.Shared.Atmos.Monitor;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Examine;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
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 SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -36,10 +38,11 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|
|
||||||
if (Loc.TryGetString("gas-valve-system-examined", out var str,
|
if (Loc.TryGetString("gas-valve-system-examined", out var str,
|
||||||
("statusColor", valve.Open ? "green" : "orange"),
|
("statusColor", valve.Open ? "green" : "orange"),
|
||||||
("open", valve.Open)
|
("open", valve.Open)))
|
||||||
))
|
{
|
||||||
args.PushMarkup(str);
|
args.PushMarkup(str);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnStartup(EntityUid uid, GasValveComponent component, ComponentStartup args)
|
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)
|
private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args)
|
||||||
{
|
{
|
||||||
Toggle(uid, component);
|
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)
|
public void Set(EntityUid uid, GasValveComponent component, bool value)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ using Content.Shared.Hands.EntitySystems;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Lock;
|
using Content.Shared.Lock;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,41 @@
|
|||||||
|
using Content.Server.GameTicking.Events;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
|
using Robust.Server.Audio;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Audio;
|
namespace Content.Server.Audio;
|
||||||
|
|
||||||
public sealed class ContentAudioSystem : SharedContentAudioSystem
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using Content.Server.Beam.Components;
|
|||||||
using Content.Shared.Beam;
|
using Content.Shared.Beam;
|
||||||
using Content.Shared.Beam.Components;
|
using Content.Shared.Beam.Components;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Collision.Shapes;
|
using Robust.Shared.Physics.Collision.Shapes;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ using Content.Shared.Slippery;
|
|||||||
using Content.Shared.StatusEffect;
|
using Content.Shared.StatusEffect;
|
||||||
using Content.Shared.Stunnable;
|
using Content.Shared.Stunnable;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Timing;
|
using Content.Shared.Timing;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ namespace Content.Server.Bible
|
|||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly UseDelaySystem _delay = default!;
|
[Dependency] private readonly UseDelaySystem _delay = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -80,8 +82,8 @@ namespace Content.Server.Bible
|
|||||||
summonableComp.Summon = null;
|
summonableComp.Summon = null;
|
||||||
}
|
}
|
||||||
summonableComp.AlreadySummoned = false;
|
summonableComp.AlreadySummoned = false;
|
||||||
_popupSystem.PopupEntity(Loc.GetString("bible-summon-respawn-ready", ("book", uid)), uid, PopupType.Medium);
|
_popupSystem.PopupEntity(Loc.GetString("bible-summon-respawn-ready", ("book", summonableComp.Owner)), summonableComp.Owner, PopupType.Medium);
|
||||||
SoundSystem.Play("/Audio/Effects/radpulse9.ogg", Filter.Pvs(uid), uid, AudioParams.Default.WithVolume(-4f));
|
_audio.PlayPvs("/Audio/Effects/radpulse9.ogg", summonableComp.Owner, AudioParams.Default.WithVolume(-4f));
|
||||||
// Clean up the accumulator and respawn tracking component
|
// Clean up the accumulator and respawn tracking component
|
||||||
summonableComp.Accumulator = 0;
|
summonableComp.Accumulator = 0;
|
||||||
_remQueue.Enqueue(uid);
|
_remQueue.Enqueue(uid);
|
||||||
@@ -107,7 +109,7 @@ namespace Content.Server.Bible
|
|||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("bible-sizzle"), args.User, args.User);
|
_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);
|
_damageableSystem.TryChangeDamage(args.User, component.DamageOnUntrainedUse, true, origin: uid);
|
||||||
_delay.BeginDelay(uid, delay);
|
_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));
|
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);
|
_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);
|
_damageableSystem.TryChangeDamage(args.Target.Value, component.DamageOnFail, true, origin: uid);
|
||||||
_delay.BeginDelay(uid, delay);
|
_delay.BeginDelay(uid, delay);
|
||||||
return;
|
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));
|
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);
|
_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);
|
_delay.BeginDelay(uid, delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ using Content.Shared.Speech.EntitySystems;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
using Content.Shared.Speech.EntitySystems;
|
||||||
|
using Robust.Server.Audio;
|
||||||
|
|
||||||
namespace Content.Server.Body.Systems;
|
namespace Content.Server.Body.Systems;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Robust.Shared.Player;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Body.Systems;
|
namespace Content.Server.Body.Systems;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ public sealed class BodySystem : SharedBodySystem
|
|||||||
var filter = Filter.Pvs(bodyId, entityManager: EntityManager);
|
var filter = Filter.Pvs(bodyId, entityManager: EntityManager);
|
||||||
var audio = AudioParams.Default.WithVariation(0.025f);
|
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)
|
foreach (var entity in gibs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Content.Shared.Random;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ using Content.Shared.Stealth;
|
|||||||
using Content.Shared.Stealth.Components;
|
using Content.Shared.Stealth.Components;
|
||||||
using Content.Shared.Storage.Components;
|
using Content.Shared.Storage.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ using Content.Shared.Containers.ItemSlots;
|
|||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.CartridgeLoader;
|
|||||||
using Content.Shared.CartridgeLoader.Cartridges;
|
using Content.Shared.CartridgeLoader.Cartridges;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Content.Shared.Players;
|
|||||||
using Content.Shared.Radio;
|
using Content.Shared.Radio;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
@@ -322,7 +323,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, wrappedMessage, default, false, true, colorOverride);
|
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, wrappedMessage, default, false, true, colorOverride);
|
||||||
if (playSound)
|
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}");
|
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Global station announcement from {sender}: {message}");
|
||||||
}
|
}
|
||||||
@@ -360,7 +361,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
|
|
||||||
if (playDefaultSound)
|
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}");
|
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement on {station} from {sender}: {message}");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ using Content.Shared.Chemistry;
|
|||||||
using Content.Shared.Chemistry.EntitySystems;
|
using Content.Shared.Chemistry.EntitySystems;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.EntitySystems;
|
namespace Content.Server.Chemistry.EntitySystems;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.Emag.Components;
|
using Content.Shared.Emag.Components;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.FixedPoint;
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
@@ -72,7 +73,8 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
var smoke = args.EntityManager.System<SmokeSystem>();
|
var smoke = args.EntityManager.System<SmokeSystem>();
|
||||||
smoke.StartSmoke(ent, splitSolution, _duration, spreadAmount);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ using Content.Shared.Roles.Jobs;
|
|||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ using Content.Server.Emoting.Systems;
|
|||||||
using Content.Server.Speech.EntitySystems;
|
using Content.Server.Speech.EntitySystems;
|
||||||
using Content.Shared.Cluwne;
|
using Content.Shared.Cluwne;
|
||||||
using Content.Shared.Interaction.Components;
|
using Content.Shared.Interaction.Components;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Cluwne;
|
namespace Content.Server.Cluwne;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Completions
|
namespace Content.Server.Construction.Completions
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ public sealed partial class PartExchangerComponent : Component
|
|||||||
[DataField("exchangeSound")]
|
[DataField("exchangeSound")]
|
||||||
public SoundSpecifier ExchangeSound = new SoundPathSpecifier("/Audio/Items/rped.ogg");
|
public SoundSpecifier ExchangeSound = new SoundPathSpecifier("/Audio/Items/rped.ogg");
|
||||||
|
|
||||||
public IPlayingAudioStream? AudioStream;
|
public EntityUid? AudioStream;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ using Content.Shared.Storage;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Content.Shared.Wires;
|
using Content.Shared.Wires;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Collections;
|
using Robust.Shared.Collections;
|
||||||
|
|
||||||
namespace Content.Server.Construction;
|
namespace Content.Server.Construction;
|
||||||
@@ -34,7 +36,7 @@ public sealed class PartExchangerSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (args.Cancelled)
|
if (args.Cancelled)
|
||||||
{
|
{
|
||||||
component.AudioStream?.Stop();
|
component.AudioStream = _audio.Stop(component.AudioStream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +170,7 @@ public sealed class PartExchangerSystem : EntitySystem
|
|||||||
return;
|
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)
|
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ExchangeDuration, new ExchangerDoAfterEvent(), uid, target: args.Target, used: uid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Content.Shared.Wires;
|
using Content.Shared.Wires;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Defusable.Systems;
|
namespace Content.Server.Defusable.Systems;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.Destructible;
|
using Content.Shared.Destructible;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Destructible.Thresholds.Behaviors
|
namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.DeviceLinking.Components;
|
using Content.Server.DeviceLinking.Components;
|
||||||
using Content.Server.DeviceLinking.Components.Overload;
|
using Content.Server.DeviceLinking.Components.Overload;
|
||||||
using Content.Server.DeviceLinking.Events;
|
using Content.Server.DeviceLinking.Events;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ using Content.Shared.Examine;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Tools;
|
using Content.Shared.Tools;
|
||||||
using Content.Shared.Popups;
|
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;
|
using SignalReceivedEvent = Content.Server.DeviceLinking.Events.SignalReceivedEvent;
|
||||||
|
|
||||||
namespace Content.Server.DeviceLinking.Systems;
|
namespace Content.Server.DeviceLinking.Systems;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Server.DeviceLinking.Components;
|
|||||||
using Content.Server.DeviceNetwork;
|
using Content.Server.DeviceNetwork;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.DeviceLinking.Systems;
|
namespace Content.Server.DeviceLinking.Systems;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using Content.Shared.Access.Systems;
|
|||||||
using Content.Shared.MachineLinking;
|
using Content.Shared.MachineLinking;
|
||||||
using Content.Shared.TextScreen;
|
using Content.Shared.TextScreen;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Server.DeviceLinking.Systems;
|
namespace Content.Server.DeviceLinking.Systems;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Content.Shared.Dice;
|
using Content.Shared.Dice;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Dice;
|
namespace Content.Server.Dice;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.Hands.Components;
|
|||||||
using Content.Shared.Movement.Events;
|
using Content.Shared.Movement.Events;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Damage;
|
|||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager;
|
using Robust.Shared.Serialization.Manager;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Dragon;
|
namespace Content.Server.Dragon;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ using Content.Shared.Mind;
|
|||||||
using Content.Shared.Mind.Components;
|
using Content.Shared.Mind.Components;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -203,7 +205,7 @@ public sealed partial class DragonSystem : EntitySystem
|
|||||||
private void Roar(EntityUid uid, DragonComponent comp)
|
private void Roar(EntityUid uid, DragonComponent comp)
|
||||||
{
|
{
|
||||||
if (comp.SoundRoar != null)
|
if (comp.SoundRoar != null)
|
||||||
_audio.Play(comp.SoundRoar, Filter.Pvs(uid, 4f, EntityManager), uid, true);
|
_audio.PlayPvs(comp.SoundRoar, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using Content.Shared.Stunnable;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
comp.Intensity = iterationIntensity;
|
comp.Intensity = iterationIntensity;
|
||||||
comp.SpaceMatrix = spaceMatrix;
|
comp.SpaceMatrix = spaceMatrix;
|
||||||
comp.SpaceTileSize = spaceData?.TileSize ?? DefaultTileSize;
|
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
|
// 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.
|
// restricted to something like the same map, but whatever.
|
||||||
_pvsSys.AddGlobalOverride(explosionEntity);
|
_pvsSys.AddGlobalOverride(GetNetEntity(explosionEntity));
|
||||||
|
|
||||||
var appearance = AddComp<AppearanceComponent>(explosionEntity);
|
var appearance = AddComp<AppearanceComponent>(explosionEntity);
|
||||||
_appearance.SetData(explosionEntity, ExplosionAppearanceData.Progress, 1, appearance);
|
_appearance.SetData(explosionEntity, ExplosionAppearanceData.Progress, 1, appearance);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Content.Shared.Throwing;
|
|||||||
using Robust.Server.GameStates;
|
using Robust.Server.GameStates;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
@@ -48,6 +49,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
[Dependency] private readonly IChatManager _chat = default!;
|
[Dependency] private readonly IChatManager _chat = default!;
|
||||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||||
[Dependency] private readonly PvsOverrideSystem _pvsSys = default!;
|
[Dependency] private readonly PvsOverrideSystem _pvsSys = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||||
|
|
||||||
@@ -333,7 +335,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
// play sound.
|
// play sound.
|
||||||
var audioRange = iterationIntensity.Count * 5;
|
var audioRange = iterationIntensity.Count * 5;
|
||||||
var filter = Filter.Pvs(epicenter).AddInRange(epicenter, audioRange);
|
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,
|
return new Explosion(this,
|
||||||
type,
|
type,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using Robust.Shared.Physics.Systems;
|
|||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Weapons.Ranged.Events;
|
using Content.Shared.Weapons.Ranged.Events;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Explosion.EntitySystems
|
namespace Content.Server.Explosion.EntitySystems
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Extinguisher;
|
namespace Content.Server.Extinguisher;
|
||||||
@@ -18,6 +19,7 @@ public sealed class FireExtinguisherSystem : EntitySystem
|
|||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -86,7 +88,7 @@ public sealed class FireExtinguisherSystem : EntitySystem
|
|||||||
var drained = _solutionContainerSystem.Drain(target, targetSolution, transfer);
|
var drained = _solutionContainerSystem.Drain(target, targetSolution, transfer);
|
||||||
_solutionContainerSystem.TryAddSolution(uid, container, drained);
|
_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)),
|
_popupSystem.PopupEntity(Loc.GetString("fire-extinguisher-component-after-interact-refilled-message", ("owner", uid)),
|
||||||
uid, args.Target.Value);
|
uid, args.Target.Value);
|
||||||
}
|
}
|
||||||
@@ -135,8 +137,7 @@ public sealed class FireExtinguisherSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
extinguisher.Safety = !extinguisher.Safety;
|
extinguisher.Safety = !extinguisher.Safety;
|
||||||
SoundSystem.Play(extinguisher.SafetySound.GetSound(), Filter.Pvs(uid),
|
_audio.PlayPvs(extinguisher.SafetySound, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-4f));
|
||||||
uid, AudioHelpers.WithVariation(0.125f).WithVolume(-4f));
|
|
||||||
UpdateAppearance(uid, extinguisher);
|
UpdateAppearance(uid, extinguisher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Paper;
|
using Content.Shared.Paper;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Physics;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Traits.Assorted;
|
using Content.Shared.Traits.Assorted;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -172,7 +173,7 @@ namespace Content.Server.Flash
|
|||||||
}
|
}
|
||||||
if (sound != null)
|
if (sound != null)
|
||||||
{
|
{
|
||||||
SoundSystem.Play(sound.GetSound(), Filter.Pvs(transform), source);
|
_audio.PlayPvs(sound, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Fluids.Components;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Timing;
|
using Content.Shared.Timing;
|
||||||
using Content.Shared.Weapons.Melee;
|
using Content.Shared.Weapons.Melee;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user