mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
parent
ae579c57bf
commit
4d6efc8dfe
4 changed files with 29 additions and 9 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.EUI;
|
||||
|
|
@ -46,7 +45,7 @@ namespace Content.Server.Administration.UI
|
|||
switch (doAnnounce.AnnounceType)
|
||||
{
|
||||
case AdminAnnounceType.Server:
|
||||
_chatManager.DispatchServerAnnouncement(doAnnounce.Announcement);
|
||||
_chatManager.DispatchServerAnnouncement(doAnnounce.Announcement, sender: Player);
|
||||
break;
|
||||
// TODO: Per-station announcement support
|
||||
case AdminAnnounceType.Station:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using Content.Server.Administration;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Database;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.ContentPack;
|
||||
|
|
@ -14,6 +16,7 @@ public sealed partial class AnnounceCommand : LocalizedEntityCommands
|
|||
[Dependency] private ChatSystem _chat = default!;
|
||||
[Dependency] private IPrototypeManager _proto = default!;
|
||||
[Dependency] private IResourceManager _res = default!;
|
||||
[Dependency] private IAdminLogManager _adminLogger = default!;
|
||||
|
||||
public override string Command => "announce";
|
||||
public override string Description => Loc.GetString("cmd-announce-desc");
|
||||
|
|
@ -59,6 +62,18 @@ public sealed partial class AnnounceCommand : LocalizedEntityCommands
|
|||
sound = new SoundPathSpecifier(args[3]);
|
||||
|
||||
_chat.DispatchGlobalAnnouncement(message, sender, true, sound, color);
|
||||
|
||||
if (shell.Player is null)
|
||||
{
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
$"LOCAL used 'announce' with displayed sender {sender}: {message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
$"{shell.Player:Player} used 'announce' with displayed sender {sender}: {message}");
|
||||
}
|
||||
|
||||
shell.WriteLine(Loc.GetString("shell-command-success"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,10 +92,10 @@ private ISawmill? _sawmill = default!;
|
|||
DispatchServerAnnouncement(Loc.GetString(val ? "chat-manager-admin-ooc-chat-enabled-message" : "chat-manager-admin-ooc-chat-disabled-message"));
|
||||
}
|
||||
|
||||
public void DeleteMessagesBy(NetUserId uid)
|
||||
{
|
||||
if (!_players.TryGetValue(uid, out var user))
|
||||
return;
|
||||
public void DeleteMessagesBy(NetUserId uid)
|
||||
{
|
||||
if (!_players.TryGetValue(uid, out var user))
|
||||
return;
|
||||
|
||||
var msg = new MsgDeleteChatMessagesBy { Key = user.Key, Entities = user.Entities };
|
||||
_netManager.ServerSendToAll(msg);
|
||||
|
|
@ -116,7 +116,7 @@ private ISawmill? _sawmill = default!;
|
|||
|
||||
#region Server Announcements
|
||||
|
||||
public void DispatchServerAnnouncement(string message, Color? colorOverride = null)
|
||||
public void DispatchServerAnnouncement(string message, Color? colorOverride = null, ICommonSession? sender = null)
|
||||
{
|
||||
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", FormattedMessage.EscapeText(message)));
|
||||
ChatMessageToAll(ChatChannel.Server, message, wrappedMessage, EntityUid.Invalid, hideChat: false, recordReplay: true, colorOverride: colorOverride);
|
||||
|
|
@ -125,7 +125,12 @@ private ISawmill? _sawmill = default!;
|
|||
// during server setup when some cvars are changed
|
||||
_sawmill?.Info(message);
|
||||
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}");
|
||||
if (sender is null) //just so that log search works...
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
$"Server announcement from SYSTEM: {message}");
|
||||
else
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
$"Server announcement from {sender:Player}: {message}");
|
||||
}
|
||||
|
||||
public void DispatchServerMessage(ICommonSession player, string message, bool suppressLog = false)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ namespace Content.Server.Chat.Managers
|
|||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="colorOverride">Override the color of the message being sent.</param>
|
||||
void DispatchServerAnnouncement(string message, Color? colorOverride = null);
|
||||
/// <param name="sender">Session of the administrator who initiated the announcement.</param>
|
||||
void DispatchServerAnnouncement(string message, Color? colorOverride = null, ICommonSession? sender = null);
|
||||
|
||||
void DispatchServerMessage(ICommonSession player, string message, bool suppressLog = false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue