Don't allow disarm on incapacitated targets (#22298)

This commit is contained in:
Errant
2023-12-10 19:54:41 +01:00
committed by GitHub
parent 46e36934a6
commit 664d2b14b9

View 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"))