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}");