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)
|
||||
|
||||
Reference in New Issue
Block a user