From b126aadd9cb867e9d64e10acce48d759385c1659 Mon Sep 17 00:00:00 2001 From: Krunklehorn <42424291+Krunklehorn@users.noreply.github.com> Date: Sun, 21 Jan 2024 01:32:47 -0500 Subject: [PATCH] Cancel CanBuckle before popup for foldable items (#24358) * Cancel CanBuckle before popup for foldable items * Moved to FoldableSystem --- Content.Shared/Foldable/FoldableSystem.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Content.Shared/Foldable/FoldableSystem.cs b/Content.Shared/Foldable/FoldableSystem.cs index 7bf00a5d24..6f2e9f3ee5 100644 --- a/Content.Shared/Foldable/FoldableSystem.cs +++ b/Content.Shared/Foldable/FoldableSystem.cs @@ -1,4 +1,5 @@ using Content.Shared.Buckle; +using Content.Shared.Buckle.Components; using Content.Shared.Storage.Components; using Content.Shared.Verbs; using Robust.Shared.Containers; @@ -26,6 +27,8 @@ public sealed class FoldableSystem : EntitySystem SubscribeLocalEvent(OnInsertEvent); SubscribeLocalEvent(OnStoreThisAttempt); SubscribeLocalEvent(OnFoldableOpenAttempt); + + SubscribeLocalEvent(OnBuckleAttempt); } private void OnGetState(EntityUid uid, FoldableComponent component, ref ComponentGetState args) @@ -61,6 +64,12 @@ public sealed class FoldableSystem : EntitySystem args.Cancelled = true; } + public void OnBuckleAttempt(EntityUid uid, FoldableComponent comp, ref BuckleAttemptEvent args) + { + if (args.Buckling && comp.IsFolded) + args.Cancelled = true; + } + /// /// Returns false if the entity isn't foldable. /// -- 2.51.2