Фикс проверок коллизии шлюзов (#3725)
This commit is contained in:
parent
acb9db8dad
commit
c704ada676
14 changed files with 42 additions and 28 deletions
|
|
@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeCircle
|
||||
bounds: ""-0.49,-0.49,0.49,0.49""
|
||||
bounds: ""-0.46,-0.46,0.46,0.46""
|
||||
layer:
|
||||
- Impassable
|
||||
|
||||
|
|
@ -47,10 +47,10 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: ""-0.49,-0.49,0.49,0.49""
|
||||
bounds: ""-0.46,-0.46,0.46,0.46""
|
||||
mask:
|
||||
- Impassable
|
||||
";
|
||||
"; // Sunrise edit - фикс двойных шлюзов (было 0.49)
|
||||
[Test]
|
||||
public async Task OpenCloseDestroyTest()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ namespace Content.IntegrationTests.Tests.Utility
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: ""-0.49,-0.49,0.49,0.49""
|
||||
bounds: ""-0.46,-0.46,0.46,0.46""
|
||||
mask:
|
||||
- Impassable
|
||||
";
|
||||
"; // Sunrise edit - фикс двойных шлюзов (было 0.49)
|
||||
|
||||
[Test]
|
||||
public async Task Test()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ using Robust.Shared.Audio.Systems;
|
|||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
// Sunrise added start - фикс двойных шлюзов
|
||||
using Robust.Shared.Physics;
|
||||
// Sunrise added end
|
||||
|
||||
namespace Content.Shared.Doors.Systems;
|
||||
|
||||
|
|
@ -50,6 +53,8 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
|||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedPowerReceiverSystem _powerReceiver = default!;
|
||||
|
||||
private EntityQuery<FixturesComponent> _fixturesQuery; // Sunrise-edit - фикс двойных шлюзов
|
||||
|
||||
public static readonly ProtoId<TagPrototype> DoorBumpTag = "DoorBumpOpener";
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -90,6 +95,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
|||
|
||||
// Sunrise added start - фикс двойных шлюзов
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
_fixturesQuery = GetEntityQuery<FixturesComponent>();
|
||||
// Sunrise added end
|
||||
}
|
||||
|
||||
|
|
@ -602,17 +608,25 @@ public abstract partial class SharedDoorSystem : EntitySystem
|
|||
_doorIntersecting.Clear();
|
||||
|
||||
// Sunrise edit start - фикс двойных шлюзов
|
||||
var aabb = _entityLookup.GetWorldAABB(uid);
|
||||
_entityLookup.GetEntitiesIntersecting(xform.GridUid.Value,
|
||||
aabb,
|
||||
_doorIntersecting,
|
||||
flags: (LookupFlags.All & ~LookupFlags.Sensors));
|
||||
// Sunrise edit end
|
||||
// Для корректного подсчета координат необходимо использовать LocalPhysicsTransform
|
||||
var transform = PhysicsSystem.GetLocalPhysicsTransform(uid);
|
||||
|
||||
if (!_fixturesQuery.TryGetComponent(uid, out var fixtures))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
// Шлюзы имеют единственный fixture с единственным child
|
||||
var shape = fixtures.Fixtures.Values.First().Shape;
|
||||
var bounds = shape.ComputeAABB(transform, 0);
|
||||
|
||||
_entityLookup.GetLocalEntitiesIntersecting(xform.GridUid.Value,
|
||||
bounds,
|
||||
_doorIntersecting,
|
||||
flags: (LookupFlags.All & ~LookupFlags.Sensors));
|
||||
|
||||
// TODO SLOTH fix electro's code.
|
||||
// ReSharper disable once InconsistentNaming
|
||||
|
||||
// Sunrise edit start - фикс двойных шлюзов
|
||||
// Просто методя с Entity<T> нет, поэтому пришлось тут все менять
|
||||
foreach (var otherPhysics in _doorIntersecting)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
mask:
|
||||
- Impassable
|
||||
- HighImpassable
|
||||
|
|
@ -213,7 +213,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,-0.2" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,-0.2" # Sunrise edit - фикс двойных шлюзов
|
||||
mask:
|
||||
- Impassable
|
||||
- HighImpassable
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49"
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49"
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,-0.36"
|
||||
bounds: "-0.46,-0.46,0.46,-0.36" # Sunrise edit - фикс двойных шлюзов
|
||||
density: 1500
|
||||
mask:
|
||||
- TabletopMachineMask
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
airlockFix:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,0.46,0.46" # don't want this colliding with walls or they won't close
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,1.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-0.46,-0.46,1.46,0.46" # don't want this colliding with walls or they won't close
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-1.49,-0.49,1.49,0.49" # don't want this colliding with walls or they won't close
|
||||
bounds: "-1.46,-0.46,1.46,0.46" # don't want this colliding with walls or they won't close
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.49,-0.49,0.49,0.49"
|
||||
bounds: "-0.46,-0.46,0.46,0.46"
|
||||
density: 100
|
||||
mask:
|
||||
- FullTileMask
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue