From 67a8de4e29bcf29bdcd2852c50318a7ae96408da Mon Sep 17 00:00:00 2001 From: TGRCDev Date: Sun, 24 Nov 2024 15:16:05 -0800 Subject: [PATCH 1/2] Pulled lockers/crates can now only be opened by the person pulling them --- .../Storage/EntitySystems/SharedEntityStorageSystem.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs index 309ac0a2e09358..160faf63968a07 100644 --- a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs @@ -26,6 +26,7 @@ using Robust.Shared.Physics.Systems; using Robust.Shared.Timing; using Robust.Shared.Utility; +using Content.Shared.Movement.Pulling.Components; namespace Content.Shared.Storage.EntitySystems; @@ -181,6 +182,15 @@ public void ToggleOpen(EntityUid user, EntityUid target, SharedEntityStorageComp if (!ResolveStorage(target, ref component)) return; + // impstation edit + // prevent dumbasses from opening crates that are being dragged + if ( + TryComp(target, out var pull) && + pull.BeingPulled && + pull.Puller != user + ) + return; + if (component.Open) { TryCloseStorage(target); From c08ca6c10f90ee7d906354534b97e770f18f038f Mon Sep 17 00:00:00 2001 From: TGRCDev Date: Sun, 24 Nov 2024 16:46:50 -0800 Subject: [PATCH 2/2] Moved pulled container check to CanOpen Also added a line to check if the user is inside the container. With the previous commit, the user could leave using the movement keys, since that method bypassed ToggleOpen. This now allows trapped users to leave both with movement keys and interact. --- .../EntitySystems/SharedEntityStorageSystem.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs index 160faf63968a07..46a36a562468ca 100644 --- a/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs @@ -182,15 +182,6 @@ public void ToggleOpen(EntityUid user, EntityUid target, SharedEntityStorageComp if (!ResolveStorage(target, ref component)) return; - // impstation edit - // prevent dumbasses from opening crates that are being dragged - if ( - TryComp(target, out var pull) && - pull.BeingPulled && - pull.Puller != user - ) - return; - if (component.Open) { TryCloseStorage(target); @@ -381,6 +372,15 @@ public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, Share } } + // impstation edit: prevent opening containers being pulled by others + if ( + TryComp(target, out var pullable) && // Can be pulled + pullable.BeingPulled && // Someone is pulling it + pullable.Puller != user && // It is not the user + !component.Contents.Contains(user) // The user is not inside of it + ) + return false; + //Checks to see if the opening position, if offset, is inside of a wall. if (component.EnteringOffset != new Vector2(0, 0) && !HasComp(target)) //if the entering position is offset {