using Content.Server.Storage.Components;
using Content.Shared.Buckle.Components;
using Content.Shared.Foldable;
-using Content.Shared.Storage.Components;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Containers;
{
base.Initialize();
- SubscribeLocalEvent<FoldableComponent, StorageOpenAttemptEvent>(OnFoldableOpenAttempt);
SubscribeLocalEvent<FoldableComponent, GetVerbsEvent<AlternativeVerb>>(AddFoldVerb);
- SubscribeLocalEvent<FoldableComponent, StoreMobInItemContainerAttemptEvent>(OnStoreThisAttempt);
}
-
- private void OnFoldableOpenAttempt(EntityUid uid, FoldableComponent component, ref StorageOpenAttemptEvent args)
- {
- if (component.IsFolded)
- args.Cancelled = true;
- }
-
public bool TryToggleFold(EntityUid uid, FoldableComponent comp)
{
return TrySetFolded(uid, comp, !comp.IsFolded);
/// <summary>
/// Set the folded state of the given <see cref="FoldableComponent"/>
/// </summary>
+ /// <param name="uid"></param>
/// <param name="component"></param>
/// <param name="folded">If true, the component will become folded, else unfolded</param>
public override void SetFolded(EntityUid uid, FoldableComponent component, bool folded)
_buckle.StrapSetEnabled(uid, !component.IsFolded);
}
- public void OnStoreThisAttempt(EntityUid uid, FoldableComponent comp, ref StoreMobInItemContainerAttemptEvent args)
- {
- args.Handled = true;
-
- if (comp.IsFolded)
- args.Cancelled = true;
- }
-
#region Verb
private void AddFoldVerb(EntityUid uid, FoldableComponent component, GetVerbsEvent<AlternativeVerb> args)
+using Content.Shared.Storage.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
SubscribeLocalEvent<FoldableComponent, ComponentInit>(OnFoldableInit);
SubscribeLocalEvent<FoldableComponent, ContainerGettingInsertedAttemptEvent>(OnInsertEvent);
+ SubscribeLocalEvent<FoldableComponent, StoreMobInItemContainerAttemptEvent>(OnStoreThisAttempt);
+ SubscribeLocalEvent<FoldableComponent, StorageOpenAttemptEvent>(OnFoldableOpenAttempt);
}
private void OnGetState(EntityUid uid, FoldableComponent component, ref ComponentGetState args)
SetFolded(uid, component, component.IsFolded);
}
+ private void OnFoldableOpenAttempt(EntityUid uid, FoldableComponent component, ref StorageOpenAttemptEvent args)
+ {
+ if (component.IsFolded)
+ args.Cancelled = true;
+ }
+
+ public void OnStoreThisAttempt(EntityUid uid, FoldableComponent comp, ref StoreMobInItemContainerAttemptEvent args)
+ {
+ args.Handled = true;
+
+ if (comp.IsFolded)
+ args.Cancelled = true;
+ }
+
/// <summary>
/// Set the folded state of the given <see cref="FoldableComponent"/>
/// </summary>