replacing sound (collection) names with SoundSpecifier - part 1
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Shared.Audio;
|
||||
using Content.Shared.EffectBlocker;
|
||||
using Content.Shared.Module;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Stunnable;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -36,7 +37,7 @@ namespace Content.Shared.Slippery
|
||||
private float _requiredSlipSpeed = 0.1f;
|
||||
private float _launchForwardsMultiplier = 1f;
|
||||
private bool _slippery = true;
|
||||
private string _slipSound = "/Audio/Effects/slip.ogg";
|
||||
private SoundSpecifier _slipSound = new SoundPathSpecifier("/Audio/Effects/slip.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// List of entities that are currently colliding with the entity.
|
||||
@@ -53,7 +54,7 @@ namespace Content.Shared.Slippery
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("slipSound")]
|
||||
public string SlipSound
|
||||
public SoundSpecifier SlipSound
|
||||
{
|
||||
get => _slipSound;
|
||||
set
|
||||
@@ -184,9 +185,9 @@ namespace Content.Shared.Slippery
|
||||
_slipped.Add(otherBody.Owner.Uid);
|
||||
Dirty();
|
||||
|
||||
if (!string.IsNullOrEmpty(SlipSound) && _moduleManager.IsServerModule)
|
||||
if (SlipSound.TryGetSound(out var slipSound) && _moduleManager.IsServerModule)
|
||||
{
|
||||
SoundSystem.Play(Filter.Broadcast(), SlipSound, Owner, AudioHelpers.WithVariation(0.2f));
|
||||
SoundSystem.Play(Filter.Broadcast(), slipSound, Owner, AudioHelpers.WithVariation(0.2f));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -232,7 +233,7 @@ namespace Content.Shared.Slippery
|
||||
|
||||
public override ComponentState GetComponentState(ICommonSession player)
|
||||
{
|
||||
return new SlipperyComponentState(ParalyzeTime, IntersectPercentage, RequiredSlipSpeed, LaunchForwardsMultiplier, Slippery, SlipSound, _slipped.ToArray());
|
||||
return new SlipperyComponentState(ParalyzeTime, IntersectPercentage, RequiredSlipSpeed, LaunchForwardsMultiplier, Slippery, SlipSound.GetSound(), _slipped.ToArray());
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
@@ -244,7 +245,7 @@ namespace Content.Shared.Slippery
|
||||
_paralyzeTime = state.ParalyzeTime;
|
||||
_requiredSlipSpeed = state.RequiredSlipSpeed;
|
||||
_launchForwardsMultiplier = state.LaunchForwardsMultiplier;
|
||||
_slipSound = state.SlipSound;
|
||||
_slipSound = new SoundPathSpecifier(state.SlipSound);
|
||||
_slipped.Clear();
|
||||
|
||||
foreach (var slipped in state.Slipped)
|
||||
|
||||
Reference in New Issue
Block a user