CatStation/Content.Client/NewPlayer/ShowNewPlayerIconSystem.cs
SlamBamActionman 19bc31aef7
Add "new player label" over the head of players joining the game for the first time (#44709)
* Initial commit

* RMC? I 'ardly know 'er

* Sprout

* Rework it to use job icons

* Revert the one change

* Always the one yaml

* Easy review changes

* We do a little salami

* Review changes

* NIGHTMARE NIGHTMARE NIGHTMARE

* Update to use StatusIconPrototype only

* Remove async

* Aaaand remove the comment, bah

* Review fixes

* Update master

* Add the ability for ghosts to see

* Byte backing

* Review fix + comment

* Update to 90 min

* Add todo message
2026-09-24 15:34:37 +00:00

29 lines
936 B
C#

using Content.Shared.CCVar;
using Content.Shared.NewPlayer;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Configuration;
namespace Content.Client.NewPlayer;
/// <summary>
/// Used to visualize <see cref="NewPlayerIconComponent"/> status icons, if enabled on the server.
/// </summary>
public sealed partial class NewPlayerSystem : EntitySystem
{
[Dependency] private IConfigurationManager _configManager = default!;
private bool _showPlayerIcons;
public override void Initialize()
{
base.Initialize();
Subs.CVar(_configManager, CCVars.ShowNewPlayerIcons, v => _showPlayerIcons = v, true);
}
[SubscribeLocalEvent]
private void GetNewPlayerIcon(Entity<NewPlayerIconComponent> ent, ref GetStatusIconsEvent args)
{
if (_showPlayerIcons && ProtoMan.Resolve(ent.Comp.StatusIcon, out var iconPrototype))
args.StatusIcons.Add(iconPrototype);
}
}