Announcements play the general announcement sound unless specifically inhibited (#5460)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Server.Chat.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Announcements
|
||||
{
|
||||
@@ -26,14 +27,12 @@ namespace Content.Server.Announcements
|
||||
if (args.Length == 1)
|
||||
{
|
||||
chat.DispatchStationAnnouncement(args[0]);
|
||||
shell.WriteLine("Sent!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 2) return;
|
||||
|
||||
else
|
||||
{
|
||||
var message = string.Join(' ', new ArraySegment<string>(args, 1, args.Length-1));
|
||||
chat.DispatchStationAnnouncement(message, args[0]);
|
||||
}
|
||||
shell.WriteLine("Sent!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,14 @@ using Content.Shared.Inventory;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using static Content.Server.Chat.Managers.IChatManager;
|
||||
|
||||
@@ -90,13 +92,17 @@ namespace Content.Server.Chat.Managers
|
||||
Logger.InfoS("SERVER", message);
|
||||
}
|
||||
|
||||
public void DispatchStationAnnouncement(string message, string sender = "CentComm")
|
||||
public void DispatchStationAnnouncement(string message, string sender = "CentComm", bool playDefaultSound = true)
|
||||
{
|
||||
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
||||
msg.Channel = ChatChannel.Radio;
|
||||
msg.Message = message;
|
||||
msg.MessageWrap = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender));
|
||||
_netManager.ServerSendToAll(msg);
|
||||
if (playDefaultSound)
|
||||
{
|
||||
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/announce.ogg", AudioParams.Default.WithVolume(-2f));
|
||||
}
|
||||
}
|
||||
|
||||
public void DispatchServerMessage(IPlayerSession player, string message)
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace Content.Server.Chat.Managers
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="sender"></param>
|
||||
void DispatchStationAnnouncement(string message, string sender = "CentComm");
|
||||
/// <param name="playDefaultSound">If the default 'PA' sound should be played.</param>
|
||||
void DispatchStationAnnouncement(string message, string sender = "CentComm", bool playDefaultSound = true);
|
||||
|
||||
void DispatchServerMessage(IPlayerSession player, string message);
|
||||
|
||||
|
||||
@@ -116,8 +116,6 @@ namespace Content.Server.Communications
|
||||
author = $"{id.FullName} ({CultureInfo.CurrentCulture.TextInfo.ToTitleCase(id.JobTitle ?? string.Empty)})".Trim();
|
||||
}
|
||||
|
||||
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/announce.ogg", AudioParams.Default.WithVolume(-2f));
|
||||
|
||||
message += $"\nSent by {author}";
|
||||
_chatManager.DispatchStationAnnouncement(message, "Communications Console");
|
||||
break;
|
||||
|
||||
@@ -90,7 +90,8 @@ namespace Content.Server.GameTicking
|
||||
"latejoin-arrival-announcement",
|
||||
("character", character.Name),
|
||||
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(job.Name))
|
||||
), Loc.GetString("latejoin-arrival-sender"));
|
||||
), Loc.GetString("latejoin-arrival-sender"),
|
||||
playDefaultSound: false);
|
||||
}
|
||||
|
||||
var mob = SpawnPlayerMob(job, character, lateJoin);
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace Content.Server.Nuke
|
||||
var announcement = Loc.GetString("nuke-component-announcement-armed",
|
||||
("time", (int) component.RemainingTime));
|
||||
var sender = Loc.GetString("nuke-component-announcement-sender");
|
||||
_chat.DispatchStationAnnouncement(announcement, sender);
|
||||
_chat.DispatchStationAnnouncement(announcement, sender, false);
|
||||
|
||||
// todo: move it to announcements system
|
||||
SoundSystem.Play(Filter.Broadcast(), component.ArmSound.GetSound());
|
||||
@@ -370,7 +370,7 @@ namespace Content.Server.Nuke
|
||||
// warn a crew
|
||||
var announcement = Loc.GetString("nuke-component-announcement-unarmed");
|
||||
var sender = Loc.GetString("nuke-component-announcement-sender");
|
||||
_chat.DispatchStationAnnouncement(announcement, sender);
|
||||
_chat.DispatchStationAnnouncement(announcement, sender, false);
|
||||
|
||||
// todo: move it to announcements system
|
||||
SoundSystem.Play(Filter.Broadcast(), component.DisarmSound.GetSound());
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.Roles
|
||||
|
||||
if(Prototype.JoinNotifyCrew && Mind.CharacterName != null)
|
||||
chat.DispatchStationAnnouncement(Loc.GetString("job-greet-join-notify-crew", ("jobName", Name), ("characterName", Mind.CharacterName)),
|
||||
Loc.GetString("job-greet-join-notify-crew-announcer"));
|
||||
Loc.GetString("job-greet-join-notify-crew-announcer"), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Content.Server.RoundEnd
|
||||
|
||||
IsRoundEndCountdownStarted = true;
|
||||
|
||||
_chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-called-announcement",("minutes", countdownTime.Minutes)), Loc.GetString("Station"));
|
||||
_chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-called-announcement",("minutes", countdownTime.Minutes)), Loc.GetString("Station"), false);
|
||||
|
||||
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/shuttlecalled.ogg");
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Content.Server.RoundEnd
|
||||
|
||||
IsRoundEndCountdownStarted = false;
|
||||
|
||||
_chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"), Loc.GetString("Station"));
|
||||
_chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"), Loc.GetString("Station"), false);
|
||||
|
||||
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/shuttlerecalled.ogg");
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Content.Server.StationEvents.Events
|
||||
if (StartAnnouncement != null)
|
||||
{
|
||||
var chatManager = IoCManager.Resolve<IChatManager>();
|
||||
chatManager.DispatchStationAnnouncement(StartAnnouncement);
|
||||
chatManager.DispatchStationAnnouncement(StartAnnouncement, playDefaultSound: false);
|
||||
}
|
||||
|
||||
if (StartAudio != null)
|
||||
@@ -146,7 +146,7 @@ namespace Content.Server.StationEvents.Events
|
||||
if (EndAnnouncement != null)
|
||||
{
|
||||
var chatManager = IoCManager.Resolve<IChatManager>();
|
||||
chatManager.DispatchStationAnnouncement(EndAnnouncement);
|
||||
chatManager.DispatchStationAnnouncement(EndAnnouncement, playDefaultSound: false);
|
||||
}
|
||||
|
||||
if (EndAudio != null)
|
||||
|
||||
Reference in New Issue
Block a user