From b408fe1467d01e173858b11eef96c33437be24cd Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Mon, 9 Oct 2023 16:07:57 -0700 Subject: [PATCH] fix nullablility error, validate yml prototype, default in component --- .../Salvage/Expeditions/SalvageExpeditionComponent.cs | 5 +++-- Content.Server/Salvage/SalvageSystem.Runner.cs | 9 ++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs index 2fd399125e..f3d4fab6fb 100644 --- a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs +++ b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs @@ -4,6 +4,7 @@ using Robust.Shared.Audio; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; namespace Content.Server.Salvage.Expeditions; @@ -44,8 +45,8 @@ public sealed class SalvageExpeditionComponent : SharedSalvageExpeditionComponen /// /// Sound that plays when the mission end is imminent. /// - [ViewVariables(VVAccess.ReadWrite), DataField("sound")] - public SoundCollectionPrototype? Sound; // Parkstation-ExpeditionMusic + [ViewVariables(VVAccess.ReadWrite), DataField("sound", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string Sound = "ExpeditionCountdownDefault"; // Parkstation-ExpeditionMusic /// /// The difficulty this mission had or, in the future, was selected. diff --git a/Content.Server/Salvage/SalvageSystem.Runner.cs b/Content.Server/Salvage/SalvageSystem.Runner.cs index b3c8f09f59..d5a35ae567 100644 --- a/Content.Server/Salvage/SalvageSystem.Runner.cs +++ b/Content.Server/Salvage/SalvageSystem.Runner.cs @@ -167,14 +167,9 @@ private void UpdateRunner() { // TODO: Some way to play audio attached to a map for players. // Parkstation-ExpeditionMusic Start - // comp.Stream = _audio.PlayGlobal(comp.Sound, Filter.BroadcastMap(Comp(uid).MapId), true); - var sound = comp.Sound; - if (sound == null && _prototypeManager.TryIndex("ExpeditionCountdownDefault", out var collection)) - { - sound = collection; - comp.Stream = _audio.PlayGlobal(new SoundPathSpecifier(_random.Pick(sound!.PickFiles), AudioParams.Default.WithVolume(-6)), + if (_prototypeManager.TryIndex(comp.Sound, out var sound)) + comp.Stream = _audio.PlayGlobal(new SoundPathSpecifier(_random.Pick(sound.PickFiles), AudioParams.Default.WithVolume(-6)), Filter.BroadcastMap(Comp(uid).MapId), true); - } // Parkstation-ExpeditionMusic End comp.Stage = ExpeditionStage.MusicCountdown; Dirty(comp);