Fix standing-state collisions resetting (#7469)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,13 @@ namespace Content.Shared.Climbing
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
|
||||
|
||||
/// <summary>
|
||||
/// List of fixtures that had vault-impassable prior to an entity being downed. Required when re-adding the
|
||||
/// collision mask.
|
||||
/// </summary>
|
||||
[DataField("vaultImpassableFixtures")]
|
||||
public List<string> VaultImpassableFixtures = new();
|
||||
|
||||
protected bool IsOnClimbableThisFrame
|
||||
{
|
||||
get
|
||||
@@ -78,17 +85,25 @@ namespace Content.Shared.Climbing
|
||||
// Hope the mob has one fixture
|
||||
if (!_entMan.TryGetComponent<FixturesComponent>(Owner, out var fixturesComponent) || fixturesComponent.Deleted) return;
|
||||
|
||||
foreach (var fixture in fixturesComponent.Fixtures.Values)
|
||||
if (value)
|
||||
{
|
||||
if (value)
|
||||
foreach (var (key, fixture) in fixturesComponent.Fixtures)
|
||||
{
|
||||
if ((fixture.CollisionMask & (int) CollisionGroup.VaultImpassable) == 0)
|
||||
continue;
|
||||
|
||||
VaultImpassableFixtures.Add(key);
|
||||
fixture.CollisionMask &= ~(int) CollisionGroup.VaultImpassable;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixture.CollisionMask |= (int) CollisionGroup.VaultImpassable;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var key in VaultImpassableFixtures)
|
||||
{
|
||||
if (fixturesComponent.Fixtures.TryGetValue(key, out var fixture))
|
||||
fixture.CollisionMask |= (int) CollisionGroup.VaultImpassable;
|
||||
}
|
||||
VaultImpassableFixtures.Clear();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
Reference in New Issue
Block a user