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

@@ -10,6 +10,7 @@ using Content.Shared.Fluids;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Notification.Managers;
using Content.Shared.Sound;
using Content.Shared.Vapor;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -35,8 +36,6 @@ namespace Content.Server.Fluids.Components
[DataField("transferAmount")]
private ReagentUnit _transferAmount = ReagentUnit.New(10);
[DataField("spraySound")]
private string? _spraySound;
[DataField("sprayVelocity")]
private float _sprayVelocity = 1.5f;
[DataField("sprayAliveTime")]
@@ -78,7 +77,8 @@ namespace Content.Server.Fluids.Components
set => _sprayVelocity = value;
}
public string? SpraySound => _spraySound;
[DataField("spraySound")]
public SoundSpecifier SpraySound { get; } = default!;
public ReagentUnit CurrentVolume => Owner.GetComponentOrNull<SolutionContainerComponent>()?.CurrentVolume ?? ReagentUnit.Zero;
@@ -172,9 +172,9 @@ namespace Content.Server.Fluids.Components
}
//Play sound
if (!string.IsNullOrEmpty(_spraySound))
if (SpraySound.TryGetSound(out var spraySound))
{
SoundSystem.Play(Filter.Pvs(Owner), _spraySound, Owner, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(Owner), spraySound, Owner, AudioHelpers.WithVariation(0.125f));
}
_lastUseTime = curTime;