]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Refactor status icons take 2, cyborgs don't see criminal status (#26207)
authorKrunklehorn <42424291+Krunklehorn@users.noreply.github.com>
Thu, 18 Apr 2024 03:20:44 +0000 (23:20 -0400)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 03:20:44 +0000 (13:20 +1000)
* Initial commit.

* review

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
19 files changed:
Content.Client/Overlays/ShowCriminalRecordIconsSystem.cs [new file with mode: 0644]
Content.Client/Overlays/ShowHungerIconsSystem.cs
Content.Client/Overlays/ShowJobIconsSystem.cs [new file with mode: 0644]
Content.Client/Overlays/ShowMindShieldIconsSystem.cs [new file with mode: 0644]
Content.Client/Overlays/ShowSecurityIconsSystem.cs [deleted file]
Content.Client/Overlays/ShowSyndicateIconsSystem.cs
Content.Client/Overlays/ShowThirstIconsSystem.cs
Content.Shared/Inventory/InventorySystem.Relay.cs
Content.Shared/Nutrition/EntitySystems/HungerSystem.cs
Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs
Content.Shared/Overlays/ShowCriminalRecordIconsComponent.cs [new file with mode: 0644]
Content.Shared/Overlays/ShowHungerIconsComponent.cs
Content.Shared/Overlays/ShowJobIconsComponent.cs [moved from Content.Shared/Overlays/ShowSecurityIconsComponent.cs with 51% similarity]
Content.Shared/Overlays/ShowMindShieldIconsComponent.cs [new file with mode: 0644]
Content.Shared/Overlays/ShowSyndicateIconsComponent.cs
Content.Shared/Overlays/ShowThirstIconsComponent.cs
Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml
Resources/Prototypes/Entities/Clothing/Eyes/hud.yml
Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml

diff --git a/Content.Client/Overlays/ShowCriminalRecordIconsSystem.cs b/Content.Client/Overlays/ShowCriminalRecordIconsSystem.cs
new file mode 100644 (file)
index 0000000..8f23cd5
--- /dev/null
@@ -0,0 +1,28 @@
+using Content.Shared.Overlays;
+using Content.Shared.Security.Components;
+using Content.Shared.StatusIcon;
+using Content.Shared.StatusIcon.Components;
+using Robust.Shared.Prototypes;
+
+namespace Content.Client.Overlays;
+
+public sealed class ShowCriminalRecordIconsSystem : EquipmentHudSystem<ShowCriminalRecordIconsComponent>
+{
+    [Dependency] private readonly IPrototypeManager _prototype = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<CriminalRecordComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
+    }
+
+    private void OnGetStatusIconsEvent(EntityUid uid, CriminalRecordComponent component, ref GetStatusIconsEvent ev)
+    {
+        if (!IsActive || ev.InContainer)
+            return;
+
+        if (_prototype.TryIndex<StatusIconPrototype>(component.StatusIcon.Id, out var iconPrototype))
+            ev.StatusIcons.Add(iconPrototype);
+    }
+}
index 58551b30c264a056bd9559e4846ebd201365d6d9..b1c0f3a1a0c9acba5b55f4da691e9294bee65838 100644 (file)
@@ -1,14 +1,13 @@
+using Content.Shared.Nutrition.EntitySystems;
 using Content.Shared.Nutrition.Components;
 using Content.Shared.Overlays;
-using Content.Shared.StatusIcon;
 using Content.Shared.StatusIcon.Components;
-using Robust.Shared.Prototypes;
 
 namespace Content.Client.Overlays;
 
 public sealed class ShowHungerIconsSystem : EquipmentHudSystem<ShowHungerIconsComponent>
 {
-    [Dependency] private readonly IPrototypeManager _prototypeMan = default!;
+    [Dependency] private readonly HungerSystem _hunger = default!;
 
     public override void Initialize()
     {
@@ -17,42 +16,12 @@ public sealed class ShowHungerIconsSystem : EquipmentHudSystem<ShowHungerIconsCo
         SubscribeLocalEvent<HungerComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
     }
 
-    private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent hungerComponent, ref GetStatusIconsEvent args)
+    private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent component, ref GetStatusIconsEvent ev)
     {
-        if (!IsActive || args.InContainer)
+        if (!IsActive || ev.InContainer)
             return;
 
-        var hungerIcons = DecideHungerIcon(uid, hungerComponent);
-
-        args.StatusIcons.AddRange(hungerIcons);
-    }
-
-    private IReadOnlyList<StatusIconPrototype> DecideHungerIcon(EntityUid uid, HungerComponent hungerComponent)
-    {
-        var result = new List<StatusIconPrototype>();
-
-        switch (hungerComponent.CurrentThreshold)
-        {
-            case HungerThreshold.Overfed:
-                if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconOverfed", out var overfed))
-                {
-                    result.Add(overfed);
-                }
-                break;
-            case HungerThreshold.Peckish:
-                if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconPeckish", out var peckish))
-                {
-                    result.Add(peckish);
-                }
-                break;
-            case HungerThreshold.Starving:
-                if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconStarving", out var starving))
-                {
-                    result.Add(starving);
-                }
-                break;
-        }
-
-        return result;
+        if (_hunger.TryGetStatusIconPrototype(component, out var iconPrototype))
+            ev.StatusIcons.Add(iconPrototype);
     }
 }
diff --git a/Content.Client/Overlays/ShowJobIconsSystem.cs b/Content.Client/Overlays/ShowJobIconsSystem.cs
new file mode 100644 (file)
index 0000000..e24b99f
--- /dev/null
@@ -0,0 +1,60 @@
+using Content.Shared.Access.Components;
+using Content.Shared.Access.Systems;
+using Content.Shared.Overlays;
+using Content.Shared.PDA;
+using Content.Shared.StatusIcon;
+using Content.Shared.StatusIcon.Components;
+using Robust.Shared.Prototypes;
+
+namespace Content.Client.Overlays;
+
+public sealed class ShowJobIconsSystem : EquipmentHudSystem<ShowJobIconsComponent>
+{
+    [Dependency] private readonly IPrototypeManager _prototype = default!;
+    [Dependency] private readonly AccessReaderSystem _accessReader = default!;
+
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string JobIconForNoId = "JobIconNoId";
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<StatusIconComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
+    }
+
+    private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent ev)
+    {
+        if (!IsActive || ev.InContainer)
+            return;
+
+        var iconId = JobIconForNoId;
+
+        if (_accessReader.FindAccessItemsInventory(uid, out var items))
+        {
+            foreach (var item in items)
+            {
+                // ID Card
+                if (TryComp<IdCardComponent>(item, out var id))
+                {
+                    iconId = id.JobIcon;
+                    break;
+                }
+
+                // PDA
+                if (TryComp<PdaComponent>(item, out var pda)
+                    && pda.ContainedId != null
+                    && TryComp(pda.ContainedId, out id))
+                {
+                    iconId = id.JobIcon;
+                    break;
+                }
+            }
+        }
+
+        if (_prototype.TryIndex<StatusIconPrototype>(iconId, out var iconPrototype))
+            ev.StatusIcons.Add(iconPrototype);
+        else
+            Log.Error($"Invalid job icon prototype: {iconPrototype}");
+    }
+}
diff --git a/Content.Client/Overlays/ShowMindShieldIconsSystem.cs b/Content.Client/Overlays/ShowMindShieldIconsSystem.cs
new file mode 100644 (file)
index 0000000..8bf39b8
--- /dev/null
@@ -0,0 +1,28 @@
+using Content.Shared.Mindshield.Components;
+using Content.Shared.Overlays;
+using Content.Shared.StatusIcon;
+using Content.Shared.StatusIcon.Components;
+using Robust.Shared.Prototypes;
+
+namespace Content.Client.Overlays;
+
+public sealed class ShowMindShieldIconsSystem : EquipmentHudSystem<ShowMindShieldIconsComponent>
+{
+    [Dependency] private readonly IPrototypeManager _prototype = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<MindShieldComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
+    }
+
+    private void OnGetStatusIconsEvent(EntityUid uid, MindShieldComponent component, ref GetStatusIconsEvent ev)
+    {
+        if (!IsActive || ev.InContainer)
+            return;
+
+        if (_prototype.TryIndex<StatusIconPrototype>(component.MindShieldStatusIcon.Id, out var iconPrototype))
+            ev.StatusIcons.Add(iconPrototype);
+    }
+}
diff --git a/Content.Client/Overlays/ShowSecurityIconsSystem.cs b/Content.Client/Overlays/ShowSecurityIconsSystem.cs
deleted file mode 100644 (file)
index 7a4abd0..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-using Content.Shared.Access.Components;
-using Content.Shared.Access.Systems;
-using Content.Shared.Mindshield.Components;
-using Content.Shared.Overlays;
-using Content.Shared.PDA;
-using Content.Shared.Security.Components;
-using Content.Shared.StatusIcon;
-using Content.Shared.StatusIcon.Components;
-using Robust.Shared.Prototypes;
-
-namespace Content.Client.Overlays;
-
-public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIconsComponent>
-{
-    [Dependency] private readonly IPrototypeManager _prototypeMan = default!;
-    [Dependency] private readonly AccessReaderSystem _accessReader = default!;
-
-    [ValidatePrototypeId<StatusIconPrototype>]
-    private const string JobIconForNoId = "JobIconNoId";
-
-    public override void Initialize()
-    {
-        base.Initialize();
-
-        SubscribeLocalEvent<StatusIconComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
-    }
-
-    private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent @event)
-    {
-        if (!IsActive || @event.InContainer)
-        {
-            return;
-        }
-
-        var securityIcons = DecideSecurityIcon(uid);
-
-        @event.StatusIcons.AddRange(securityIcons);
-    }
-
-    private IReadOnlyList<StatusIconPrototype> DecideSecurityIcon(EntityUid uid)
-    {
-        var result = new List<StatusIconPrototype>();
-
-        var jobIconToGet = JobIconForNoId;
-        if (_accessReader.FindAccessItemsInventory(uid, out var items))
-        {
-            foreach (var item in items)
-            {
-                // ID Card
-                if (TryComp(item, out IdCardComponent? id))
-                {
-                    jobIconToGet = id.JobIcon;
-                    break;
-                }
-
-                // PDA
-                if (TryComp(item, out PdaComponent? pda)
-                    && pda.ContainedId != null
-                    && TryComp(pda.ContainedId, out id))
-                {
-                    jobIconToGet = id.JobIcon;
-                    break;
-                }
-            }
-        }
-
-        if (_prototypeMan.TryIndex<StatusIconPrototype>(jobIconToGet, out var jobIcon))
-            result.Add(jobIcon);
-        else
-            Log.Error($"Invalid job icon prototype: {jobIcon}");
-
-        if (TryComp<MindShieldComponent>(uid, out var comp))
-        {
-            if (_prototypeMan.TryIndex<StatusIconPrototype>(comp.MindShieldStatusIcon.Id, out var icon))
-                result.Add(icon);
-        }
-
-        if (TryComp<CriminalRecordComponent>(uid, out var record))
-        {
-            if(_prototypeMan.TryIndex<StatusIconPrototype>(record.StatusIcon.Id, out var criminalIcon))
-                result.Add(criminalIcon);
-        }
-
-        return result;
-    }
-}
index a6407266853bbcf27b75e024ebdc55c87a4af9a1..660ef198e14709f08f1671ed6e8054eb64b81cd2 100644 (file)
@@ -1,10 +1,11 @@
 using Content.Shared.Overlays;
