Fix climbing not ending when any contacts still exist (#30488)
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Body.Systems;
|
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
using Content.Shared.Climbing.Components;
|
using Content.Shared.Climbing.Components;
|
||||||
using Content.Shared.Climbing.Events;
|
using Content.Shared.Climbing.Events;
|
||||||
@@ -44,6 +43,7 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
private const string ClimbingFixtureName = "climb";
|
private const string ClimbingFixtureName = "climb";
|
||||||
private const int ClimbingCollisionGroup = (int) (CollisionGroup.TableLayer | CollisionGroup.LowImpassable);
|
private const int ClimbingCollisionGroup = (int) (CollisionGroup.TableLayer | CollisionGroup.LowImpassable);
|
||||||
|
|
||||||
|
private EntityQuery<ClimbableComponent> _climbableQuery;
|
||||||
private EntityQuery<FixturesComponent> _fixturesQuery;
|
private EntityQuery<FixturesComponent> _fixturesQuery;
|
||||||
private EntityQuery<TransformComponent> _xformQuery;
|
private EntityQuery<TransformComponent> _xformQuery;
|
||||||
|
|
||||||
@@ -51,6 +51,7 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
|
_climbableQuery = GetEntityQuery<ClimbableComponent>();
|
||||||
_fixturesQuery = GetEntityQuery<FixturesComponent>();
|
_fixturesQuery = GetEntityQuery<FixturesComponent>();
|
||||||
_xformQuery = GetEntityQuery<TransformComponent>();
|
_xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
|
|
||||||
@@ -350,12 +351,39 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
{
|
{
|
||||||
if (args.OurFixtureId != ClimbingFixtureName
|
if (args.OurFixtureId != ClimbingFixtureName
|
||||||
|| !component.IsClimbing
|
|| !component.IsClimbing
|
||||||
|| component.NextTransition != null
|
|| component.NextTransition != null)
|
||||||
|| args.OurFixture.Contacts.Count > 1)
|
|
||||||
{
|
{
|
||||||
return;
|
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)
|
foreach (var otherFixture in args.OurFixture.Contacts.Keys)
|
||||||
{
|
{
|
||||||
// If it's the other fixture then ignore em
|
// If it's the other fixture then ignore em
|
||||||
|
|||||||
Reference in New Issue
Block a user