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,6 +1,7 @@
using Content.Server.Flash.Components;
using Content.Server.Storage.Components;
using Content.Shared.Acts;
using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -22,7 +23,7 @@ namespace Content.Server.Explosion.Components
[DataField("duration")]
private float _duration = 8.0f;
[DataField("sound")]
private string _sound = "/Audio/Effects/flash_bang.ogg";
private SoundSpecifier _sound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg");
[DataField("deleteOnFlash")]
private bool _deleteOnFlash = true;
@@ -35,9 +36,9 @@ namespace Content.Server.Explosion.Components
FlashableComponent.FlashAreaHelper(Owner, _range, _duration);
}
if (_sound != null)
if (_sound.TryGetSound(out var sound))
{
SoundSystem.Play(Filter.Pvs(Owner), _sound, Owner.Transform.Coordinates);
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates);
}
if (_deleteOnFlash && !Owner.Deleted)