replacing sound (collection) names with SoundSpecifier - part 1
This commit is contained in:
@@ -11,12 +11,14 @@ using Content.Shared.AME;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Sound;
|
||||
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;
|
||||
|
||||
namespace Content.Server.AME.Components
|
||||
@@ -32,6 +34,8 @@ namespace Content.Server.AME.Components
|
||||
|
||||
private AppearanceComponent? _appearance;
|
||||
private PowerSupplierComponent? _powerSupplier;
|
||||
[DataField("clickSound")] private SoundSpecifier _clickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
|
||||
[DataField("injectSound")] private SoundSpecifier _injectSound = new SoundPathSpecifier("/Audio/Effects/bang.ogg");
|
||||
|
||||
private bool Powered => !Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
|
||||
@@ -312,12 +316,14 @@ namespace Content.Server.AME.Components
|
||||
|
||||
private void ClickSound()
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f));
|
||||
if(_clickSound.TryGetSound(out var clickSound))
|
||||
SoundSystem.Play(Filter.Pvs(Owner), clickSound, Owner, AudioParams.Default.WithVolume(-2f));
|
||||
}
|
||||
|
||||
private void InjectSound(bool overloading)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/bang.ogg", Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
|
||||
if(_injectSound.TryGetSound(out var injectSound))
|
||||
SoundSystem.Play(Filter.Pvs(Owner), injectSound, Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user