From 94594000025d52c474b03e01a88c7656e5a15a28 Mon Sep 17 00:00:00 2001 From: Acruid Date: Sun, 21 Mar 2021 09:12:03 -0700 Subject: [PATCH] SoundSystem Improvements (#3697) * Refactor all audio to use the new SoundSystem. * Update submodule Co-authored-by: Pieter-Jan Briers --- .../EntitySystems/BackgroundAudioSystem.cs | 12 ++++------ Content.Server/Actions/DisarmAction.cs | 6 +++-- Content.Server/Actions/ScreamAction.cs | 11 ++++----- Content.Server/Atmos/TileAtmosphere.cs | 9 ++++++-- .../ReactionEffects/AreaReactionEffect.cs | 6 +++-- .../Construction/Completions/PlaySound.cs | 7 +++--- Content.Server/Explosions/ExplosionHelper.cs | 4 +++- .../ActionBlocking/CuffableComponent.cs | 11 +++++---- .../ActionBlocking/HandcuffComponent.cs | 8 ++++--- .../Arcade/SpaceVillainArcadeComponent.cs | 15 ++++++------ .../Components/Atmos/GasTankComponent.cs | 4 +++- .../Components/Body/BodyComponent.cs | 5 ++-- .../Components/Botany/PlantHolderComponent.cs | 5 ++-- .../Components/Buckle/BuckleComponent.cs | 6 +++-- .../Components/Cargo/CargoTelepadComponent.cs | 3 ++- .../Chemistry/ChemMasterComponent.cs | 3 ++- .../Chemistry/HyposprayComponent.cs | 6 +++-- .../Components/Chemistry/PillComponent.cs | 6 ++--- .../Chemistry/ReagentDispenserComponent.cs | 4 ++-- .../GameObjects/Components/CrayonComponent.cs | 6 +++-- .../Culinary/SliceableFoodComponent.cs | 3 ++- .../Components/Culinary/UtensilComponent.cs | 6 ++--- .../DamageOnHighSpeedImpactComponent.cs | 4 +++- .../Thresholds/Behaviors/PlaySoundBehavior.cs | 7 +++--- .../Behaviors/PlaySoundCollectionBehavior.cs | 6 +++-- .../Disposal/DisposalMailingUnitComponent.cs | 3 ++- .../Disposal/DisposalRouterComponent.cs | 5 ++-- .../Disposal/DisposalTaggerComponent.cs | 5 ++-- .../Disposal/DisposalTubeComponent.cs | 4 +++- .../Disposal/DisposalUnitComponent.cs | 3 ++- .../Components/Doors/AirlockComponent.cs | 5 ++-- .../Components/Doors/ServerDoorComponent.cs | 3 ++- .../Explosion/FlashExplosiveComponent.cs | 6 +++-- .../ExtinguisherCabinetComponent.cs | 6 +++-- .../Components/Fluids/BucketComponent.cs | 6 +++-- .../Components/Fluids/MopComponent.cs | 6 +++-- .../Components/Fluids/PuddleComponent.cs | 6 +++-- .../Components/Fluids/SprayComponent.cs | 4 +++- .../Components/GUI/HandsComponent.cs | 4 +++- .../Interactable/ExpendableLightComponent.cs | 5 ++-- .../Interactable/HandheldLightComponent.cs | 10 ++++---- .../Interactable/MatchstickComponent.cs | 6 +++-- .../Interactable/MultitoolComponent.cs | 8 +++---- .../Components/Interactable/ToolComponent.cs | 8 +++---- .../Interactable/WelderComponent.cs | 4 +++- .../Components/Items/DiceComponent.cs | 5 ++-- .../Items/FireExtinguisherComponent.cs | 6 +++-- .../Items/FloorTileItemComponent.cs | 4 +++- .../Components/Items/RCD/RCDComponent.cs | 7 +++--- .../Storage/CursedEntityStorageComponent.cs | 8 ++++--- .../Items/Storage/EntityStorageComponent.cs | 6 +++-- .../Storage/SecureEntityStorageComponent.cs | 5 ++-- .../Items/Storage/ServerStorageComponent.cs | 4 ++-- .../Components/Items/ToysComponent.cs | 5 ++-- .../Kitchen/KitchenSpikeComponent.cs | 6 +++-- .../Components/Kitchen/MicrowaveComponent.cs | 7 +++--- .../Kitchen/ReagentGrinderComponent.cs | 7 +++--- .../Mining/AsteroidRockComponent.cs | 5 ++-- .../Components/Mobs/StunnableComponent.cs | 9 ++++---- .../CrematoriumEntityStorageComponent.cs | 4 +++- .../Morgue/MorgueEntityStorageComponent.cs | 6 +++-- .../Components/Nutrition/CreamPieComponent.cs | 8 +++---- .../Components/Nutrition/DrinkComponent.cs | 9 ++++---- .../Components/Nutrition/FoodComponent.cs | 4 ++-- .../Components/PDA/PDAComponent.cs | 8 ++++--- .../Pointing/RoguePointingArrowComponent.cs | 6 +++-- .../Components/Portal/PortalComponent.cs | 7 +++--- .../Components/Portal/TeleporterComponent.cs | 12 +++++----- .../Components/PottedPlantHideComponent.cs | 5 ++-- .../Power/AME/AMEControllerComponent.cs | 7 +++--- .../Components/Power/AME/AMEPartComponent.cs | 4 +++- .../Power/ApcNetComponents/ApcComponent.cs | 3 ++- .../PowerReceiverUsers/LightBulbComponent.cs | 4 +++- .../PoweredLightComponent.cs | 6 ++--- .../Power/PowerCellSlotComponent.cs | 6 +++-- .../Projectiles/HitscanComponent.cs | 5 +++- .../Projectiles/ProjectileComponent.cs | 8 +++++-- .../Research/ResearchConsoleComponent.cs | 6 ++--- .../Singularity/EmitterComponent.cs | 4 +++- .../Singularity/ServerSingularityComponent.cs | 9 ++++---- .../Sound/EmitSoundOnThrowComponent.cs | 8 +++---- .../Sound/EmitSoundOnUseComponent.cs | 10 ++++---- .../Sound/FootstepModifierComponent.cs | 5 ++-- .../StationEvents/RadiationPulseComponent.cs | 4 +++- .../VendingMachineComponent.cs | 5 ++-- .../Components/Watercloset/ToiletComponent.cs | 5 ++-- .../Components/Weapon/FlashableComponent.cs | 4 +++- .../Components/Weapon/Melee/FlashComponent.cs | 3 ++- .../Weapon/Melee/MeleeWeaponComponent.cs | 14 +++++------ .../Weapon/Melee/StunbatonComponent.cs | 23 ++++++++++++------- .../Barrels/BoltActionBarrelComponent.cs | 17 +++++++------- .../Ranged/Barrels/PumpBarrelComponent.cs | 7 +++--- .../Ranged/Barrels/RevolverBarrelComponent.cs | 9 ++++---- .../Barrels/ServerBatteryBarrelComponent.cs | 5 ++-- .../Barrels/ServerMagazineBarrelComponent.cs | 22 ++++++++---------- .../Ranged/ServerRangedWeaponComponent.cs | 13 +++++------ .../GameObjects/Components/WindowComponent.cs | 8 ++++--- .../GameObjects/Components/WiresComponent.cs | 7 +++--- .../EntitySystems/ChemicalReactionSystem.cs | 5 ++-- .../EntitySystems/GravitySystem.cs | 6 +++-- .../EntitySystems/StandingStateSystem.cs | 6 +++-- .../Physics/Controllers/MoverController.cs | 3 ++- Content.Server/StationEvents/GasLeak.cs | 4 +++- RobustToolbox | 2 +- 104 files changed, 401 insertions(+), 279 deletions(-) diff --git a/Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs b/Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs index 33c6a9277d..f61dbe7214 100644 --- a/Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs @@ -2,7 +2,6 @@ using Content.Client.Interfaces; using Content.Shared.Audio; using JetBrains.Annotations; -using Robust.Client.GameObjects; using Content.Shared; using Robust.Shared.Audio; using Robust.Shared.Configuration; @@ -13,6 +12,7 @@ using Robust.Shared.Random; using Robust.Client; using Robust.Client.State; using Content.Client.State; +using Robust.Shared.Player; namespace Content.Client.GameObjects.EntitySystems { @@ -25,9 +25,7 @@ namespace Content.Client.GameObjects.EntitySystems [Dependency] private readonly IStateManager _stateManager = default!; [Dependency] private readonly IBaseClient _client = default!; [Dependency] private readonly IClientGameTicker _clientGameTicker = default!; - - private AudioSystem _audioSystem = default!; - + private SoundCollectionPrototype _ambientCollection = default!; private AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, AudioMixTarget.Stereo, true, 0f); @@ -40,8 +38,6 @@ namespace Content.Client.GameObjects.EntitySystems { base.Initialize(); - _audioSystem = Get(); - _ambientCollection = _prototypeManager.Index("AmbienceBase"); _configManager.OnValueChanged(CCVars.AmbienceBasicEnabled, AmbienceCVarChanged); @@ -130,7 +126,7 @@ namespace Content.Client.GameObjects.EntitySystems { EndAmbience(); var file = _robustRandom.Pick(_ambientCollection.PickFiles); - _ambientStream = _audioSystem.Play(file, _ambientParams); + _ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams); } private void EndAmbience() @@ -174,7 +170,7 @@ namespace Content.Client.GameObjects.EntitySystems { return; } - _lobbyStream = _audioSystem.Play(file, _lobbyParams); + _lobbyStream = SoundSystem.Play(Filter.Local(), file, _lobbyParams); } private void EndLobbyMusic() diff --git a/Content.Server/Actions/DisarmAction.cs b/Content.Server/Actions/DisarmAction.cs index 5e2e7cd722..cc0be52f42 100644 --- a/Content.Server/Actions/DisarmAction.cs +++ b/Content.Server/Actions/DisarmAction.cs @@ -13,10 +13,12 @@ using Content.Shared.Interfaces; using Content.Shared.Utility; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -65,7 +67,7 @@ namespace Content.Server.Actions if (random.Prob(_failProb)) { - audio.PlayFromEntity("/Audio/Weapons/punchmiss.ogg", args.Performer, + SoundSystem.Play(Filter.Pvs(args.Performer), "/Audio/Weapons/punchmiss.ogg", args.Performer, AudioHelpers.WithVariation(0.025f)); args.Performer.PopupMessageOtherClients(Loc.GetString("{0} fails to disarm {1}!", args.Performer.Name, args.Target.Name)); args.Performer.PopupMessageCursor(Loc.GetString("You fail to disarm {0}!", args.Target.Name)); @@ -86,7 +88,7 @@ namespace Content.Server.Actions return; } - audio.PlayFromEntity("/Audio/Effects/thudswoosh.ogg", args.Performer, + SoundSystem.Play(Filter.Pvs(args.Performer), "/Audio/Effects/thudswoosh.ogg", args.Performer, AudioHelpers.WithVariation(0.025f)); } } diff --git a/Content.Server/Actions/ScreamAction.cs b/Content.Server/Actions/ScreamAction.cs index 04ec08e597..44570fd37e 100644 --- a/Content.Server/Actions/ScreamAction.cs +++ b/Content.Server/Actions/ScreamAction.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Collections.Generic; using Content.Server.GameObjects.Components.Mobs; @@ -9,10 +9,9 @@ using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.Preferences; using Content.Shared.Utility; using JetBrains.Annotations; -using Robust.Server.GameObjects; using Robust.Shared.Audio; -using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -47,7 +46,7 @@ namespace Content.Server.Actions if (_random.Prob(.01f) && !string.IsNullOrWhiteSpace(_wilhelm)) { - EntitySystem.Get().PlayFromEntity(_wilhelm, args.Performer, AudioParams.Default.WithVolume(Volume)); + SoundSystem.Play(Filter.Pvs(args.Performer), _wilhelm, args.Performer, AudioParams.Default.WithVolume(Volume)); } else { @@ -55,12 +54,12 @@ namespace Content.Server.Actions { case Sex.Male: if (_male == null) break; - EntitySystem.Get().PlayFromEntity(_random.Pick(_male), args.Performer, + SoundSystem.Play(Filter.Pvs(args.Performer), _random.Pick(_male), args.Performer, AudioHelpers.WithVariation(Variation).WithVolume(Volume)); break; case Sex.Female: if (_female == null) break; - EntitySystem.Get().PlayFromEntity(_random.Pick(_female), args.Performer, + SoundSystem.Play(Filter.Pvs(args.Performer), _random.Pick(_female), args.Performer, AudioHelpers.WithVariation(Variation).WithVolume(Volume)); break; default: diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index d2dfd20dc9..8fe78c21f5 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -13,12 +13,14 @@ using Content.Shared.Audio; using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.ViewVariables; @@ -189,8 +191,11 @@ namespace Content.Server.Atmos if(PressureDifference > 15) { if(_soundCooldown == 0) - EntitySystem.Get().PlayAtCoords("/Audio/Effects/space_wind.ogg", - GridIndices.ToEntityCoordinates(GridIndex, _mapManager), AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(PressureDifference / 10, 10, 100))); + { + var coordinates = GridIndices.ToEntityCoordinates(GridIndex, _mapManager); + SoundSystem.Play(Filter.Pvs(coordinates), "/Audio/Effects/space_wind.ogg", + coordinates, AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(PressureDifference / 10, 10, 100))); + } } foreach (var entity in _gridTileLookupSystem.GetEntitiesIntersecting(GridIndex, GridIndices)) diff --git a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs index 4eb1d9a83e..65a9dfdea5 100644 --- a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using Content.Server.GameObjects.Components.Chemistry; using Content.Server.Utility; @@ -6,10 +6,12 @@ using Content.Shared.Audio; using Content.Shared.Interfaces.Chemistry; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Chemistry.ReactionEffects @@ -136,7 +138,7 @@ namespace Content.Server.Chemistry.ReactionEffects if (!string.IsNullOrEmpty(_sound)) { - EntitySystem.Get().PlayFromEntity(_sound, solutionEntity, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(solutionEntity), _sound, solutionEntity, AudioHelpers.WithVariation(0.125f)); } } diff --git a/Content.Server/Construction/Completions/PlaySound.cs b/Content.Server/Construction/Completions/PlaySound.cs index 891b600907..6d0f7de98c 100644 --- a/Content.Server/Construction/Completions/PlaySound.cs +++ b/Content.Server/Construction/Completions/PlaySound.cs @@ -1,10 +1,11 @@ -#nullable enable +#nullable enable using System.Threading.Tasks; using Content.Shared.Audio; using Content.Shared.Construction; using JetBrains.Annotations; -using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Construction.Completions @@ -22,7 +23,7 @@ namespace Content.Server.Construction.Completions if (string.IsNullOrEmpty(sound)) return; - EntitySystem.Get().PlayFromEntity(sound, entity, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(entity), sound, entity, AudioHelpers.WithVariation(0.125f)); } private string GetSound() diff --git a/Content.Server/Explosions/ExplosionHelper.cs b/Content.Server/Explosions/ExplosionHelper.cs index b03beebb2a..fba68c6889 100644 --- a/Content.Server/Explosions/ExplosionHelper.cs +++ b/Content.Server/Explosions/ExplosionHelper.cs @@ -11,11 +11,13 @@ using Content.Shared.Physics; using Content.Shared.Utility; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -311,7 +313,7 @@ namespace Content.Server.Explosions var boundingBox = new Box2(epicenterMapPos - new Vector2(maxRange, maxRange), epicenterMapPos + new Vector2(maxRange, maxRange)); - EntitySystem.Get().PlayAtCoords("/Audio/Effects/explosion.ogg", epicenter); + SoundSystem.Play(Filter.Broadcast(), "/Audio/Effects/explosion.ogg", epicenter); DamageEntitiesInRange(epicenter, boundingBox, devastationRange, heavyImpactRange, maxRange, mapId); var mapGridsNear = mapManager.FindGridsIntersecting(mapId, boundingBox); diff --git a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs index 75d579e06c..e582389b36 100644 --- a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs +++ b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs @@ -12,11 +12,13 @@ using Content.Shared.GameObjects.Verbs; using Content.Shared.Interfaces; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.ViewVariables; @@ -228,15 +230,14 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (isOwner) { if (cuff.StartBreakoutSound != null) - audio.PlayFromEntity(cuff.StartBreakoutSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), cuff.StartBreakoutSound, Owner); } else { if (cuff.StartUncuffSound != null) - audio.PlayFromEntity(cuff.StartUncuffSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), cuff.StartUncuffSound, Owner); } - - + var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime; var doAfterEventArgs = new DoAfterEventArgs(user, uncuffTime) { @@ -256,7 +257,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (result != DoAfterStatus.Cancelled) { if (cuff.EndUncuffSound != null) - audio.PlayFromEntity(cuff.EndUncuffSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound, Owner); Container.ForceRemove(cuffsToRemove); cuffsToRemove.Transform.AttachToGridOrMap(); diff --git a/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs b/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs index feb55e0df3..4cf0d035ce 100644 --- a/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs +++ b/Content.Server/GameObjects/Components/ActionBlocking/HandcuffComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Threading.Tasks; using Content.Server.GameObjects.Components.GUI; @@ -10,9 +10,11 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -183,7 +185,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking eventArgs.User.PopupMessage(eventArgs.Target, Loc.GetString("{0:theName} starts cuffing you!", eventArgs.User)); if (StartCuffSound != null) - EntitySystem.Get().PlayFromEntity(StartCuffSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), StartCuffSound, Owner); TryUpdateCuff(eventArgs.User, eventArgs.Target, cuffed); return true; @@ -221,7 +223,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking if (cuffs.TryAddNewCuffs(user, Owner)) { if (EndCuffSound != null) - EntitySystem.Get().PlayFromEntity(EndCuffSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), EndCuffSound, Owner); user.PopupMessage(Loc.GetString("You successfully cuff {0:theName}.", target)); target.PopupMessage(Loc.GetString("You have been cuffed by {0:theName}!", user)); diff --git a/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs b/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs index e801fa1c64..1752e68e7d 100644 --- a/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs +++ b/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs @@ -13,6 +13,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -127,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Arcade _game?.ExecutePlayerAction(msg.PlayerAction); break; case PlayerAction.NewGame: - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/newgame.ogg", Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/Arcade/newgame.ogg", Owner, AudioParams.Default.WithVolume(-4f)); _game = new SpaceVillainGame(this); UserInterface?.SendMessage(_game.GenerateMetaDataMessage()); break; @@ -293,7 +294,7 @@ namespace Content.Server.GameObjects.Components.Arcade case PlayerAction.Attack: var attackAmount = _random.Next(2, 6); _latestPlayerActionMessage = Loc.GetString("You attack {0} for {1}!", _enemyName, attackAmount); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_attack.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(_owner.Owner), "/Audio/Effects/Arcade/player_attack.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); if(!_owner._enemyInvincibilityFlag) _enemyHp -= attackAmount; _turtleTracker -= _turtleTracker > 0 ? 1 : 0; break; @@ -301,7 +302,7 @@ namespace Content.Server.GameObjects.Components.Arcade var pointAmount = _random.Next(1, 3); var healAmount = _random.Next(6, 8); _latestPlayerActionMessage = Loc.GetString("You use {0} magic to heal for {1} damage!", pointAmount, healAmount); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_heal.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(_owner.Owner), "/Audio/Effects/Arcade/player_heal.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); if(!_owner._playerInvincibilityFlag) _playerMp -= pointAmount; _playerHp += healAmount; _turtleTracker++; @@ -309,7 +310,7 @@ namespace Content.Server.GameObjects.Components.Arcade case PlayerAction.Recharge: var chargeAmount = _random.Next(4, 7); _latestPlayerActionMessage = Loc.GetString("You regain {0} points", chargeAmount); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_charge.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(_owner.Owner), "/Audio/Effects/Arcade/player_charge.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); _playerMp += chargeAmount; _turtleTracker -= _turtleTracker > 0 ? 1 : 0; break; @@ -341,7 +342,7 @@ namespace Content.Server.GameObjects.Components.Arcade { _running = false; UpdateUi(Loc.GetString("You won!"), Loc.GetString("{0} dies.", _enemyName), true); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/win.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(_owner.Owner), "/Audio/Effects/Arcade/win.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); _owner.ProcessWin(); return false; } @@ -352,14 +353,14 @@ namespace Content.Server.GameObjects.Components.Arcade { _running = false; UpdateUi(Loc.GetString("You lost!"), Loc.GetString("{0} cheers.", _enemyName), true); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(_owner.Owner), "/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); return false; } if (_enemyHp <= 0 || _enemyMp <= 0) { _running = false; UpdateUi(Loc.GetString("You lost!"), Loc.GetString("{0} dies, but takes you with him.", _enemyName), true); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + SoundSystem.Play(Filter.Pvs(_owner.Owner), "/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); return false; } diff --git a/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs b/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs index e8be9a2a2f..67f50048d0 100644 --- a/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs @@ -18,9 +18,11 @@ using Content.Shared.Interfaces.GameObjects.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -278,7 +280,7 @@ namespace Content.Server.GameObjects.Components.Atmos var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(); tileAtmos?.AssumeAir(Air); - EntitySystem.Get().PlayAtCoords("Audio/Effects/spray.ogg", Owner.Transform.Coordinates, + SoundSystem.Play(Filter.Pvs(Owner), "Audio/Effects/spray.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.125f)); Owner.Delete(); diff --git a/Content.Server/GameObjects/Components/Body/BodyComponent.cs b/Content.Server/GameObjects/Components/Body/BodyComponent.cs index 3d0b58d806..a4b8e3c452 100644 --- a/Content.Server/GameObjects/Components/Body/BodyComponent.cs +++ b/Content.Server/GameObjects/Components/Body/BodyComponent.cs @@ -10,11 +10,13 @@ using Content.Shared.GameObjects.Components.Movement; using Content.Shared.Utility; using Robust.Server.Console; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Console; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; +using Robust.Shared.Player; using Robust.Shared.Players; namespace Content.Server.GameObjects.Components.Body @@ -98,8 +100,7 @@ namespace Content.Server.GameObjects.Components.Body { base.Gib(gibParts); - EntitySystem.Get() - .PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("gib"), Owner.Transform.Coordinates, + SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("gib"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.025f)); if (Owner.TryGetComponent(out ContainerManagerComponent? container)) diff --git a/Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs b/Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs index 6a384d7d86..feb198567f 100644 --- a/Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs +++ b/Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs @@ -20,10 +20,12 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -722,8 +724,7 @@ namespace Content.Server.GameObjects.Components.Botany if (!string.IsNullOrEmpty(spray.SpraySound)) { - EntitySystem.Get().PlayFromEntity(spray.SpraySound, usingItem, - AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(usingItem), spray.SpraySound, usingItem, AudioHelpers.WithVariation(0.125f)); } } diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs index ce04fe1676..12c9f61f8e 100644 --- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs @@ -15,11 +15,13 @@ using Content.Shared.GameObjects.Verbs; using Content.Shared.Interfaces; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; @@ -241,7 +243,7 @@ namespace Content.Server.GameObjects.Components.Buckle return false; } - EntitySystem.Get().PlayFromEntity(strap.BuckleSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), strap.BuckleSound, Owner); if (!strap.TryAdd(this)) { @@ -348,7 +350,7 @@ namespace Content.Server.GameObjects.Components.Buckle UpdateBuckleStatus(); oldBuckledTo.Remove(this); - EntitySystem.Get().PlayFromEntity(oldBuckledTo.UnbuckleSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), oldBuckledTo.UnbuckleSound, Owner); SendMessage(new UnbuckleMessage(Owner, oldBuckledTo.Owner)); diff --git a/Content.Server/GameObjects/Components/Cargo/CargoTelepadComponent.cs b/Content.Server/GameObjects/Components/Cargo/CargoTelepadComponent.cs index 29c9de9af1..f286536c77 100644 --- a/Content.Server/GameObjects/Components/Cargo/CargoTelepadComponent.cs +++ b/Content.Server/GameObjects/Components/Cargo/CargoTelepadComponent.cs @@ -5,6 +5,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using System.Collections.Generic; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.Cargo { @@ -71,7 +72,7 @@ namespace Content.Server.GameObjects.Components.Cargo { if (!Deleted && !Owner.Deleted && _currentState == CargoTelepadState.Teleporting && _teleportQueue.Count > 0) { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/phasein.ogg", Owner, AudioParams.Default.WithVolume(-8f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/phasein.ogg", Owner, AudioParams.Default.WithVolume(-8f)); Owner.EntityManager.SpawnEntity(_teleportQueue[0].Product, Owner.Transform.Coordinates); _teleportQueue.RemoveAt(0); if (Owner.TryGetComponent(out var spriteComponent)) diff --git a/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs index e3c83a8a32..a4094cb684 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ChemMasterComponent.cs @@ -20,6 +20,7 @@ using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -416,7 +417,7 @@ namespace Content.Server.GameObjects.Components.Chemistry private void ClickSound() { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } [Verb] diff --git a/Content.Server/GameObjects/Components/Chemistry/HyposprayComponent.cs b/Content.Server/GameObjects/Components/Chemistry/HyposprayComponent.cs index e518075211..8a1142837a 100644 --- a/Content.Server/GameObjects/Components/Chemistry/HyposprayComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/HyposprayComponent.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs.State; using Content.Server.GameObjects.EntitySystems; @@ -8,9 +8,11 @@ using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -88,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Chemistry meleeSys.SendLunge(angle, user); } - EntitySystem.Get().PlayFromEntity("/Audio/Items/hypospray.ogg", user); + SoundSystem.Play(Filter.Pvs(user), "/Audio/Items/hypospray.ogg", user); var targetSolution = target.GetComponent(); diff --git a/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs index d7d4a44b12..ebe60b9f7f 100644 --- a/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Body.Behavior; using Content.Server.GameObjects.Components.Culinary; @@ -13,6 +13,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -104,8 +105,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (UseSound != null) { - _entitySystem.GetEntitySystem() - .PlayFromEntity(UseSound, trueTarget, AudioParams.Default.WithVolume(-1f)); + SoundSystem.Play(Filter.Pvs(trueTarget), UseSound, trueTarget, AudioParams.Default.WithVolume(-1f)); } trueTarget.PopupMessage(user, Loc.GetString("You swallow the pill.")); diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 630c693314..4a45870e45 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -22,6 +22,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -356,8 +357,7 @@ namespace Content.Server.GameObjects.Components.Chemistry private void ClickSound() { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); - + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } [Verb] diff --git a/Content.Server/GameObjects/Components/CrayonComponent.cs b/Content.Server/GameObjects/Components/CrayonComponent.cs index 61e6cde42d..3e6764cbb6 100644 --- a/Content.Server/GameObjects/Components/CrayonComponent.cs +++ b/Content.Server/GameObjects/Components/CrayonComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Linq; using System.Threading.Tasks; using Content.Server.Utility; @@ -8,10 +8,12 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -133,7 +135,7 @@ namespace Content.Server.GameObjects.Components if (!string.IsNullOrEmpty(_useSound)) { - EntitySystem.Get().PlayFromEntity(_useSound, Owner, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), _useSound, Owner, AudioHelpers.WithVariation(0.125f)); } // Decrease "Ammo" diff --git a/Content.Server/GameObjects/Components/Culinary/SliceableFoodComponent.cs b/Content.Server/GameObjects/Components/Culinary/SliceableFoodComponent.cs index 0f5883f283..05419a4840 100644 --- a/Content.Server/GameObjects/Components/Culinary/SliceableFoodComponent.cs +++ b/Content.Server/GameObjects/Components/Culinary/SliceableFoodComponent.cs @@ -11,6 +11,7 @@ using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -67,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Culinary } } - EntitySystem.Get().PlayAtCoords(_sound, Owner.Transform.Coordinates, + SoundSystem.Play(Filter.Pvs(Owner), _sound, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); Count--; diff --git a/Content.Server/GameObjects/Components/Culinary/UtensilComponent.cs b/Content.Server/GameObjects/Components/Culinary/UtensilComponent.cs index 41e9b77e61..e8bbf26fe1 100644 --- a/Content.Server/GameObjects/Components/Culinary/UtensilComponent.cs +++ b/Content.Server/GameObjects/Components/Culinary/UtensilComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Nutrition; @@ -8,6 +8,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -74,8 +75,7 @@ namespace Content.Server.GameObjects.Components.Culinary { if (_breakSound != null && IoCManager.Resolve().Prob(_breakChance)) { - EntitySystem.Get() - .PlayFromEntity(_breakSound, user, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(user), _breakSound, user, AudioParams.Default.WithVolume(-2f)); Owner.Delete(); } } diff --git a/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs b/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs index 17a08fe73f..bbc04a818f 100644 --- a/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs @@ -4,10 +4,12 @@ using Content.Shared.Audio; using Content.Shared.Damage; using Content.Shared.GameObjects.Components.Damage; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; @@ -51,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Damage if (speed < MinimumSpeed) return; if (!string.IsNullOrEmpty(SoundHit)) - EntitySystem.Get().PlayFromEntity(SoundHit, otherBody.Entity, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); + SoundSystem.Play(Filter.Pvs(otherBody.Entity), SoundHit, otherBody.Entity, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); if ((_gameTiming.CurTime - _lastHit).TotalSeconds < DamageCooldown) return; diff --git a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs index 5f260d96a3..27086a82a3 100644 --- a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs +++ b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs @@ -1,7 +1,9 @@ -using System; +using System; using Content.Server.GameObjects.EntitySystems; using Content.Shared.Audio; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors @@ -23,8 +25,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior } var pos = owner.Transform.Coordinates; - - system.AudioSystem.PlayAtCoords(Sound, pos, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(pos), Sound, pos, AudioHelpers.WithVariation(0.125f)); } } } diff --git a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundCollectionBehavior.cs b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundCollectionBehavior.cs index 3a638e9367..e377795539 100644 --- a/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundCollectionBehavior.cs +++ b/Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/PlaySoundCollectionBehavior.cs @@ -1,7 +1,9 @@ -using System; +using System; using Content.Server.GameObjects.EntitySystems; using Content.Shared.Audio; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors @@ -26,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior var sound = AudioHelpers.GetRandomFileFromSoundCollection(SoundCollection); var pos = owner.Transform.Coordinates; - system.AudioSystem.PlayAtCoords(sound, pos, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(pos), sound, pos, AudioHelpers.WithVariation(0.125f)); } } } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs index eb2767a653..878fcf5913 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs @@ -28,6 +28,7 @@ using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.Serialization; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; @@ -445,7 +446,7 @@ namespace Content.Server.GameObjects.Components.Disposal break; case UiButton.Power: TogglePower(); - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); break; default: diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs index c8d5dcf635..0fe8bb5ec4 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Collections.Generic; using System.Text; @@ -17,6 +17,7 @@ using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.ViewVariables; using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent; @@ -146,7 +147,7 @@ namespace Content.Server.GameObjects.Components.Disposal private void ClickSound() { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } /// diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs index 5aa90d534e..d20953b59a 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Utility; using Content.Shared.GameObjects.Verbs; @@ -14,6 +14,7 @@ using Robust.Shared.ViewVariables; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Player; using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent; namespace Content.Server.GameObjects.Components.Disposal @@ -111,7 +112,7 @@ namespace Content.Server.GameObjects.Components.Disposal private void ClickSound() { - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } /// diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs index 26c0005c56..8bd528b3e0 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs @@ -7,11 +7,13 @@ using Content.Shared.GameObjects.Verbs; using Content.Shared.Interfaces; using Robust.Server.Console; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Timing; @@ -257,7 +259,7 @@ namespace Content.Server.GameObjects.Components.Disposal } _lastClang = _gameTiming.CurTime; - EntitySystem.Get().PlayAtCoords(_clangSound, Owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), _clangSound, Owner.Transform.Coordinates); break; case AnchoredChangedMessage: diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs index 763b0d80ad..63685958e1 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs @@ -29,6 +29,7 @@ using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; @@ -400,7 +401,7 @@ namespace Content.Server.GameObjects.Components.Disposal break; case UiButton.Power: TogglePower(); - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); break; default: throw new ArgumentOutOfRangeException(); diff --git a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs index 95c3b82314..b97e39022c 100644 --- a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs @@ -8,9 +8,11 @@ using Content.Shared.GameObjects.Components.Doors; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.ViewVariables; using static Content.Shared.GameObjects.Components.SharedWiresComponent; using static Content.Shared.GameObjects.Components.SharedWiresComponent.WiresAction; @@ -453,8 +455,7 @@ namespace Content.Server.GameObjects.Components.Doors BoltsDown = newBolts; - EntitySystem.Get() - .PlayFromEntity(newBolts ? "/Audio/Machines/boltsdown.ogg" : "/Audio/Machines/boltsup.ogg", Owner); + SoundSystem.Play(Filter.Broadcast(), newBolts ? "/Audio/Machines/boltsdown.ogg" : "/Audio/Machines/boltsup.ogg", Owner); } } } diff --git a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs index f7ba30ff9a..ad7927b81b 100644 --- a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs @@ -28,6 +28,7 @@ using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Physics.Broadphase; using Robust.Shared.Physics.Collision; +using Robust.Shared.Player; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; using Timer = Robust.Shared.Timing.Timer; @@ -257,7 +258,7 @@ namespace Content.Server.GameObjects.Components.Doors if (user.TryGetComponent(out HandsComponent? hands) && hands.Count == 0) { - EntitySystem.Get().PlayFromEntity("/Audio/Effects/bang.ogg", Owner, + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/bang.ogg", Owner, AudioParams.Default.WithVolume(-2)); } } diff --git a/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs b/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs index 708f7e4562..adb8d1f9c7 100644 --- a/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs +++ b/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs @@ -1,10 +1,12 @@ -using Content.Server.GameObjects.Components.Items.Storage; +using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Weapon; using Content.Server.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.Explosion @@ -37,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Explosion if (_sound != null) { - EntitySystem.Get().PlayAtCoords(_sound, Owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), _sound, Owner.Transform.Coordinates); } if (_deleteOnFlash && !Owner.Deleted) diff --git a/Content.Server/GameObjects/Components/ExtinguisherCabinetComponent.cs b/Content.Server/GameObjects/Components/ExtinguisherCabinetComponent.cs index 6fa9970403..7a3e77f4d6 100644 --- a/Content.Server/GameObjects/Components/ExtinguisherCabinetComponent.cs +++ b/Content.Server/GameObjects/Components/ExtinguisherCabinetComponent.cs @@ -8,9 +8,11 @@ using Content.Shared.GameObjects.Components; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -112,8 +114,8 @@ namespace Content.Server.GameObjects.Components private void ClickLatchSound() { - EntitySystem.Get() // Don't have original click, this sounds close - .PlayFromEntity(DoorSound, Owner, AudioHelpers.WithVariation(0.15f)); + // Don't have original click, this sounds close + SoundSystem.Play(Filter.Pvs(Owner), DoorSound, Owner, AudioHelpers.WithVariation(0.15f)); } } } diff --git a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs index 11bd04735f..2dffb39656 100644 --- a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Collections.Generic; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Chemistry; @@ -8,8 +8,10 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.Fluids @@ -114,7 +116,7 @@ namespace Content.Server.GameObjects.Components.Fluids if (_sound != null) { - EntitySystem.Get().PlayFromEntity(_sound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), _sound, Owner); } return true; diff --git a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs index fca0d3ad9e..3b4c481150 100644 --- a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.GameObjects.Components.Chemistry; using Content.Shared.Chemistry; using Content.Shared.Interfaces; @@ -10,6 +10,8 @@ using Robust.Shared.Serialization; using System.Threading.Tasks; using Content.Server.GameObjects.EntitySystems.DoAfter; using Robust.Server.GameObjects; +using Robust.Shared.Audio; +using Robust.Shared.Player; using Robust.Shared.ViewVariables; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager.Attributes; @@ -165,7 +167,7 @@ namespace Content.Server.GameObjects.Components.Fluids if (!string.IsNullOrWhiteSpace(_pickupSound)) { - EntitySystem.Get().PlayFromEntity(_pickupSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), _pickupSound, Owner); } return true; diff --git a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs index 55ca157507..a64f11fefa 100644 --- a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -11,12 +11,14 @@ using Content.Shared.Maps; using Content.Shared.Physics; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; @@ -188,7 +190,7 @@ namespace Content.Server.GameObjects.Components.Fluids return true; } - EntitySystem.Get().PlayAtCoords(_spillSound, Owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), _spillSound, Owner.Transform.Coordinates); return true; } diff --git a/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs b/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs index 7df470b88d..b6d526cb91 100644 --- a/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/SprayComponent.cs @@ -10,11 +10,13 @@ using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Player; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; @@ -162,7 +164,7 @@ namespace Content.Server.GameObjects.Components.Fluids //Play sound if (!string.IsNullOrEmpty(_spraySound)) { - EntitySystem.Get().PlayFromEntity(_spraySound, Owner, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), _spraySound, Owner, AudioHelpers.WithVariation(0.125f)); } _lastUseTime = curTime; diff --git a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs index 83fb6f8e19..aaf0eaa059 100644 --- a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs @@ -17,6 +17,7 @@ using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.Interfaces; using Content.Shared.Physics.Pull; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -28,6 +29,7 @@ using Robust.Shared.Network; using Robust.Shared.Physics; using Robust.Shared.Players; using Robust.Shared.ViewVariables; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.GUI { @@ -760,7 +762,7 @@ namespace Content.Server.GameObjects.Components.GUI if (source != null) { - EntitySystem.Get().PlayFromEntity("/Audio/Effects/thudswoosh.ogg", source, + SoundSystem.Play(Filter.Pvs(source), "/Audio/Effects/thudswoosh.ogg", source, AudioHelpers.WithVariation(0.025f)); if (target != null) diff --git a/Content.Server/GameObjects/Components/Interactable/ExpendableLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/ExpendableLightComponent.cs index 02edb49d94..79ac6d990b 100644 --- a/Content.Server/GameObjects/Components/Interactable/ExpendableLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/ExpendableLightComponent.cs @@ -9,6 +9,7 @@ using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Interactable @@ -107,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (LitSound != string.Empty) { - EntitySystem.Get().PlayFromEntity(LitSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), LitSound, Owner); } if (IconStateLit != string.Empty) @@ -127,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (DieSound != string.Empty) { - EntitySystem.Get().PlayFromEntity(DieSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), DieSound, Owner); } if (LoopedSound != string.Empty && Owner.TryGetComponent(out var loopSound)) diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index b8336c5afa..a1a4809b71 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -14,9 +14,11 @@ using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -119,7 +121,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (makeNoise) { - if (TurnOffSound != null) EntitySystem.Get().PlayFromEntity(TurnOffSound, Owner); + if (TurnOffSound != null) SoundSystem.Play(Filter.Pvs(Owner), TurnOffSound, Owner); } return true; @@ -134,7 +136,7 @@ namespace Content.Server.GameObjects.Components.Interactable if (Cell == null) { - if (TurnOnFailSound != null) EntitySystem.Get().PlayFromEntity(TurnOnFailSound, Owner); + if (TurnOnFailSound != null) SoundSystem.Play(Filter.Pvs(Owner), TurnOnFailSound, Owner); Owner.PopupMessage(user, Loc.GetString("Cell missing...")); UpdateLightAction(); return false; @@ -145,7 +147,7 @@ namespace Content.Server.GameObjects.Components.Interactable // Simple enough. if (Wattage > Cell.CurrentCharge) { - if (TurnOnFailSound != null) EntitySystem.Get().PlayFromEntity(TurnOnFailSound, Owner); + if (TurnOnFailSound != null) SoundSystem.Play(Filter.Pvs(Owner), TurnOnFailSound, Owner); Owner.PopupMessage(user, Loc.GetString("Dead cell...")); UpdateLightAction(); return false; @@ -156,7 +158,7 @@ namespace Content.Server.GameObjects.Components.Interactable SetState(true); Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this)); - if (TurnOnSound != null) EntitySystem.Get().PlayFromEntity(TurnOnSound, Owner); + if (TurnOnSound != null) SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound, Owner); return true; } diff --git a/Content.Server/GameObjects/Components/Interactable/MatchstickComponent.cs b/Content.Server/GameObjects/Components/Interactable/MatchstickComponent.cs index 05836a8e9f..140933c3ed 100644 --- a/Content.Server/GameObjects/Components/Interactable/MatchstickComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/MatchstickComponent.cs @@ -1,10 +1,12 @@ -#nullable enable +#nullable enable using System.Threading.Tasks; using Content.Shared.Audio; using Content.Shared.GameObjects.Components; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -68,7 +70,7 @@ namespace Content.Server.GameObjects.Components.Interactable // Play Sound if (!string.IsNullOrEmpty(_igniteSound)) { - EntitySystem.Get().PlayFromEntity(_igniteSound, Owner, + SoundSystem.Play(Filter.Pvs(Owner), _igniteSound, Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); } diff --git a/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs b/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs index c84c9efaf1..e6a7bf0d91 100644 --- a/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/MultitoolComponent.cs @@ -3,7 +3,9 @@ using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; @@ -44,7 +46,6 @@ namespace Content.Server.GameObjects.Components.Interactable [DataField("tools")] private List _tools = new(); private int _currentTool = 0; - private AudioSystem _audioSystem = default!; private ToolComponent? _tool; private SpriteComponent? _sprite; @@ -53,9 +54,6 @@ namespace Content.Server.GameObjects.Components.Interactable base.Initialize(); Owner.TryGetComponent(out _tool); Owner.TryGetComponent(out _sprite); - - _audioSystem = EntitySystem.Get(); - SetTool(); } @@ -65,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Interactable SetTool(); var current = _tools[_currentTool]; if(!string.IsNullOrEmpty(current.ChangeSound)) - _audioSystem.PlayFromEntity(current.ChangeSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), current.ChangeSound, Owner); } private void SetTool() diff --git a/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs b/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs index 2becf640ab..96d327eab8 100644 --- a/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/ToolComponent.cs @@ -5,7 +5,9 @@ using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -102,8 +104,7 @@ namespace Content.Server.GameObjects.Components.Interactable } var file = AudioHelpers.GetRandomFileFromSoundCollection(name); - EntitySystem.Get() - .PlayFromEntity(file, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume)); + SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume)); } public void PlayUseSound(float volume=-5f) @@ -112,8 +113,7 @@ namespace Content.Server.GameObjects.Components.Interactable { if (!string.IsNullOrEmpty(UseSound)) { - EntitySystem.Get() - .PlayFromEntity(UseSound, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume)); + SoundSystem.Play(Filter.Pvs(Owner), UseSound, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume)); } } else diff --git a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs index c43ee1c0ef..acf31ed29e 100644 --- a/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/WelderComponent.cs @@ -17,9 +17,11 @@ using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; @@ -321,7 +323,7 @@ namespace Content.Server.GameObjects.Components.Interactable var drained = targetSolution.Drain(trans); _solutionComponent.TryAddSolution(drained); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/refill.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/refill.ogg", Owner); eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("Welder refueled")); } } diff --git a/Content.Server/GameObjects/Components/Items/DiceComponent.cs b/Content.Server/GameObjects/Components/Items/DiceComponent.cs index 0d29ab4508..1b44ead6e2 100644 --- a/Content.Server/GameObjects/Components/Items/DiceComponent.cs +++ b/Content.Server/GameObjects/Components/Items/DiceComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Audio; +using Content.Shared.Audio; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; @@ -6,6 +6,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -60,7 +61,7 @@ namespace Content.Server.GameObjects.Components.Items { var soundCollection = _prototypeManager.Index(_soundCollectionName); var file = _random.Pick(soundCollection.PickFiles); - EntitySystem.Get().PlayFromEntity(file, Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default); } } diff --git a/Content.Server/GameObjects/Components/Items/FireExtinguisherComponent.cs b/Content.Server/GameObjects/Components/Items/FireExtinguisherComponent.cs index d4adbf7207..2c5b0d4e15 100644 --- a/Content.Server/GameObjects/Components/Items/FireExtinguisherComponent.cs +++ b/Content.Server/GameObjects/Components/Items/FireExtinguisherComponent.cs @@ -1,12 +1,14 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Content.Server.GameObjects.Components.Chemistry; using Content.Shared.Chemistry; using Content.Shared.GameObjects.Components.Chemistry; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; #nullable enable @@ -38,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Items var drained = targetSolution.Drain(trans); container.TryAddSolution(drained); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/refill.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/refill.ogg", Owner); eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("{0:TheName} is now refilled", Owner)); } diff --git a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs index c67c3b6493..a31798fd7d 100644 --- a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs @@ -10,6 +10,8 @@ using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; +using Robust.Shared.Audio; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.Items @@ -45,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Items private void PlaceAt(IMapGrid mapGrid, EntityCoordinates location, ushort tileId, float offset = 0) { mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId)); - EntitySystem.Get().PlayAtCoords("/Audio/Items/genhit.ogg", location, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(location), "/Audio/Items/genhit.ogg", location, AudioHelpers.WithVariation(0.125f)); } async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) diff --git a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs index b4daec9ed6..129e4b6eea 100644 --- a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs +++ b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs @@ -8,11 +8,13 @@ using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Maps; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -23,7 +25,6 @@ namespace Content.Server.GameObjects.Components.Items.RCD public class RCDComponent : Component, IAfterInteract, IUse, IExamine { [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; - [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager = default!; @@ -67,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD public void SwapMode(UseEntityEventArgs eventArgs) { - _entitySystemManager.GetEntitySystem().PlayFromEntity("/Audio/Items/genhit.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Items/genhit.ogg", Owner); int mode = (int) _mode; //Firstly, cast our RCDmode mode to an int (enums are backed by ints anyway by default) mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state _mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it. @@ -148,7 +149,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD return true; //I don't know why this would happen, but sure I guess. Get out of here invalid state! } - _entitySystemManager.GetEntitySystem().PlayFromEntity("/Audio/Items/deconstruct.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Items/deconstruct.ogg", Owner); _ammo--; return true; } diff --git a/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs index 57d3fa4faa..b68aac9f93 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs @@ -1,9 +1,11 @@ -using System.Linq; +using System.Linq; using Content.Shared.Audio; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Random; namespace Content.Server.GameObjects.Components.Items.Storage @@ -45,8 +47,8 @@ namespace Content.Server.GameObjects.Components.Items.Storage locker.Insert(entity); } - EntitySystem.Get().PlayFromEntity("/Audio/Effects/teleport_departure.ogg", Owner, AudioHelpers.WithVariation(0.125f)); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/teleport_arrival.ogg", lockerEnt, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/teleport_departure.ogg", Owner, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(lockerEnt), "/Audio/Effects/teleport_arrival.ogg", lockerEnt, AudioHelpers.WithVariation(0.125f)); } } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs index 64afba87e5..f0eb4e5ef1 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs @@ -14,6 +14,7 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Physics; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -21,6 +22,7 @@ using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.Serialization; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; @@ -223,7 +225,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage } ModifyComponents(); - EntitySystem.Get().PlayFromEntity(_closeSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), _closeSound, Owner); _lastInternalOpenAttempt = default; } @@ -232,7 +234,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage Open = true; EmptyContents(); ModifyComponents(); - EntitySystem.Get().PlayFromEntity(_openSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), _openSound, Owner); } private void ModifyComponents() diff --git a/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs index 9c3d323f15..065fa0eb91 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/SecureEntityStorageComponent.cs @@ -8,6 +8,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -98,7 +99,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage if (!CheckAccess(user)) return; Locked = false; - EntitySystem.Get().PlayFromEntity("/Audio/Machines/door_lock_off.ogg", Owner, AudioParams.Default.WithVolume(-5)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/door_lock_off.ogg", Owner, AudioParams.Default.WithVolume(-5)); } private void DoLock(IEntity user) @@ -106,7 +107,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage if (!CheckAccess(user)) return; Locked = true; - EntitySystem.Get().PlayFromEntity("/Audio/Machines/door_lock_on.ogg", Owner, AudioParams.Default.WithVolume(-5)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/door_lock_on.ogg", Owner, AudioParams.Default.WithVolume(-5)); } private bool CheckAccess(IEntity user) diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index fb9d230212..cb26ce2358 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -22,6 +22,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Network; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -620,8 +621,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage } var file = AudioHelpers.GetRandomFileFromSoundCollection(name); - EntitySystem.Get() - .PlayFromEntity(file, Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default); } } } diff --git a/Content.Server/GameObjects/Components/Items/ToysComponent.cs b/Content.Server/GameObjects/Components/Items/ToysComponent.cs index d123f56eaf..4cb6c473f2 100644 --- a/Content.Server/GameObjects/Components/Items/ToysComponent.cs +++ b/Content.Server/GameObjects/Components/Items/ToysComponent.cs @@ -1,9 +1,10 @@ -using Content.Shared.Audio; +using Content.Shared.Audio; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -35,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Items { var soundCollection = _prototypeManager.Index(_soundCollectionName); var file = _random.Pick(soundCollection.PickFiles); - EntitySystem.Get().PlayFromEntity(file, Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default); } } diff --git a/Content.Server/GameObjects/Components/Kitchen/KitchenSpikeComponent.cs b/Content.Server/GameObjects/Components/Kitchen/KitchenSpikeComponent.cs index b3378cc852..b23a7528f4 100644 --- a/Content.Server/GameObjects/Components/Kitchen/KitchenSpikeComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/KitchenSpikeComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Content.Server.GameObjects.EntitySystems.DoAfter; @@ -10,8 +10,10 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Kitchen; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.Kitchen { @@ -148,7 +150,7 @@ namespace Content.Server.GameObjects.Components.Kitchen victim.Delete(); if (SpikeSound != null) - EntitySystem.Get().PlayFromEntity(SpikeSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), SpikeSound, Owner); } SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) diff --git a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs index d8339228c3..c89f435a82 100644 --- a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs @@ -26,6 +26,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -297,7 +298,7 @@ namespace Content.Server.GameObjects.Components.Kitchen } SetAppearance(MicrowaveVisualState.Cooking); - _audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), _startCookingSound, Owner, AudioParams.Default); Owner.SpawnTimer((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() => { if (_lostPower) @@ -324,7 +325,7 @@ namespace Content.Server.GameObjects.Components.Kitchen Owner.EntityManager.SpawnEntity(_badRecipeName, Owner.Transform.Coordinates); } } - _audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f)); + SoundSystem.Play(Filter.Pvs(Owner), _cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f)); SetAppearance(MicrowaveVisualState.Idle); _busy = false; @@ -457,7 +458,7 @@ namespace Content.Server.GameObjects.Components.Kitchen private void ClickSound() { - _audioSystem.PlayFromEntity("/Audio/Machines/machine_switch.ogg",Owner,AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg",Owner,AudioParams.Default.WithVolume(-2f)); } SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) diff --git a/Content.Server/GameObjects/Components/Kitchen/ReagentGrinderComponent.cs b/Content.Server/GameObjects/Components/Kitchen/ReagentGrinderComponent.cs index 3c54c414ab..6677f3eb74 100644 --- a/Content.Server/GameObjects/Components/Kitchen/ReagentGrinderComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/ReagentGrinderComponent.cs @@ -19,6 +19,7 @@ using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -164,7 +165,7 @@ namespace Content.Server.GameObjects.Components.Kitchen private void ClickSound() { - _audioSystem.PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } private void SetAppearance() @@ -328,7 +329,7 @@ namespace Content.Server.GameObjects.Components.Kitchen switch (program) { case GrinderProgram.Grind: - _audioSystem.PlayFromEntity("/Audio/Machines/blender.ogg", Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/blender.ogg", Owner, AudioParams.Default); //Get each item inside the chamber and get the reagents it contains. Transfer those reagents to the beaker, given we have one in. Owner.SpawnTimer(_workTime, (Action) (() => { @@ -349,7 +350,7 @@ namespace Content.Server.GameObjects.Components.Kitchen break; case GrinderProgram.Juice: - _audioSystem.PlayFromEntity("/Audio/Machines/juicer.ogg", Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/juicer.ogg", Owner, AudioParams.Default); Owner.SpawnTimer(_workTime, (Action) (() => { foreach (var item in _chamber.ContainedEntities.ToList()) diff --git a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs index 29aa888f70..055a80bea6 100644 --- a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs +++ b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Content.Server.GameObjects.Components.Weapon.Melee; using Content.Shared.Damage; using Content.Shared.GameObjects.Components.Damage; @@ -7,6 +7,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Random; namespace Content.Server.GameObjects.Components.Mining @@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Mining if (!item.TryGetComponent(out PickaxeComponent? pickaxeComponent)) return true; if (!string.IsNullOrWhiteSpace(pickaxeComponent.MiningSound)) { - EntitySystem.Get().PlayFromEntity(pickaxeComponent.MiningSound, Owner, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound, Owner, AudioParams.Default); } return true; } diff --git a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs index 4060dc0db3..c312b953a7 100644 --- a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs @@ -7,9 +7,12 @@ using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs.State; using Content.Shared.Interfaces; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; +using Robust.Shared.Players; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -56,8 +59,7 @@ namespace Content.Server.GameObjects.Components.Mobs protected override void OnInteractHand() { - EntitySystem.Get() - .PlayFromEntity("/Audio/Effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.05f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.05f)); } bool IDisarmedAct.Disarmed(DisarmedActEventArgs eventArgs) @@ -72,9 +74,8 @@ namespace Content.Server.GameObjects.Components.Mobs if (source != null) { - EntitySystem.Get().PlayFromEntity("/Audio/Effects/thudswoosh.ogg", source, + SoundSystem.Play(Filter.Pvs(source), "/Audio/Effects/thudswoosh.ogg", source, AudioHelpers.WithVariation(0.025f)); - if (target != null) { source.PopupMessageOtherClients(Loc.GetString("{0} pushes {1}!", source.Name, target.Name)); diff --git a/Content.Server/GameObjects/Components/Morgue/CrematoriumEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Morgue/CrematoriumEntityStorageComponent.cs index 033e5ed132..a34df4b521 100644 --- a/Content.Server/GameObjects/Components/Morgue/CrematoriumEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Morgue/CrematoriumEntityStorageComponent.cs @@ -19,6 +19,8 @@ using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; +using Robust.Shared.Audio; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.Morgue { @@ -113,7 +115,7 @@ namespace Content.Server.GameObjects.Components.Morgue TryOpenStorage(Owner); - EntitySystem.Get().PlayFromEntity("/Audio/Machines/ding.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/ding.ogg", Owner); }, _cremateCancelToken.Token); } diff --git a/Content.Server/GameObjects/Components/Morgue/MorgueEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Morgue/MorgueEntityStorageComponent.cs index 535f38b70c..1cab3005e9 100644 --- a/Content.Server/GameObjects/Components/Morgue/MorgueEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Morgue/MorgueEntityStorageComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.EntitySystems; using Content.Shared.GameObjects.Components.Body; @@ -9,10 +9,12 @@ using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Physics; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -140,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Morgue CheckContents(); if(DoSoulBeep && Appearance !=null && Appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul) - EntitySystem.Get().PlayFromEntity("/Audio/Weapons/Guns/EmptyAlarm/smg_empty_alarm.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/Guns/EmptyAlarm/smg_empty_alarm.ogg", Owner); } void IExamine.Examine(FormattedMessage message, bool inDetailsRange) diff --git a/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs b/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs index 9272442e32..02cd9699bd 100644 --- a/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/CreamPieComponent.cs @@ -1,9 +1,10 @@ -using Content.Server.GameObjects.Components.Chemistry; +using Content.Server.GameObjects.Components.Chemistry; using Content.Server.GameObjects.Components.Fluids; using Content.Shared.Audio; using Content.Shared.Interfaces.GameObjects.Components; -using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.Nutrition { @@ -14,8 +15,7 @@ namespace Content.Server.GameObjects.Components.Nutrition public void PlaySound() { - EntitySystem.Get() - .PlayFromEntity(AudioHelpers.GetRandomFileFromSoundCollection("desecration"), Owner, + SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("desecration"), Owner, AudioHelpers.WithVariation(0.125f)); } diff --git a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs index 76744aaea9..1692f9e609 100644 --- a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Linq; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Body.Behavior; @@ -18,6 +18,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -125,7 +126,7 @@ namespace Content.Server.GameObjects.Components.Nutrition var soundCollection = _prototypeManager.Index(_soundCollection); var file = _random.Pick(soundCollection.PickFiles); - EntitySystem.Get().PlayFromEntity(file, args.User, AudioParams.Default); + SoundSystem.Play(Filter.Pvs(args.User), file, args.User, AudioParams.Default); Opened = true; return false; } @@ -217,7 +218,7 @@ namespace Content.Server.GameObjects.Components.Nutrition if (!string.IsNullOrEmpty(_useSound)) { - EntitySystem.Get().PlayFromEntity(_useSound, target, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(target), _useSound, target, AudioParams.Default.WithVolume(-2f)); } target.PopupMessage(Loc.GetString("Slurp")); @@ -249,7 +250,7 @@ namespace Content.Server.GameObjects.Components.Nutrition var solution = interactions.Drain(interactions.DrainAvailable); solution.SpillAt(Owner, "PuddleSmear"); - EntitySystem.Get().PlayFromEntity(_burstSound, Owner, + SoundSystem.Play(Filter.Pvs(Owner), _burstSound, Owner, AudioParams.Default.WithVolume(-4)); } } diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index 7de614b37d..364d3bf803 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -18,6 +18,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -163,8 +164,7 @@ namespace Content.Server.GameObjects.Components.Nutrition if (UseSound != null) { - _entitySystem.GetEntitySystem() - .PlayFromEntity(UseSound, trueTarget, AudioParams.Default.WithVolume(-1f)); + SoundSystem.Play(Filter.Pvs(trueTarget), UseSound, trueTarget, AudioParams.Default.WithVolume(-1f)); } trueTarget.PopupMessage(user, Loc.GetString("Nom")); diff --git a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs index d3df3f4bd8..09e5fdc1ce 100644 --- a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs +++ b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs @@ -19,10 +19,12 @@ using Content.Shared.GameObjects.Verbs; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -300,7 +302,7 @@ namespace Content.Server.GameObjects.Components.PDA { _idSlot.Insert(card.Owner); ContainedID = card; - EntitySystem.Get().PlayFromEntity("/Audio/Weapons/Guns/MagIn/batrifle_magin.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/Guns/MagIn/batrifle_magin.ogg", Owner); } /// @@ -329,7 +331,7 @@ namespace Content.Server.GameObjects.Components.PDA _lightOn = !_lightOn; light.Enabled = _lightOn; - EntitySystem.Get().PlayFromEntity("/Audio/Items/flashlight_toggle.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Items/flashlight_toggle.ogg", Owner); UpdatePDAUserInterface(); } @@ -348,7 +350,7 @@ namespace Content.Server.GameObjects.Components.PDA hands.PutInHandOrDrop(cardItemComponent); ContainedID = null; - EntitySystem.Get().PlayFromEntity("/Audio/Machines/id_swipe.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/id_swipe.ogg", Owner); UpdatePDAUserInterface(); } diff --git a/Content.Server/GameObjects/Components/Pointing/RoguePointingArrowComponent.cs b/Content.Server/GameObjects/Components/Pointing/RoguePointingArrowComponent.cs index f7d3999bdd..16544644a8 100644 --- a/Content.Server/GameObjects/Components/Pointing/RoguePointingArrowComponent.cs +++ b/Content.Server/GameObjects/Components/Pointing/RoguePointingArrowComponent.cs @@ -1,12 +1,14 @@ -#nullable enable +#nullable enable using System.Linq; using Content.Server.Explosions; using Content.Shared.GameObjects.Components.Pointing; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -120,7 +122,7 @@ namespace Content.Server.GameObjects.Components.Pointing } Owner.SpawnExplosion(0, 2, 1, 1); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/explosion.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/explosion.ogg", Owner); Owner.Delete(); } diff --git a/Content.Server/GameObjects/Components/Portal/PortalComponent.cs b/Content.Server/GameObjects/Components/Portal/PortalComponent.cs index 510b34565a..b098888c18 100644 --- a/Content.Server/GameObjects/Components/Portal/PortalComponent.cs +++ b/Content.Server/GameObjects/Components/Portal/PortalComponent.cs @@ -4,10 +4,12 @@ using System.Collections.Generic; using Content.Shared.GameObjects.Components.Portal; using Content.Shared.GameObjects.Components.Tag; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision; +using Robust.Shared.Player; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -139,13 +141,12 @@ namespace Content.Server.GameObjects.Components.Portal } var position = _connectingTeleporter.Transform.Coordinates; - var soundPlayer = EntitySystem.Get(); // Departure // Do we need to rate-limit sounds to stop ear BLAST? - soundPlayer.PlayAtCoords(_departureSound, entity.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(entity), _departureSound, entity.Transform.Coordinates); entity.Transform.Coordinates = position; - soundPlayer.PlayAtCoords(_arrivalSound, entity.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(entity), _arrivalSound, entity.Transform.Coordinates); TryChangeState(PortalState.RecentlyTeleported); // To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal diff --git a/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs b/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs index f10d94ff82..afd851bd23 100644 --- a/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs @@ -1,15 +1,17 @@ -#nullable enable +#nullable enable using System; using System.Linq; using System.Threading.Tasks; using Content.Shared.GameObjects.Components.Portal; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Physics; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -124,8 +126,7 @@ namespace Content.Server.GameObjects.Components.Portal Owner.SpawnTimer(TimeSpan.FromSeconds(_chargeTime + _cooldown), () => SetState(ItemTeleporterState.Off)); if (_cooldownSound != null) { - var soundPlayer = EntitySystem.Get(); - soundPlayer.PlayFromEntity(_cooldownSound, Owner); + SoundSystem.Play(Filter.Pvs(Owner), _cooldownSound, Owner); } } @@ -209,7 +210,6 @@ namespace Content.Server.GameObjects.Components.Portal { // Messy maybe? var targetGrid = user.Transform.Coordinates.WithPosition(vector); - var soundPlayer = EntitySystem.Get(); // If portals use those, otherwise just move em over if (_portalAliveTime > 0.0f) @@ -229,12 +229,12 @@ namespace Content.Server.GameObjects.Components.Portal else { // Departure - soundPlayer.PlayAtCoords(_departureSound, user.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(user), _departureSound, user.Transform.Coordinates); // Arrival user.Transform.AttachToGridOrMap(); user.Transform.WorldPosition = vector; - soundPlayer.PlayAtCoords(_arrivalSound, user.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(user), _arrivalSound, user.Transform.Coordinates); } } } diff --git a/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs b/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs index a90786bae8..a53b48d1ef 100644 --- a/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs +++ b/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs @@ -4,8 +4,10 @@ using Content.Shared.Audio; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components @@ -44,8 +46,7 @@ namespace Content.Server.GameObjects.Components private void Rustle() { - EntitySystem.Get() - .PlayFromEntity("/Audio/Effects/plant_rustle.ogg", Owner, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/plant_rustle.ogg", Owner, AudioHelpers.WithVariation(0.25f)); } } } diff --git a/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs b/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs index 78687efe9e..cc78e3b9ba 100644 --- a/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/AME/AMEControllerComponent.cs @@ -18,6 +18,7 @@ using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Power.AME @@ -319,14 +320,12 @@ namespace Content.Server.GameObjects.Components.Power.AME private void ClickSound() { - - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); - + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } private void InjectSound(bool overloading) { - EntitySystem.Get().PlayFromEntity("/Audio/Effects/bang.ogg", Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/bang.ogg", Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f)); } async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) diff --git a/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs b/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs index a69dbfe12c..8cab4a77d1 100644 --- a/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs +++ b/Content.Server/GameObjects/Components/Power/AME/AMEPartComponent.cs @@ -7,10 +7,12 @@ using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.Power.AME { @@ -48,7 +50,7 @@ namespace Content.Server.GameObjects.Components.Power.AME var ent = _serverEntityManager.SpawnEntity("AMEShielding", mapGrid.GridTileToLocal(snapPos)); ent.Transform.LocalRotation = Owner.Transform.LocalRotation; - EntitySystem.Get().PlayFromEntity(_unwrap, Owner); + SoundSystem.Play(Filter.Pvs(Owner), _unwrap, Owner); Owner.Delete(); diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs index 11ff7fe509..79f04f8991 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/ApcComponent.cs @@ -12,6 +12,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; @@ -89,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents { MainBreakerEnabled = !MainBreakerEnabled; _uiDirty = true; - EntitySystem.Get().PlayFromEntity("/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); } else { diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs index 5db2572224..3ed09df96a 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/LightBulbComponent.cs @@ -4,9 +4,11 @@ using Content.Shared.Audio; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -131,7 +133,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece var soundCollection = _prototypeManager.Index("GlassBreak"); var file = _random.Pick(soundCollection.PickFiles); - EntitySystem.Get().PlayFromEntity(file, Owner); + SoundSystem.Play(Filter.Pvs(Owner), file, Owner); } } } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs index 96aa5f3a5d..6b75a9333e 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs @@ -19,6 +19,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; @@ -115,8 +116,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece { Owner.PopupMessage(eventArgs.User, Loc.GetString("You burn your hand!")); damageableComponent.ChangeDamage(DamageType.Heat, 20, false, Owner); - var audioSystem = EntitySystem.Get(); - audioSystem.PlayFromEntity("/Audio/Effects/lightburn.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/lightburn.ogg", Owner); } void Eject() @@ -201,7 +201,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece if (time > _lastThunk + _thunkDelay) { _lastThunk = time; - EntitySystem.Get().PlayFromEntity("/Audio/Machines/light_tube_on.ogg", Owner, AudioParams.Default.WithVolume(-10f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/light_tube_on.ogg", Owner, AudioParams.Default.WithVolume(-10f)); } } else diff --git a/Content.Server/GameObjects/Components/Power/PowerCellSlotComponent.cs b/Content.Server/GameObjects/Components/Power/PowerCellSlotComponent.cs index 7272994f19..23383521c1 100644 --- a/Content.Server/GameObjects/Components/Power/PowerCellSlotComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerCellSlotComponent.cs @@ -7,9 +7,11 @@ using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.GameObjects.Verbs; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -146,7 +148,7 @@ namespace Content.Server.GameObjects.Components.Power if (playSound && CellRemoveSound != null) { - EntitySystem.Get().PlayFromEntity(CellRemoveSound, Owner, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), CellRemoveSound, Owner, AudioHelpers.WithVariation(0.125f)); } SendMessage(new PowerCellChangedMessage(true)); return cell; @@ -168,7 +170,7 @@ namespace Content.Server.GameObjects.Components.Power //Dirty(); if (playSound && CellInsertSound != null) { - EntitySystem.Get().PlayFromEntity(CellInsertSound, Owner, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), CellInsertSound, Owner, AudioHelpers.WithVariation(0.125f)); } SendMessage(new PowerCellChangedMessage(false)); return true; diff --git a/Content.Server/GameObjects/Components/Projectiles/HitscanComponent.cs b/Content.Server/GameObjects/Components/Projectiles/HitscanComponent.cs index bff571c198..aeccd9fe39 100644 --- a/Content.Server/GameObjects/Components/Projectiles/HitscanComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/HitscanComponent.cs @@ -2,11 +2,13 @@ using System; using Content.Shared.Damage; using Content.Shared.Physics; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Player; using Robust.Shared.Timing; namespace Content.Server.GameObjects.Components.Projectiles @@ -82,7 +84,8 @@ namespace Content.Server.GameObjects.Components.Projectiles { // TODO: No wall component so ? var offset = angle.ToVec().Normalized / 2; - EntitySystem.Get().PlayAtCoords(_soundHitWall, user.Transform.Coordinates.Offset(offset)); + var coordinates = user.Transform.Coordinates.Offset(offset); + SoundSystem.Play(Filter.Pvs(coordinates), _soundHitWall, coordinates); } Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () => diff --git a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs index 4b8f144f95..9fa7ec69d7 100644 --- a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs @@ -4,9 +4,11 @@ using Content.Shared.Damage; using Content.Shared.GameObjects.Components.Damage; using Content.Shared.GameObjects.Components.Projectiles; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -63,13 +65,15 @@ namespace Content.Server.GameObjects.Components.Projectiles return; } + var coordinates = otherBody.Entity.Transform.Coordinates; + var playerFilter = Filter.Pvs(coordinates); if (otherBody.Entity.TryGetComponent(out IDamageableComponent? damage) && _soundHitSpecies != null) { - EntitySystem.Get().PlayAtCoords(_soundHitSpecies, otherBody.Entity.Transform.Coordinates); + SoundSystem.Play(playerFilter, _soundHitSpecies, coordinates); } else if (_soundHit != null) { - EntitySystem.Get().PlayAtCoords(_soundHit, otherBody.Entity.Transform.Coordinates); + SoundSystem.Play(playerFilter, _soundHit, coordinates); } if (damage != null) diff --git a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs index 0d3d91bd8c..11ad16241c 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.GameObjects.Components.Power.ApcNetComponents; using Content.Server.Utility; using Content.Shared.Audio; @@ -10,6 +10,7 @@ using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.ViewVariables; @@ -124,8 +125,7 @@ namespace Content.Server.GameObjects.Components.Research { var soundCollection = _prototypeManager.Index(SoundCollectionName); var file = _random.Pick(soundCollection.PickFiles); - var audioSystem = EntitySystem.Get(); - audioSystem.PlayFromEntity(file,Owner,AudioParams.Default); + SoundSystem.Play(Filter.Pvs(Owner), file,Owner,AudioParams.Default); } } } diff --git a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs index 950fe392f5..e6d4bc2a22 100644 --- a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs @@ -12,10 +12,12 @@ using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Physics; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Log; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -257,7 +259,7 @@ namespace Content.Server.GameObjects.Components.Singularity // TODO: Move to projectile's code. Timer.Spawn(3000, () => projectile.Delete()); - EntitySystem.Get().PlayFromEntity(_fireSound, Owner, + SoundSystem.Play(Filter.Pvs(Owner), _fireSound, Owner, AudioHelpers.WithVariation(Variation).WithVolume(Volume).WithMaxDistance(Distance)); } diff --git a/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs b/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs index 1e16731abd..ac1ca0a29e 100644 --- a/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs @@ -17,6 +17,7 @@ using Robust.Shared.Physics.Dynamics.Shapes; using Robust.Shared.Random; using Robust.Server.GameObjects; using Content.Shared.GameObjects.Components.Singularity; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Timing; @@ -98,7 +99,6 @@ namespace Content.Server.GameObjects.Components.Singularity private PhysicsComponent? _collidableComponent; private SpriteComponent? _spriteComponent; private RadiationPulseComponent? _radiationPulseComponent; - private AudioSystem _audioSystem = null!; private IPlayingAudioStream? _playingSound; public override ComponentState GetComponentState(ICommonSession player) @@ -110,13 +110,12 @@ namespace Content.Server.GameObjects.Components.Singularity { base.Initialize(); - _audioSystem = EntitySystem.Get(); var audioParams = AudioParams.Default; audioParams.Loop = true; audioParams.MaxDistance = 20f; audioParams.Volume = 5; - _audioSystem.PlayFromEntity("/Audio/Effects/singularity_form.ogg", Owner); - Timer.Spawn(5200,() => _playingSound = _audioSystem.PlayFromEntity("/Audio/Effects/singularity.ogg", Owner, audioParams)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity_form.ogg", Owner); + Timer.Spawn(5200,() => _playingSound = SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity.ogg", Owner, audioParams)); if (!Owner.TryGetComponent(out _spriteComponent)) Logger.Error("SingularityComponent was spawned without SpriteComponent"); @@ -163,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Singularity public override void OnRemove() { _playingSound?.Stop(); - _audioSystem.PlayAtCoords("/Audio/Effects/singularity_collapse.ogg", Owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity_collapse.ogg", Owner.Transform.Coordinates); base.OnRemove(); } } diff --git a/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs b/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs index b943db1ba5..678b3c93e7 100644 --- a/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs +++ b/Content.Server/GameObjects/Components/Sound/EmitSoundOnThrowComponent.cs @@ -1,8 +1,8 @@ -using Content.Shared.Audio; +using Content.Shared.Audio; using Content.Shared.Interfaces.GameObjects.Components; -using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.Sound @@ -28,9 +28,9 @@ namespace Content.Server.GameObjects.Components.Sound { if (_pitchVariation > 0.0) { - EntitySystem.Get().PlayFromEntity(_soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f)); } - EntitySystem.Get().PlayFromEntity(_soundName, Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundName, Owner, AudioParams.Default.WithVolume(-2f)); } } diff --git a/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs b/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs index 53bd2642c7..de28408820 100644 --- a/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs +++ b/Content.Server/GameObjects/Components/Sound/EmitSoundOnUseComponent.cs @@ -1,8 +1,8 @@ -using Content.Shared.Audio; +using Content.Shared.Audio; using Content.Shared.Interfaces.GameObjects.Components; -using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -28,15 +28,15 @@ namespace Content.Server.GameObjects.Components.Sound { if (_pitchVariation > 0.0) { - EntitySystem.Get().PlayFromEntity(_soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f)); return true; } if (_semitoneVariation > 0) { - EntitySystem.Get().PlayFromEntity(_soundName, Owner, AudioHelpers.WithSemitoneVariation(_semitoneVariation).WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundName, Owner, AudioHelpers.WithSemitoneVariation(_semitoneVariation).WithVolume(-2f)); return true; } - EntitySystem.Get().PlayFromEntity(_soundName, Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundName, Owner, AudioParams.Default.WithVolume(-2f)); return true; } return false; diff --git a/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs b/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs index dc74ea7b51..71468d367f 100644 --- a/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs +++ b/Content.Server/GameObjects/Components/Sound/FootstepModifierComponent.cs @@ -1,8 +1,9 @@ -using Content.Shared.Audio; +using Content.Shared.Audio; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -30,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Sound { var soundCollection = _prototypeManager.Index(_soundCollectionName); var file = _footstepRandom.Pick(soundCollection.PickFiles); - EntitySystem.Get().PlayFromEntity(file, Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default.WithVolume(-2f)); } } } diff --git a/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs b/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs index acd298d01f..856d6c4c40 100644 --- a/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs +++ b/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs @@ -1,8 +1,10 @@ using System; using Content.Shared.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Random; using Robust.Shared.Serialization.Manager.Attributes; @@ -92,7 +94,7 @@ namespace Content.Server.GameObjects.Components.StationEvents } if(!string.IsNullOrEmpty(Sound)) - EntitySystem.Get().PlayAtCoords(Sound, Owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), Sound, Owner.Transform.Coordinates); Dirty(); } diff --git a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs index ec32be41b9..6ab8f7c6d3 100644 --- a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs @@ -14,6 +14,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -187,7 +188,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines Owner.EntityManager.SpawnEntity(id, Owner.Transform.Coordinates); }); - EntitySystem.Get().PlayFromEntity(_soundVend, Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundVend, Owner, AudioParams.Default.WithVolume(-2f)); } private void TryEject(string id, IEntity? sender) @@ -206,7 +207,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines private void Deny() { - EntitySystem.Get().PlayFromEntity(_soundDeny, Owner, AudioParams.Default.WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), _soundDeny, Owner, AudioParams.Default.WithVolume(-2f)); // Play the Deny animation TrySetVisualState(VendingMachineVisualState.Deny); diff --git a/Content.Server/GameObjects/Components/Watercloset/ToiletComponent.cs b/Content.Server/GameObjects/Components/Watercloset/ToiletComponent.cs index a641342a90..64911aa701 100644 --- a/Content.Server/GameObjects/Components/Watercloset/ToiletComponent.cs +++ b/Content.Server/GameObjects/Components/Watercloset/ToiletComponent.cs @@ -21,6 +21,8 @@ using Robust.Shared.Random; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; using System.Threading.Tasks; +using Robust.Shared.Audio; +using Robust.Shared.Player; namespace Content.Server.GameObjects.Components.Watercloset { @@ -124,8 +126,7 @@ namespace Content.Server.GameObjects.Components.Watercloset public void ToggleToiletSeat() { IsSeatUp = !IsSeatUp; - EntitySystem.Get() - .PlayFromEntity("/Audio/Effects/toilet_seat_down.ogg", Owner, AudioHelpers.WithVariation(0.05f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/toilet_seat_down.ogg", Owner, AudioHelpers.WithVariation(0.05f)); UpdateSprite(); } diff --git a/Content.Server/GameObjects/Components/Weapon/FlashableComponent.cs b/Content.Server/GameObjects/Components/Weapon/FlashableComponent.cs index 5c3eee0d14..13aa585e3c 100644 --- a/Content.Server/GameObjects/Components/Weapon/FlashableComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/FlashableComponent.cs @@ -3,8 +3,10 @@ using Content.Shared.GameObjects.Components.Weapons; using Content.Shared.Physics; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Timing; @@ -42,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Weapon if (!string.IsNullOrEmpty(sound)) { - EntitySystem.Get().PlayAtCoords(sound, source.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(source), sound, source.Transform.Coordinates); } } } diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs index 8197e4e488..a5f86dade4 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/FlashComponent.cs @@ -8,6 +8,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -98,7 +99,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee }); } - EntitySystem.Get().PlayAtCoords("/Audio/Weapons/flash.ogg", Owner.Transform.Coordinates, + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/flash.ogg", Owner.Transform.Coordinates, AudioParams.Default); return true; diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 5be0b15709..0d629986a1 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -8,11 +8,13 @@ using Content.Shared.GameObjects.Components.Items; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Physics; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Physics; using Robust.Shared.Physics.Broadphase; +using Robust.Shared.Player; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; using Robust.Shared.ViewVariables; @@ -85,15 +87,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee // This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes. var entities = ArcRayCast(eventArgs.User.Transform.WorldPosition, angle, eventArgs.User); - - var audioSystem = EntitySystem.Get(); + if (entities.Count != 0) { - audioSystem.PlayFromEntity(_hitSound, entities.First()); + SoundSystem.Play(Filter.Pvs(Owner), _hitSound, entities.First()); } else { - audioSystem.PlayFromEntity(_missSound, eventArgs.User); + SoundSystem.Play(Filter.Pvs(Owner), _missSound, eventArgs.User); } var hitEntities = new List(); @@ -141,14 +142,13 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee var diff = eventArgs.ClickLocation.ToMapPos(Owner.EntityManager) - location.ToMapPos(Owner.EntityManager); var angle = Angle.FromWorldVec(diff); - var audioSystem = EntitySystem.Get(); if (target != null) { - audioSystem.PlayFromEntity(_hitSound, target); + SoundSystem.Play(Filter.Pvs(Owner), _hitSound, target); } else { - audioSystem.PlayFromEntity(_missSound, eventArgs.User); + SoundSystem.Play(Filter.Pvs(Owner), _missSound, eventArgs.User); return false; } diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs index 0633f1600d..b13258c740 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/StunbatonComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Collections.Generic; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Items.Storage; @@ -10,9 +10,11 @@ using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -86,27 +88,31 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee if (!Cell.TryUseCharge(EnergyPerUse)) return true; - EntitySystem.Get().PlayAtCoords("/Audio/Weapons/egloves.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/egloves.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); foreach (var entity in entities) { if (!entity.TryGetComponent(out StunnableComponent? stunnable)) continue; if(!stunnable.SlowedDown) + { if(_robustRandom.Prob(_paralyzeChanceNoSlowdown)) stunnable.Paralyze(_paralyzeTime); else stunnable.Slowdown(_slowdownTime); + } else + { if(_robustRandom.Prob(_paralyzeChanceWithSlowdown)) stunnable.Paralyze(_paralyzeTime); else stunnable.Slowdown(_slowdownTime); + } } if (!(Cell.CurrentCharge < EnergyPerUse)) return true; - EntitySystem.Get().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); TurnOff(); return true; @@ -137,7 +143,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee var sprite = Owner.GetComponent(); var item = Owner.GetComponent(); - EntitySystem.Get().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); item.EquippedPrefix = "off"; sprite.LayerSetState(0, "stunbaton_off"); @@ -154,9 +160,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee var sprite = Owner.GetComponent(); var item = Owner.GetComponent(); + var playerFilter = Filter.Pvs(Owner); if (Cell == null) { - EntitySystem.Get().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(playerFilter, "/Audio/Machines/button.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); Owner.PopupMessage(user, Loc.GetString("Cell missing...")); return; @@ -164,12 +171,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee if (Cell.CurrentCharge < EnergyPerUse) { - EntitySystem.Get().PlayAtCoords("/Audio/Machines/button.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(playerFilter, "/Audio/Machines/button.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); Owner.PopupMessage(user, Loc.GetString("Dead cell...")); return; } - EntitySystem.Get().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(playerFilter, AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); item.EquippedPrefix = "on"; sprite.LayerSetState(0, "stunbaton_on"); @@ -204,7 +211,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee if (!Activated || Cell == null || !Cell.TryUseCharge(EnergyPerUse) || !eventArgs.Target.TryGetComponent(out StunnableComponent? stunnable)) return; - EntitySystem.Get().PlayAtCoords("/Audio/Weapons/egloves.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/egloves.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); stunnable.Paralyze(_paralyzeTime); } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs index 2d5f50772e..6c5e9db8b5 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Shared.GameObjects; @@ -14,6 +14,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; @@ -68,15 +69,13 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { return; } - - var soundSystem = EntitySystem.Get(); - + if (value) { TryEjectChamber(); if (_soundBoltOpen != null) { - soundSystem.PlayAtCoords(_soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } else @@ -84,7 +83,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels TryFeedChamber(); if (_soundBoltClosed != null) { - soundSystem.PlayAtCoords(_soundBoltClosed, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } @@ -226,7 +225,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (!string.IsNullOrEmpty(_soundCycle)) { - EntitySystem.Get().PlayAtCoords(_soundCycle, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundCycle, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } @@ -258,7 +257,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels _chamberContainer.Insert(ammo); if (_soundInsert != null) { - EntitySystem.Get().PlayAtCoords(_soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } Dirty(); UpdateAppearance(); @@ -271,7 +270,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels _spawnedAmmo.Push(ammo); if (_soundInsert != null) { - EntitySystem.Get().PlayAtCoords(_soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } Dirty(); UpdateAppearance(); diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs index 163fce067a..be783ea1ee 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/PumpBarrelComponent.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Shared.GameObjects; @@ -11,6 +11,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; @@ -189,7 +190,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (!string.IsNullOrEmpty(_soundCycle)) { - EntitySystem.Get().PlayAtCoords(_soundCycle, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundCycle, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } @@ -218,7 +219,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels UpdateAppearance(); if (_soundInsert != null) { - EntitySystem.Get().PlayAtCoords(_soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } return true; } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs index 116792f51a..4131db241c 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/RevolverBarrelComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition; using Content.Shared.GameObjects; @@ -14,6 +14,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -164,7 +165,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels _ammoContainer.Insert(entity); if (_soundInsert != null) { - EntitySystem.Get().PlayAtCoords(_soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } Dirty(); @@ -194,7 +195,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels _currentSlot = random; if (!string.IsNullOrEmpty(_soundSpin)) { - EntitySystem.Get().PlayAtCoords(_soundSpin, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundSpin, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } Dirty(); } @@ -248,7 +249,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (_soundEject != null) { - EntitySystem.Get().PlayAtCoords(_soundEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-1)); + SoundSystem.Play(Filter.Pvs(Owner), _soundEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-1)); } } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs index 8399f0ee12..f926ea12e3 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerBatteryBarrelComponent.cs @@ -17,6 +17,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -221,7 +222,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels if (_soundPowerCellInsert != null) { - EntitySystem.Get().PlayAtCoords(_soundPowerCellInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } _powerCellContainer.Insert(entity); @@ -274,7 +275,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels if (_soundPowerCellEject != null) { - EntitySystem.Get().PlayAtCoords(_soundPowerCellEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } return true; } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs index ae618e3ab7..001d455f8d 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs @@ -18,6 +18,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; @@ -92,14 +93,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels return; } - var soundSystem = EntitySystem.Get(); - if (value) { TryEjectChamber(); if (_soundBoltOpen != null) { - soundSystem.PlayAtCoords(_soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } else @@ -107,7 +106,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels TryFeedChamber(); if (_soundBoltClosed != null) { - soundSystem.PlayAtCoords(_soundBoltClosed, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } @@ -225,13 +224,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels TryFeedChamber(); - var soundSystem = EntitySystem.Get(); - if (_chamberContainer.ContainedEntity == null && !BoltOpen) { if (_soundBoltOpen != null) { - soundSystem.PlayAtCoords(_soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); + SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); } if (Owner.TryGetContainer(out var container)) @@ -246,7 +243,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (_soundRack != null) { - soundSystem.PlayAtCoords(_soundRack, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundRack, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } } @@ -274,7 +271,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (_soundBoltClosed != null) { - EntitySystem.Get().PlayAtCoords(_soundBoltClosed, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); + SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); } Owner.PopupMessage(eventArgs.User, Loc.GetString("Bolt closed")); BoltOpen = false; @@ -328,8 +325,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (_soundAutoEject != null) { - var soundSystem = EntitySystem.Get(); - soundSystem.PlayAtCoords(_soundAutoEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } _magazineContainer.Remove(magazine); @@ -356,7 +352,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels _magazineContainer.Remove(mag); if (_soundMagEject != null) { - EntitySystem.Get().PlayAtCoords(_soundMagEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundMagEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } if (user.TryGetComponent(out HandsComponent? handsComponent)) @@ -395,7 +391,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels { if (_soundMagInsert != null) { - EntitySystem.Get().PlayAtCoords(_soundMagInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); + SoundSystem.Play(Filter.Pvs(Owner), _soundMagInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); } Owner.PopupMessage(eventArgs.User, Loc.GetString("Magazine inserted")); _magazineContainer.Insert(eventArgs.Using); diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs index 70011581fa..450ffe7f11 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/ServerRangedWeaponComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels; @@ -8,7 +8,6 @@ using Content.Shared.GameObjects.Components.Weapons.Ranged; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; -using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -17,6 +16,7 @@ using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Network; +using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; @@ -151,12 +151,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged if (ClumsyCheck && ClumsyComponent.TryRollClumsy(user, ClumsyExplodeChance)) { - var soundSystem = EntitySystem.Get(); - soundSystem.PlayAtCoords("/Audio/Items/bikehorn.ogg", - Owner.Transform.Coordinates, AudioParams.Default, 5); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Items/bikehorn.ogg", + Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5)); - soundSystem.PlayAtCoords("/Audio/Weapons/Guns/Gunshots/bang.ogg", - Owner.Transform.Coordinates, AudioParams.Default, 5); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/Guns/Gunshots/bang.ogg", + Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5)); if (user.TryGetComponent(out IDamageableComponent? health)) { diff --git a/Content.Server/GameObjects/Components/WindowComponent.cs b/Content.Server/GameObjects/Components/WindowComponent.cs index 6d7707ef98..c839e27cfd 100644 --- a/Content.Server/GameObjects/Components/WindowComponent.cs +++ b/Content.Server/GameObjects/Components/WindowComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using Content.Server.Utility; using Content.Shared.Audio; @@ -10,9 +10,11 @@ using Content.Server.GameObjects.Components.Destructible; using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers; using Content.Shared.Utility; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Timing; @@ -129,8 +131,8 @@ namespace Content.Server.GameObjects.Components return false; } - EntitySystem.Get() - .PlayAtCoords("/Audio/Effects/glass_knock.ogg", eventArgs.Target.Transform.Coordinates, AudioHelpers.WithVariation(0.05f)); + SoundSystem.Play(Filter.Pvs(eventArgs.Target), "/Audio/Effects/glass_knock.ogg", + eventArgs.Target.Transform.Coordinates, AudioHelpers.WithVariation(0.05f)); eventArgs.Target.PopupMessageEveryone(Loc.GetString("comp-window-knock")); _lastKnockTime = _gameTiming.CurTime; diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index 8bc9c36ec7..a6ca152089 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -17,9 +17,11 @@ using Content.Shared.Utility; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -448,7 +450,7 @@ namespace Content.Server.GameObjects.Components return; } - _audioSystem.PlayFromEntity("/Audio/Effects/multitool_pulse.ogg", Owner); + SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/multitool_pulse.ogg", Owner); break; } @@ -498,8 +500,7 @@ namespace Content.Server.GameObjects.Components else if (await tool.UseTool(eventArgs.User, Owner, 0.5f, ToolQuality.Screwing)) { IsPanelOpen = !IsPanelOpen; - EntitySystem.Get() - .PlayFromEntity(IsPanelOpen ? "/Audio/Machines/screwdriveropen.ogg" : "/Audio/Machines/screwdriverclose.ogg", + SoundSystem.Play(Filter.Pvs(Owner), IsPanelOpen ? "/Audio/Machines/screwdriveropen.ogg" : "/Audio/Machines/screwdriverclose.ogg", Owner); return true; } diff --git a/Content.Server/GameObjects/EntitySystems/ChemicalReactionSystem.cs b/Content.Server/GameObjects/EntitySystems/ChemicalReactionSystem.cs index 59eba6b1b1..f6ba40a3f6 100644 --- a/Content.Server/GameObjects/EntitySystems/ChemicalReactionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ChemicalReactionSystem.cs @@ -1,8 +1,9 @@ #nullable enable using Content.Shared.Chemistry; using Content.Shared.GameObjects.EntitySystems; -using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; namespace Content.Server.GameObjects.EntitySystems.NewFolder { @@ -13,7 +14,7 @@ namespace Content.Server.GameObjects.EntitySystems.NewFolder base.OnReaction(reaction, owner, unitReactions); if (reaction.Sound != null) - Get().PlayAtCoords(reaction.Sound, owner.Transform.Coordinates); + SoundSystem.Play(Filter.Pvs(owner), reaction.Sound, owner.Transform.Coordinates); } } } diff --git a/Content.Server/GameObjects/EntitySystems/GravitySystem.cs b/Content.Server/GameObjects/EntitySystems/GravitySystem.cs index 29a7ef8fe1..cf9c41de78 100644 --- a/Content.Server/GameObjects/EntitySystems/GravitySystem.cs +++ b/Content.Server/GameObjects/EntitySystems/GravitySystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Gravity; using Content.Server.GameObjects.Components.Mobs; @@ -7,10 +7,12 @@ using Content.Shared.GameObjects.EntitySystemMessages.Gravity; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Random; namespace Content.Server.GameObjects.EntitySystems @@ -101,7 +103,7 @@ namespace Content.Server.GameObjects.EntitySystems { if (player.AttachedEntity == null || player.AttachedEntity.Transform.GridID != gridId) continue; - Get().PlayFromEntity("/Audio/Effects/alert.ogg", player.AttachedEntity); + SoundSystem.Play(Filter.Pvs(player.AttachedEntity), "/Audio/Effects/alert.ogg", player.AttachedEntity); } } diff --git a/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs b/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs index d137c68a70..21c7b4506d 100644 --- a/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Mobs.State; @@ -6,7 +6,9 @@ using Content.Shared.GameObjects.Components.Rotation; using Content.Shared.GameObjects.EntitySystems; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Player; namespace Content.Server.GameObjects.EntitySystems { @@ -30,7 +32,7 @@ namespace Content.Server.GameObjects.EntitySystems if (playSound) { var file = AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"); - Get().PlayFromEntity(file, entity, AudioHelpers.WithVariation(0.25f)); + SoundSystem.Play(Filter.Pvs(entity), file, entity, AudioHelpers.WithVariation(0.25f)); } } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 177c419357..92590633f2 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -22,6 +22,7 @@ using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Physics; using Robust.Shared.Physics.Dynamics; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -185,7 +186,7 @@ namespace Content.Server.Physics.Controllers { var soundCollection = _prototypeManager.Index(soundCollectionName); var file = _robustRandom.Pick(soundCollection.PickFiles); - _audioSystem.PlayAtCoords(file, coordinates, sprinting ? AudioParams.Default.WithVolume(0.75f) : null); + SoundSystem.Play(Filter.Pvs(coordinates), file, coordinates, sprinting ? AudioParams.Default.WithVolume(0.75f) : null); } catch (UnknownPrototypeException) { diff --git a/Content.Server/StationEvents/GasLeak.cs b/Content.Server/StationEvents/GasLeak.cs index 8d3c05d161..aae290fffd 100644 --- a/Content.Server/StationEvents/GasLeak.cs +++ b/Content.Server/StationEvents/GasLeak.cs @@ -2,11 +2,13 @@ using Content.Server.GameObjects.Components.Atmos; using Content.Server.Interfaces.GameTicking; using Content.Shared.Atmos; using Robust.Server.GameObjects; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; +using Robust.Shared.Player; using Robust.Shared.Random; #nullable enable @@ -159,7 +161,7 @@ namespace Content.Server.StationEvents // Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that // it COULD start potentially start a bigger fire. atmos?.HotspotExpose(700f, 50f, true); - EntitySystem.Get().PlayAtCoords("/Audio/Effects/sparks4.ogg", _targetCoords); + SoundSystem.Play(Filter.Pvs(_targetCoords), "/Audio/Effects/sparks4.ogg", _targetCoords); } } diff --git a/RobustToolbox b/RobustToolbox index 4f3b4ac2d2..92f44b390e 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 4f3b4ac2d2cc3c7dc4c949611d501ba9684c531a +Subproject commit 92f44b390eaf8a62c44f396dc9de3a2a042c99ae