]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix: Prevent single-use hyposprays from getting the toggle draw verb (#26595)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Sun, 31 Mar 2024 05:20:48 +0000 (22:20 -0700)
committerGitHub <noreply@github.com>
Sun, 31 Mar 2024 05:20:48 +0000 (16:20 +1100)
Prevent single-use hyposprays from getting the toggle draw verb

Co-authored-by: Plykiya <plykiya@protonmail.com>
Content.Shared/Chemistry/Components/HyposprayComponent.cs
Content.Shared/Chemistry/EntitySystems/SharedHypospraySystem.cs
Resources/Prototypes/Entities/Objects/Specific/Medical/hypospray.yml

index 05d202aaaa36d6d47bb7065124fb63fee1e0c79e..05ef84bbaf757932326a0c200b0b8cdd963d5e9c 100644 (file)
@@ -30,4 +30,11 @@ public sealed partial class HyposprayComponent : Component
     [AutoNetworkedField]
     [DataField(required: true)]
     public bool OnlyAffectsMobs = false;
+
+    /// <summary>
+    /// Whether or not the hypospray is able to draw from containers or if it's a single use
+    /// device that can only inject.
+    /// </summary>
+    [DataField]
+    public bool InjectOnly = false;
 }
index f91e5621f0ae0a3bf697e550d243762146b51e65..b647d33c98c195918cb7c21496542fff94d5f1dd 100644 (file)
@@ -27,7 +27,7 @@ public abstract class SharedHypospraySystem : EntitySystem
     // </summary>
     private void AddToggleModeVerb(Entity<HyposprayComponent> entity, ref GetVerbsEvent<AlternativeVerb> args)
     {
-        if (!args.CanAccess || !args.CanInteract || args.Hands == null)
+        if (!args.CanAccess || !args.CanInteract || args.Hands == null || entity.Comp.InjectOnly)
             return;
 
         var (_, component) = entity;
index dbc78a8409859c46cd7d111c97a8f7f4c17973cc..d6f3ee75fa6bed5f105fc00b59f37089ca193cd2 100644 (file)
     solutionName: pen
     transferAmount: 15
     onlyAffectsMobs: false
+    injectOnly: true
   - type: Appearance
   - type: SolutionContainerVisuals
     maxFillLevels: 1
     solutionName: pen
     transferAmount: 20
     onlyAffectsMobs: false
+    injectOnly: true
   - type: SolutionContainerManager
     solutions:
       pen:
     solutionName: pen
     transferAmount: 20
     onlyAffectsMobs: false
+    injectOnly: true
   - type: SolutionContainerManager
     solutions:
       pen:
     solutionName: pen
     transferAmount: 20
     onlyAffectsMobs: false
+    injectOnly: true
+
   - type: SolutionContainerManager
     solutions:
       pen:
     solutionName: pen
     transferAmount: 30
     onlyAffectsMobs: false
+    injectOnly: true
   - type: SolutionContainerManager
     solutions:
       pen:
     solutionName: pen
     transferAmount: 30
     onlyAffectsMobs: false
+    injectOnly: true
   - type: StaticPrice
     price: 500
   - type: Tag
     solutionName: pen
     transferAmount: 30
     onlyAffectsMobs: false
+    injectOnly: true
   - type: StaticPrice
     price: 500
   - type: Tag