Event Music & Nuke Countdown Song (#8597)

Co-authored-by: ike709 <ike709@github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
ike709
2022-07-04 01:29:38 -05:00
committed by GitHub
parent eb15c11b86
commit 0b86e0e953
14 changed files with 283 additions and 85 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.AlertLevel;
using Content.Server.Audio;
using Content.Server.Chat;
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
@@ -15,6 +16,7 @@ using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server.Nuke
{
@@ -26,6 +28,7 @@ namespace Content.Server.Nuke
[Dependency] private readonly ExplosionSystem _explosions = default!;
[Dependency] private readonly AlertLevelSystem _alertLevel = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly ServerGlobalSoundSystem _soundSystem = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
public override void Initialize()
@@ -218,6 +221,7 @@ namespace Content.Server.Nuke
if (nuke.RemainingTime <= nuke.AlertSoundTime && !nuke.PlayedAlertSound)
{
nuke.AlertAudioStream = SoundSystem.Play(nuke.AlertSound.GetSound(), Filter.Broadcast());
_soundSystem.StopStationEventMusic(uid, StationEventMusicType.Nuke);
nuke.PlayedAlertSound = true;
}
@@ -335,7 +339,7 @@ namespace Content.Server.Nuke
// Otherwise, you could set every station to whatever AlertLevelOnActivate is.
if (stationUid != null)
{
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true, true);
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, false, true, true, true);
}
// warn a crew
@@ -344,8 +348,7 @@ namespace Content.Server.Nuke
var sender = Loc.GetString("nuke-component-announcement-sender");
_chatSystem.DispatchStationAnnouncement(uid, announcement, sender, false, Color.Red);
// todo: move it to announcements system
SoundSystem.Play(component.ArmSound.GetSound(), Filter.Broadcast());
NukeArmedAudio(component);
component.Status = NukeStatus.ARMED;
UpdateUserInterface(uid, component);
@@ -373,8 +376,7 @@ namespace Content.Server.Nuke
var sender = Loc.GetString("nuke-component-announcement-sender");
_chatSystem.DispatchStationAnnouncement(uid, announcement, sender, false);
// todo: move it to announcements system
SoundSystem.Play(component.DisarmSound.GetSound(), Filter.Broadcast());
NukeDisarmedAudio(component);
// disable sound and reset it
component.PlayedAlertSound = false;
@@ -423,6 +425,7 @@ namespace Content.Server.Nuke
RaiseLocalEvent(new NukeExplodedEvent());
_soundSystem.StopStationEventMusic(component.Owner, StationEventMusicType.Nuke);
EntityManager.DeleteEntity(uid);
}
@@ -438,6 +441,18 @@ namespace Content.Server.Nuke
UpdateUserInterface(uid, component);
}
#endregion
private void NukeArmedAudio(NukeComponent component)
{
_soundSystem.PlayGlobalOnStation(component.Owner, component.ArmSound.GetSound());
_soundSystem.DispatchStationEventMusic(component.Owner, component.ArmMusic, StationEventMusicType.Nuke);
}
private void NukeDisarmedAudio(NukeComponent component)
{
_soundSystem.PlayGlobalOnStation(component.Owner, component.DisarmSound.GetSound());
_soundSystem.StopStationEventMusic(component.Owner, StationEventMusicType.Nuke);
}
}
public sealed class NukeExplodedEvent : EntityEventArgs {}