]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Prevent EntityStorages from being opened while inside another container (#24253)
authorArendian <137322659+Arendian@users.noreply.github.com>
Sat, 20 Jan 2024 02:50:14 +0000 (03:50 +0100)
committerGitHub <noreply@github.com>
Sat, 20 Jan 2024 02:50:14 +0000 (13:50 +1100)
* Prevent EntityStorages from being opened while inside a mech.

* compressed into few lines

* unneeded line

* Popup client

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Content.Shared/Storage/EntitySystems/SharedEntityStorageSystem.cs

index 911c6e5380b776e79eb0b43eae35db0c09f8edbd..19e41848a1eb8a8520b436f0383710778f55cb71 100644 (file)
@@ -336,6 +336,17 @@ public abstract class SharedEntityStorageSystem : EntitySystem
             return false;
         }
 
+        if (_container.IsEntityInContainer(target))
+        {
+            if (_container.TryGetOuterContainer(target,Transform(target) ,out var container) &&
+                !HasComp<HandsComponent>(container.Owner))
+            {
+                Popup.PopupClient(Loc.GetString("entity-storage-component-already-contains-user-message"), user, user);
+
+                return false;
+            }
+        }
+
         //Checks to see if the opening position, if offset, is inside of a wall.
         if (component.EnteringOffset != new Vector2(0, 0) && !HasComp<WallMountComponent>(target)) //if the entering position is offset
         {