Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Body.Systems;
using System.Numerics;
using Content.Server.Body.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Rotation;

View File

@@ -11,6 +11,7 @@ using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Maths;
using System.Linq;
using System.Numerics;
namespace Content.IntegrationTests.Tests.Body
{

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Server.Body.Systems;
using Content.Shared.Buckle;
using Content.Shared.ActionBlocker;
@@ -181,7 +182,7 @@ namespace Content.IntegrationTests.Tests.Buckle
// Move away from the chair
var xformQuery = entityManager.GetEntityQuery<TransformComponent>();
var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + (1000, 1000), xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(1000, 1000), xformQuery);
// Out of range
#pragma warning disable NUnit2045 // Interdependent asserts.
@@ -192,7 +193,7 @@ namespace Content.IntegrationTests.Tests.Buckle
// Move near the chair
oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + (0.5f, 0), xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(0.5f, 0), xformQuery);
// In range
#pragma warning disable NUnit2045 // Interdependent asserts.
@@ -219,7 +220,7 @@ namespace Content.IntegrationTests.Tests.Buckle
// Move away from the chair
oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + (1, 0), xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(1, 0), xformQuery);
});
await server.WaitRunTicks(1);
@@ -378,7 +379,7 @@ namespace Content.IntegrationTests.Tests.Buckle
// Move the buckled entity away
var xformQuery = entityManager.GetEntityQuery<TransformComponent>();
var oldWorldPosition = xformSystem.GetWorldPosition(chair, xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + (100, 0), xformQuery);
xformSystem.SetWorldPosition(human, oldWorldPosition + new Vector2(100, 0), xformQuery);
});
await PoolManager.WaitUntil(server, () => !buckle.Buckled, 10);

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Numerics;
using Content.Server.Cargo.Components;
using Content.Server.Cargo.Systems;
using Content.Shared.Cargo.Prototypes;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Client.Clickable;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
@@ -70,7 +71,7 @@ namespace Content.IntegrationTests.Tests
await client.WaitPost(() =>
{
var sprite = spriteQuery.GetComponent(entity);
sprite.Scale = (scale, scale);
sprite.Scale = new Vector2(scale, scale);
// these tests currently all assume player eye is 0
eyeManager.CurrentEye.Rotation = 0;
@@ -78,7 +79,7 @@ namespace Content.IntegrationTests.Tests
var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(entity);
var clickable = clientEntManager.GetComponent<ClickableComponent>(entity);
hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, (clickPosX, clickPosY) + pos, eye, out _, out _, out _);
hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
});
await server.WaitPost(() =>

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Server.Construction.Components;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.GameObjects;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Server.Storage.EntitySystems;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
@@ -156,7 +157,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
});
device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 50), testMap.MapId));
device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Vector2(0, 50), testMap.MapId));
Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True);
Assert.Multiple(() =>

View File

@@ -1,5 +1,6 @@
#nullable enable annotations
using System.Linq;
using System.Numerics;
using Content.Server.Disposal.Tube.Components;
using Content.Server.Disposal.Unit.Components;
using Content.Server.Disposal.Unit.EntitySystems;
@@ -210,7 +211,7 @@ namespace Content.IntegrationTests.Tests.Disposal
// Move the disposal trunk away
var xform = entityManager.GetComponent<TransformComponent>(disposalTrunk);
var worldPos = xformSystem.GetWorldPosition(disposalTrunk);
xformSystem.SetWorldPosition(xform, worldPos + (1, 0));
xformSystem.SetWorldPosition(xform, worldPos + new Vector2(1, 0));
// Fail to flush with a mob and an item
Flush(disposalUnit, unitComponent, false, disposalSystem, human, wrench);
@@ -221,7 +222,7 @@ namespace Content.IntegrationTests.Tests.Disposal
// Move the disposal trunk back
var xform = entityManager.GetComponent<TransformComponent>(disposalTrunk);
var worldPos = xformSystem.GetWorldPosition(disposalTrunk);
xformSystem.SetWorldPosition(xform, worldPos - (1, 0));
xformSystem.SetWorldPosition(xform, worldPos - new Vector2(1, 0));
// Fail to flush with a mob and an item, no power
Flush(disposalUnit, unitComponent, false, disposalSystem, human, wrench);

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Server.Doors.Systems;
using Content.Shared.Doors.Components;
using Robust.Shared.GameObjects;
@@ -139,10 +140,10 @@ namespace Content.IntegrationTests.Tests.Doors
{
var mapId = mapManager.CreateMap();
var humanCoordinates = new MapCoordinates((physicsDummyStartingX, 0), mapId);
var humanCoordinates = new MapCoordinates(new Vector2(physicsDummyStartingX, 0), mapId);
physicsDummy = entityManager.SpawnEntity("PhysicsDummy", humanCoordinates);
airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId));
airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates(new Vector2(0, 0), mapId));
Assert.Multiple(() =>
{

View File

@@ -1,4 +1,5 @@
#nullable enable
using System.Numerics;
using Content.Server.Cuffs;
using Content.Shared.Body.Components;
using Content.Shared.Cuffs.Components;

View File

@@ -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>();
});

View File

@@ -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(() =>
{

View File

@@ -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>();

View File

@@ -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

View File

@@ -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();

View File

@@ -1,6 +1,7 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Robust.Client.GameStates;
using Robust.Client.Timing;
using Robust.Server.Player;
@@ -65,7 +66,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Spawn dummy component entity.
var map = sMapManager.CreateMap();
var player = sPlayerManager.ServerSessions.Single();
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates((0, 0), map));
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map));
serverComponent = sEntityManager.AddComponent<AutoPredictionTestComponent>(serverEnt);
// Make client "join game" so they receive game state updates.

View File

@@ -1,6 +1,7 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Robust.Client.GameStates;
using Robust.Client.Timing;
using Robust.Server.Player;
@@ -66,7 +67,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Spawn dummy component entity.
var map = sMapManager.CreateMap();
var player = sPlayerManager.ServerSessions.Single();
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates((0, 0), map));
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map));
serverComponent = sEntityManager.AddComponent<PredictionTestComponent>(serverEnt);
// Make client "join game" so they receive game state updates.

View File

@@ -1,6 +1,7 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Robust.Client.GameStates;
using Robust.Client.Timing;
using Robust.Server.Player;
@@ -65,7 +66,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Spawn dummy component entity.
var map = sMapManager.CreateMap();
var player = sPlayerManager.ServerSessions.Single();
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates((0, 0), map));
serverEnt = sEntityManager.SpawnEntity(null, new MapCoordinates(new Vector2(0, 0), map));
serverComponent = sEntityManager.AddComponent<SystemPredictionTestComponent>(serverEnt);
// Make client "join game" so they receive game state updates.

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Shared.CCVar;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Numerics;
using Content.Server.Shuttles.Systems;
using Content.Tests;
using Robust.Shared.GameObjects;

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Content.Server.Shuttles.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
@@ -34,7 +35,7 @@ namespace Content.IntegrationTests.Tests
Assert.Multiple(() =>
{
Assert.That(entManager.HasComponent<ShuttleComponent>(gridEnt));
Assert.That(entManager.TryGetComponent<PhysicsComponent>(gridEnt, out gridPhys));
Assert.That(entManager.TryGetComponent(gridEnt, out gridPhys));
});
Assert.Multiple(() =>
{