-using Content.Shared.StatusIcon.Components;
 using Content.Shared.NukeOps;
 using Content.Shared.StatusIcon;
+using Content.Shared.StatusIcon.Components;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.Overlays;
+
 public sealed class ShowSyndicateIconsSystem : EquipmentHudSystem<ShowSyndicateIconsComponent>
 {
     [Dependency] private readonly IPrototypeManager _prototype = default!;
@@ -16,28 +17,13 @@ public sealed class ShowSyndicateIconsSystem : EquipmentHudSystem<ShowSyndicateI
         SubscribeLocalEvent<NukeOperativeComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
     }
 
-    private void OnGetStatusIconsEvent(EntityUid uid, NukeOperativeComponent nukeOperativeComponent, ref GetStatusIconsEvent args)
+    private void OnGetStatusIconsEvent(EntityUid uid, NukeOperativeComponent component, ref GetStatusIconsEvent ev)
     {
-        if (!IsActive || args.InContainer)
-        {
+        if (!IsActive || ev.InContainer)
             return;
-        }
-
-        var syndicateIcons = SyndicateIcon(uid, nukeOperativeComponent);
-
-        args.StatusIcons.AddRange(syndicateIcons);
-    }
-
-    private IReadOnlyList<StatusIconPrototype> SyndicateIcon(EntityUid uid, NukeOperativeComponent nukeOperativeComponent)
-    {
-        var result = new List<StatusIconPrototype>();
-
-        if (_prototype.TryIndex<StatusIconPrototype>(nukeOperativeComponent.SyndStatusIcon, out var syndicateicon))
-        {
-            result.Add(syndicateicon);
-        }
 
-        return result;
+        if (_prototype.TryIndex<StatusIconPrototype>(component.SyndStatusIcon, out var iconPrototype))
+            ev.StatusIcons.Add(iconPrototype);
     }
 }
 
index f9d6d0ab2592e489439455297d3c0c38aeab43fa..b08aa4340b215f0b0c11146e8e634732f98dff23 100644 (file)
@@ -1,14 +1,13 @@
+using Content.Shared.Nutrition.EntitySystems;
 using Content.Shared.Nutrition.Components;
 using Content.Shared.Overlays;
-using Content.Shared.StatusIcon;
 using Content.Shared.StatusIcon.Components;
-using Robust.Shared.Prototypes;
 
 namespace Content.Client.Overlays;
 
 public sealed class ShowThirstIconsSystem : EquipmentHudSystem<ShowThirstIconsComponent>
 {
-    [Dependency] private readonly IPrototypeManager _prototypeMan = default!;
+    [Dependency] private readonly ThirstSystem _thirst = default!;
 
     public override void Initialize()
     {
@@ -17,42 +16,12 @@ public sealed class ShowThirstIconsSystem : EquipmentHudSystem<ShowThirstIconsCo
         SubscribeLocalEvent<ThirstComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
     }
 
-    private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent thirstComponent, ref GetStatusIconsEvent args)
+    private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent component, ref GetStatusIconsEvent ev)
     {
-        if (!IsActive || args.InContainer)
+        if (!IsActive || ev.InContainer)
             return;
 
-        var thirstIcons = DecideThirstIcon(uid, thirstComponent);
-
-        args.StatusIcons.AddRange(thirstIcons);
-    }
-
-    private IReadOnlyList<StatusIconPrototype> DecideThirstIcon(EntityUid uid, ThirstComponent thirstComponent)
-    {
-        var result = new List<StatusIconPrototype>();
-
-        switch (thirstComponent.CurrentThirstThreshold)
-        {
-            case ThirstThreshold.OverHydrated:
-                if (_prototypeMan.TryIndex<StatusIconPrototype>("ThirstIconOverhydrated", out var overhydrated))
-                {
-                    result.Add(overhydrated);
-                }
-                break;
-            case ThirstThreshold.Thirsty:
-                if (_prototypeMan.TryIndex<StatusIconPrototype>("ThirstIconThirsty", out var thirsty))
-                {
-                    result.Add(thirsty);
-                }
-                break;
-            case ThirstThreshold.Parched:
-                if (_prototypeMan.TryIndex<StatusIconPrototype>("ThirstIconParched", out var parched))
-                {
-                    result.Add(parched);
-                }
-                break;
-        }
-
-        return result;
+        if (_thirst.TryGetStatusIconPrototype(component, out var iconPrototype))
+            ev.StatusIcons.Add(iconPrototype!);
     }
 }
