diff --git a/Content.Client/Entry/EntryPoint.cs b/Content.Client/Entry/EntryPoint.cs index 00d93fa4c7..810367c19e 100644 --- a/Content.Client/Entry/EntryPoint.cs +++ b/Content.Client/Entry/EntryPoint.cs @@ -104,6 +104,7 @@ namespace Content.Client.Entry prototypes.RegisterIgnore("worldSpell"); prototypes.RegisterIgnore("entitySpell"); prototypes.RegisterIgnore("instantSpell"); + prototypes.RegisterIgnore("roundAnnouncement"); prototypes.RegisterIgnore("wireLayout"); ClientContentIoC.Register(); diff --git a/Content.Server/Announcements/RoundAnnouncementPrototype.cs b/Content.Server/Announcements/RoundAnnouncementPrototype.cs new file mode 100644 index 0000000000..cc7ab3100c --- /dev/null +++ b/Content.Server/Announcements/RoundAnnouncementPrototype.cs @@ -0,0 +1,23 @@ +using Content.Server.GameTicking.Presets; +using Content.Shared.Sound; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; + +namespace Content.Server.Announcements; + +/// +/// Used for any announcements on the start of a round. +/// +[Prototype("roundAnnouncement")] +public sealed class RoundAnnouncementPrototype : IPrototype +{ + [IdDataFieldAttribute] + public string ID { get; } = default!; + + [DataField("sound")] public SoundSpecifier? Sound; + + [DataField("message")] public string? Message; + + [DataField("presets", customTypeSerializer: typeof(PrototypeIdListSerializer))] + public List GamePresets = new(); +} diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 07f820cf2e..60ac9a094e 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -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()) + { + 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 diff --git a/Resources/Audio/Announcements/license.txt b/Resources/Audio/Announcements/license.txt index 08e00462d3..337c3e569e 100644 --- a/Resources/Audio/Announcements/license.txt +++ b/Resources/Audio/Announcements/license.txt @@ -2,4 +2,4 @@ aliens.ogg taken from https://github.com/tgstation/tgstation/blob/95731342b97167 attention.ogg taken from /tg/station at commit https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0 meteors.ogg taken from https://github.com/tgstation/tgstation/blob/95731342b97167d7883ff091d389f79c36442ee6/sound/ai/default/meteors.ogg used under CC-BY-SA-3.0 outbreak7.ogg taken from /tg/station at commit https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0 - +welcome.ogg taken from /tg/station at commit https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0 diff --git a/Resources/Audio/Announcements/welcome.ogg b/Resources/Audio/Announcements/welcome.ogg new file mode 100644 index 0000000000..c7013dcbd5 Binary files /dev/null and b/Resources/Audio/Announcements/welcome.ogg differ diff --git a/Resources/Prototypes/round_announcements.yml b/Resources/Prototypes/round_announcements.yml new file mode 100644 index 0000000000..15c342cd23 --- /dev/null +++ b/Resources/Prototypes/round_announcements.yml @@ -0,0 +1,7 @@ +- type: roundAnnouncement + id: Welcome + sound: /Audio/Announcements/welcome.ogg + presets: + - Extended + - Sandbox + - Traitor