ShowSyndicateIconsSystem.cs 881 B

12345678910111213141516171819202122232425262728
  1. using Content.Shared.Overlays;
  2. using Content.Shared.NukeOps;
  3. using Content.Shared.StatusIcon;
  4. using Content.Shared.StatusIcon.Components;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Client.Overlays;
  7. public sealed class ShowSyndicateIconsSystem : EquipmentHudSystem<ShowSyndicateIconsComponent>
  8. {
  9. [Dependency] private readonly IPrototypeManager _prototype = default!;
  10. public override void Initialize()
  11. {
  12. base.Initialize();
  13. SubscribeLocalEvent<NukeOperativeComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
  14. }
  15. private void OnGetStatusIconsEvent(EntityUid uid, NukeOperativeComponent component, ref GetStatusIconsEvent ev)
  16. {
  17. if (!IsActive)
  18. return;
  19. if (_prototype.TryIndex<FactionIconPrototype>(component.SyndStatusIcon, out var iconPrototype))
  20. ev.StatusIcons.Add(iconPrototype);
  21. }
  22. }