From 6856440084e1549ab2680decc5f94e69d9c61608 Mon Sep 17 00:00:00 2001 From: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Date: Sat, 22 Mar 2025 00:21:32 +0100 Subject: [PATCH] Add antag notice to admin chat alerts (#35994) Add antag notice to admin chat pop-ups --- .../Administration/Logs/AdminLogManager.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Content.Server/Administration/Logs/AdminLogManager.cs b/Content.Server/Administration/Logs/AdminLogManager.cs index b345f55ad9..0df177347a 100644 --- a/Content.Server/Administration/Logs/AdminLogManager.cs +++ b/Content.Server/Administration/Logs/AdminLogManager.cs @@ -2,6 +2,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Content.Server.Administration.Systems; using Content.Server.Database; using Content.Server.GameTicking; using Content.Shared.Administration.Logs; @@ -310,6 +311,10 @@ public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogMa Players = new List(players.Count) }; + var adminLog = false; + var adminSys = _entityManager.SystemOrNull(); + var logMessage = message; + foreach (var id in players) { var player = new AdminLogPlayer @@ -319,8 +324,21 @@ public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogMa }; log.Players.Add(player); + + if (adminSys != null) + { + var cachedInfo = adminSys.GetCachedPlayerInfo(new NetUserId(id)); + if (cachedInfo != null && cachedInfo.Antag) + { + logMessage += " [ANTAG: " + cachedInfo.CharacterName + "]"; + } + } + + if (adminLog) + continue; + if (impact == LogImpact.Extreme) // Always chat-notify Extreme logs - _chat.SendAdminAlert(message); + adminLog = true; if (impact == LogImpact.High) // Only chat-notify High logs if the player is below a threshold playtime { @@ -330,12 +348,15 @@ public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogMa if (playtimes.TryGetValue(PlayTimeTrackingShared.TrackerOverall, out var overallTime) && overallTime <= TimeSpan.FromHours(_highImpactLogPlaytime)) { - _chat.SendAdminAlert(message); + adminLog = true; } } } } + if (adminLog) + _chat.SendAdminAlert(logMessage); + if (preRound) { _preRoundLogQueue.Enqueue(log);