]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add some container checks (#30896)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 11 Aug 2024 02:28:07 +0000 (12:28 +1000)
committerGitHub <noreply@github.com>
Sun, 11 Aug 2024 02:28:07 +0000 (12:28 +1000)
Climbable container probably getting checked up the callstack so just check these ones.

Content.Shared/Climbing/Systems/ClimbSystem.cs

index 635bf36049bedb4da1231b517daaed637a007d9c..9b77d039f465e4da01f3fc7510abda8b0512e019 100644 (file)
@@ -14,6 +14,7 @@ using Content.Shared.Popups;
 using Content.Shared.Stunnable;
 using Content.Shared.Verbs;
 using Robust.Shared.Audio.Systems;
+using Robust.Shared.Containers;
 using Robust.Shared.Physics;
 using Robust.Shared.Physics.Collision.Shapes;
 using Robust.Shared.Physics.Components;
@@ -34,6 +35,7 @@ public sealed partial class ClimbSystem : VirtualController
     [Dependency] private readonly FixtureSystem _fixtureSystem = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
+    [Dependency] private readonly SharedContainerSystem _containers = default!;
     [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly SharedPhysicsSystem _physics = default!;
@@ -450,6 +452,12 @@ public sealed partial class ClimbSystem : VirtualController
             return false;
         }
 
+        if (_containers.IsEntityInContainer(user))
+        {
+            reason = Loc.GetString("comp-climbable-cant-reach");
+            return false;
+        }
+
         reason = string.Empty;
         return true;
     }
@@ -487,6 +495,12 @@ public sealed partial class ClimbSystem : VirtualController
             return false;
         }
 
+        if (_containers.IsEntityInContainer(user) || _containers.IsEntityInContainer(dragged))
+        {
+            reason = Loc.GetString("comp-climbable-cant-reach");
+            return false;
+        }
+
         reason = string.Empty;
         return true;
     }