Skip to content

Commit

Permalink
Cancel attack events
Browse files Browse the repository at this point in the history
  • Loading branch information
DebugOk committed Feb 12, 2024
1 parent 3e843a9 commit 5f1c224
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public override void Initialize()
SubscribeLocalEvent<PseudoItemComponent, ContainerGettingInsertedAttemptEvent>(OnInsertAttempt);
SubscribeLocalEvent<PseudoItemComponent, InteractionAttemptEvent>(OnInteractAttempt);
SubscribeLocalEvent<PseudoItemComponent, PseudoItemInsertDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<PseudoItemComponent, AttackAttemptEvent>(OnAttackAttempt);
}

private void AddInsertVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent<InnateVerb> args)
Expand Down Expand Up @@ -155,4 +156,10 @@ protected void StartInsertDoAfter(EntityUid inserter, EntityUid toInsert, Entity

_doAfter.TryStartDoAfter(args);
}

private void OnAttackAttempt(EntityUid uid, PseudoItemComponent component, AttackAttemptEvent args)
{
if (component.Active)
args.Cancel();
}
}

0 comments on commit 5f1c224

Please sign in to comment.