index c43a5885077371c02436bd28470f5da23864a4ad..b418a1d41624987d75ff5d6ebbd783a7cf2f0dea 100644 (file)
@@ -38,12 +38,14 @@ public partial class InventorySystem
         SubscribeLocalEvent<InventoryComponent, SolutionScanEvent>(RelayInventoryEvent);
 
         // ComponentActivatedClientSystems
-        SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowSecurityIconsComponent>>(RelayInventoryEvent);
+        SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowJobIconsComponent>>(RelayInventoryEvent);
         SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowHealthBarsComponent>>(RelayInventoryEvent);
         SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowHealthIconsComponent>>(RelayInventoryEvent);
         SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowHungerIconsComponent>>(RelayInventoryEvent);
         SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowThirstIconsComponent>>(RelayInventoryEvent);
+        SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowMindShieldIconsComponent>>(RelayInventoryEvent);
         SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowSyndicateIconsComponent>>(RelayInventoryEvent);
+        SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowCriminalRecordIconsComponent>>(RelayInventoryEvent);
 
         SubscribeLocalEvent<InventoryComponent, GetVerbsEvent<EquipmentVerb>>(OnGetEquipmentVerbs);
     }
index 89aae57074e8918677bac3d826d85cf3f06ed85c..4de4e4d5feb05aa25196252f290b730f20f60133 100644 (file)
@@ -1,17 +1,22 @@
+using System.Diagnostics.CodeAnalysis;
 using Content.Shared.Alert;
 using Content.Shared.Damage;
 using Content.Shared.Mobs.Systems;
 using Content.Shared.Movement.Systems;
 using Content.Shared.Nutrition.Components;
 using Content.Shared.Rejuvenate;
