Added insertion blocking to Strap and Foldable components (#6151)
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
using Content.Server.Buckle.Components;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -19,6 +23,14 @@ namespace Content.Server.Buckle.Systems
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<StrapComponent, GetInteractionVerbsEvent>(AddStrapVerbs);
|
||||
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnInsertAttempt);
|
||||
}
|
||||
|
||||
private void OnInsertAttempt(EntityUid uid, StrapComponent component, ContainerGettingInsertedAttemptEvent args)
|
||||
{
|
||||
// If someone is attempting to put this item inside of a backpack, ensure that it has no entities strapped to it.
|
||||
if (HasComp<SharedStorageComponent>(args.Container.Owner) && component.BuckledEntities.Count != 0)
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
// TODO ECS BUCKLE/STRAP These 'Strap' verbs are an incestuous mess of buckle component and strap component
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.Foldable
|
||||
if (!Resolve(uid, ref fold))
|
||||
return false;
|
||||
|
||||
// Can't un-fold in hands / inventory
|
||||
// Can't un-fold in any container (locker, hands, inventory, whatever).
|
||||
if (_container.IsEntityInContainer(uid))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement;
|
||||
|
||||
Reference in New Issue
Block a user