Skip to content

Commit

Permalink
fix nullablility error, validate yml prototype, default in component
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT committed Oct 9, 2023
1 parent 076a24b commit b408fe1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,8 +45,8 @@ public sealed class SalvageExpeditionComponent : SharedSalvageExpeditionComponen
/// <summary>
/// Sound that plays when the mission end is imminent.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("sound")]
public SoundCollectionPrototype? Sound; // Parkstation-ExpeditionMusic
[ViewVariables(VVAccess.ReadWrite), DataField("sound", customTypeSerializer: typeof(PrototypeIdSerializer<SoundCollectionPrototype>))]
public string Sound = "ExpeditionCountdownDefault"; // Parkstation-ExpeditionMusic

/// <summary>
/// The difficulty this mission had or, in the future, was selected.
Expand Down
9 changes: 2 additions & 7 deletions Content.Server/Salvage/SalvageSystem.Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MapComponent>(uid).MapId), true);
var sound = comp.Sound;
if (sound == null && _prototypeManager.TryIndex<SoundCollectionPrototype>("ExpeditionCountdownDefault", out var collection))
{
sound = collection;
comp.Stream = _audio.PlayGlobal(new SoundPathSpecifier(_random.Pick(sound!.PickFiles), AudioParams.Default.WithVolume(-6)),
if (_prototypeManager.TryIndex<SoundCollectionPrototype>(comp.Sound, out var sound))
comp.Stream = _audio.PlayGlobal(new SoundPathSpecifier(_random.Pick(sound.PickFiles), AudioParams.Default.WithVolume(-6)),
Filter.BroadcastMap(Comp<MapComponent>(uid).MapId), true);
}
// Parkstation-ExpeditionMusic End
comp.Stage = ExpeditionStage.MusicCountdown;
Dirty(comp);
Expand Down

0 comments on commit b408fe1

Please sign in to comment.