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

@@ -5,6 +5,7 @@ using Content.Server.Items;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -27,7 +28,7 @@ namespace Content.Server.Nutrition.Components
private string _slice = string.Empty;
[DataField("sound")] [ViewVariables(VVAccess.ReadWrite)]
private string _sound = "/Audio/Items/Culinary/chop.ogg";
private SoundSpecifier _sound = new SoundPathSpecifier("/Audio/Items/Culinary/chop.ogg");
[DataField("count")] [ViewVariables(VVAccess.ReadWrite)]
private ushort _totalCount = 5;
@@ -66,8 +67,9 @@ namespace Content.Server.Nutrition.Components
}
}
SoundSystem.Play(Filter.Pvs(Owner), _sound, Owner.Transform.Coordinates,
AudioParams.Default.WithVolume(-2));
if(_sound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates,
AudioParams.Default.WithVolume(-2));
Count--;
if (Count < 1)