]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Predict ExamineEvent for CryoPodSystem. (#39322)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Fri, 1 Aug 2025 19:38:39 +0000 (15:38 -0400)
committerGitHub <noreply@github.com>
Fri, 1 Aug 2025 19:38:39 +0000 (21:38 +0200)
commit

Content.Server/Medical/CryoPodSystem.cs
Content.Shared/Medical/Cryogenics/SharedCryoPodSystem.cs

index 1160f6aa17c2ae6677e454ba00bd83419d8aa7d3..2eb85fe42900e6c7ce050a3b3bc7fb481ddf16e3 100644 (file)
@@ -68,7 +68,6 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem
         SubscribeLocalEvent<CryoPodComponent, AtmosDeviceUpdateEvent>(OnCryoPodUpdateAtmosphere);
         SubscribeLocalEvent<CryoPodComponent, DragDropTargetEvent>(HandleDragDropOn);
         SubscribeLocalEvent<CryoPodComponent, InteractUsingEvent>(OnInteractUsing);
-        SubscribeLocalEvent<CryoPodComponent, ExaminedEvent>(OnExamined);
         SubscribeLocalEvent<CryoPodComponent, PowerChangedEvent>(OnPowerChanged);
         SubscribeLocalEvent<CryoPodComponent, GasAnalyzerScanEvent>(OnGasAnalyzed);
         SubscribeLocalEvent<CryoPodComponent, ActivatableUIOpenAttemptEvent>(OnActivateUIAttempt);
@@ -218,22 +217,6 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem
         args.Handled = _toolSystem.UseTool(args.Used, args.User, entity.Owner, entity.Comp.PryDelay, PryingQuality, new CryoPodPryFinished());
     }
 
-    private void OnExamined(Entity<CryoPodComponent> entity, ref ExaminedEvent args)
-    {
-        var container = _itemSlotsSystem.GetItemOrNull(entity.Owner, entity.Comp.SolutionContainerName);
-        if (args.IsInDetailsRange && container != null && _solutionContainerSystem.TryGetFitsInDispenser(container.Value, out _, out var containerSolution))
-        {
-            using (args.PushGroup(nameof(CryoPodComponent)))
-            {
-                args.PushMarkup(Loc.GetString("cryo-pod-examine", ("beaker", Name(container.Value))));
-                if (containerSolution.Volume == 0)
-                {
-                    args.PushMarkup(Loc.GetString("cryo-pod-empty-beaker"));
-                }
-            }
-        }
-    }
-
     private void OnPowerChanged(Entity<CryoPodComponent> entity, ref PowerChangedEvent args)
     {
         // Needed to avoid adding/removing components on a deleted entity
index 8d7eb05cd9152ca055f8c2dfe18b6e739077a2f3..f45ecc0934223a8537155ef8ab112c8e23bc8e24 100644 (file)
@@ -1,9 +1,12 @@
 using Content.Shared.Administration.Logs;
 using Content.Shared.Body.Components;
+using Content.Shared.Chemistry.EntitySystems;
+using Content.Shared.Containers.ItemSlots;
 using Content.Shared.Database;
 using Content.Shared.DoAfter;
 using Content.Shared.DragDrop;
 using Content.Shared.Emag.Systems;
+using Content.Shared.Examine;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Mobs.Systems;
 using Content.Shared.Popups;
@@ -20,10 +23,12 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
     [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
     [Dependency] private readonly StandingStateSystem _standingStateSystem = default!;
     [Dependency] private readonly EmagSystem _emag = default!;
+    [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
     [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
     [Dependency] private readonly SharedPointLightSystem _light = default!;
+    [Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
 
     public override void Initialize()
@@ -31,9 +36,26 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         base.Initialize();
 
         SubscribeLocalEvent<CryoPodComponent, CanDropTargetEvent>(OnCryoPodCanDropOn);
+        SubscribeLocalEvent<CryoPodComponent, ExaminedEvent>(OnExamined);
         InitializeInsideCryoPod();
     }
 
+    private void OnExamined(Entity<CryoPodComponent> entity, ref ExaminedEvent args)
+    {
+        var container = _itemSlotsSystem.GetItemOrNull(entity.Owner, entity.Comp.SolutionContainerName);
+        if (args.IsInDetailsRange && container != null && _solutionContainerSystem.TryGetFitsInDispenser(container.Value, out _, out var containerSolution))
+        {
+            using (args.PushGroup(nameof(CryoPodComponent)))
+            {
+                args.PushMarkup(Loc.GetString("cryo-pod-examine", ("beaker", Name(container.Value))));
+                if (containerSolution.Volume == 0)
+                {
+                    args.PushMarkup(Loc.GetString("cryo-pod-empty-beaker"));
+                }
+            }
+        }
+    }
+
     private void OnCryoPodCanDropOn(EntityUid uid, CryoPodComponent component, ref CanDropTargetEvent args)
     {
         if (args.Handled)