Round start audio announcement (#8047)
This commit is contained in:
@@ -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();
|
||||
|
||||
23
Content.Server/Announcements/RoundAnnouncementPrototype.cs
Normal file
23
Content.Server/Announcements/RoundAnnouncementPrototype.cs
Normal file
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Used for any announcements on the start of a round.
|
||||
/// </summary>
|
||||
[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<GamePresetPrototype>))]
|
||||
public List<string> GamePresets = new();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
Resources/Audio/Announcements/welcome.ogg
Normal file
BIN
Resources/Audio/Announcements/welcome.ogg
Normal file
Binary file not shown.
7
Resources/Prototypes/round_announcements.yml
Normal file
7
Resources/Prototypes/round_announcements.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- type: roundAnnouncement
|
||||
id: Welcome
|
||||
sound: /Audio/Announcements/welcome.ogg
|
||||
presets:
|
||||
- Extended
|
||||
- Sandbox
|
||||
- Traitor
|
||||
Reference in New Issue
Block a user