From 664d2b14b98087be495f59173dd2092004b0942c Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Sun, 10 Dec 2023 19:54:41 +0100 Subject: [PATCH] Don't allow disarm on incapacitated targets (#22298) --- Content.Server/Weapons/Melee/MeleeWeaponSystem.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs index 3d9c3e8219..0e085cdfe0 100644 --- a/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs @@ -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(target, out var targetHandsComponent)) { if (!TryComp(target, out var status) || !status.AllowedEffects.Contains("KnockedDown"))