]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Station AI has their name displayed in announcements now. (#31802)
authorScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Tue, 3 Sep 2024 22:05:02 +0000 (00:05 +0200)
committerGitHub <noreply@github.com>
Tue, 3 Sep 2024 22:05:02 +0000 (00:05 +0200)
* Station AI has their name displayed in announcements now.

* I'm so sorry

* Corrections

* part 2

* part 3 :|

* part 4

* Whitespace

* Fixing whitespace part 1

* No more whitespace

* PLEASE NO MORE WHITESPACE

Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs

index a6c57f5940012e2f15fedf96f23c2c62e5625526..c59c4723079aa50700665ab93136c15f4e23fdaf 100644 (file)
@@ -1,5 +1,6 @@
 using System.Diagnostics.CodeAnalysis;
 using Content.Shared.Actions.Events;
+using Content.Shared.IdentityManagement;
 using Content.Shared.Interaction.Events;
 using Content.Shared.Verbs;
 using Robust.Shared.Serialization;
@@ -12,6 +13,9 @@ public abstract partial class SharedStationAiSystem
     /*
      * Added when an entity is inserted into a StationAiCore.
      */
+        
+       //TODO: Fix this, please
+       private const string JobNameLocId = "job-name-station-ai";
 
     private void InitializeHeld()
     {
@@ -22,6 +26,22 @@ public abstract partial class SharedStationAiSystem
         SubscribeLocalEvent<StationAiHeldComponent, InteractionAttemptEvent>(OnHeldInteraction);
         SubscribeLocalEvent<StationAiHeldComponent, AttemptRelayActionComponentChangeEvent>(OnHeldRelay);
         SubscribeLocalEvent<StationAiHeldComponent, JumpToCoreEvent>(OnCoreJump);
+               SubscribeLocalEvent<TryGetIdentityShortInfoEvent>(OnTryGetIdentityShortInfo);
+    }
+       
+       private void OnTryGetIdentityShortInfo(TryGetIdentityShortInfoEvent args)
+    {
+        if (args.Handled)
+        {
+            return;
+        }
+
+        if (!HasComp<StationAiHeldComponent>(args.ForActor))
+        {
+            return;
+        }
+           args.Title = $"{Name(args.ForActor)} ({Loc.GetString(JobNameLocId)})";
+        args.Handled = true;
     }
 
     private void OnCoreJump(Entity<StationAiHeldComponent> ent, ref JumpToCoreEvent args)