Remove Walking out of Containers while You can't Walk (#30391)

* Require Standing to Exit Containers

* whoops, forgot a not

* You can't walk out if cuffed

* GUAH(requested stuff)

* bwomp(tiny cleanup)
This commit is contained in:
Cojoke
2024-07-30 08:53:44 -05:00
committed by GitHub
parent 04b7b80210
commit 247222beab
4 changed files with 18 additions and 10 deletions

View File

@@ -25,7 +25,6 @@ using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Content.Shared.Verbs;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
@@ -35,7 +34,6 @@ using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Server.Disposal.Unit.EntitySystems;
@@ -331,12 +329,13 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
{
var currentTime = GameTiming.CurTime;
if (!_actionBlockerSystem.CanMove(args.Entity))
return;
if (!TryComp(args.Entity, out HandsComponent? hands) ||
hands.Count == 0 ||
currentTime < component.LastExitAttempt + ExitAttemptDelay)
{
return;
}
component.LastExitAttempt = currentTime;
Remove(uid, component, args.Entity);

View File

@@ -8,6 +8,7 @@ using Content.Shared.Popups;
using Content.Shared.Resist;
using Content.Shared.Tools.Components;
using Content.Shared.Tools.Systems;
using Content.Shared.ActionBlocker;
namespace Content.Server.Resist;
@@ -18,6 +19,7 @@ public sealed class ResistLockerSystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly WeldableSystem _weldable = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
public override void Initialize()
{
@@ -34,6 +36,9 @@ public sealed class ResistLockerSystem : EntitySystem
if (!TryComp(uid, out EntityStorageComponent? storageComponent))
return;
if (!_actionBlocker.CanMove(args.Entity))
return;
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked || _weldable.IsWelded(uid))
{
AttemptResist(args.Entity, uid, storageComponent, component);

View File

@@ -1,3 +1,4 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Burial;
using Content.Shared.Burial.Components;
using Content.Shared.DoAfter;
@@ -8,7 +9,6 @@ using Content.Shared.Popups;
using Content.Shared.Storage.Components;
using Content.Shared.Storage.EntitySystems;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
namespace Content.Server.Burial.Systems;
@@ -18,6 +18,7 @@ public sealed class BurialSystem : EntitySystem
[Dependency] private readonly SharedEntityStorageSystem _storageSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
public override void Initialize()
{
@@ -162,6 +163,9 @@ public sealed class BurialSystem : EntitySystem
if (component.HandDiggingDoAfter != null)
return;
if (!_actionBlocker.CanMove(args.Entity))
return;
var doAfterEventArgs = new DoAfterArgs(EntityManager, args.Entity, component.DigDelay / component.DigOutByHandModifier, new GraveDiggingDoAfterEvent(), uid, target: uid)
{
NeedHand = false,

View File

@@ -16,16 +16,14 @@ using Content.Shared.Tools.Systems;
using Content.Shared.Verbs;
using Content.Shared.Wall;
using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Content.Shared.ActionBlocker;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -47,6 +45,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
[Dependency] protected readonly SharedTransformSystem TransformSystem = default!;
[Dependency] private readonly WeldableSystem _weldable = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
public const string ContainerName = "entity_storage";
@@ -132,6 +131,9 @@ public abstract class SharedEntityStorageSystem : EntitySystem
if (!HasComp<HandsComponent>(args.Entity))
return;
if (!_actionBlocker.CanMove(args.Entity))
return;
if (_timing.CurTime < component.NextInternalOpenAttempt)
return;
@@ -139,9 +141,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
Dirty(uid, component);
if (component.OpenOnMove)
{
TryOpenStorage(args.Entity, uid);
}
}
protected void OnFoldAttempt(EntityUid uid, SharedEntityStorageComponent component, ref FoldAttemptEvent args)