From 6917b0fe174dcd765cfe02e84eca3362c37b2fe1 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Tue, 22 Nov 2022 13:49:48 +1300 Subject: [PATCH] Misc audio and related changes for replays (#12578) --- Content.Client/Audio/BackgroundAudioSystem.cs | 4 ++-- Content.Client/Audio/ClientGlobalSoundSystem.cs | 6 +++--- Content.Client/Doors/DoorSystem.cs | 2 +- Content.Client/Voting/VoteManager.cs | 2 +- .../Weapons/Ranged/Systems/FlyBySoundSystem.cs | 2 +- .../Administration/QuickDialogSystem.cs | 2 +- .../Atmos/EntitySystems/GasTankSystem.cs | 6 +++--- Content.Server/Audio/ServerGlobalSoundSystem.cs | 15 ++++++++++++--- Content.Server/Body/Systems/BodySystem.cs | 2 +- .../Buckle/Systems/BuckleSystem.Buckle.cs | 4 ++-- Content.Server/Camera/CameraRecoilSystem.cs | 2 +- .../Cartridges/NetProbeCartridgeSystem.cs | 2 +- .../CharacterInfo/CharacterInfoSystem.cs | 3 +-- .../Chemistry/EntitySystems/ChemMasterSystem.cs | 2 +- Content.Server/Decals/DecalSystem.cs | 2 +- Content.Server/Doors/Systems/DoorSystem.cs | 12 +++--------- Content.Server/Dragon/DragonSystem.cs | 6 +++--- .../GameTicking/Rules/NukeopsRuleSystem.cs | 4 ++-- .../Kitchen/EntitySystems/MicrowaveSystem.cs | 2 +- .../BiomassReclaimer/BiomassReclaimerSystem.cs | 2 +- .../Pointing/EntitySystems/PointingSystem.cs | 7 ++++++- Content.Server/Popups/PopupSystem.cs | 7 +++++++ Content.Server/Prayer/PrayerSystem.cs | 2 +- .../Shuttles/Systems/ShuttleSystem.Impact.cs | 2 +- Content.Server/Station/Systems/StationSystem.cs | 2 +- .../StationEvents/Events/PowerGridCheck.cs | 2 +- Content.Server/Store/Systems/StoreSystem.Ui.cs | 2 +- Content.Server/Tiles/FloorTileSystem.cs | 2 +- .../VendingMachines/VendingMachineSystem.cs | 4 ++-- Content.Shared/Actions/SharedActionsSystem.cs | 2 +- 30 files changed, 64 insertions(+), 50 deletions(-) diff --git a/Content.Client/Audio/BackgroundAudioSystem.cs b/Content.Client/Audio/BackgroundAudioSystem.cs index 6508767a806..034ed166651 100644 --- a/Content.Client/Audio/BackgroundAudioSystem.cs +++ b/Content.Client/Audio/BackgroundAudioSystem.cs @@ -199,7 +199,7 @@ public sealed class BackgroundAudioSystem : EntitySystem return; _playingCollection = _currentCollection; var file = _robustRandom.Pick(_currentCollection.PickFiles).ToString(); - _ambientStream = _audio.PlayGlobal(file, Filter.Local(), + _ambientStream = _audio.PlayGlobal(file, Filter.Local(), false, _ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume))); } @@ -304,7 +304,7 @@ public sealed class BackgroundAudioSystem : EntitySystem return; } - _lobbyStream = _audio.PlayGlobal(file, Filter.Local(), + _lobbyStream = _audio.PlayGlobal(file, Filter.Local(), false, _lobbyParams.WithVolume(_lobbyParams.Volume + _configManager.GetCVar(CCVars.LobbyMusicVolume))); } diff --git a/Content.Client/Audio/ClientGlobalSoundSystem.cs b/Content.Client/Audio/ClientGlobalSoundSystem.cs index 6e744b093b1..792f149d180 100644 --- a/Content.Client/Audio/ClientGlobalSoundSystem.cs +++ b/Content.Client/Audio/ClientGlobalSoundSystem.cs @@ -65,7 +65,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem { if(!_adminAudioEnabled) return; - var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams); + var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams); _adminAudio.Add(stream); } @@ -74,13 +74,13 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem // Either the cvar is disabled or it's already playing if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return; - var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams); + var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams); _eventAudio.Add(soundEvent.Type, stream); } private void PlayGameSound(GameGlobalSoundEvent soundEvent) { - _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams); + _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), false, soundEvent.AudioParams); } private void StopStationEventMusic(StopStationEventMusic soundEvent) diff --git a/Content.Client/Doors/DoorSystem.cs b/Content.Client/Doors/DoorSystem.cs index d14a9733044..ac393c519bf 100644 --- a/Content.Client/Doors/DoorSystem.cs +++ b/Content.Client/Doors/DoorSystem.cs @@ -30,6 +30,6 @@ public sealed class DoorSystem : SharedDoorSystem protected override void PlaySound(EntityUid uid, SoundSpecifier soundSpecifier, AudioParams audioParams, EntityUid? predictingPlayer, bool predicted) { if (GameTiming.InPrediction && GameTiming.IsFirstTimePredicted) - Audio.Play(soundSpecifier, Filter.Local(), uid, audioParams); + Audio.Play(soundSpecifier, Filter.Local(), uid, false, audioParams); } } diff --git a/Content.Client/Voting/VoteManager.cs b/Content.Client/Voting/VoteManager.cs index 9a95860cf8d..00c53b38c69 100644 --- a/Content.Client/Voting/VoteManager.cs +++ b/Content.Client/Voting/VoteManager.cs @@ -119,7 +119,7 @@ namespace Content.Client.Voting @new = true; IoCManager.Resolve().GetEntitySystem() - .PlayGlobal("/Audio/Effects/voteding.ogg", Filter.Local()); + .PlayGlobal("/Audio/Effects/voteding.ogg", Filter.Local(), false); // New vote from the server. var vote = new ActiveVote(voteId) diff --git a/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs b/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs index d92fc587f77..994998a1415 100644 --- a/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/FlyBySoundSystem.cs @@ -42,6 +42,6 @@ public sealed class FlyBySoundSystem : SharedFlyBySoundSystem } // Play attached to our entity because the projectile may immediately delete or the likes. - _audio.Play(component.Sound, Filter.Local(), attachedEnt.Value); + _audio.Play(component.Sound, Filter.Local(), attachedEnt.Value, false); } } diff --git a/Content.Server/Administration/QuickDialogSystem.cs b/Content.Server/Administration/QuickDialogSystem.cs index b2037d4da3e..b53ad9a0c2b 100644 --- a/Content.Server/Administration/QuickDialogSystem.cs +++ b/Content.Server/Administration/QuickDialogSystem.cs @@ -94,7 +94,7 @@ public sealed partial class QuickDialogSystem : EntitySystem entries, did, buttons), - Filter.SinglePlayer(session) + session ); _openDialogs.Add(did, (okAction, cancelAction)); diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index 27dfeea451e..e59216691ab 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -203,7 +203,7 @@ namespace Content.Server.Atmos.EntitySystems component.ConnectStream?.Stop(); if (component.ConnectSound != null) - component.ConnectStream = _audioSys.Play(component.ConnectSound, Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, component.ConnectSound.Params); + component.ConnectStream = _audioSys.PlayPvs(component.ConnectSound, component.Owner); UpdateUserInterface(component); } @@ -222,7 +222,7 @@ namespace Content.Server.Atmos.EntitySystems component.DisconnectStream?.Stop(); if (component.DisconnectSound != null) - component.DisconnectStream = _audioSys.Play(component.DisconnectSound, Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, component.DisconnectSound.Params); + component.DisconnectStream = _audioSys.PlayPvs(component.DisconnectSound, component.Owner); UpdateUserInterface(component); } @@ -281,7 +281,7 @@ namespace Content.Server.Atmos.EntitySystems if(environment != null) _atmosphereSystem.Merge(environment, component.Air); - _audioSys.Play(component.RuptureSound, Filter.Pvs(component.Owner), Transform(component.Owner).Coordinates, AudioParams.Default.WithVariation(0.125f)); + _audioSys.Play(component.RuptureSound, Filter.Pvs(component.Owner), Transform(component.Owner).Coordinates, true, AudioParams.Default.WithVariation(0.125f)); QueueDel(component.Owner); return; diff --git a/Content.Server/Audio/ServerGlobalSoundSystem.cs b/Content.Server/Audio/ServerGlobalSoundSystem.cs index 706cf8c15da..a510fe9ce7d 100644 --- a/Content.Server/Audio/ServerGlobalSoundSystem.cs +++ b/Content.Server/Audio/ServerGlobalSoundSystem.cs @@ -28,10 +28,10 @@ public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem _conHost.UnregisterCommand("playglobalsound"); } - private void PlayAdminGlobal(Filter playerFilter, string filename, AudioParams? audioParams = null) + private void PlayAdminGlobal(Filter playerFilter, string filename, AudioParams? audioParams = null, bool replay = true) { var msg = new AdminSoundEvent(filename, audioParams); - RaiseNetworkEvent(msg, playerFilter); + RaiseNetworkEvent(msg, playerFilter, recordReplay: replay); } private Filter GetStationAndPvs(EntityUid source) @@ -50,6 +50,10 @@ public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem public void StopStationEventMusic(EntityUid source, StationEventMusicType type) { + // TODO REPLAYS + // these start & stop events are gonna be a PITA + // theres probably some nice way of handling them. Maybe it just needs dedicated replay data (in which case these events should NOT get recorded). + var msg = new StopStationEventMusic(type); var filter = GetStationAndPvs(source); RaiseNetworkEvent(msg, filter); @@ -74,6 +78,8 @@ public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem Filter filter; var audio = AudioParams.Default.WithVolume(-8); + bool replay = true; + switch (args.Length) { // No arguments, show command help. @@ -110,6 +116,9 @@ public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem } else { + // TODO REPLAYS uhhh.. what to do with this? + replay = false; + filter = Filter.Empty(); // Skip the first argument, which is the sound path. @@ -130,6 +139,6 @@ public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem break; } - PlayAdminGlobal(filter, args[0], audio); + PlayAdminGlobal(filter, args[0], audio, replay); } } diff --git a/Content.Server/Body/Systems/BodySystem.cs b/Content.Server/Body/Systems/BodySystem.cs index 87f4f2492c9..cdd30899724 100644 --- a/Content.Server/Body/Systems/BodySystem.cs +++ b/Content.Server/Body/Systems/BodySystem.cs @@ -142,7 +142,7 @@ public sealed class BodySystem : SharedBodySystem var filter = Filter.Pvs(bodyId.Value, entityManager: EntityManager); var audio = AudioParams.Default.WithVariation(0.025f); - _audio.Play(body.GibSound, filter, coordinates, audio); + _audio.Play(body.GibSound, filter, coordinates, true, audio); if (TryComp(bodyId, out ContainerManagerComponent? container)) { diff --git a/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs b/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs index fa24a305623..62cd0a7d9fd 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs @@ -239,7 +239,7 @@ public sealed partial class BuckleSystem if (!CanBuckle(buckleId, user, to, out var strap, buckle)) return false; - _audio.Play(strap.BuckleSound, Filter.Pvs(buckleId), buckleId); + _audio.PlayPvs(strap.BuckleSound, buckleId); if (!StrapTryAdd(to, buckle, strap: strap)) { @@ -356,7 +356,7 @@ public sealed partial class BuckleSystem Dirty(oldBuckledTo); } - _audio.Play(oldBuckledTo.UnbuckleSound, Filter.Pvs(buckleId), buckleId); + _audio.PlayPvs(oldBuckledTo.UnbuckleSound, buckleId); var ev = new BuckleChangeEvent { Buckling = false, Strap = oldBuckledTo.Owner, BuckledEntity = buckleId }; RaiseLocalEvent(buckleId, ev); diff --git a/Content.Server/Camera/CameraRecoilSystem.cs b/Content.Server/Camera/CameraRecoilSystem.cs index ecd69934907..d8e6e22bd15 100644 --- a/Content.Server/Camera/CameraRecoilSystem.cs +++ b/Content.Server/Camera/CameraRecoilSystem.cs @@ -9,6 +9,6 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem { if (!Resolve(euid, ref component, false)) return; - RaiseNetworkEvent(new CameraKickEvent(euid, kickback), Filter.Entities(euid)); + RaiseNetworkEvent(new CameraKickEvent(euid, kickback), euid); } } diff --git a/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs b/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs index d1ba9bfd997..753baade28a 100644 --- a/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs +++ b/Content.Server/CartridgeLoader/Cartridges/NetProbeCartridgeSystem.cs @@ -50,7 +50,7 @@ public sealed class NetProbeCartridgeSystem : EntitySystem //Play scanning sound with slightly randomized pitch //Why is there no NextFloat(float min, float max)??? var audioParams = AudioParams.Default.WithVolume(-2f).WithPitchScale((float)_random.Next(12, 21) / 10); - _audioSystem.Play(component.SoundScan, Filter.Pvs(args.InteractEvent.User), target, audioParams); + _audioSystem.PlayEntity(component.SoundScan, args.InteractEvent.User, target, audioParams); _popupSystem.PopupCursor(Loc.GetString("net-probe-scan", ("device", target)), Filter.Entities(args.InteractEvent.User)); diff --git a/Content.Server/CharacterInfo/CharacterInfoSystem.cs b/Content.Server/CharacterInfo/CharacterInfoSystem.cs index 8ab34380940..282722ceae3 100644 --- a/Content.Server/CharacterInfo/CharacterInfoSystem.cs +++ b/Content.Server/CharacterInfo/CharacterInfoSystem.cs @@ -55,7 +55,6 @@ public sealed class CharacterInfoSystem : EntitySystem briefing = mind.Briefing; } - RaiseNetworkEvent(new CharacterInfoEvent(entity, jobTitle, conditions, briefing), - Filter.SinglePlayer(args.SenderSession)); + RaiseNetworkEvent(new CharacterInfoEvent(entity, jobTitle, conditions, briefing), args.SenderSession); } } diff --git a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs index 6dde5798a06..722c15f0e12 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs @@ -279,7 +279,7 @@ namespace Content.Server.Chemistry.EntitySystems private void ClickSound(ChemMasterComponent chemMaster) { - _audioSystem.Play(chemMaster.ClickSound, Filter.Pvs(chemMaster.Owner), chemMaster.Owner, AudioParams.Default.WithVolume(-2f)); + _audioSystem.PlayPvs(chemMaster.ClickSound, chemMaster.Owner, AudioParams.Default.WithVolume(-2f)); } private ContainerInfo? BuildInputContainerInfo(EntityUid? container) diff --git a/Content.Server/Decals/DecalSystem.cs b/Content.Server/Decals/DecalSystem.cs index e590c6245a2..b152d3e0269 100644 --- a/Content.Server/Decals/DecalSystem.cs +++ b/Content.Server/Decals/DecalSystem.cs @@ -522,7 +522,7 @@ namespace Content.Server.Decals } if (updatedDecals.Count != 0 || staleChunks.Count != 0) - RaiseNetworkEvent(new DecalChunkUpdateEvent{Data = updatedDecals, RemovedChunks = staleChunks}, Filter.SinglePlayer(session)); + RaiseNetworkEvent(new DecalChunkUpdateEvent{Data = updatedDecals, RemovedChunks = staleChunks}, session); ReturnToPool(updatedChunks); ReturnToPool(staleChunks); diff --git a/Content.Server/Doors/Systems/DoorSystem.cs b/Content.Server/Doors/Systems/DoorSystem.cs index 1b5db3a39e6..5a89a26752d 100644 --- a/Content.Server/Doors/Systems/DoorSystem.cs +++ b/Content.Server/Doors/Systems/DoorSystem.cs @@ -105,16 +105,10 @@ public sealed class DoorSystem : SharedDoorSystem if (predicted && predictingPlayer == null) return; - var filter = Filter.Pvs(uid); - if (predicted) - { - // This interaction is predicted, but only by the instigating user, who will have played their own sounds. - filter.RemoveWhereAttachedEntity(e => e == predictingPlayer); - } - - // send the sound to players. - Audio.Play(soundSpecifier, filter, uid, audioParams); + Audio.PlayPredicted(soundSpecifier, uid, predictingPlayer, audioParams); + else + Audio.PlayPvs(soundSpecifier, uid, audioParams); } #region DoAfters diff --git a/Content.Server/Dragon/DragonSystem.cs b/Content.Server/Dragon/DragonSystem.cs index 10799d429ff..7ecf239c276 100644 --- a/Content.Server/Dragon/DragonSystem.cs +++ b/Content.Server/Dragon/DragonSystem.cs @@ -147,7 +147,7 @@ namespace Content.Server.Dragon var location = Transform(comp.Owner).LocalPosition; _chat.DispatchGlobalAnnouncement(Loc.GetString("carp-rift-warning", ("location", location)), playSound: false, colorOverride: Color.Red); - _audioSystem.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast()); + _audioSystem.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true); } if (comp.SpawnAccumulator > comp.SpawnCooldown) @@ -258,7 +258,7 @@ namespace Content.Server.Dragon var carpUid = Spawn(component.RiftPrototype, xform.MapPosition); component.Rifts.Add(carpUid); Comp(carpUid).Dragon = uid; - _audioSystem.Play("/Audio/Weapons/Guns/Gunshots/rocket_launcher.ogg", Filter.Pvs(carpUid, entityManager: EntityManager), carpUid); + _audioSystem.PlayPvs("/Audio/Weapons/Guns/Gunshots/rocket_launcher.ogg", carpUid); } #endregion @@ -327,7 +327,7 @@ namespace Content.Server.Dragon private void Roar(DragonComponent component) { if (component.SoundRoar != null) - _audioSystem.Play(component.SoundRoar, Filter.Pvs(component.Owner, 4f, EntityManager), component.Owner, component.SoundRoar.Params); + _audioSystem.Play(component.SoundRoar, Filter.Pvs(component.Owner, 4f, EntityManager), component.Owner, true, component.SoundRoar.Params); } private void OnStartup(EntityUid uid, DragonComponent component, ComponentStartup args) diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index 0854542cc99..ffddd9c9b18 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -263,7 +263,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem filter.AddPlayer(actor.PlayerSession); } - _audioSystem.PlayGlobal(_nukeopsRuleConfig.GreetSound, filter); + _audioSystem.PlayGlobal(_nukeopsRuleConfig.GreetSound, filter, recordReplay: false); } private void OnRoundEnd() @@ -592,7 +592,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem return; if (_nukeopsRuleConfig.GreetSound != null) - _audioSystem.PlayGlobal(_nukeopsRuleConfig.GreetSound, Filter.Empty().AddPlayer(playerSession)); + _audioSystem.PlayGlobal(_nukeopsRuleConfig.GreetSound, playerSession); if (_targetStation != null && !string.IsNullOrEmpty(Name(_targetStation.Value))) _chatManager.DispatchServerMessage(playerSession, Loc.GetString("nukeops-welcome", ("station", _targetStation.Value))); diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index c95f24ced10..9ec5686f46c 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -72,7 +72,7 @@ namespace Content.Server.Kitchen.EntitySystems SetAppearance(microwaveComponent, MicrowaveVisualState.Cooking); microwaveComponent.PlayingStream = - _audio.Play(microwaveComponent.LoopingSound, Filter.Pvs(uid), uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5)); + _audio.PlayPvs(microwaveComponent.LoopingSound, uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5)); } private void OnCookStop(EntityUid uid, ActiveMicrowaveComponent component, ComponentShutdown args) diff --git a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs index ae8288d9622..9335a9ac198 100644 --- a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs +++ b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs @@ -120,7 +120,7 @@ namespace Content.Server.Medical.BiomassReclaimer private void OnInit(EntityUid uid, ActiveBiomassReclaimerComponent component, ComponentInit args) { _jitteringSystem.AddJitter(uid, -10, 100); - _sharedAudioSystem.Play("/Audio/Machines/reclaimer_startup.ogg", Filter.Pvs(uid), uid); + _sharedAudioSystem.PlayPvs("/Audio/Machines/reclaimer_startup.ogg", uid); _ambientSoundSystem.SetAmbience(uid, true); } diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index 2dcbcd248d3..501581d87d4 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -1,3 +1,4 @@ +using System; using System.Linq; using Content.Server.Ghost.Components; using Content.Server.Players; @@ -19,6 +20,7 @@ using Robust.Shared.Input.Binding; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Players; +using Robust.Shared.Replays; using Robust.Shared.Timing; namespace Content.Server.Pointing.EntitySystems @@ -26,6 +28,7 @@ namespace Content.Server.Pointing.EntitySystems [UsedImplicitly] internal sealed class PointingSystem : SharedPointingSystem { + [Dependency] private readonly IReplayRecordingManager _replay = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; @@ -72,8 +75,10 @@ namespace Content.Server.Pointing.EntitySystems ? viewerPointedAtMessage : viewerMessage; - _popup.PopupEntity(message, source, Filter.Entities(viewerEntity)); + RaiseNetworkEvent(new PopupEntityEvent(message, PopupType.Small, source), viewerEntity); } + + _replay.QueueReplayMessage(new PopupEntityEvent(viewerMessage, PopupType.Small, source)); } public bool InRange(EntityUid pointer, EntityCoordinates coordinates) diff --git a/Content.Server/Popups/PopupSystem.cs b/Content.Server/Popups/PopupSystem.cs index 877d1dc4178..7dca1a30472 100644 --- a/Content.Server/Popups/PopupSystem.cs +++ b/Content.Server/Popups/PopupSystem.cs @@ -8,16 +8,23 @@ namespace Content.Server.Popups { public override void PopupCursor(string message, Filter filter, PopupType type=PopupType.Small) { + // TODO REPLAYS + // add variants that take in a EntityUid or ICommonSession + // then remove any that send Filter.SinglePlayer() or single entity. + // then default to recording replays + // and manually remove any that shouldn't be replayed. RaiseNetworkEvent(new PopupCursorEvent(message, type), filter); } public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter, PopupType type=PopupType.Small) { + // TODO REPLAYS See above RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, coordinates), filter); } public override void PopupEntity(string message, EntityUid uid, Filter filter, PopupType type=PopupType.Small) { + // TODO REPLAYS See above RaiseNetworkEvent(new PopupEntityEvent(message, type, uid), filter); } } diff --git a/Content.Server/Prayer/PrayerSystem.cs b/Content.Server/Prayer/PrayerSystem.cs index 9a80495afce..655ebb62b4b 100644 --- a/Content.Server/Prayer/PrayerSystem.cs +++ b/Content.Server/Prayer/PrayerSystem.cs @@ -90,6 +90,6 @@ public sealed class PrayerSystem : SharedPrayerSystem var networkMessage = new PrayerTextMessage(Loc.GetString("prayer-chat-notify", ("message", message))); - RaiseNetworkEvent(networkMessage, Filter.Empty().AddPlayer(sender)); + RaiseNetworkEvent(networkMessage, sender); } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs index 60f948f9db6..889d4b69866 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.Impact.cs @@ -53,6 +53,6 @@ public sealed partial class ShuttleSystem var volume = MathF.Min(10f, 1f * MathF.Pow(jungleDiff, 0.5f) - 5f); var audioParams = AudioParams.Default.WithVariation(0.05f).WithVolume(volume); - _audio.Play(_shuttleImpactSound, Filter.Pvs(coordinates, rangeMultiplier: 4f, entityMan: EntityManager), coordinates, audioParams); + _audio.Play(_shuttleImpactSound, Filter.Pvs(coordinates, rangeMultiplier: 4f, entityMan: EntityManager), coordinates, true, audioParams); } } diff --git a/Content.Server/Station/Systems/StationSystem.cs b/Content.Server/Station/Systems/StationSystem.cs index d9750f53c9f..5a4cfa0cc9d 100644 --- a/Content.Server/Station/Systems/StationSystem.cs +++ b/Content.Server/Station/Systems/StationSystem.cs @@ -100,7 +100,7 @@ public sealed class StationSystem : EntitySystem { if (e.NewStatus == SessionStatus.Connected) { - RaiseNetworkEvent(new StationsUpdatedEvent(_stations), Filter.SinglePlayer(e.Session)); + RaiseNetworkEvent(new StationsUpdatedEvent(_stations), e.Session); } } diff --git a/Content.Server/StationEvents/Events/PowerGridCheck.cs b/Content.Server/StationEvents/Events/PowerGridCheck.cs index f0879cbe6f0..b27afcf24bf 100644 --- a/Content.Server/StationEvents/Events/PowerGridCheck.cs +++ b/Content.Server/StationEvents/Events/PowerGridCheck.cs @@ -105,7 +105,7 @@ namespace Content.Server.StationEvents.Events _announceCancelToken = new CancellationTokenSource(); Timer.Spawn(3000, () => { - _audioSystem.PlayGlobal("/Audio/Announcements/power_on.ogg", Filter.Broadcast(), AudioParams.Default.WithVolume(-4f)); + _audioSystem.PlayGlobal("/Audio/Announcements/power_on.ogg", Filter.Broadcast(), true, AudioParams.Default.WithVolume(-4f)); }, _announceCancelToken.Token); _unpowered.Clear(); diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index 4b5fc7981bb..f7a095f1be1 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -163,7 +163,7 @@ public sealed partial class StoreSystem : EntitySystem } listing.PurchaseAmount++; //track how many times something has been purchased - _audio.Play(component.BuySuccessSound, Filter.SinglePlayer(msg.Session), uid); //cha-ching! + _audio.PlayEntity(component.BuySuccessSound, msg.Session, uid); //cha-ching! UpdateUserInterface(buyer, component); } diff --git a/Content.Server/Tiles/FloorTileSystem.cs b/Content.Server/Tiles/FloorTileSystem.cs index 9bef0d7e582..d4df1ea35b7 100644 --- a/Content.Server/Tiles/FloorTileSystem.cs +++ b/Content.Server/Tiles/FloorTileSystem.cs @@ -98,7 +98,7 @@ namespace Content.Server.Tiles { var variant = _random.Pick(((ContentTileDefinition) _tileDefinitionManager[tileId]).PlacementVariants); mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant)); - _audio.Play(placeSound, Filter.Pvs(location), location, AudioHelpers.WithVariation(0.125f, _random)); + _audio.Play(placeSound, Filter.Pvs(location), location, true, AudioHelpers.WithVariation(0.125f, _random)); } } } diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index b185ef7926d..68463a97e7b 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -183,7 +183,7 @@ namespace Content.Server.VendingMachines return; vendComponent.Denying = true; - _audioSystem.Play(vendComponent.SoundDeny, Filter.Pvs(vendComponent.Owner), vendComponent.Owner, AudioParams.Default.WithVolume(-2f)); + _audioSystem.PlayPvs(vendComponent.SoundDeny, vendComponent.Owner, AudioParams.Default.WithVolume(-2f)); TryUpdateVisualState(uid, vendComponent); } @@ -254,7 +254,7 @@ namespace Content.Server.VendingMachines entry.Amount--; UpdateVendingMachineInterfaceState(vendComponent); TryUpdateVisualState(uid, vendComponent); - _audioSystem.Play(vendComponent.SoundVend, Filter.Pvs(vendComponent.Owner), vendComponent.Owner, AudioParams.Default.WithVolume(-2f)); + _audioSystem.PlayPvs(vendComponent.SoundVend, vendComponent.Owner, AudioParams.Default.WithVolume(-2f)); } /// diff --git a/Content.Shared/Actions/SharedActionsSystem.cs b/Content.Shared/Actions/SharedActionsSystem.cs index 67110fa338d..98e9a57adc5 100644 --- a/Content.Shared/Actions/SharedActionsSystem.cs +++ b/Content.Shared/Actions/SharedActionsSystem.cs @@ -326,7 +326,7 @@ public abstract class SharedActionsSystem : EntitySystem var filter = Filter.Pvs(performer).RemoveWhereAttachedEntity(e => e == performer); - _audio.Play(action.Sound, filter, performer, action.AudioParams); + _audio.Play(action.Sound, filter, performer, true, action.AudioParams); if (string.IsNullOrWhiteSpace(action.Popup)) return true;