Don't allow incapacitated mobs to attack (#11594)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState;
|
||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.MobState.EntitySystems;
|
using Content.Shared.MobState.EntitySystems;
|
||||||
@@ -26,6 +27,13 @@ public sealed partial class MobStateSystem : SharedMobStateSystem
|
|||||||
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttach);
|
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttach);
|
||||||
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetach);
|
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetach);
|
||||||
SubscribeLocalEvent<MobStateComponent, ComponentHandleState>(OnMobHandleState);
|
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()
|
public override void Shutdown()
|
||||||
|
|||||||
Reference in New Issue
Block a user