Cancel CanBuckle before popup for foldable items (#24358)
* Cancel CanBuckle before popup for foldable items * Moved to FoldableSystem (cherry picked from commit b126aadd9cb867e9d64e10acce48d759385c1659)
This commit is contained in:
parent
8e99c422f4
commit
5f2c241f9e
|
|
@ -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<FoldableComponent, ContainerGettingInsertedAttemptEvent>(OnInsertEvent);
|
||||
SubscribeLocalEvent<FoldableComponent, StoreMobInItemContainerAttemptEvent>(OnStoreThisAttempt);
|
||||
SubscribeLocalEvent<FoldableComponent, StorageOpenAttemptEvent>(OnFoldableOpenAttempt);
|
||||
|
||||
SubscribeLocalEvent<FoldableComponent, BuckleAttemptEvent>(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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns false if the entity isn't foldable.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue