SoundSystem Improvements (#3697)

* Refactor all audio to use the new SoundSystem.

* Update submodule

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
Acruid
2021-03-21 09:12:03 -07:00
committed by GitHub
parent d4030edff6
commit 9459400002
104 changed files with 401 additions and 279 deletions

View File

@@ -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<SoundCollectionPrototype>(_soundCollectionName);
var file = _random.Pick(soundCollection.PickFiles);
EntitySystem.Get<AudioSystem>().PlayFromEntity(file, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default);
}
}

View File

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

View File

@@ -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<AudioSystem>().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<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)

View File

@@ -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<AudioSystem>().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<AudioSystem>().PlayFromEntity("/Audio/Items/deconstruct.ogg", Owner);
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Items/deconstruct.ogg", Owner);
_ammo--;
return true;
}

View File

@@ -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<AudioSystem>().PlayFromEntity("/Audio/Effects/teleport_departure.ogg", Owner, AudioHelpers.WithVariation(0.125f));
EntitySystem.Get<AudioSystem>().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));
}
}
}

View File

@@ -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<AudioSystem>().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<AudioSystem>().PlayFromEntity(_openSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _openSound, Owner);
}
private void ModifyComponents()

View File

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

View File

@@ -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<AudioSystem>()
.PlayFromEntity(file, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default);
}
}
}

View File

@@ -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<SoundCollectionPrototype>(_soundCollectionName);
var file = _random.Pick(soundCollection.PickFiles);
EntitySystem.Get<AudioSystem>().PlayFromEntity(file, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(Owner), file, Owner, AudioParams.Default);
}
}