Rename SoundComponent and refactor its wrong usages. (#1036)

* Rename `SoundComponent` and refactor its wrong usages.

* Replace verbose IoC grabs with EntitySysetm.Get

* unused depend

Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
FL-OZ
2020-05-31 12:40:36 -05:00
committed by GitHub
parent 8db5adb387
commit 53900b79e9
30 changed files with 137 additions and 97 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Projectiles;
using Content.Server.GameObjects.Components.Sound;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
@@ -12,6 +11,8 @@ using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using System.Collections.Generic;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Physics;
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
@@ -28,6 +29,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
#pragma warning disable 649
[Dependency] private IRobustRandom _spreadRandom;
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
#pragma warning restore 649
public override void ExposeData(ObjectSerializer serializer)
@@ -75,7 +77,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
}
}
private void PlayFireSound() => Owner.GetComponent<SoundComponent>().Play(_soundGunshot);
private void PlayFireSound() => EntitySystem.Get<AudioSystem>().Play(_soundGunshot, Owner);
/// <summary>
/// Gets the angle from an entity to a coordinate.