mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-06-09 10:06:43 +02:00
5168b5f3d4
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using Content.Client.Overlays;
|
|
using Content.Shared.Access.Systems;
|
|
using Content.Shared.StatusIcon;
|
|
using Content.Shared.StatusIcon.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Access.Systems;
|
|
|
|
public sealed partial class JobStatusSystem : SharedJobStatusSystem
|
|
{
|
|
[Dependency] private ShowJobIconsSystem _showJobIcons = default!;
|
|
[Dependency] private ShowCrewIconsSystem _showCrewIcons = default!;
|
|
[Dependency] private IPrototypeManager _prototype = default!;
|
|
|
|
private static readonly ProtoId<SecurityIconPrototype> CrewBorderIcon = "CrewBorderIcon";
|
|
private static readonly ProtoId<SecurityIconPrototype> CrewUncertainBorderIcon = "CrewUncertainBorderIcon";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<JobStatusComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
|
}
|
|
|
|
// show the status icons if the player has the correponding HUDs
|
|
private void OnGetStatusIconsEvent(Entity<JobStatusComponent> ent, ref GetStatusIconsEvent ev)
|
|
{
|
|
if (_showJobIcons.IsActive && ent.Comp.JobStatusIcon != null)
|
|
ev.StatusIcons.Add(_prototype.Index(ent.Comp.JobStatusIcon));
|
|
|
|
if (_showCrewIcons.IsActive)
|
|
{
|
|
if (_showCrewIcons.UncertainCrewBorder)
|
|
ev.StatusIcons.Add(_prototype.Index(CrewUncertainBorderIcon));
|
|
else if (ent.Comp.IsCrew)
|
|
ev.StatusIcons.Add(_prototype.Index(CrewBorderIcon));
|
|
}
|
|
}
|
|
}
|