diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index e2db7a8d6b4cbc..47d251910cb59f 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -1,16 +1,21 @@ +using System.Linq; using System.Numerics; using Content.Client.Administration.Systems; +using Content.Shared.CCVar; +using Content.Shared.Mind; using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; -using Robust.Shared; -using Robust.Shared.Enums; using Robust.Shared.Configuration; +using Robust.Shared.Enums; +using Robust.Shared.Prototypes; namespace Content.Client.Administration; internal sealed class AdminNameOverlay : Overlay { + [Dependency] private readonly IConfigurationManager _config = default!; + private readonly AdminSystem _system; private readonly IEntityManager _entityManager; private readonly IEyeManager _eyeManager; @@ -18,8 +23,16 @@ internal sealed class AdminNameOverlay : Overlay private readonly IUserInterfaceManager _userInterfaceManager; private readonly Font _font; + //TODO make this adjustable via GUI + private readonly ProtoId[] _filter = + ["SoloAntagonist", "TeamAntagonist", "SiliconAntagonist", "FreeAgent"]; + private readonly string _antagLabelClassic = Loc.GetString("admin-overlay-antag-classic"); + private readonly Color _antagColorClassic = Color.OrangeRed; + public AdminNameOverlay(AdminSystem system, IEntityManager entityManager, IEyeManager eyeManager, IResourceCache resourceCache, EntityLookupSystem entityLookup, IUserInterfaceManager userInterfaceManager) { + IoCManager.InjectDependencies(this); + _system = system; _entityManager = entityManager; _eyeManager = eyeManager; @@ -35,6 +48,9 @@ protected override void Draw(in OverlayDrawArgs args) { var viewport = args.WorldAABB; + //TODO make this adjustable via GUI + var classic = _config.GetCVar(CCVars.AdminOverlayClassic); + foreach (var playerInfo in _system.PlayerList) { var entity = _entityManager.GetEntity(playerInfo.NetEntity); @@ -64,12 +80,20 @@ protected override void Draw(in OverlayDrawArgs args) var screenCoordinates = _eyeManager.WorldToScreen(aabb.Center + new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec( aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f); - if (playerInfo.Antag) + + if (classic && playerInfo.Antag) { - args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", uiScale, Color.OrangeRed); -; + args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), _antagLabelClassic, uiScale, _antagColorClassic); } - args.ScreenHandle.DrawString(_font, screenCoordinates+lineoffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White); + else if (!classic && _filter.Contains(playerInfo.RoleProto.ID)) + { + var label = Loc.GetString(playerInfo.RoleProto.Name).ToUpper(); + var color = playerInfo.RoleProto.Color; + + args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), label, uiScale, color); + } + + args.ScreenHandle.DrawString(_font, screenCoordinates + lineoffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White); args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, uiScale, playerInfo.Connected ? Color.Aquamarine : Color.White); } } diff --git a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs index 043bf343ecf26d..b7231869c9edd3 100644 --- a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs @@ -197,6 +197,7 @@ private int Compare(PlayerInfo x, PlayerInfo y) Header.Character => Compare(x.CharacterName, y.CharacterName), Header.Job => Compare(x.StartingJob, y.StartingJob), Header.Antagonist => x.Antag.CompareTo(y.Antag), + Header.RoleType => Compare(x.RoleProto.Name , y.RoleProto.Name), Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default), _ => 1 }; diff --git a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml index e1371ec6f73b7b..54e51747fb9e80 100644 --- a/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml +++ b/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml @@ -24,6 +24,11 @@ HorizontalExpand="True" ClipText="True"/> +