diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index 69fe66039b..ce45df8256 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -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() { diff --git a/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs b/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs index d460fd354f..9a7b1671a1 100644 --- a/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs +++ b/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs @@ -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() diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index 8892e56fe4..e91f8dd595 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -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 _fixturesQuery; // Sunrise-edit - фикс двойных шлюзов + public static readonly ProtoId DoorBumpTag = "DoorBumpOpener"; /// @@ -90,6 +95,7 @@ public abstract partial class SharedDoorSystem : EntitySystem // Sunrise added start - фикс двойных шлюзов _physicsQuery = GetEntityQuery(); + _fixturesQuery = GetEntityQuery(); // 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 нет, поэтому пришлось тут все менять foreach (var otherPhysics in _doorIntersecting) { diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml index 7bd3a88b3c..88a5289984 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml index 773065bea0..4c97cb9dda 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml index 30456878f7..1b442cd37a 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml index 801709afbe..43fa8008cd 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/MaterialDoors/material_doors.yml b/Resources/Prototypes/Entities/Structures/Doors/MaterialDoors/material_doors.yml index d9387fc5ef..9735fbffb1 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/MaterialDoors/material_doors.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/MaterialDoors/material_doors.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/SecretDoor/secret_door.yml b/Resources/Prototypes/Entities/Structures/Doors/SecretDoor/secret_door.yml index c8fdbec326..d1c8b3c3c6 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/SecretDoor/secret_door.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/SecretDoor/secret_door.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml b/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml index b242a0bebe..01b0c3513f 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml index 307a0724c1..a851ed794a 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml @@ -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 diff --git a/Resources/Prototypes/_Sunrise/BloodCult/Entities/other_structures.yml b/Resources/Prototypes/_Sunrise/BloodCult/Entities/other_structures.yml index d2f5be996a..7a3054621b 100644 --- a/Resources/Prototypes/_Sunrise/BloodCult/Entities/other_structures.yml +++ b/Resources/Prototypes/_Sunrise/BloodCult/Entities/other_structures.yml @@ -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 diff --git a/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/Airlocks/Glass/airlocks.yml b/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/Airlocks/Glass/airlocks.yml index 9a8259f29d..61354282eb 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/Airlocks/Glass/airlocks.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/Airlocks/Glass/airlocks.yml @@ -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 diff --git a/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/SecretDoor/secret_door.yml b/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/SecretDoor/secret_door.yml index 42302bfb41..38e03ce0d3 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/SecretDoor/secret_door.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Structures/Doors/SecretDoor/secret_door.yml @@ -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