replacing sound (collection) names with SoundSpecifier - part 1
This commit is contained in:
@@ -8,6 +8,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -43,7 +44,7 @@ namespace Content.Server.Fluids.Components
|
||||
: ReagentUnit.Zero;
|
||||
|
||||
[DataField("sound")]
|
||||
private string? _sound = "/Audio/Effects/Fluids/watersplash.ogg";
|
||||
private SoundSpecifier _sound = new SoundPathSpecifier("/Audio/Effects/Fluids/watersplash.ogg");
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Initialize()
|
||||
@@ -114,9 +115,9 @@ namespace Content.Server.Fluids.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_sound != null)
|
||||
if (_sound.TryGetSound(out var sound))
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _sound, Owner);
|
||||
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -54,7 +55,7 @@ namespace Content.Server.Fluids.Components
|
||||
public ReagentUnit PickupAmount { get; } = ReagentUnit.New(5);
|
||||
|
||||
[DataField("pickup_sound")]
|
||||
private string? _pickupSound = "/Audio/Effects/Fluids/slosh.ogg";
|
||||
private SoundSpecifier _pickupSound = new SoundPathSpecifier("/Audio/Effects/Fluids/slosh.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// Multiplier for the do_after delay for how fast the mop works.
|
||||
@@ -163,9 +164,9 @@ namespace Content.Server.Fluids.Components
|
||||
contents.SplitSolution(transferAmount);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_pickupSound))
|
||||
if (_pickupSound.TryGetSound(out var pickupSound))
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _pickupSound, Owner);
|
||||
SoundSystem.Play(Filter.Pvs(Owner), pickupSound, Owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Slippery;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -71,7 +72,7 @@ namespace Content.Server.Fluids.Components
|
||||
public float EvaporateTime { get; private set; } = 5f;
|
||||
|
||||
[DataField("spill_sound")]
|
||||
private string _spillSound = "/Audio/Effects/Fluids/splat.ogg";
|
||||
private SoundSpecifier _spillSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this puddle is currently overflowing onto its neighbors
|
||||
@@ -189,7 +190,8 @@ namespace Content.Server.Fluids.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _spillSound, Owner.Transform.Coordinates);
|
||||
if(_spillSound.TryGetSound(out var spillSound))
|
||||
SoundSystem.Play(Filter.Pvs(Owner), spillSound, Owner.Transform.Coordinates);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user