]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
prevent nettles from injecting through hardsuit (#14895)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Tue, 11 Apr 2023 02:19:43 +0000 (02:19 +0000)
committerGitHub <noreply@github.com>
Tue, 11 Apr 2023 02:19:43 +0000 (19:19 -0700)
* prevent nettles from injecting through hardsuit

* pro

* better

* pro

* pro

* noob

* inject popup

* caution

* )

* ;

* :skull:

* :skull:

* scaf + bomb suit immune to nettle

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/Chemistry/Components/MeleeChemicalInjectorComponent.cs
Content.Server/Weapons/Melee/MeleeWeaponSystem.cs
Resources/Locale/en-US/weapons/melee/melee.ftl [new file with mode: 0644]
Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml
Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml
Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml
Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml
Resources/Prototypes/tags.yml

index 4b855f759a7024aec7fe8120af3f11157c734c4c..2042c1d212346ae68541cf648ac36c1ba943da8d 100644 (file)
@@ -15,6 +15,12 @@ namespace Content.Server.Chemistry.Components
         [DataField("transferEfficiency")]
         private float _transferEfficiency = 1f;
 
+        /// <summary>
+        /// Whether this will inject through hardsuits or not.
+        /// </summary>
+        [DataField("pierceArmor"), ViewVariables(VVAccess.ReadWrite)]
+        public bool PierceArmor = true;
+
         /// <summary>
         ///     Solution to inject from.
         /// </summary>
index 7d8c0873e96cc075af40686490eecb3309dd1c45..c354a82bcc7fc2ae3452ad42dc265d142e44f433 100644 (file)
@@ -15,7 +15,10 @@ using Content.Shared.Database;
 using Content.Shared.FixedPoint;
 using Content.Shared.Hands.Components;
 using Content.Shared.IdentityManagement;
+using Content.Shared.Inventory;
+using Content.Shared.Popups;
 using Content.Shared.StatusEffect;
+using Content.Shared.Tag;
 using Content.Shared.Verbs;
 using Content.Shared.Weapons.Melee;
 using Content.Shared.Weapons.Melee.Events;
@@ -35,8 +38,10 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
     [Dependency] private readonly BloodstreamSystem _bloodstream = default!;
     [Dependency] private readonly ContestsSystem _contests = default!;
     [Dependency] private readonly ExamineSystem _examine = default!;
+    [Dependency] private readonly InventorySystem _inventory = default!;
     [Dependency] private readonly LagCompensationSystem _lag = default!;
     [Dependency] private readonly SolutionContainerSystem _solutions = default!;
+    [Dependency] private readonly TagSystem _tag = default!;
 
     public override void Initialize()
     {
@@ -254,6 +259,13 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
             if (Deleted(entity))
                 continue;
 
+            // prevent deathnettles injecting through hardsuits
+            if (!comp.PierceArmor && _inventory.TryGetSlotEntity(entity, "outerClothing", out var suit) && _tag.HasTag(suit.Value, "Hardsuit"))
+            {
+                PopupSystem.PopupEntity(Loc.GetString("melee-inject-failed-hardsuit", ("weapon", owner)), args.User, args.User, PopupType.SmallCaution);
+                continue;
+            }
+
             if (bloodQuery.TryGetComponent(entity, out var bloodstream))
                 hitBloodstreams.Add((entity, bloodstream));
         }
diff --git a/Resources/Locale/en-US/weapons/melee/melee.ftl b/Resources/Locale/en-US/weapons/melee/melee.ftl
new file mode 100644 (file)
index 0000000..ad18c43
--- /dev/null
@@ -0,0 +1 @@
+melee-inject-failed-hardsuit = Your {$weapon} cannot inject through hardsuits!
index e15cfebf98eb1dfa2ffac26e4921a184a5a771bb..a270f4a9591d8c7bbacc547da794e7c35508289e 100644 (file)
   - type: ExplosionResistance
     damageCoefficient: 0.8
   - type: GroupExamine
+  - type: Tag
+    tags:
+    - Hardsuit
 
 - type: entity
   parent: ClothingOuterBaseLarge
index af41be3c40cd41f50fe5b0a2326b6ab6a37f0bdc..aed8e690350d06a4867107333df8b1251be901ba 100644 (file)
@@ -74,6 +74,9 @@
     containers:
       toggleable-clothing: !type:ContainerSlot {}
   - type: GroupExamine
+  - type: Tag
+    tags:
+    - Hardsuit
 
 - type: entity
   abstract: true
index 5ec3c1ebafa1f38247ea7cf99892e4593cf9a3a6..8254b3e91dbbe881e946465214c37b8bdc8553e7 100644 (file)
@@ -18,6 +18,9 @@
   - type: ExplosionResistance
     damageCoefficient: 0.65
   - type: GroupExamine
+  - type: Tag
+    tags:
+    - Hardsuit
 
 - type: entity
   parent: ClothingOuterEVASuitBase
index 5910191b3641c1f8098af298e5f5d3316b98c30c..f0462227ceef79f3737d06b471ee1d9c40e0120d 100644 (file)
   - type: MeleeChemicalInjector
     transferAmount: 6 #To OD someone you would need 2 nettles and about 6-7 hits, the DOT is likely to crit them if they are running away with almost no health
     solution: food
+    pierceArmor: false
   - type: Extractable
     grindableSolutionName: food
 
index f7870ccdc6ec0aaa6ad2ab26c15188b834313be7..8b4550abc111e6da3badea72efca5f3d309e870e 100644 (file)
 - type: Tag
   id: Handcuffs
 
+- type: Tag
+  id: Hardsuit # Prevent melee injectors that can't penetrate hardsuits from injecting the wearer (nettles)
+
 - type: Tag
   id: Head