Update content vectors to numerics (#17759)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#nullable enable annotations
|
||||
using System.Numerics;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
@@ -142,10 +143,10 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
user = sEntities.SpawnEntity(null, coords);
|
||||
user.EnsureComponent<HandsComponent>();
|
||||
handSys.AddHand(user, "hand", HandLocation.Left);
|
||||
target = sEntities.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId));
|
||||
target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(1.9f, 0), mapId));
|
||||
item = sEntities.SpawnEntity(null, coords);
|
||||
item.EnsureComponent<ItemComponent>();
|
||||
wall = sEntities.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), sEntities.GetComponent<TransformComponent>(user).MapID));
|
||||
wall = sEntities.SpawnEntity("DummyDebugWall", new MapCoordinates(new Vector2(1, 0), sEntities.GetComponent<TransformComponent>(user).MapID));
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -212,7 +213,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
user = sEntities.SpawnEntity(null, coords);
|
||||
user.EnsureComponent<HandsComponent>();
|
||||
handSys.AddHand(user, "hand", HandLocation.Left);
|
||||
target = sEntities.SpawnEntity(null, new MapCoordinates((InteractionSystem.InteractionRange - 0.1f, 0), mapId));
|
||||
target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange - 0.1f, 0), mapId));
|
||||
item = sEntities.SpawnEntity(null, coords);
|
||||
item.EnsureComponent<ItemComponent>();
|
||||
});
|
||||
@@ -282,7 +283,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
user = sEntities.SpawnEntity(null, coords);
|
||||
user.EnsureComponent<HandsComponent>();
|
||||
handSys.AddHand(user, "hand", HandLocation.Left);
|
||||
target = sEntities.SpawnEntity(null, new MapCoordinates((SharedInteractionSystem.InteractionRange + 0.01f, 0), mapId));
|
||||
target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange + 0.01f, 0), mapId));
|
||||
item = sEntities.SpawnEntity(null, coords);
|
||||
item.EnsureComponent<ItemComponent>();
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -16,7 +17,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
|
||||
private const float InteractionRangeDivided15 = InteractionRange / 1.5f;
|
||||
|
||||
private readonly (float, float) _interactionRangeDivided15X = (InteractionRangeDivided15, 0f);
|
||||
private static readonly Vector2 InteractionRangeDivided15X = new(InteractionRangeDivided15, 0f);
|
||||
|
||||
private const float InteractionRangeDivided15Times3 = InteractionRangeDivided15 * 3;
|
||||
|
||||
@@ -67,7 +68,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
});
|
||||
|
||||
// Move them slightly apart
|
||||
xformSys.SetLocalPosition(origin, xform.LocalPosition + _interactionRangeDivided15X, xform);
|
||||
xformSys.SetLocalPosition(origin, xform.LocalPosition + InteractionRangeDivided15X, xform);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using Content.Client.Construction;
|
||||
using Content.Server.Atmos;
|
||||
@@ -532,7 +533,7 @@ public abstract partial class InteractionTest
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
// Get all entities left behind by deconstruction
|
||||
entities = lookup.GetEntitiesIntersecting(MapId, Box2.CentredAroundZero((10, 10)), flags);
|
||||
entities = lookup.GetEntitiesIntersecting(MapId, Box2.CentredAroundZero(new Vector2(10, 10)), flags);
|
||||
|
||||
var xformQuery = SEntMan.GetEntityQuery<TransformComponent>();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Client.Construction;
|
||||
using Content.Client.Examine;
|
||||
using Content.Server.Body.Systems;
|
||||
@@ -171,8 +172,8 @@ public abstract partial class InteractionTest
|
||||
|
||||
// Setup map.
|
||||
MapData = await PoolManager.CreateTestMap(PairTracker);
|
||||
PlayerCoords = MapData.GridCoords.Offset((0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
|
||||
TargetCoords = MapData.GridCoords.Offset((1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
|
||||
PlayerCoords = MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
|
||||
TargetCoords = MapData.GridCoords.Offset(new Vector2(1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
|
||||
await SetTile(Plating, grid: MapData.MapGrid);
|
||||
|
||||
// Get player data
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
using System.Numerics;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Interaction;
|
||||
@@ -28,14 +29,14 @@ public abstract class MovementTest : InteractionTest
|
||||
await base.Setup();
|
||||
for (var i = -Tiles; i <= Tiles; i++)
|
||||
{
|
||||
await SetTile(Plating, PlayerCoords.Offset((i, 0)), MapData.MapGrid);
|
||||
await SetTile(Plating, PlayerCoords.Offset(new Vector2(i, 0)), MapData.MapGrid);
|
||||
}
|
||||
AssertGridCount(1);
|
||||
|
||||
if (AddWalls)
|
||||
{
|
||||
await SpawnEntity("WallSolid", PlayerCoords.Offset((-Tiles, 0)));
|
||||
await SpawnEntity("WallSolid", PlayerCoords.Offset((Tiles, 0)));
|
||||
await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(-Tiles, 0)));
|
||||
await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(Tiles, 0)));
|
||||
}
|
||||
|
||||
await AddGravity();
|
||||
|
||||
Reference in New Issue
Block a user