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

@@ -14,6 +14,7 @@ using Content.Shared.Item;
using Content.Shared.Movement;
using Content.Shared.Notification.Managers;
using Content.Shared.Physics;
using Content.Shared.Sound;
using Content.Shared.Storage;
using Content.Shared.Tool;
using Content.Shared.Verbs;
@@ -76,10 +77,10 @@ namespace Content.Server.Storage.Components
private bool _isWeldedShut;
[DataField("closeSound")]
private string _closeSound = "/Audio/Machines/closetclose.ogg";
private SoundSpecifier _closeSound = new SoundPathSpecifier("/Audio/Machines/closetclose.ogg");
[DataField("openSound")]
private string _openSound = "/Audio/Machines/closetopen.ogg";
private SoundSpecifier _openSound = new SoundPathSpecifier("/Audio/Machines/closetopen.ogg");
[ViewVariables]
protected Container Contents = default!;
@@ -219,7 +220,8 @@ namespace Content.Server.Storage.Components
}
ModifyComponents();
SoundSystem.Play(Filter.Pvs(Owner), _closeSound, Owner);
if(_closeSound.TryGetSound(out var closeSound))
SoundSystem.Play(Filter.Pvs(Owner), closeSound, Owner);
_lastInternalOpenAttempt = default;
}
@@ -228,7 +230,8 @@ namespace Content.Server.Storage.Components
Open = true;
EmptyContents();
ModifyComponents();
SoundSystem.Play(Filter.Pvs(Owner), _openSound, Owner);
if(_openSound.TryGetSound(out var openSound))
SoundSystem.Play(Filter.Pvs(Owner), openSound, Owner);
}
private void UpdateAppearance()