Remove PoolSettings.ExtraPrototypes option (#18678)

This commit is contained in:
Leon Friedrich
2023-08-05 16:16:48 +12:00
committed by GitHub
parent c2beaff3ac
commit d58786faf4
51 changed files with 463 additions and 399 deletions

View File

@@ -13,10 +13,11 @@ namespace Content.IntegrationTests.Tests.Doors
[TestOf(typeof(AirlockComponent))]
public sealed class AirlockTest
{
[TestPrototypes]
private const string Prototypes = @"
- type: entity
name: PhysicsDummy
id: PhysicsDummy
name: AirlockPhysicsDummy
id: AirlockPhysicsDummy
components:
- type: Physics
bodyType: Dynamic
@@ -54,8 +55,7 @@ namespace Content.IntegrationTests.Tests.Doors
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
{
NoClient = true,
ExtraPrototypes = Prototypes
NoClient = true
});
var server = pairTracker.Pair.Server;
@@ -117,8 +117,7 @@ namespace Content.IntegrationTests.Tests.Doors
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
{
NoClient = true,
ExtraPrototypes = Prototypes
NoClient = true
});
var server = pairTracker.Pair.Server;
@@ -130,24 +129,24 @@ namespace Content.IntegrationTests.Tests.Doors
var xformSystem = entityManager.System<SharedTransformSystem>();
PhysicsComponent physBody = null;
EntityUid physicsDummy = default;
EntityUid AirlockPhysicsDummy = default;
EntityUid airlock = default;
DoorComponent doorComponent = null;
var physicsDummyStartingX = -1;
var AirlockPhysicsDummyStartingX = -1;
await server.WaitAssertion(() =>
{
var mapId = mapManager.CreateMap();
var humanCoordinates = new MapCoordinates(new Vector2(physicsDummyStartingX, 0), mapId);
physicsDummy = entityManager.SpawnEntity("PhysicsDummy", humanCoordinates);
var humanCoordinates = new MapCoordinates(new Vector2(AirlockPhysicsDummyStartingX, 0), mapId);
AirlockPhysicsDummy = entityManager.SpawnEntity("AirlockPhysicsDummy", humanCoordinates);
airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates(new Vector2(0, 0), mapId));
Assert.Multiple(() =>
{
Assert.That(entityManager.TryGetComponent(physicsDummy, out physBody), Is.True);
Assert.That(entityManager.TryGetComponent(AirlockPhysicsDummy, out physBody), Is.True);
Assert.That(entityManager.TryGetComponent(airlock, out doorComponent), Is.True);
});
Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));
@@ -159,7 +158,7 @@ namespace Content.IntegrationTests.Tests.Doors
await server.WaitAssertion(() => Assert.That(physBody, Is.Not.EqualTo(null)));
await server.WaitPost(() =>
{
physicsSystem.SetLinearVelocity(physicsDummy, new Vector2(0.5f, 0f), body: physBody);
physicsSystem.SetLinearVelocity(AirlockPhysicsDummy, new Vector2(0.5f, 0f), body: physBody);
});
for (var i = 0; i < 240; i += 10)
@@ -178,12 +177,12 @@ namespace Content.IntegrationTests.Tests.Doors
// Sloth: Okay I'm sorry but I hate having to rewrite tests for every refactor
// If you see this yell at me in discord so I can continue to pretend this didn't happen.
// REMINDER THAT I STILL HAVE TO FIX THIS TEST EVERY OTHER PHYSICS PR
// Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
// Assert.That(AirlockPhysicsDummy.Transform.MapPosition.X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
// Blocked by the airlock
await server.WaitAssertion(() =>
{
Assert.That(Math.Abs(xformSystem.GetWorldPosition(physicsDummy).X - 1), Is.GreaterThan(0.01f));
Assert.That(Math.Abs(xformSystem.GetWorldPosition(AirlockPhysicsDummy).X - 1), Is.GreaterThan(0.01f));
});
await pairTracker.CleanReturnAsync();
}