]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Don't allow disarm on incapacitated targets (#22298)
authorErrant <35878406+Errant-4@users.noreply.github.com>
Sun, 10 Dec 2023 18:54:41 +0000 (19:54 +0100)
committerGitHub <noreply@github.com>
Sun, 10 Dec 2023 18:54:41 +0000 (13:54 -0500)
Content.Server/Weapons/Melee/MeleeWeaponSystem.cs

index 3d9c3e821940fc9b3965a362902f1a083477717c..0e085cdfe00120710afd282f9a64567c7c59e3d4 100644 (file)
@@ -18,6 +18,7 @@ using Content.Shared.Effects;
 using Content.Shared.Hands.Components;
 using Content.Shared.IdentityManagement;
 using Content.Shared.Inventory;
+using Content.Shared.Mobs.Systems;
 using Content.Shared.Popups;
 using Content.Shared.Speech.Components;
 using Content.Shared.StatusEffect;
@@ -40,6 +41,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
     [Dependency] private readonly DamageExamineSystem _damageExamine = default!;
     [Dependency] private readonly InventorySystem _inventory = default!;
     [Dependency] private readonly LagCompensationSystem _lag = default!;
+    [Dependency] private readonly MobStateSystem _mobState = default!;
     [Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
     [Dependency] private readonly SolutionContainerSystem _solutions = default!;
     [Dependency] private readonly TagSystem _tag = default!;
@@ -101,6 +103,11 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
 
         var target = GetEntity(ev.Target!.Value);
 
+        if (_mobState.IsIncapacitated(target))
+        {
+            return false;
+        }
+
         if (!TryComp<HandsComponent>(target, out var targetHandsComponent))
         {
             if (!TryComp<StatusEffectsComponent>(target, out var status) || !status.AllowedEffects.Contains("KnockedDown"))