Round start audio announcement (#8047)

This commit is contained in:
metalgearsloth
2022-05-10 10:44:38 +10:00
committed by GitHub
parent ea498da45d
commit 681e59bb76
6 changed files with 55 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Announcements;
using Content.Server.GameTicking.Events;
using Content.Server.Ghost;
using Content.Server.Maps;
@@ -10,11 +11,13 @@ using Content.Shared.CCVar;
using Content.Shared.Coordinates;
using Content.Shared.GameTicking;
using Content.Shared.Preferences;
using Content.Shared.Sound;
using Content.Shared.Station;
using JetBrains.Annotations;
using Prometheus;
using Robust.Server.Maps;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Player;
@@ -214,6 +217,7 @@ namespace Content.Server.GameTicking
ReqWindowAttentionAll();
UpdateLateJoinStatus();
UpdateJobsAvailable();
AnnounceRound();
#if EXCEPTION_TOLERANCE
}
@@ -466,6 +470,25 @@ namespace Content.Server.GameTicking
{
return _gameTiming.RealTime.Subtract(_roundStartTimeSpan);
}
private void AnnounceRound()
{
if (_preset == null) return;
foreach (var proto in _prototypeManager.EnumeratePrototypes<RoundAnnouncementPrototype>())
{
if (!proto.GamePresets.Contains(_preset.ID)) continue;
if (proto.Message != null)
_chatManager.DispatchStationAnnouncement(Loc.GetString(proto.Message), playDefaultSound: false);
if (proto.Sound != null)
SoundSystem.Play(Filter.Broadcast(), proto.Sound.GetSound());
// Only play one because A
break;
}
}
}
public enum GameRunLevel