Don't allow incapacitated mobs to attack (#11594)

This commit is contained in:
metalgearsloth
2022-09-29 17:33:09 +10:00
committed by GitHub
parent 2b771461ae
commit 27e325b94b

View File

@@ -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<PlayerAttachedEvent>(OnPlayerAttach);
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetach);
SubscribeLocalEvent<MobStateComponent, ComponentHandleState>(OnMobHandleState);
SubscribeLocalEvent<MobStateComponent, AttackAttemptEvent>(OnAttack);
}
private void OnAttack(EntityUid uid, MobStateComponent component, AttackAttemptEvent args)
{
if (IsIncapacitated(uid, component))
args.Cancel();
}
public override void Shutdown()