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;
|
||||||
|
using Content.Shared.Buckle.Components;
|
||||||
using Content.Shared.Storage.Components;
|
using Content.Shared.Storage.Components;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
@@ -26,6 +27,8 @@ public sealed class FoldableSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<FoldableComponent, ContainerGettingInsertedAttemptEvent>(OnInsertEvent);
|
SubscribeLocalEvent<FoldableComponent, ContainerGettingInsertedAttemptEvent>(OnInsertEvent);
|
||||||
SubscribeLocalEvent<FoldableComponent, StoreMobInItemContainerAttemptEvent>(OnStoreThisAttempt);
|
SubscribeLocalEvent<FoldableComponent, StoreMobInItemContainerAttemptEvent>(OnStoreThisAttempt);
|
||||||
SubscribeLocalEvent<FoldableComponent, StorageOpenAttemptEvent>(OnFoldableOpenAttempt);
|
SubscribeLocalEvent<FoldableComponent, StorageOpenAttemptEvent>(OnFoldableOpenAttempt);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<FoldableComponent, BuckleAttemptEvent>(OnBuckleAttempt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGetState(EntityUid uid, FoldableComponent component, ref ComponentGetState args)
|
private void OnGetState(EntityUid uid, FoldableComponent component, ref ComponentGetState args)
|
||||||
@@ -61,6 +64,12 @@ public sealed class FoldableSystem : EntitySystem
|
|||||||
args.Cancelled = true;
|
args.Cancelled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnBuckleAttempt(EntityUid uid, FoldableComponent comp, ref BuckleAttemptEvent args)
|
||||||
|
{
|
||||||
|
if (args.Buckling && comp.IsFolded)
|
||||||
|
args.Cancelled = true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns false if the entity isn't foldable.
|
/// Returns false if the entity isn't foldable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user