Add salvage song (#15580)

This commit is contained in:
metalgearsloth
2023-04-21 15:06:35 +10:00
committed by GitHub
parent 3d1333b9ab
commit 8c0d7cfa9f
6 changed files with 18 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Salvage;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Salvage.Expeditions;
@@ -33,6 +34,11 @@ public sealed class SalvageExpeditionComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField("stage")]
public ExpeditionStage Stage = ExpeditionStage.Added;
/// <summary>
/// Countdown audio stream.
/// </summary>
public IPlayingAudioStream? Stream = null;
}
public enum ExpeditionStage : byte

View File

@@ -84,6 +84,8 @@ public sealed partial class SalvageSystem
private void OnExpeditionShutdown(EntityUid uid, SalvageExpeditionComponent component, ComponentShutdown args)
{
component.Stream?.Stop();
foreach (var (job, cancelToken) in _salvageJobs.ToArray())
{
if (job.Station == component.Station)

View File

@@ -6,6 +6,7 @@ using Content.Server.Shuttles.Systems;
using Content.Server.Station.Components;
using Content.Shared.Chat;
using Content.Shared.Salvage;
using Robust.Shared.Audio;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Utility;
@@ -125,9 +126,11 @@ public sealed partial class SalvageSystem
comp.Stage = ExpeditionStage.FinalCountdown;
Announce(uid, Loc.GetString("salvage-expedition-announcement-countdown-seconds", ("duration", TimeSpan.FromSeconds(30).Seconds)));
}
// TODO: Play song.
else if (comp.Stage < ExpeditionStage.Countdown && remaining < TimeSpan.FromMinutes(2))
{
// TODO: Some way to play audio attached to a map for players.
comp.Stream = _audio.PlayGlobal(new SoundPathSpecifier("/Audio/Misc/salvage.ogg"),
Filter.BroadcastMap(Comp<MapComponent>(uid).MapId), true, AudioParams.Default.WithVolume(-7));
comp.Stage = ExpeditionStage.Countdown;
Announce(uid, Loc.GetString("salvage-expedition-announcement-countdown-minutes", ("duration", TimeSpan.FromMinutes(2).Minutes)));
}

View File

@@ -41,6 +41,7 @@ namespace Content.Server.Salvage
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly RadioSystem _radioSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly ShuttleConsoleSystem _shuttleConsoles = default!;

View File

@@ -2,3 +2,8 @@
license: "CC-BY-NC-SA-3.0"
copyright: "Taken from TG station."
source: "https://github.com/tgstation/tgstation/commit/97945e7d08d1457ffc27e46526a48c0453cc95e4"
- files: ["salvage.ogg"]
license: "CC-BY-3.0"
copyright: "Created by qwertyquerty / discord coconatsu#4342"
source: "https://www.example.com/wagoogus" # It was sent via DM what do you want

Binary file not shown.