Files
Delta-v/Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml.cs
T
DisposableCrewmember42 3c0d4ab253 feat: Various Admin QOL features (#5436)
* feat: added lslaws command

* feat: add lswatchlisted command

* tweak: nicer formatting for lswatchlisted

* tweak: nicer formatting for lslaws

* feat: lsobjectives lists everyone's objectives if no user specified

* feat: mark ghosted players in players tab

* docs: add missing DeltaV patch comment

* feat: only alert admins if meatspiking player characters

* feat: always alert about station explosions, don't spam off-station alerts

* feat: stripping alert tweaks

* feat: admin alert on low hour latejoin

* refactor: forgot to make onspawncomplete non-async, wasn't necessary after all

* feat: EORG alerts

* feat: getping command

* refactor: remove unused imports, format

* refactor: early return in onspawncomplete

* feat: add coordinate link to eorg destroy alert

* tweak: cache watchlist data to avoid db calls, use in lswatchlisted

* fix: null-check in OnNoteAdded

* feat: watchlist indicator on admin overlay

* feat: optionally mark watchlisted in f7 players

* feat: refresh admin playerlist data on wl change

* fix: update player list after cache write

* feat: add tp links to prayer messages

* tweak: don't alert when uncuffing self

* tweak: lower uncuff other alert impact if mindshielded

* docs: add deltav comments to imports

* refactor: address review comments

* style: deltav comments on same line as change

* performance: get metadata only if objectives > 0

* fix: actually check user if explosion gridPos not on station

* style: remove extraneous newlines

* refactor: use fancy getOrNew method

* feat: refresh player list UI if marking pref changed

* feat: latejoin alert hours configurable

* fix: also list objectives for non-humanoids and dead people
2026-04-04 16:38:32 +02:00

119 lines
4.4 KiB
C#

using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI.Tabs.PlayerTab;
[GenerateTypedNameReferences]
public sealed partial class PlayerTabEntry : PanelContainer
{
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
public PlayerTabEntry(
PlayerInfo player,
StyleBoxFlat styleBoxFlat,
AdminPlayerTabColorOption colorOption,
AdminPlayerTabRoleTypeOption roleSetting,
AdminPlayerTabSymbolOption symbolSetting,
bool markGhosted, // DeltaV - Add markGhosted
bool markWatchlisted // DeltaV - Add markWatchlisted
)
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
var roles = _entMan.System<SharedRoleSystem>();
var rolePrototype = player.RoleProto == null ? null : _prototype.Index(player.RoleProto.Value);
UsernameLabel.Text = player.Username;
if (!player.Connected)
UsernameLabel.StyleClasses.Add("Disabled");
JobLabel.Text = player.StartingJob;
var colorAntags = false;
var colorRoles = false;
switch (colorOption)
{
case AdminPlayerTabColorOption.Off:
break;
case AdminPlayerTabColorOption.Character:
colorAntags = true;
break;
case AdminPlayerTabColorOption.Roletype:
colorRoles = true;
break;
default:
case AdminPlayerTabColorOption.Both:
colorAntags = true;
colorRoles = true;
break;
}
var symbol = string.Empty;
switch (symbolSetting)
{
case AdminPlayerTabSymbolOption.Off:
break;
case AdminPlayerTabSymbolOption.Basic:
symbol = player.Antag ? Loc.GetString("player-tab-antag-prefix") : string.Empty;
break;
default:
case AdminPlayerTabSymbolOption.Specific:
symbol = player.Antag ? rolePrototype?.Symbol ?? RoleTypePrototype.FallbackSymbol : string.Empty;
break;
}
CharacterLabel.Text = Loc.GetString("player-tab-character-name-antag-symbol", ("symbol", symbol), ("name", player.CharacterName));
if (player.Antag && colorAntags)
CharacterLabel.FontColorOverride = rolePrototype?.Color ?? RoleTypePrototype.FallbackColor;
if (player.IdentityName != player.CharacterName)
CharacterLabel.Text += $" [{player.IdentityName}]";
// DeltaV - Mark ghosted/watchlisted players START
if (player.Ghost && markGhosted)
{
CharacterLabel.Text = $"(G) {CharacterLabel.Text}";
}
if (player.Watchlisted && markWatchlisted)
{
CharacterLabel.Text = $"(WL) {CharacterLabel.Text}";
}
// DeltaV - Mark ghosted/watchlisted players END
var roletype = RoleTypeLabel.Text = Loc.GetString(rolePrototype?.Name ?? RoleTypePrototype.FallbackName);
var subtype = roles.GetRoleSubtypeLabel(rolePrototype?.Name ?? RoleTypePrototype.FallbackName, player.Subtype);
switch (roleSetting)
{
case AdminPlayerTabRoleTypeOption.RoleTypeSubtype:
RoleTypeLabel.Text = roletype != subtype
? roletype + " - " +subtype
: roletype;
break;
case AdminPlayerTabRoleTypeOption.SubtypeRoleType:
RoleTypeLabel.Text = roletype != subtype
? subtype + " - " + roletype
: roletype;
break;
case AdminPlayerTabRoleTypeOption.RoleType:
RoleTypeLabel.Text = roletype;
break;
default:
case AdminPlayerTabRoleTypeOption.Subtype:
RoleTypeLabel.Text = subtype;
break;
}
if (colorRoles)
RoleTypeLabel.FontColorOverride = rolePrototype?.Color ?? RoleTypePrototype.FallbackColor;
BackgroundColorPanel.PanelOverride = styleBoxFlat;
OverallPlaytimeLabel.Text = player.PlaytimeString;
}
}