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

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