Cancel CanBuckle before popup for foldable items (#24358)
* Cancel CanBuckle before popup for foldable items * Moved to FoldableSystem
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user