From f0d02f032a5831ce09284cd0489fdd639e6dd3b0 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 31 Oct 2022 12:05:34 +1300 Subject: [PATCH] Content changes for broadphase rejig (#12290) --- Content.Client/Entry/EntryPoint.cs | 1 - .../Tests/Commands/RejuvenateTest.cs | 2 -- .../Tests/DeleteInventoryTest.cs | 8 ++--- .../Tests/DeviceNetwork/DeviceNetworkTest.cs | 25 ++++++-------- .../Tests/Disposal/DisposalUnitTest.cs | 12 +++++++ .../Tests/DoAfter/DoAfterServerTest.cs | 2 -- .../Tests/Doors/AirlockTest.cs | 2 -- .../Components/Movement/ClimbUnitTest.cs | 2 -- .../Tests/HumanInventoryUniformSlotsTest.cs | 15 ++++----- .../Tests/InventoryHelpersTest.cs | 3 -- .../Tests/MindEntityDeletionTest.cs | 16 +++------ .../Tests/PrototypeSaveTest.cs | 33 ++++++++++++++++++- .../Tests/Station/StationJobsTest.cs | 3 +- Content.IntegrationTests/Tests/Tag/TagTest.cs | 3 +- 14 files changed, 71 insertions(+), 56 deletions(-) diff --git a/Content.Client/Entry/EntryPoint.cs b/Content.Client/Entry/EntryPoint.cs index bc1a2b590c..d902dea498 100644 --- a/Content.Client/Entry/EntryPoint.cs +++ b/Content.Client/Entry/EntryPoint.cs @@ -142,7 +142,6 @@ namespace Content.Client.Entry _ghostKick.Initialize(); _extendedDisconnectInformation.Initialize(); _playTimeTracking.Initialize(); - _baseClient.PlayerJoinedServer += (_, _) => { _mapManager.CreateNewMapEntity(MapId.Nullspace);}; //AUTOSCALING default Setup! _configManager.SetCVar("interface.resolutionAutoScaleUpperCutoffX", 1080); diff --git a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs index fb163bf13a..df47a8770f 100644 --- a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs @@ -42,8 +42,6 @@ namespace Content.IntegrationTests.Tests.Commands await server.WaitAssertion(() => { - mapManager.CreateNewMapEntity(MapId.Nullspace); - var human = entManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace); // Sanity check diff --git a/Content.IntegrationTests/Tests/DeleteInventoryTest.cs b/Content.IntegrationTests/Tests/DeleteInventoryTest.cs index 0303b12c2f..4542f7ebfc 100644 --- a/Content.IntegrationTests/Tests/DeleteInventoryTest.cs +++ b/Content.IntegrationTests/Tests/DeleteInventoryTest.cs @@ -21,6 +21,8 @@ namespace Content.IntegrationTests.Tests { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; + var testMap = await PoolManager.CreateTestMap(pairTracker); + var coordinates = testMap.GridCoords; await server.WaitAssertion(() => { @@ -28,14 +30,12 @@ namespace Content.IntegrationTests.Tests var mapMan = IoCManager.Resolve(); var invSystem = IoCManager.Resolve().GetEntitySystem(); - mapMan.CreateNewMapEntity(MapId.Nullspace); - var entMgr = IoCManager.Resolve(); - var container = entMgr.SpawnEntity(null, MapCoordinates.Nullspace); + var container = entMgr.SpawnEntity(null, coordinates); entMgr.EnsureComponent(container); entMgr.EnsureComponent(container); - var child = entMgr.SpawnEntity(null, MapCoordinates.Nullspace); + var child = entMgr.SpawnEntity(null, coordinates); var item = entMgr.EnsureComponent(child); IoCManager.Resolve().GetEntitySystem().SetSlots(item.Owner, SlotFlags.HEAD, item); diff --git a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs index 3627327292..7484b1b55b 100644 --- a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs +++ b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs @@ -73,8 +73,6 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork }; await server.WaitAssertion(() => { - mapManager.CreateNewMapEntity(MapId.Nullspace); - device1 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace); Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True); @@ -106,13 +104,14 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes}); var server = pairTracker.Pair.Server; + var testMap = await PoolManager.CreateTestMap(pairTracker); + var coordinates = testMap.GridCoords; var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem(); var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem(); - EntityUid device1 = default; EntityUid device2 = default; DeviceNetworkComponent networkComponent1 = null; @@ -128,16 +127,14 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork }; await server.WaitAssertion(() => { - mapManager.CreateNewMapEntity(MapId.Nullspace); - - device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace); + device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", coordinates); Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True); Assert.That(entityManager.TryGetComponent(device1, out wirelessNetworkComponent), Is.True); Assert.That(networkComponent1.ReceiveFrequency != null, Is.True); Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); - device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0,50), MapId.Nullspace)); + device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0,50), testMap.MapId)); Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True); Assert.That(networkComponent2.ReceiveFrequency != null, Is.True); @@ -179,19 +176,20 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes}); var server = pairTracker.Pair.Server; + var testMap = await PoolManager.CreateTestMap(pairTracker); + var coordinates = testMap.GridCoords; var mapManager = server.ResolveDependency(); var entityManager = server.ResolveDependency(); var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem(); var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem(); - EntityUid device1 = default; EntityUid device2 = default; DeviceNetworkComponent networkComponent1 = null; DeviceNetworkComponent networkComponent2 = null; WiredNetworkComponent wiredNetworkComponent = null; - IMapGrid grid = null; + IMapGrid grid = testMap.MapGrid; var testValue = "test"; var payload = new NetworkPayload @@ -205,17 +203,14 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork await server.WaitIdleAsync(); await server.WaitAssertion(() => { - var map = mapManager.CreateNewMapEntity(MapId.Nullspace); - grid = mapManager.CreateGrid(MapId.Nullspace); - - device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", MapCoordinates.Nullspace); + device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", coordinates); Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True); Assert.That(entityManager.TryGetComponent(device1, out wiredNetworkComponent), Is.True); Assert.That(networkComponent1.ReceiveFrequency != null, Is.True); Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); - device2 = entityManager.SpawnEntity("DummyWiredNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 2), MapId.Nullspace)); + device2 = entityManager.SpawnEntity("DummyWiredNetworkDevice", coordinates); Assert.That(entityManager.TryGetComponent(device2, out networkComponent2), Is.True); Assert.That(networkComponent2.ReceiveFrequency != null, Is.True); @@ -232,7 +227,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork await server.WaitAssertion(() => { //CollectionAssert.AreNotEqual(deviceNetTestSystem.LastPayload, payload); - entityManager.SpawnEntity("CableApcExtension", grid.MapToGrid(new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 1), MapId.Nullspace))); + entityManager.SpawnEntity("CableApcExtension", coordinates); deviceNetSystem.QueuePacket(device1, networkComponent2.Address, payload, networkComponent2.ReceiveFrequency.Value); }); diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index 650780c05f..60dbfbde96 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -84,6 +84,10 @@ namespace Content.IntegrationTests.Tests.Disposal - type: Physics bodyType: KinematicController - type: Fixtures + fixtures: + - shape: + !type:PhysShapeCircle + radius: 0.35 - type: DoAfter - type: entity @@ -97,6 +101,10 @@ namespace Content.IntegrationTests.Tests.Disposal - type: Physics bodyType: Dynamic - type: Fixtures + fixtures: + - shape: + !type:PhysShapeCircle + radius: 0.35 - type: DoAfter - type: entity @@ -111,6 +119,10 @@ namespace Content.IntegrationTests.Tests.Disposal - type: Physics bodyType: Static - type: Fixtures + fixtures: + - shape: + !type:PhysShapeCircle + radius: 0.35 - type: entity name: DisposalTrunkDummy diff --git a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs index 96c7b3db74..7a6c3f7f87 100644 --- a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs +++ b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs @@ -37,7 +37,6 @@ namespace Content.IntegrationTests.Tests.DoAfter await server.WaitPost(() => { var tickTime = 1.0f / IoCManager.Resolve().TickRate; - mapManager.CreateNewMapEntity(MapId.Nullspace); var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace); var cancelToken = new CancellationTokenSource(); var args = new DoAfterEventArgs(mob, tickTime / 2, cancelToken.Token); @@ -67,7 +66,6 @@ namespace Content.IntegrationTests.Tests.DoAfter await server.WaitPost(() => { var tickTime = 1.0f / IoCManager.Resolve().TickRate; - mapManager.CreateNewMapEntity(MapId.Nullspace); var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace); var cancelToken = new CancellationTokenSource(); diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index 719b50a809..7d50ce2a33 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -60,8 +60,6 @@ namespace Content.IntegrationTests.Tests.Doors await server.WaitAssertion(() => { - mapManager.CreateNewMapEntity(MapId.Nullspace); - airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace); Assert.True(entityManager.TryGetComponent(airlock, out doorComponent)); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index 55db8be0b4..5033c50e31 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -43,8 +43,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement await server.WaitAssertion(() => { var mapManager = IoCManager.Resolve(); - mapManager.CreateNewMapEntity(MapId.Nullspace); - var entityManager = IoCManager.Resolve(); // Spawn the entities diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index bc1cce5222..f6a4d9dc3a 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -60,6 +60,8 @@ namespace Content.IntegrationTests.Tests { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes}); var server = pairTracker.Pair.Server; + var testMap = await PoolManager.CreateTestMap(pairTracker); + var coordinates = testMap.GridCoords; EntityUid human = default; EntityUid uniform = default; @@ -72,16 +74,13 @@ namespace Content.IntegrationTests.Tests { invSystem = IoCManager.Resolve().GetEntitySystem(); var mapMan = IoCManager.Resolve(); - - mapMan.CreateNewMapEntity(MapId.Nullspace); - var entityMan = IoCManager.Resolve(); - human = entityMan.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); - uniform = entityMan.SpawnEntity("UniformDummy", MapCoordinates.Nullspace); - idCard = entityMan.SpawnEntity("IDCardDummy", MapCoordinates.Nullspace); - pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace); - var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace); + human = entityMan.SpawnEntity("HumanDummy", coordinates); + uniform = entityMan.SpawnEntity("UniformDummy", coordinates); + idCard = entityMan.SpawnEntity("IDCardDummy", coordinates); + pocketItem = entityMan.SpawnEntity("FlashlightDummy", coordinates); + var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", coordinates); Assert.That(invSystem.CanEquip(human, uniform, "jumpsuit", out _)); diff --git a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs index 5ef3c2990d..6a7d8c8c13 100644 --- a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs +++ b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs @@ -52,9 +52,6 @@ namespace Content.IntegrationTests.Tests { var mapMan = IoCManager.Resolve(); var systemMan = IoCManager.Resolve(); - - mapMan.CreateNewMapEntity(MapId.Nullspace); - var human = sEntities.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace); var invSystem = systemMan.GetEntitySystem(); diff --git a/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs b/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs index 5c84e1ff2f..f760c86a9f 100644 --- a/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs +++ b/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs @@ -124,25 +124,18 @@ namespace Content.IntegrationTests.Tests { await using var pairTracker = await PoolManager.GetServerClient(); var server = pairTracker.Pair.Server; + var testMap = await PoolManager.CreateTestMap(pairTracker); + var coordinates = testMap.GridCoords; EntityUid playerEnt = default; Mind mind = null; - MapId map = default; await server.WaitAssertion(() => { var player = IoCManager.Resolve().ServerSessions.Single(); var mapMan = IoCManager.Resolve(); - - map = mapMan.CreateMap(); - var grid = mapMan.CreateGrid(map); - var entMgr = IoCManager.Resolve(); - - mapMan.CreateNewMapEntity(MapId.Nullspace); - - playerEnt = entMgr.SpawnEntity(null, grid.ToCoordinates()); - + playerEnt = entMgr.SpawnEntity(null, coordinates); mind = new Mind(player.UserId); mind.ChangeOwningPlayer(player.UserId); @@ -156,8 +149,7 @@ namespace Content.IntegrationTests.Tests await server.WaitPost(() => { var mapMan = IoCManager.Resolve(); - - mapMan.DeleteMap(map); + mapMan.DeleteMap(testMap.MapId); }); await PoolManager.RunTicksSync(pairTracker.Pair, 5); diff --git a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs index 49fbb357e6..91f26e3f33 100644 --- a/Content.IntegrationTests/Tests/PrototypeSaveTest.cs +++ b/Content.IntegrationTests/Tests/PrototypeSaveTest.cs @@ -126,7 +126,38 @@ public sealed class PrototypeSaveTest "ClothingHeadHatChef", "Bucket", "AirlockShuttle", - "AirlockGlassShuttle" + "AirlockGlassShuttle", + // The followjng are all fixture-less phsyics entities that set can-collide to false on init. + "CarpRift", + "GasMinerOxygen", + "GasMinerNitrogen", + "GasMinerCarbonDioxide", + "GasMinerPlasma", + "GasMinerTritium", + "GasMinerWaterVapor", + "GasMinerMiasma", + "GasMinerNitrousOxide", + "SignalSwitch", + "SignalButton", + "ApcNetSwitch", + "TetherEntity", + "SignalButtonExt1", + "SignalButtonExt2", + "SignalButtonExt3", + "SignalButtonBridge", + "SignalButtonWindows", + "GrilleBroken", + "BaseGeneratorWallmountFrame", + "GeneratorWallmountBasic", + "GeneratorWallmountAPU", + "Lightning", + "LightningRevenant", + "ChargedLightning", + "SuperchargedLightning", + "HyperchargedLightning", + "BaseSubstationWall", + "SubstationWallBasic", + "BaseSubstationWallFrame" }; [Test] diff --git a/Content.IntegrationTests/Tests/Station/StationJobsTest.cs b/Content.IntegrationTests/Tests/Station/StationJobsTest.cs index 11b09c1552..b8be6b807e 100644 --- a/Content.IntegrationTests/Tests/Station/StationJobsTest.cs +++ b/Content.IntegrationTests/Tests/Station/StationJobsTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -157,7 +157,6 @@ public sealed class StationJobsTest var station = EntityUid.Invalid; await server.WaitPost(() => { - mapManager.CreateNewMapEntity(MapId.Nullspace); station = stationSystem.InitializeNewStation(fooStationProto.Stations["Station"], null, $"Foo Station"); }); diff --git a/Content.IntegrationTests/Tests/Tag/TagTest.cs b/Content.IntegrationTests/Tests/Tag/TagTest.cs index 4a025f752c..5f949a5080 100644 --- a/Content.IntegrationTests/Tests/Tag/TagTest.cs +++ b/Content.IntegrationTests/Tests/Tag/TagTest.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Collections.Generic; using System.Threading.Tasks; using Content.Shared.Tag; @@ -57,7 +57,6 @@ namespace Content.IntegrationTests.Tests.Tag await server.WaitPost(() => { - sMapManager.CreateNewMapEntity(MapId.Nullspace); sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace); sTagComponent = sEntityManager.GetComponent(sTagDummy); });