From 5f1c224d54a4815cef1ea7f62282ea2f76a6d0d1 Mon Sep 17 00:00:00 2001 From: Debug <49997488+DebugOk@users.noreply.github.com> Date: Mon, 12 Feb 2024 19:13:46 +0100 Subject: [PATCH] Cancel attack events --- .../Nyanotrasen/Item/PseudoItem/SharedPseudoItemSystem.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Content.Shared/Nyanotrasen/Item/PseudoItem/SharedPseudoItemSystem.cs b/Content.Shared/Nyanotrasen/Item/PseudoItem/SharedPseudoItemSystem.cs index 2705cff8dc6..4b7910746f1 100644 --- a/Content.Shared/Nyanotrasen/Item/PseudoItem/SharedPseudoItemSystem.cs +++ b/Content.Shared/Nyanotrasen/Item/PseudoItem/SharedPseudoItemSystem.cs @@ -32,6 +32,7 @@ public override void Initialize() SubscribeLocalEvent(OnInsertAttempt); SubscribeLocalEvent(OnInteractAttempt); SubscribeLocalEvent(OnDoAfter); + SubscribeLocalEvent(OnAttackAttempt); } private void AddInsertVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent args) @@ -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(); + } }