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

@@ -1,8 +1,8 @@
using Content.Server.Access.Components;
using Content.Shared.ActionBlocker;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Notification.Managers;
using Content.Shared.Sound;
using Content.Shared.Storage;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
@@ -25,6 +25,9 @@ namespace Content.Server.Storage.Components
[DataField("locked")]
private bool _locked = true;
[DataField("unlockSound")] private SoundSpecifier _unlockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
[DataField("lockSound")] private SoundSpecifier _lockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_on.ogg");
[ViewVariables(VVAccess.ReadWrite)]
public bool Locked
{
@@ -100,7 +103,8 @@ namespace Content.Server.Storage.Components
if (!CheckAccess(user)) return;
Locked = false;
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/door_lock_off.ogg", Owner, AudioParams.Default.WithVolume(-5));
if(_unlockSound.TryGetSound(out var unlockSound))
SoundSystem.Play(Filter.Pvs(Owner), unlockSound, Owner, AudioParams.Default.WithVolume(-5));
}
private void DoLock(IEntity user)
@@ -108,7 +112,8 @@ namespace Content.Server.Storage.Components
if (!CheckAccess(user)) return;
Locked = true;
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Machines/door_lock_on.ogg", Owner, AudioParams.Default.WithVolume(-5));
if(_lockSound.TryGetSound(out var lockSound))
SoundSystem.Play(Filter.Pvs(Owner), lockSound, Owner, AudioParams.Default.WithVolume(-5));
}
private bool CheckAccess(IEntity user)