From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Tue, 30 Jul 2024 08:31:59 +0000 (-0700) Subject: Fix climbing not ending when any contacts still exist (#30488) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=517598f72dbc615ba9b3269ec75e907640b5ee77;p=space-station-14.git Fix climbing not ending when any contacts still exist (#30488) --- diff --git a/Content.Shared/Climbing/Systems/ClimbSystem.cs b/Content.Shared/Climbing/Systems/ClimbSystem.cs index 726cdc2468..635bf36049 100644 --- a/Content.Shared/Climbing/Systems/ClimbSystem.cs +++ b/Content.Shared/Climbing/Systems/ClimbSystem.cs @@ -1,5 +1,4 @@ using Content.Shared.ActionBlocker; -using Content.Shared.Body.Systems; using Content.Shared.Buckle.Components; using Content.Shared.Climbing.Components; using Content.Shared.Climbing.Events; @@ -44,6 +43,7 @@ public sealed partial class ClimbSystem : VirtualController private const string ClimbingFixtureName = "climb"; private const int ClimbingCollisionGroup = (int) (CollisionGroup.TableLayer | CollisionGroup.LowImpassable); + private EntityQuery _climbableQuery; private EntityQuery _fixturesQuery; private EntityQuery _xformQuery; @@ -51,6 +51,7 @@ public sealed partial class ClimbSystem : VirtualController { base.Initialize(); + _climbableQuery = GetEntityQuery(); _fixturesQuery = GetEntityQuery(); _xformQuery = GetEntityQuery(); @@ -350,12 +351,39 @@ public sealed partial class ClimbSystem : VirtualController { if (args.OurFixtureId != ClimbingFixtureName || !component.IsClimbing - || component.NextTransition != null - || args.OurFixture.Contacts.Count > 1) + || component.NextTransition != null) { return; } + if (args.OurFixture.Contacts.Count > 1) + { + foreach (var contact in args.OurFixture.Contacts.Values) + { + if (!contact.IsTouching) + continue; + + var otherEnt = contact.EntityA; + var otherFixture = contact.FixtureA; + var otherFixtureId = contact.FixtureAId; + if (uid == contact.EntityA) + { + otherEnt = contact.EntityB; + otherFixture = contact.FixtureB; + otherFixtureId = contact.FixtureBId; + } + + if (args.OtherEntity == otherEnt && args.OtherFixtureId == otherFixtureId) + continue; + + if (otherFixture is { Hard: true } && + _climbableQuery.HasComp(otherEnt)) + { + return; + } + } + } + foreach (var otherFixture in args.OurFixture.Contacts.Keys) { // If it's the other fixture then ignore em