From 27e325b94b3fd964ee71837287d8a063c900eefe Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 29 Sep 2022 17:33:09 +1000 Subject: [PATCH] Don't allow incapacitated mobs to attack (#11594) --- Content.Client/MobState/MobStateSystem.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Content.Client/MobState/MobStateSystem.cs b/Content.Client/MobState/MobStateSystem.cs index 4753a0fd9b..64edff1ace 100644 --- a/Content.Client/MobState/MobStateSystem.cs +++ b/Content.Client/MobState/MobStateSystem.cs @@ -1,5 +1,6 @@ using Content.Shared.Damage; using Content.Shared.FixedPoint; +using Content.Shared.Interaction.Events; using Content.Shared.MobState; using Content.Shared.MobState.Components; using Content.Shared.MobState.EntitySystems; @@ -26,6 +27,13 @@ public sealed partial class MobStateSystem : SharedMobStateSystem SubscribeLocalEvent(OnPlayerAttach); SubscribeLocalEvent(OnPlayerDetach); SubscribeLocalEvent(OnMobHandleState); + SubscribeLocalEvent(OnAttack); + } + + private void OnAttack(EntityUid uid, MobStateComponent component, AttackAttemptEvent args) + { + if (IsIncapacitated(uid, component)) + args.Cancel(); } public override void Shutdown()