Remove client/server split on sharedphysicsmap (#3618)

This commit is contained in:
metalgearsloth
2022-12-27 13:17:54 +11:00
committed by GitHub
parent d8d68480c3
commit ace8500240
21 changed files with 73 additions and 95 deletions

View File

@@ -137,7 +137,7 @@ namespace Robust.UnitTesting
compFactory.RegisterClass<MetaDataComponent>();
}
if (!compFactory.AllRegisteredTypes.Contains(typeof(SharedPhysicsMapComponent)))
if (!compFactory.AllRegisteredTypes.Contains(typeof(PhysicsMapComponent)))
{
compFactory.RegisterClass<PhysicsMapComponent>();
}

View File

@@ -1,13 +1,12 @@
using System.Linq;
using NUnit.Framework;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Server.Physics;
using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Manager.Attributes;

View File

@@ -39,6 +39,7 @@ using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Threading;
using Robust.Shared.Timing;
using Robust.Server.Replays;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Replays;
using Robust.Shared.Players;

View File

@@ -231,7 +231,7 @@ public sealed class Broadphase_Test
var AssertMap = (EntityUid map, EntityUid otherMap) =>
{
var broadphase = entManager.GetComponent<BroadphaseComponent>(map);
var physMap = entManager.GetComponent<SharedPhysicsMapComponent>(map);
var physMap = entManager.GetComponent<PhysicsMapComponent>(map);
Assert.That(parentXform.ParentUid == map);
Assert.That(parentXform.MapUid == map);
Assert.That(childXform.MapUid == map);
@@ -240,7 +240,7 @@ public sealed class Broadphase_Test
Assert.That(parentXform.Broadphase == new BroadphaseData(map, default, false, false));
Assert.That(childXform.Broadphase == new BroadphaseData(map, map, true, true));
Assert.That(physMap.MoveBuffer.ContainsKey(childFixtures.Fixtures.First().Value.Proxies.First()));
var otherPhysMap = entManager.GetComponent<SharedPhysicsMapComponent>(otherMap);
var otherPhysMap = entManager.GetComponent<PhysicsMapComponent>(otherMap);
Assert.That(otherPhysMap.MoveBuffer.Count == 0);
};
AssertMap(mapA, mapB);
@@ -263,7 +263,7 @@ public sealed class Broadphase_Test
var AssertGrid = (EntityUid grid, EntityUid map, EntityUid otherMap) =>
{
var broadphase = entManager.GetComponent<BroadphaseComponent>(grid);
var physMap = entManager.GetComponent<SharedPhysicsMapComponent>(map);
var physMap = entManager.GetComponent<PhysicsMapComponent>(map);
var gridXform = entManager.GetComponent<TransformComponent>(grid);
Assert.That(gridXform.ParentUid == map);
Assert.That(gridXform.MapUid == map);
@@ -275,7 +275,7 @@ public sealed class Broadphase_Test
Assert.That(parentXform.Broadphase == new BroadphaseData(grid, default, false, false));
Assert.That(childXform.Broadphase == new BroadphaseData(grid, map, true, true));
Assert.That(physMap.MoveBuffer.ContainsKey(childFixtures.Fixtures.First().Value.Proxies.First()));
var otherPhysMap = entManager.GetComponent<SharedPhysicsMapComponent>(otherMap);
var otherPhysMap = entManager.GetComponent<PhysicsMapComponent>(otherMap);
Assert.That(otherPhysMap.MoveBuffer.Count == 0);
};
AssertGrid(gridA, mapA, mapB);

View File

@@ -62,7 +62,7 @@ public sealed class GridMovement_Test : RobustIntegrationTest
// Alright just a quick validation then we start the actual damn test.
var physicsMap = entManager.GetComponent<SharedPhysicsMapComponent>(mapManager.GetMapEntityId(mapId));
var physicsMap = entManager.GetComponent<PhysicsMapComponent>(mapManager.GetMapEntityId(mapId));
physSystem.Step(physicsMap, 0.001f, false);
Assert.That(onGridBody.ContactCount, Is.EqualTo(0));

View File

@@ -12,7 +12,7 @@ using Robust.UnitTesting.Server;
namespace Robust.UnitTesting.Shared.Physics;
[TestFixture, TestOf(typeof(SharedPhysicsMapComponent))]
[TestFixture, TestOf(typeof(PhysicsMapComponent))]
public sealed class PhysicsMap_Test
{
/// <summary>
@@ -32,8 +32,8 @@ public sealed class PhysicsMap_Test
var mapUid = mapManager.GetMapEntityId(mapId);
var mapUid2 = mapManager.GetMapEntityId(mapId2);
var physicsMap = entManager.GetComponent<SharedPhysicsMapComponent>(mapUid);
var physicsMap2 = entManager.GetComponent<SharedPhysicsMapComponent>(mapUid2);
var physicsMap = entManager.GetComponent<PhysicsMapComponent>(mapUid);
var physicsMap2 = entManager.GetComponent<PhysicsMapComponent>(mapUid2);
var parent = entManager.SpawnEntity(null, new MapCoordinates(Vector2.Zero, mapId));
var parentXform = entManager.GetComponent<TransformComponent>(parent);

View File

@@ -65,7 +65,7 @@ namespace Robust.UnitTesting.Shared.Physics
mapId = mapManager.CreateMap();
EntityUid tempQualifier2 = mapManager.GetMapEntityId(mapId);
entityManager.GetComponent<SharedPhysicsMapComponent>(tempQualifier2).Gravity = new Vector2(0, -9.8f);
entityManager.GetComponent<PhysicsMapComponent>(tempQualifier2).Gravity = new Vector2(0, -9.8f);
EntityUid tempQualifier = entityManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId));
var ground = entityManager.AddComponent<PhysicsComponent>(tempQualifier);
@@ -183,7 +183,7 @@ namespace Robust.UnitTesting.Shared.Physics
{
mapId = mapManager.CreateMap();
EntityUid tempQualifier2 = mapManager.GetMapEntityId(mapId);
entityManager.GetComponent<SharedPhysicsMapComponent>(tempQualifier2).Gravity = new Vector2(0, -9.8f);
entityManager.GetComponent<PhysicsMapComponent>(tempQualifier2).Gravity = new Vector2(0, -9.8f);
EntityUid tempQualifier = entityManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId));
var ground = entityManager.AddComponent<PhysicsComponent>(tempQualifier);