Nuke ops war anounce sound (#9035)

This commit is contained in:
Morber
2022-07-15 12:16:41 +03:00
committed by GitHub
parent f60b5f545c
commit efb17f1e98
13 changed files with 29 additions and 17 deletions

View File

@@ -16,6 +16,7 @@ using Content.Shared.Chat;
using Content.Shared.Database;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory;
using Content.Shared.Sound;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;
@@ -51,7 +52,7 @@ public sealed partial class ChatSystem : SharedChatSystem
private const int VoiceRange = 7; // how far voice goes in world units
private const int WhisperRange = 2; // how far whisper goes in world units
private const string AnnouncementSound = "/Audio/Announcements/announce.ogg";
private const string DefaultAnnouncementSound = "/Audio/Announcements/announce.ogg";
private bool _loocEnabled = true;
private readonly bool _adminLoocEnabled = true;
@@ -170,16 +171,16 @@ public sealed partial class ChatSystem : SharedChatSystem
/// </summary>
/// <param name="message">The contents of the message</param>
/// <param name="sender">The sender (Communications Console in Communications Console Announcement)</param>
/// <param name="playDefaultSound">Play the announcement sound</param>
/// <param name="playSound">Play the announcement sound</param>
/// <param name="colorOverride">Optional color for the announcement message</param>
public void DispatchGlobalAnnouncement(string message, string sender = "Central Command",
bool playDefaultSound = true, Color? colorOverride = null)
bool playSound = true, SoundSpecifier? announcementSound = null, Color? colorOverride = null)
{
var messageWrap = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender));
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, messageWrap, colorOverride);
if (playDefaultSound)
if (playSound)
{
SoundSystem.Play(AnnouncementSound, Filter.Broadcast(), AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(announcementSound?.GetSound() ?? DefaultAnnouncementSound, Filter.Broadcast(), AudioParams.Default.WithVolume(-2f));
}
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Global station announcement from {sender}: {message}");
}
@@ -192,7 +193,8 @@ public sealed partial class ChatSystem : SharedChatSystem
/// <param name="sender">The sender (Communications Console in Communications Console Announcement)</param>
/// <param name="playDefaultSound">Play the announcement sound</param>
/// <param name="colorOverride">Optional color for the announcement message</param>
public void DispatchStationAnnouncement(EntityUid source, string message, string sender = "Central Command", bool playDefaultSound = true, Color? colorOverride = null)
public void DispatchStationAnnouncement(EntityUid source, string message, string sender = "Central Command",
bool playDefaultSound = true, SoundSpecifier? announcementSound = null, Color? colorOverride = null)
{
var messageWrap = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender));
var station = _stationSystem.GetOwningStation(source);
@@ -211,7 +213,7 @@ public sealed partial class ChatSystem : SharedChatSystem
if (playDefaultSound)
{
SoundSystem.Play(AnnouncementSound, filter, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(announcementSound?.GetSound() ?? DefaultAnnouncementSound, filter, AudioParams.Default.WithVolume(-2f));
}
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement on {station} from {sender}: {message}");

View File

@@ -1,5 +1,6 @@
using Content.Server.UserInterface;
using Content.Shared.Communications;
using Content.Shared.Sound;
using Robust.Server.GameObjects;
namespace Content.Server.Communications
@@ -50,6 +51,12 @@ namespace Content.Server.Communications
[DataField("global")]
public bool AnnounceGlobal = false;
/// <summary>
/// Announce sound file path
/// </summary>
[DataField("sound")]
public SoundSpecifier AnnouncementSound = new SoundPathSpecifier("/Audio/Announcements/announce.ogg");
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CommunicationsConsoleUiKey.Key);
}
}

View File

@@ -250,7 +250,7 @@ namespace Content.Server.Communications
msg += "\n" + Loc.GetString("comms-console-announcement-sent-by") + " " + author;
if (comp.AnnounceGlobal)
{
_chatSystem.DispatchGlobalAnnouncement(msg, title, colorOverride: comp.AnnouncementColor);
_chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.AnnouncementSound, colorOverride: comp.AnnouncementColor);
return;
}
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);

View File

@@ -484,7 +484,7 @@ namespace Content.Server.GameTicking
if (!proto.GamePresets.Contains(Preset.ID)) continue;
if (proto.Message != null)
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playDefaultSound: true);
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);
if (proto.Sound != null)
SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());

