]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Hypo can inject solutions back into beakers (#19877)
authorVasilis <vasilis@pikachu.systems>
Thu, 7 Sep 2023 16:49:02 +0000 (18:49 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Sep 2023 16:49:02 +0000 (09:49 -0700)
* Inject to beakers

* Stop fighting in my pr

* Review

Content.Server/Chemistry/Components/HyposprayComponent.cs
Content.Server/Chemistry/EntitySystems/ChemistrySystemHypospray.cs
Resources/Prototypes/Entities/Objects/Specific/Medical/hypospray.yml

index cddbd178880fd99d5289d1f952b3035ddaf63a1f..76bb0e8d418a05d965b2be95e4aa8e84540ef756 100644 (file)
@@ -19,5 +19,11 @@ namespace Content.Server.Chemistry.Components
 
         [DataField("injectSound")]
         public SoundSpecifier InjectSound = new SoundPathSpecifier("/Audio/Items/hypospray.ogg");
+
+        /// <summary>
+        /// Whether or not the hypo is able to inject only into mobs. On false you can inject into beakers/jugs
+        /// </summary>
+        [DataField("onlyMobs")]
+        public bool OnlyMobs = true;
     }
 }
index d357e46f6678df7da4965aced73a1a40376e50c2..a352d51368e073aade7b4d8d86769480011b72bc 100644 (file)
@@ -74,7 +74,7 @@ namespace Content.Server.Chemistry.EntitySystems
             if (!Resolve(uid, ref component))
                 return false;
 
-            if (!EligibleEntity(target, _entMan))
+            if (!EligibleEntity(target, _entMan, component))
                 return false;
 
             if (TryComp(uid, out UseDelayComponent? delayComp) && _useDelay.ActiveDelay(uid, delayComp))
@@ -84,7 +84,7 @@ namespace Content.Server.Chemistry.EntitySystems
 
             if (target == user)
                 msgFormat = "hypospray-component-inject-self-message";
-            else if (EligibleEntity(user, _entMan) && _interaction.TryRollClumsy(user, component.ClumsyFailChance))
+            else if (EligibleEntity(user, _entMan, component) && _interaction.TryRollClumsy(user, component.ClumsyFailChance))
             {
                 msgFormat = "hypospray-component-inject-self-clumsy-message";
                 target = user;
@@ -143,13 +143,15 @@ namespace Content.Server.Chemistry.EntitySystems
             return true;
         }
 
-        static bool EligibleEntity([NotNullWhen(true)] EntityUid? entity, IEntityManager entMan)
+        static bool EligibleEntity([NotNullWhen(true)] EntityUid? entity, IEntityManager entMan, HyposprayComponent component)
         {
             // TODO: Does checking for BodyComponent make sense as a "can be hypospray'd" tag?
             // In SS13 the hypospray ONLY works on mobs, NOT beakers or anything else.
-
-            return entMan.HasComponent<SolutionContainerManagerComponent>(entity)
-                && entMan.HasComponent<MobStateComponent>(entity);
+            // But this is 14, we dont do what SS13 does just because SS13 does it.
+            return component.OnlyMobs
+                ? entMan.HasComponent<SolutionContainerManagerComponent>(entity) &&
+                  entMan.HasComponent<MobStateComponent>(entity)
+                : entMan.HasComponent<SolutionContainerManagerComponent>(entity);
         }
     }
 }
index 2dc5555c0372a45c30dd4a10b3433b5490ebfc5d..fb234194f978bab02cc0dc2418a79dba1eed0d81 100644 (file)
@@ -18,6 +18,7 @@
   - type: ExaminableSolution
     solution: hypospray
   - type: Hypospray
+    onlyMobs: false
   - type: UseDelay
     delay: 0.5
   - type: StaticPrice
@@ -46,6 +47,7 @@
   - type: ExaminableSolution
     solution: hypospray
   - type: Hypospray
+    onlyMobs: false
   - type: UseDelay
     delay: 0.5
 
   - type: ExaminableSolution
     solution: hypospray
   - type: Hypospray
+    onlyMobs: false
   - type: UseDelay
     delay: 0.5
   - type: StaticPrice # A new shitcurity meta