From: Krunklehorn <42424291+Krunklehorn@users.noreply.github.com> Date: Sun, 21 Jan 2024 06:32:47 +0000 (-0500) Subject: Cancel CanBuckle before popup for foldable items (#24358) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b126aadd9cb867e9d64e10acce48d759385c1659;p=space-station-14.git Cancel CanBuckle before popup for foldable items (#24358) * Cancel CanBuckle before popup for foldable items * Moved to FoldableSystem --- 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. ///