View File

@@ -432,7 +432,7 @@ namespace Content.Server.Nuke
var announcement = Loc.GetString("nuke-component-announcement-armed",
("time", (int) component.RemainingTime), ("position", posText));
var sender = Loc.GetString("nuke-component-announcement-sender");
_chatSystem.DispatchStationAnnouncement(uid, announcement, sender, false, Color.Red);
_chatSystem.DispatchStationAnnouncement(uid, announcement, sender, false, null, Color.Red);
NukeArmedAudio(component);

View File

@@ -133,6 +133,7 @@ namespace Content.Server.RoundEnd
("units", Loc.GetString(units))),
Loc.GetString("Station"),
false,
null,
Color.Gold);
SoundSystem.Play("/Audio/Announcements/shuttlecalled.ogg", Filter.Broadcast());

View File

@@ -222,7 +222,7 @@ public sealed partial class ShuttleSystem
if (remaining > 0)
_chatSystem.DispatchGlobalAnnouncement(
Loc.GetString("emergency-shuttle-console-auth-left", ("remaining", remaining)),
playDefaultSound: false, colorOverride: DangerColor);
playSound: false, colorOverride: DangerColor);
if (!CheckForLaunch(component))
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());
@@ -297,7 +297,7 @@ public sealed partial class ShuttleSystem
_announced = true;
_chatSystem.DispatchGlobalAnnouncement(
Loc.GetString("emergency-shuttle-launch-time", ("consoleAccumulator", $"{_consoleAccumulator:0}")),
playDefaultSound: false,
playSound: false,
colorOverride: DangerColor);
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());

View File

@@ -18,7 +18,7 @@ public sealed class BreakerFlip : StationEventSystem
base.Added();
var str = Loc.GetString("station-event-breaker-flip-announcement", ("data", Loc.GetString(Loc.GetString($"random-sentience-event-data-{RobustRandom.Next(1, 6)}"))));
ChatSystem.DispatchGlobalAnnouncement(str, playDefaultSound: false, colorOverride: Color.Gold);
ChatSystem.DispatchGlobalAnnouncement(str, playSound: false, colorOverride: Color.Gold);
}
public override void Started()

View File

@@ -21,7 +21,7 @@ namespace Content.Server.StationEvents.Events
if (cfg.StartAnnouncement != null)
{
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(cfg.StartAnnouncement), playDefaultSound: false, colorOverride: Color.Gold);
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(cfg.StartAnnouncement), playSound: false, colorOverride: Color.Gold);
}
if (cfg.StartAudio != null)

View File

@@ -62,7 +62,7 @@ namespace Content.Server.StationEvents.Events
if (ev.StartAnnouncement != null)
{
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(ev.StartAnnouncement), playDefaultSound: false, colorOverride: Color.Gold);
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(ev.StartAnnouncement), playSound: false, colorOverride: Color.Gold);
}
if (ev.StartAudio != null)
@@ -85,7 +85,7 @@ namespace Content.Server.StationEvents.Events
if (ev.EndAnnouncement != null)
{
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(ev.EndAnnouncement), playDefaultSound: false, colorOverride: Color.Gold);
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(ev.EndAnnouncement), playSound: false, colorOverride: Color.Gold);
}
if (ev.EndAudio != null)

View File

@@ -6,3 +6,4 @@ welcome.ogg taken from /tg/station at commit https://github.com/tgstation/tgstat
announce.ogg taken from /tg/station https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a cut from the beginning of "shuttlerecalled.ogg" used under CC-BY-SA-3.0
shuttle_dock.ogg taken from /tg/station at https://github.com/tgstation/tgstation/blob/b327cb667c1ca5d1aa14e6368e66cbfa7b343b9c/sound/ai/default/shuttledock.ogg used under CC-BY-SA-3.0
war.ogg taken from Paradise at https://github.com/ParadiseSS13/Paradise/blob/07b26ee6b4a11a0607986d322ee007020569feae/sound/effects/siren.ogg used under CC-BY-SA-3.0, volume increased

Binary file not shown.

View File

@@ -371,6 +371,7 @@
color: "#ff0000"
canShuttle: false
global: true #announce to everyone they're about to fuck shit up
sound: /Audio/Announcements/war.ogg
- type: Computer
board: SyndicateCommsComputerCircuitboard
- type: PointLight