]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Syringe QoL improvements (#25480)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Mon, 4 Mar 2024 05:07:11 +0000 (21:07 -0800)
committerGitHub <noreply@github.com>
Mon, 4 Mar 2024 05:07:11 +0000 (01:07 -0400)
Co-authored-by: Plykiya <plykiya@protonmail.com>
Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs
Resources/Locale/en-US/chemistry/components/injector-component.ftl

index a4497c0bd657a7c99ad48415f56acbe0b3c5e732..0846d35477781c073c00e58dacce857de6e081f2 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Server.Body.Components;
+using Content.Server.Body.Components;
 using Content.Server.Body.Systems;
 using Content.Shared.Chemistry;
 using Content.Shared.Chemistry.Components;
@@ -115,7 +115,14 @@ public sealed class InjectorSystem : SharedInjectorSystem
     private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target, EntityUid user)
     {
         // Create a pop-up for the user
-        Popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user);
+        if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
+        {
+            Popup.PopupEntity(Loc.GetString("injector-component-drawing-user"), target, user);
+        }
+        else
+        {
+            Popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user);
+        }
 
         if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out _, out var solution))
             return;
@@ -131,8 +138,17 @@ public sealed class InjectorSystem : SharedInjectorSystem
         {
             // Create a pop-up for the target
             var userName = Identity.Entity(user, EntityManager);
-            Popup.PopupEntity(Loc.GetString("injector-component-injecting-target",
-                ("user", userName)), user, target);
+            if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
+            {
+                Popup.PopupEntity(Loc.GetString("injector-component-drawing-target",
+    ("user", userName)), user, target);
+            }
+            else
+            {
+                Popup.PopupEntity(Loc.GetString("injector-component-injecting-target",
+    ("user", userName)), user, target);
+            }
+
 
             // Check if the target is incapacitated or in combat mode and modify time accordingly.
             if (MobState.IsIncapacitated(target))
index 7ad21702817e897d6d6032ccdcf47e9d77e5135c..dad8eb40910838edc96dd9815d102b025d39e675 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Shared.Administration.Logs;
+using Content.Shared.Administration.Logs;
 using Content.Shared.Chemistry.Components;
 using Content.Shared.CombatMode;
 using Content.Shared.DoAfter;
@@ -94,16 +94,34 @@ public abstract class SharedInjectorSystem : EntitySystem
         if (injector.Comp.InjectOnly)
             return;
 
+        if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out var solEnt, out var solution))
+            return;
+
         string msg;
+
         switch (injector.Comp.ToggleState)
         {
             case InjectorToggleMode.Inject:
-                SetMode(injector, InjectorToggleMode.Draw);
-                msg = "injector-component-drawing-text";
+                if (solution.AvailableVolume > 0) // If solution has empty space to fill up, allow toggling to draw
+                {
+                    SetMode(injector, InjectorToggleMode.Draw);
+                    msg = "injector-component-drawing-text";
+                }
+                else
+                {
+                    msg = "injector-component-cannot-toggle-draw-message";
+                }
                 break;
             case InjectorToggleMode.Draw:
-                SetMode(injector, InjectorToggleMode.Inject);
-                msg = "injector-component-injecting-text";
+                if (solution.Volume > 0) // If solution has anything in it, allow toggling to inject
+                {
+                    SetMode(injector, InjectorToggleMode.Inject);
+                    msg = "injector-component-injecting-text";
+                }
+                else
+                {
+                    msg = "injector-component-cannot-toggle-inject-message";
+                }
                 break;
             default:
                 throw new ArgumentOutOfRangeException();
index 4fafc9cd3bbc2235c7c42e9dc6ac7a45ccd821b5..24f524081e0d3500a41e3b002b3f32140f92a23f 100644 (file)
@@ -18,8 +18,12 @@ injector-component-transfer-success-message = You transfer {$amount}u into {$tar
 injector-component-draw-success-message = You draw {$amount}u from {$target}.
 injector-component-target-already-full-message = {$target} is already full!
 injector-component-target-is-empty-message = {$target} is empty!
+injector-component-cannot-toggle-draw-message = Too full to draw!
+injector-component-cannot-toggle-inject-message = Nothing to inject!
 
 ## mob-inject doafter messages
 
-injector-component-injecting-user = You start inserting the needle.
-injector-component-injecting-target = {CAPITALIZE(THE($user))} is trying to stick a needle into you!
+injector-component-drawing-user = You start drawing the needle.
+injector-component-injecting-user = You start injecting the needle.
+injector-component-drawing-target = {CAPITALIZE(THE($user))} is trying to use a needle to draw from you!
+injector-component-injecting-target = {CAPITALIZE(THE($user))} is trying to inject a needle into you!