replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -4,8 +4,8 @@ using System.Threading.Tasks;
using Content.Server.Hands.Components;
using Content.Server.Tools.Components;
using Content.Shared.Interaction;
using Content.Shared.Notification;
using Content.Shared.Notification.Managers;
using Content.Shared.Sound;
using Content.Shared.Tool;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -14,6 +14,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.AME.Components
{
@@ -25,7 +26,7 @@ namespace Content.Server.AME.Components
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
public override string Name => "AMEPart";
private string _unwrap = "/Audio/Effects/unwrap.ogg";
[DataField("unwrapSound")] private SoundSpecifier _unwrapSound = new SoundPathSpecifier("/Audio/Effects/unwrap.ogg");
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
{
@@ -51,7 +52,8 @@ namespace Content.Server.AME.Components
var ent = _serverEntityManager.SpawnEntity("AMEShielding", mapGrid.GridTileToLocal(snapPos));
ent.Transform.LocalRotation = Owner.Transform.LocalRotation;
SoundSystem.Play(Filter.Pvs(Owner), _unwrap, Owner);
if(_unwrapSound.TryGetSound(out var unwrapSound))
SoundSystem.Play(Filter.Pvs(Owner), unwrapSound, Owner);
Owner.Delete();