diff --git a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs index e9051c87c82..e3d49ee1b42 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs @@ -252,7 +252,7 @@ private bool AnyEntitiesIntersecting(MapId mapId, var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); var localAabb = state.Shape.ComputeAABB(localTransform, 0); - if (state.Lookup.AnyEntitiesIntersecting(uid, state.Shape, localAabb, state.Transform, state.Flags, ignored: state.Ignored)) + if (state.Lookup.AnyEntitiesIntersecting(uid, state.Shape, localAabb, localTransform, state.Flags, ignored: state.Ignored)) { state.Found = true; return false; @@ -266,7 +266,7 @@ private bool AnyEntitiesIntersecting(MapId mapId, var mapUid = _map.GetMapOrInvalid(mapId); var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, mapUid); var localAabb = state.Shape.ComputeAABB(localTransform, 0); - state.Found = AnyEntitiesIntersecting(mapUid, shape, localAabb, shapeTransform, flags, ignored); + state.Found = AnyEntitiesIntersecting(mapUid, shape, localAabb, localTransform, flags, ignored); } return state.Found; @@ -568,7 +568,7 @@ public HashSet GetEntitiesIntersecting(MapId mapId, Box2Rotated world state.intersecting, state.shape, localAabb, - state.transform, + localTransform, state.flags); return true; }); diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs index 52e6134ff14..6b001b024e3 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -542,7 +542,7 @@ public void GetEntitiesIntersecting(Type type, MapId mapId, IPhysShape shape, Tr { var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); var localAabb = state.Shape.ComputeAABB(localTransform, 0); - state.Lookup.AddEntitiesIntersecting(uid, state.Intersecting, state.Shape, localAabb, state.Transform, state.Flags, state.Query); + state.Lookup.AddEntitiesIntersecting(uid, state.Intersecting, state.Shape, localAabb, localTransform, state.Flags, state.Query); return true; }, approx: true, includeMap: false); @@ -550,7 +550,7 @@ public void GetEntitiesIntersecting(Type type, MapId mapId, IPhysShape shape, Tr var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, mapUid); var localAabb = state.Shape.ComputeAABB(localTransform, 0); - AddEntitiesIntersecting(mapUid, intersecting, shape, localAabb, shapeTransform, flags, query); + AddEntitiesIntersecting(mapUid, intersecting, shape, localAabb, localTransform, flags, query); AddContained(intersecting, flags, query); } @@ -586,7 +586,7 @@ public void GetEntitiesIntersecting(MapId mapId, IPhysShape shape, Transform { var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, uid); var localAabb = state.Shape.ComputeAABB(localTransform, 0); - state.Lookup.AddEntitiesIntersecting(uid, state.Intersecting, state.Shape, localAabb, state.Transform, state.Flags, state.Query); + state.Lookup.AddEntitiesIntersecting(uid, state.Intersecting, state.Shape, localAabb, localTransform, state.Flags, state.Query); return true; }, approx: true, includeMap: false); @@ -595,7 +595,7 @@ public void GetEntitiesIntersecting(MapId mapId, IPhysShape shape, Transform var localTransform = state.Physics.GetRelativePhysicsTransform(state.Transform, mapUid); var localAabb = state.Shape.ComputeAABB(localTransform, 0); - AddEntitiesIntersecting(mapUid, entities, shape, localAabb, shapeTransform, flags, query); + AddEntitiesIntersecting(mapUid, entities, shape, localAabb, localTransform, flags, query); AddContained(entities, flags, query); } } @@ -678,8 +678,8 @@ public HashSet GetComponentsInRange(MapId mapId, Vector2 worldPos, float r public void GetEntitiesInRange(MapId mapId, Vector2 worldPos, float range, HashSet> entities, LookupFlags flags = DefaultFlags) where T : IComponent { - var shape = new PhysShapeCircle(range); - var transform = new Transform(worldPos, 0f); + var shape = new PhysShapeCircle(range, worldPos); + var transform = Physics.Transform.Empty; GetEntitiesInRange(mapId, shape, transform, entities, flags); } diff --git a/Robust.UnitTesting/Shared/EntityLookup_Test.cs b/Robust.UnitTesting/Shared/EntityLookup_Test.cs index b7ce0778250..cc9352bb106 100644 --- a/Robust.UnitTesting/Shared/EntityLookup_Test.cs +++ b/Robust.UnitTesting/Shared/EntityLookup_Test.cs @@ -33,6 +33,9 @@ public sealed class EntityLookupTest new TestCaseData(false, new MapCoordinates(new Vector2(10f, 10f), MapId), new MapCoordinates(new Vector2(9.5f, 9.5f), MapId), 0.5f, false), // Close but no cigar new TestCaseData(false, new MapCoordinates(new Vector2(10f, 10f), MapId), new MapCoordinates(new Vector2(9f, 9f), MapId), 0.5f, false), + + // Big offset + new TestCaseData(true, new MapCoordinates(new Vector2(100f, 0f), MapId), new MapCoordinates(new Vector2(100f, 0f), MapId), 0.25f, true), }; // Remember this test data is relative.