Content changes for broadphase rejig (#12290)

This commit is contained in:
Leon Friedrich
2022-10-31 12:05:34 +13:00
committed by GitHub
parent 9d09de0f85
commit f0d02f032a
14 changed files with 71 additions and 56 deletions

View File

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

View File

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

View File

@@ -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<IMapManager>();
var invSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InventorySystem>();
mapMan.CreateNewMapEntity(MapId.Nullspace);
var entMgr = IoCManager.Resolve<IEntityManager>();
var container = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);
var container = entMgr.SpawnEntity(null, coordinates);
entMgr.EnsureComponent<ServerInventoryComponent>(container);
entMgr.EnsureComponent<ContainerManagerComponent>(container);
var child = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);
var child = entMgr.SpawnEntity(null, coordinates);
var item = entMgr.EnsureComponent<ClothingComponent>(child);
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ClothingSystem>().SetSlots(item.Owner, SlotFlags.HEAD, item);

View File

@@ -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<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkSystem>();
var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkTestSystem>();
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<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>();
var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkSystem>();
var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkTestSystem>();
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);
});

View File

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

View File

@@ -37,7 +37,6 @@ namespace Content.IntegrationTests.Tests.DoAfter
await server.WaitPost(() =>
{
var tickTime = 1.0f / IoCManager.Resolve<IGameTiming>().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<IGameTiming>().TickRate;
mapManager.CreateNewMapEntity(MapId.Nullspace);
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
var cancelToken = new CancellationTokenSource();

View File

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

View File

@@ -43,8 +43,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
await server.WaitAssertion(() =>
{
var mapManager = IoCManager.Resolve<IMapManager>();
mapManager.CreateNewMapEntity(MapId.Nullspace);
var entityManager = IoCManager.Resolve<IEntityManager>();
// Spawn the entities

View File

@@ -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<IEntitySystemManager>().GetEntitySystem<InventorySystem>();
var mapMan = IoCManager.Resolve<IMapManager>();
mapMan.CreateNewMapEntity(MapId.Nullspace);
var entityMan = IoCManager.Resolve<IEntityManager>();
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 _));

View File

@@ -52,9 +52,6 @@ namespace Content.IntegrationTests.Tests
{
var mapMan = IoCManager.Resolve<IMapManager>();
var systemMan = IoCManager.Resolve<IEntitySystemManager>();
mapMan.CreateNewMapEntity(MapId.Nullspace);
var human = sEntities.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
var invSystem = systemMan.GetEntitySystem<InventorySystem>();

View File

@@ -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<IPlayerManager>().ServerSessions.Single();
var mapMan = IoCManager.Resolve<IMapManager>();
map = mapMan.CreateMap();
var grid = mapMan.CreateGrid(map);
var entMgr = IoCManager.Resolve<IServerEntityManager>();
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<IMapManager>();
mapMan.DeleteMap(map);
mapMan.DeleteMap(testMap.MapId);
});
await PoolManager.RunTicksSync(pairTracker.Pair, 5);

View File

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

View File

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

View File

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