+using Content.Shared.StatusIcon;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
+using Robust.Shared.Utility;
 
 namespace Content.Shared.Nutrition.EntitySystems;
 
 public sealed class HungerSystem : EntitySystem
 {
     [Dependency] private readonly IGameTiming _timing = default!;
+    [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly AlertsSystem _alerts = default!;
     [Dependency] private readonly DamageableSystem _damageable = default!;
@@ -19,10 +24,27 @@ public sealed class HungerSystem : EntitySystem
     [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
     [Dependency] private readonly SharedJetpackSystem _jetpack = default!;
 
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string HungerIconOverfedId = "HungerIconOverfed";
+
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string HungerIconPeckishId = "HungerIconPeckish";
+
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string HungerIconStarvingId = "HungerIconStarving";
+
+    private StatusIconPrototype? _hungerIconOverfed;
+    private StatusIconPrototype? _hungerIconPeckish;
+    private StatusIconPrototype? _hungerIconStarving;
+
     public override void Initialize()
     {
         base.Initialize();
 
+        DebugTools.Assert(_prototype.TryIndex(HungerIconOverfedId, out _hungerIconOverfed) &&
+                          _prototype.TryIndex(HungerIconPeckishId, out _hungerIconPeckish) &&
+                          _prototype.TryIndex(HungerIconStarvingId, out _hungerIconStarving));
+
         SubscribeLocalEvent<HungerComponent, MapInitEvent>(OnMapInit);
         SubscribeLocalEvent<HungerComponent, ComponentShutdown>(OnShutdown);
         SubscribeLocalEvent<HungerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
@@ -194,6 +216,27 @@ public sealed class HungerSystem : EntitySystem
         }
     }
 
+    public bool TryGetStatusIconPrototype(HungerComponent component, [NotNullWhen(true)] out StatusIconPrototype? prototype)
+    {
+        switch (component.CurrentThreshold)
+        {
+            case HungerThreshold.Overfed:
+                prototype = _hungerIconOverfed;
+                break;
+            case HungerThreshold.Peckish:
+                prototype = _hungerIconPeckish;
+                break;
+            case HungerThreshold.Starving:
+                prototype = _hungerIconStarving;
+                break;
+            default:
+                prototype = null;
+                break;
+        }
+
+        return prototype != null;
+    }
+
     public override void Update(float frameTime)
     {
         base.Update(frameTime);
index 29218f571983aebee5ff6d13d02faafcd37f395b..8ea7d9140c36bc78edca6bc06baa4c7815879550 100644 (file)
@@ -3,9 +3,12 @@ using Content.Shared.Movement.Components;
 using Content.Shared.Movement.Systems;
 using Content.Shared.Nutrition.Components;
 using Content.Shared.Rejuvenate;
+using Content.Shared.StatusIcon;
 using JetBrains.Annotations;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
+using Robust.Shared.Utility;
 
 namespace Content.Shared.Nutrition.EntitySystems;
 
@@ -13,15 +16,33 @@ namespace Content.Shared.Nutrition.EntitySystems;
 public sealed class ThirstSystem : EntitySystem
 {
     [Dependency] private readonly IGameTiming _timing = default!;
+    [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly AlertsSystem _alerts = default!;
     [Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
     [Dependency] private readonly SharedJetpackSystem _jetpack = default!;
 
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string ThirstIconOverhydratedId = "ThirstIconOverhydrated";
+
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string ThirstIconThirstyId = "ThirstIconThirsty";
+
+    [ValidatePrototypeId<StatusIconPrototype>]
+    private const string ThirstIconParchedId = "ThirstIconParched";
+
+    private StatusIconPrototype? _thirstIconOverhydrated = null;
+    private StatusIconPrototype? _thirstIconThirsty = null;
+    private StatusIconPrototype? _thirstIconParched = null;
+
     public override void Initialize()
     {
         base.Initialize();
 
+        DebugTools.Assert(_prototype.TryIndex(ThirstIconOverhydratedId, out _thirstIconOverhydrated) &&
+                          _prototype.TryIndex(ThirstIconThirstyId, out _thirstIconThirsty) &&
+                          _prototype.TryIndex(ThirstIconParchedId, out _thirstIconParched));
+
         SubscribeLocalEvent<ThirstComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
         SubscribeLocalEvent<ThirstComponent, MapInitEvent>(OnMapInit);
         SubscribeLocalEvent<ThirstComponent, RejuvenateEvent>(OnRejuvenate);
@@ -107,6 +128,28 @@ public sealed class ThirstSystem : EntitySystem
         }
     }
 
+    public bool TryGetStatusIconPrototype(ThirstComponent component, out StatusIconPrototype? prototype)
+    {
+        switch (component.CurrentThirstThreshold)
+        {
+            case ThirstThreshold.OverHydrated:
+                prototype = _thirstIconOverhydrated;
+                return true;
+
+            case ThirstThreshold.Thirsty:
+                prototype = _thirstIconThirsty;
+                return true;
+
+            case ThirstThreshold.Parched:
+                prototype = _thirstIconParched;
+                return true;
+
+            default:
+                prototype = null;
+                return false;
+        }
+    }
+
     private void UpdateEffects(EntityUid uid, ThirstComponent component)
     {
         if (IsMovementThreshold(component.LastThirstThreshold) != IsMovementThreshold(component.CurrentThirstThreshold) &&
diff --git a/Content.Shared/Overlays/ShowCriminalRecordIconsComponent.cs b/Content.Shared/Overlays/ShowCriminalRecordIconsComponent.cs
new file mode 100644 (file)
index 0000000..cb0759b
--- /dev/null
@@ -0,0 +1,9 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Overlays;
+
+/// <summary>
+///     This component allows you to see criminal record status of mobs.
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class ShowCriminalRecordIconsComponent : Component { }
index bf1fb2dc19d033aefe72b9a168b58e6d9967c61f..b3841bd80ff5d72dcbf6eb0d105d14da1103f1e9 100644 (file)
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
 namespace Content.Shared.Overlays;
 
 /// <summary>
-/// This component allows you to see the hungriness of mobs.
+///     This component allows you to see the hungriness of mobs.
 /// </summary>
 [RegisterComponent, NetworkedComponent]
 public sealed partial class ShowHungerIconsComponent : Component { }
similarity index 51%
rename from Content.Shared/Overlays/ShowSecurityIconsComponent.cs
rename to Content.Shared/Overlays/ShowJobIconsComponent.cs
index ec268174d18f92dd6dbf3020180f297c31aeae01..aae973950634481bffa5c49724094edb027ac3b5 100644 (file)
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
 namespace Content.Shared.Overlays;
 
 /// <summary>
-/// This component allows you to see job icons above mobs.
+///     This component allows you to see job icons above mobs.
 /// </summary>
 [RegisterComponent, NetworkedComponent]
-public sealed partial class ShowSecurityIconsComponent : Component { }
+public sealed partial class ShowJobIconsComponent : Component { }
diff --git a/Content.Shared/Overlays/ShowMindShieldIconsComponent.cs b/Content.Shared/Overlays/ShowMindShieldIconsComponent.cs
new file mode 100644 (file)
index 0000000..624d5ab
--- /dev/null
@@ -0,0 +1,9 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Overlays;
+
+/// <summary>
+///     This component allows you to see mindshield icons above mobs.
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class ShowMindShieldIconsComponent : Component { }
index 74a67db694aaaa4a27efc3efbde2950f45035aae..a63eae8e466c25d745196e2a241689b1a6945afc 100644 (file)
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
 namespace Content.Shared.Overlays;
 
 /// <summary>
-/// 
+///     This component allows you to identify members of the Syndicate faction.
 /// </summary>
 [RegisterComponent, NetworkedComponent]
 public sealed partial class ShowSyndicateIconsComponent : Component {}
index 905ab07fe235ff63abb120399e305bee93c3089b..1914034e9e33077a81b3d2ca3f593f553c729226 100644 (file)
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
 namespace Content.Shared.Overlays;
 
 /// <summary>
-/// This component allows you to see the thirstiness of mobs.
+///     This component allows you to see the thirstiness of mobs.
 /// </summary>
 [RegisterComponent, NetworkedComponent]
 public sealed partial class ShowThirstIconsComponent : Component { }
index 24944f02dd550132fff49c293fb390404dd71e4a..7ad21ba93aab5d1da2111c54205a17193ba95a0f 100644 (file)
     - WhitelistChameleon
 
 - type: entity
-  parent: ClothingEyesBase
+  parent: [ClothingEyesBase, ShowSecurityIcons]
   id: ClothingEyesGlassesSecurity
   name: security glasses
   description: Upgraded sunglasses that provide flash immunity and a security HUD.
   - type: GuideHelp
     guides:
     - Security
-  - type: ShowSecurityIcons
   - type: IdentityBlocker
     coverage: EYES
 
index 1b01ce1514df74497da113861dd47ab9bf3e57eb..9c29b17b3456651f9c72387fd59ac0ceaafbb708 100644 (file)
@@ -1,3 +1,13 @@
+- type: entity
+  id: ShowSecurityIcons
+  abstract: true
+  noSpawn: true
+  components:
+  - type: ShowJobIcons
+  - type: ShowMindShieldIcons
+  - type: ShowCriminalRecordIcons
+
+
 - type: entity
   parent: ClothingEyesBase
   id: ClothingEyesHudDiagnostic
@@ -17,7 +27,7 @@
   parent: ClothingEyesBase
   id: ClothingEyesHudMedical
   name: medical hud
-  description: A heads-up display that scans the humanoids in view and provides accurate data about their health status. 
+  description: A heads-up display that scans the humanoids in view and provides accurate data about their health status.
   components:
   - type: Sprite
     sprite: Clothing/Eyes/Hud/med.rsi
@@ -34,7 +44,7 @@
     - HudMedical
 
 - type: entity
-  parent: ClothingEyesBase
+  parent: [ClothingEyesBase, ShowSecurityIcons]
   id: ClothingEyesHudSecurity
   name: security hud
   description: A heads-up display that scans the humanoids in view and provides accurate data about their ID status and security records.
@@ -43,7 +53,6 @@
     sprite: Clothing/Eyes/Hud/sec.rsi
   - type: Clothing
     sprite: Clothing/Eyes/Hud/sec.rsi
-  - type: ShowSecurityIcons
   - type: Tag
     tags:
     - HudSecurity
   - type: ShowThirstIcons
 
 - type: entity
-  parent: ClothingEyesBase
+  parent: [ClothingEyesBase, ShowSecurityIcons]
   id: ClothingEyesHudMedSec
   name: medsec hud
   description: An eye display that looks like a mixture of medical and security huds.
   - type: Construction
     graph: HudMedSec
     node: medsecHud
-  - type: ShowSecurityIcons
   - type: ShowHealthBars
     damageContainers:
     - Biological
 
 - type: entity
-  parent: ClothingEyesBase
+  parent: [ClothingEyesBase, ShowSecurityIcons]
   id: ClothingEyesHudMultiversal
   name: multiversal hud
   description: Filler
     sprite: Clothing/Eyes/Hud/medsecengi.rsi
   - type: Clothing
     sprite: Clothing/Eyes/Hud/medsecengi.rsi
-  - type: ShowSecurityIcons
   - type: ShowHealthBars
     damageContainers:
     - Biological
   - type: ShowSyndicateIcons
 
 - type: entity
-  parent: ClothingEyesBase
+  parent: [ClothingEyesBase, ShowSecurityIcons]
   id: ClothingEyesHudOmni
   name: omni hud
   description: Filler
     sprite: Clothing/Eyes/Hud/omni.rsi
   - type: Clothing
     sprite: Clothing/Eyes/Hud/omni.rsi
-  - type: ShowSecurityIcons
   - type: ShowHealthBars
     damageContainers:
     - Biological
   - type: ShowSyndicateIcons
 
 - type: entity
-  parent: ClothingEyesBase
+  parent: [ClothingEyesBase, ShowSecurityIcons]
   id: ClothingEyesHudSyndicate
   name: syndicate visor
   description: The syndicate's professional head-up display, designed for better detection of humanoids and their subsequent elimination.
   - type: Clothing
     sprite: Clothing/Eyes/Hud/synd.rsi
   - type: ShowSyndicateIcons
-  - type: ShowSecurityIcons
 
 - type: entity
   parent: ClothingEyesBase
     - Biological
 
 - type: entity
-  parent: ClothingEyesGlassesSunglasses
+  parent: [ClothingEyesGlassesSunglasses, ShowSecurityIcons]
   id: ClothingEyesGlassesHiddenSecurity
   suffix: Syndicate
-  components:
-  - type: ShowSecurityIcons
 
 - type: entity
   parent: ClothingEyesHudMedical
index 9ca99f9982296b3f73bd8f16d4ae566b91b1f8a5..9907c5f71feb9080e5f5af41e13c9a225a84def3 100644 (file)
     - AllAccess
   - type: AccessReader
     access: [["Command"], ["Research"]]
-  - type: ShowSecurityIcons
+  - type: ShowJobIcons
+  - type: ShowMindShieldIcons
 
 - type: entity
   id: BaseBorgChassisSyndicate