Adds linting support to SoundCollectionPrototype, fix linter errors.

Closes #4580
This commit is contained in:
Vera Aguilera Puerto
2021-10-01 12:40:44 +02:00
parent ac9f0b39b0
commit 47107c6a42
13 changed files with 17 additions and 16 deletions

View File

@@ -126,7 +126,7 @@ namespace Content.Client.Audio
private void StartAmbience() private void StartAmbience()
{ {
EndAmbience(); EndAmbience();
var file = _robustRandom.Pick(_ambientCollection.PickFiles); var file = _robustRandom.Pick(_ambientCollection.PickFiles).ToString();
_ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams); _ambientStream = SoundSystem.Play(Filter.Local(), file, _ambientParams);
} }

View File

@@ -64,7 +64,7 @@ namespace Content.Server.GameTicking
public void ChooseRandomLobbySong() public void ChooseRandomLobbySong()
{ {
DebugTools.Assert(_lobbyMusicInitialized); DebugTools.Assert(_lobbyMusicInitialized);
SetLobbySong(_robustRandom.Pick(_lobbyMusicCollection.PickFiles)); SetLobbySong(_robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString());
} }
/// <summary> /// <summary>

View File

@@ -246,7 +246,7 @@ namespace Content.Server.GameTicking
RoundNumberMetric.Inc(); RoundNumberMetric.Inc();
RunLevel = GameRunLevel.PreRoundLobby; RunLevel = GameRunLevel.PreRoundLobby;
LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles); LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString();
ResettingCleanup(); ResettingCleanup();
PreRoundSetup(); PreRoundSetup();

View File

@@ -55,7 +55,7 @@ namespace Content.Shared.Audio
public static string GetRandomFileFromSoundCollection(string name) public static string GetRandomFileFromSoundCollection(string name)
{ {
var soundCollection = IoCManager.Resolve<IPrototypeManager>().Index<SoundCollectionPrototype>(name); var soundCollection = IoCManager.Resolve<IPrototypeManager>().Index<SoundCollectionPrototype>(name);
return IoCManager.Resolve<IRobustRandom>().Pick(soundCollection.PickFiles); return IoCManager.Resolve<IRobustRandom>().Pick(soundCollection.PickFiles).ToString();
} }
} }
} }

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
namespace Content.Shared.Audio namespace Content.Shared.Audio
@@ -12,6 +13,7 @@ namespace Content.Shared.Audio
[DataField("id", required: true)] [DataField("id", required: true)]
public string ID { get; } = default!; public string ID { get; } = default!;
[DataField("files")] public List<string> PickFiles { get; } = new(); [DataField("files")]
public List<ResourcePath> PickFiles { get; } = new();
} }
} }

View File

@@ -55,11 +55,10 @@
- type: soundCollection - type: soundCollection
id: footstep_tile id: footstep_tile
files: files:
- /Audio/Effects/Footsteps/tile1.ogg - /Audio/Effects/Footsteps/tile1.wav
- /Audio/Effects/Footsteps/tile2.ogg - /Audio/Effects/Footsteps/tile2.wav
- /Audio/Effects/Footsteps/tile3.ogg - /Audio/Effects/Footsteps/tile3.wav
- /Audio/Effects/Footsteps/tile4.ogg - /Audio/Effects/Footsteps/tile4.wav
- /Audio/Effects/Footsteps/tile5.ogg
- type: soundCollection - type: soundCollection
id: footstep_clown id: footstep_clown

View File

@@ -20,9 +20,9 @@
- type: soundCollection - type: soundCollection
id: ScientistScreams id: ScientistScreams
files: files:
- /Audio/Voice/Human/science_scream_1.ogg - /Audio/Voice/Human/science_scream1.ogg
- /Audio/Voice/Human/science_scream_2.ogg - /Audio/Voice/Human/science_scream2.ogg
- /Audio/Voice/Human/science_scream_3.ogg - /Audio/Voice/Human/science_scream3.ogg
- /Audio/Voice/Human/science_scream_4.ogg - /Audio/Voice/Human/science_scream4.ogg
- /Audio/Voice/Human/science_scream_5.ogg - /Audio/Voice/Human/science_scream5.ogg
- /Audio/Voice/Human/science_scream_6.ogg - /Audio/Voice/Human/science_scream6.ogg