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(); _ghostKick.Initialize();
_extendedDisconnectInformation.Initialize(); _extendedDisconnectInformation.Initialize();
_playTimeTracking.Initialize(); _playTimeTracking.Initialize();
_baseClient.PlayerJoinedServer += (_, _) => { _mapManager.CreateNewMapEntity(MapId.Nullspace);};
//AUTOSCALING default Setup! //AUTOSCALING default Setup!
_configManager.SetCVar("interface.resolutionAutoScaleUpperCutoffX", 1080); _configManager.SetCVar("interface.resolutionAutoScaleUpperCutoffX", 1080);

View File

@@ -42,8 +42,6 @@ namespace Content.IntegrationTests.Tests.Commands
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
mapManager.CreateNewMapEntity(MapId.Nullspace);
var human = entManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace); var human = entManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace);
// Sanity check // Sanity check

View File

@@ -21,6 +21,8 @@ namespace Content.IntegrationTests.Tests
{ {
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
@@ -28,14 +30,12 @@ namespace Content.IntegrationTests.Tests
var mapMan = IoCManager.Resolve<IMapManager>(); var mapMan = IoCManager.Resolve<IMapManager>();
var invSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InventorySystem>(); var invSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InventorySystem>();
mapMan.CreateNewMapEntity(MapId.Nullspace);
var entMgr = IoCManager.Resolve<IEntityManager>(); var entMgr = IoCManager.Resolve<IEntityManager>();
var container = entMgr.SpawnEntity(null, MapCoordinates.Nullspace); var container = entMgr.SpawnEntity(null, coordinates);
entMgr.EnsureComponent<ServerInventoryComponent>(container); entMgr.EnsureComponent<ServerInventoryComponent>(container);
entMgr.EnsureComponent<ContainerManagerComponent>(container); entMgr.EnsureComponent<ContainerManagerComponent>(container);
var child = entMgr.SpawnEntity(null, MapCoordinates.Nullspace); var child = entMgr.SpawnEntity(null, coordinates);
var item = entMgr.EnsureComponent<ClothingComponent>(child); var item = entMgr.EnsureComponent<ClothingComponent>(child);
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ClothingSystem>().SetSlots(item.Owner, SlotFlags.HEAD, item); 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(() => { await server.WaitAssertion(() => {
mapManager.CreateNewMapEntity(MapId.Nullspace);
device1 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace); device1 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace);
Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True); 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}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>(); var entityManager = server.ResolveDependency<IEntityManager>();
var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkSystem>(); var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkSystem>();
var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkTestSystem>(); var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkTestSystem>();
EntityUid device1 = default; EntityUid device1 = default;
EntityUid device2 = default; EntityUid device2 = default;
DeviceNetworkComponent networkComponent1 = null; DeviceNetworkComponent networkComponent1 = null;
@@ -128,16 +127,14 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
}; };
await server.WaitAssertion(() => { await server.WaitAssertion(() => {
mapManager.CreateNewMapEntity(MapId.Nullspace); device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", coordinates);
device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace);
Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True); Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
Assert.That(entityManager.TryGetComponent(device1, out wirelessNetworkComponent), Is.True); Assert.That(entityManager.TryGetComponent(device1, out wirelessNetworkComponent), Is.True);
Assert.That(networkComponent1.ReceiveFrequency != null, Is.True); Assert.That(networkComponent1.ReceiveFrequency != null, Is.True);
Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); 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(entityManager.TryGetComponent(device2, out networkComponent2), Is.True);
Assert.That(networkComponent2.ReceiveFrequency != null, 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}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
var mapManager = server.ResolveDependency<IMapManager>(); var mapManager = server.ResolveDependency<IMapManager>();
var entityManager = server.ResolveDependency<IEntityManager>(); var entityManager = server.ResolveDependency<IEntityManager>();
var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkSystem>(); var deviceNetSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkSystem>();
var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkTestSystem>(); var deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem<DeviceNetworkTestSystem>();
EntityUid device1 = default; EntityUid device1 = default;
EntityUid device2 = default; EntityUid device2 = default;
DeviceNetworkComponent networkComponent1 = null; DeviceNetworkComponent networkComponent1 = null;
DeviceNetworkComponent networkComponent2 = null; DeviceNetworkComponent networkComponent2 = null;
WiredNetworkComponent wiredNetworkComponent = null; WiredNetworkComponent wiredNetworkComponent = null;
IMapGrid grid = null; IMapGrid grid = testMap.MapGrid;
var testValue = "test"; var testValue = "test";
var payload = new NetworkPayload var payload = new NetworkPayload
@@ -205,17 +203,14 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
await server.WaitIdleAsync(); await server.WaitIdleAsync();
await server.WaitAssertion(() => { await server.WaitAssertion(() => {
var map = mapManager.CreateNewMapEntity(MapId.Nullspace); device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", coordinates);
grid = mapManager.CreateGrid(MapId.Nullspace);
device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", MapCoordinates.Nullspace);
Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True); Assert.That(entityManager.TryGetComponent(device1, out networkComponent1), Is.True);
Assert.That(entityManager.TryGetComponent(device1, out wiredNetworkComponent), Is.True); Assert.That(entityManager.TryGetComponent(device1, out wiredNetworkComponent), Is.True);
Assert.That(networkComponent1.ReceiveFrequency != null, Is.True); Assert.That(networkComponent1.ReceiveFrequency != null, Is.True);
Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); 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(entityManager.TryGetComponent(device2, out networkComponent2), Is.True);
Assert.That(networkComponent2.ReceiveFrequency != null, Is.True); Assert.That(networkComponent2.ReceiveFrequency != null, Is.True);
@@ -232,7 +227,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
await server.WaitAssertion(() => { await server.WaitAssertion(() => {
//CollectionAssert.AreNotEqual(deviceNetTestSystem.LastPayload, payload); //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); deviceNetSystem.QueuePacket(device1, networkComponent2.Address, payload, networkComponent2.ReceiveFrequency.Value);
}); });

View File

@@ -84,6 +84,10 @@ namespace Content.IntegrationTests.Tests.Disposal
- type: Physics - type: Physics
bodyType: KinematicController bodyType: KinematicController
- type: Fixtures - type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
- type: DoAfter - type: DoAfter
- type: entity - type: entity
@@ -97,6 +101,10 @@ namespace Content.IntegrationTests.Tests.Disposal
- type: Physics - type: Physics
bodyType: Dynamic bodyType: Dynamic
- type: Fixtures - type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
- type: DoAfter - type: DoAfter
- type: entity - type: entity
@@ -111,6 +119,10 @@ namespace Content.IntegrationTests.Tests.Disposal
- type: Physics - type: Physics
bodyType: Static bodyType: Static
- type: Fixtures - type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
- type: entity - type: entity
name: DisposalTrunkDummy name: DisposalTrunkDummy

View File

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

View File

@@ -60,8 +60,6 @@ namespace Content.IntegrationTests.Tests.Doors
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
mapManager.CreateNewMapEntity(MapId.Nullspace);
airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace); airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace);
Assert.True(entityManager.TryGetComponent(airlock, out doorComponent)); Assert.True(entityManager.TryGetComponent(airlock, out doorComponent));

View File

@@ -43,8 +43,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
var mapManager = IoCManager.Resolve<IMapManager>(); var mapManager = IoCManager.Resolve<IMapManager>();
mapManager.CreateNewMapEntity(MapId.Nullspace);
var entityManager = IoCManager.Resolve<IEntityManager>(); var entityManager = IoCManager.Resolve<IEntityManager>();
// Spawn the entities // 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}); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
EntityUid human = default; EntityUid human = default;
EntityUid uniform = default; EntityUid uniform = default;
@@ -72,16 +74,13 @@ namespace Content.IntegrationTests.Tests
{ {
invSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InventorySystem>(); invSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InventorySystem>();
var mapMan = IoCManager.Resolve<IMapManager>(); var mapMan = IoCManager.Resolve<IMapManager>();
mapMan.CreateNewMapEntity(MapId.Nullspace);
var entityMan = IoCManager.Resolve<IEntityManager>(); var entityMan = IoCManager.Resolve<IEntityManager>();
human = entityMan.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); human = entityMan.SpawnEntity("HumanDummy", coordinates);
uniform = entityMan.SpawnEntity("UniformDummy", MapCoordinates.Nullspace); uniform = entityMan.SpawnEntity("UniformDummy", coordinates);
idCard = entityMan.SpawnEntity("IDCardDummy", MapCoordinates.Nullspace); idCard = entityMan.SpawnEntity("IDCardDummy", coordinates);
pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace); pocketItem = entityMan.SpawnEntity("FlashlightDummy", coordinates);
var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace); var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", coordinates);
Assert.That(invSystem.CanEquip(human, uniform, "jumpsuit", out _)); Assert.That(invSystem.CanEquip(human, uniform, "jumpsuit", out _));

View File

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

View File

@@ -124,25 +124,18 @@ namespace Content.IntegrationTests.Tests
{ {
await using var pairTracker = await PoolManager.GetServerClient(); await using var pairTracker = await PoolManager.GetServerClient();
var server = pairTracker.Pair.Server; var server = pairTracker.Pair.Server;
var testMap = await PoolManager.CreateTestMap(pairTracker);
var coordinates = testMap.GridCoords;
EntityUid playerEnt = default; EntityUid playerEnt = default;
Mind mind = null; Mind mind = null;
MapId map = default;
await server.WaitAssertion(() => await server.WaitAssertion(() =>
{ {
var player = IoCManager.Resolve<IPlayerManager>().ServerSessions.Single(); var player = IoCManager.Resolve<IPlayerManager>().ServerSessions.Single();
var mapMan = IoCManager.Resolve<IMapManager>(); var mapMan = IoCManager.Resolve<IMapManager>();
map = mapMan.CreateMap();
var grid = mapMan.CreateGrid(map);
var entMgr = IoCManager.Resolve<IServerEntityManager>(); var entMgr = IoCManager.Resolve<IServerEntityManager>();
playerEnt = entMgr.SpawnEntity(null, coordinates);
mapMan.CreateNewMapEntity(MapId.Nullspace);
playerEnt = entMgr.SpawnEntity(null, grid.ToCoordinates());
mind = new Mind(player.UserId); mind = new Mind(player.UserId);
mind.ChangeOwningPlayer(player.UserId); mind.ChangeOwningPlayer(player.UserId);
@@ -156,8 +149,7 @@ namespace Content.IntegrationTests.Tests
await server.WaitPost(() => await server.WaitPost(() =>
{ {
var mapMan = IoCManager.Resolve<IMapManager>(); var mapMan = IoCManager.Resolve<IMapManager>();
mapMan.DeleteMap(testMap.MapId);
mapMan.DeleteMap(map);
}); });
await PoolManager.RunTicksSync(pairTracker.Pair, 5); await PoolManager.RunTicksSync(pairTracker.Pair, 5);

View File

@@ -126,7 +126,38 @@ public sealed class PrototypeSaveTest
"ClothingHeadHatChef", "ClothingHeadHatChef",
"Bucket", "Bucket",
"AirlockShuttle", "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] [Test]

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -157,7 +157,6 @@ public sealed class StationJobsTest
var station = EntityUid.Invalid; var station = EntityUid.Invalid;
await server.WaitPost(() => await server.WaitPost(() =>
{ {
mapManager.CreateNewMapEntity(MapId.Nullspace);
station = stationSystem.InitializeNewStation(fooStationProto.Stations["Station"], null, $"Foo Station"); 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.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Shared.Tag; using Content.Shared.Tag;
@@ -57,7 +57,6 @@ namespace Content.IntegrationTests.Tests.Tag
await server.WaitPost(() => await server.WaitPost(() =>
{ {
sMapManager.CreateNewMapEntity(MapId.Nullspace);
sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace); sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace);
sTagComponent = sEntityManager.GetComponent<TagComponent>(sTagDummy); sTagComponent = sEntityManager.GetComponent<TagComponent>(sTagDummy);
}); });