Replace every usage of GridCoordinates with EntityCoordinates (#2021)
* Update RobustToolbox * Transition direct type usages * More updates * Fix invalid use of to map * Update RobustToolbox * Fix dropping items * Rename name usages of "GridCoordinates" to "EntityCoordinates" * Revert "Update RobustToolbox" This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346. * Revert "Update RobustToolbox" This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09. # Conflicts: # RobustToolbox * Fix cursed IMapGrid method usage. * GridTileLookupTest now uses EntityCoordinates Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Shared.Utility;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.AI;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -50,7 +51,7 @@ namespace Content.IntegrationTests.Tests.AI
|
||||
|
||||
if (!comps.ContainsKey("AiController")) continue;
|
||||
|
||||
var aiEntity = entityManager.SpawnEntity(entity.ID, new GridCoordinates(new Vector2(0, 0), grid.Index));
|
||||
var aiEntity = entityManager.SpawnEntity(entity.ID, grid.ToCoordinates());
|
||||
var aiController = aiEntity.GetComponent<AiControllerComponent>();
|
||||
Assert.That(processorNames.Contains(aiController.LogicName), $"Could not find valid processor named {aiController.LogicName} on entity {entity.ID}");
|
||||
}
|
||||
@@ -58,6 +59,5 @@ namespace Content.IntegrationTests.Tests.AI
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Atmos;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Atmos
|
||||
@@ -10,17 +11,23 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
public class AtmosHelpersTest : ContentIntegrationTest
|
||||
{
|
||||
[Test]
|
||||
public async Task GetTileAtmosphereGridCoordinatesNullTest()
|
||||
public async Task GetTileAtmosphereEntityCoordinatesNullTest()
|
||||
{
|
||||
var server = StartServerDummyTicker();
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var atmosphere = default(GridCoordinates).GetTileAtmosphere();
|
||||
var atmosphere1 = default(EntityCoordinates).GetTileAtmosphere();
|
||||
var atmosphere2 = default(EntityCoordinates).GetTileAtmosphere(entityManager);
|
||||
|
||||
Assert.Null(atmosphere);
|
||||
Assert.Null(atmosphere1);
|
||||
Assert.Null(atmosphere2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,7 +35,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task GetTileAirGridCoordinatesNullTest()
|
||||
public async Task GetTileAirEntityCoordinatesNullTest()
|
||||
{
|
||||
var server = StartServerDummyTicker();
|
||||
|
||||
@@ -36,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var air = default(GridCoordinates).GetTileAir();
|
||||
var air = default(EntityCoordinates).GetTileAir();
|
||||
|
||||
Assert.Null(air);
|
||||
});
|
||||
@@ -46,7 +53,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TryGetTileAtmosphereGridCoordinatesNullTest()
|
||||
public async Task TryGetTileAtmosphereEntityCoordinatesNullTest()
|
||||
{
|
||||
var server = StartServerDummyTicker();
|
||||
|
||||
@@ -54,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var hasAtmosphere = default(GridCoordinates).TryGetTileAtmosphere(out var atmosphere);
|
||||
var hasAtmosphere = default(EntityCoordinates).TryGetTileAtmosphere(out var atmosphere);
|
||||
|
||||
Assert.False(hasAtmosphere);
|
||||
Assert.Null(atmosphere);
|
||||
@@ -65,7 +72,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TryGetTileTileAirGridCoordinatesNullTest()
|
||||
public async Task TryGetTileTileAirEntityCoordinatesNullTest()
|
||||
{
|
||||
var server = StartServerDummyTicker();
|
||||
|
||||
@@ -73,7 +80,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
var hasAir = default(GridCoordinates).TryGetTileAir(out var air);
|
||||
var hasAir = default(EntityCoordinates).TryGetTileAir(out var air);
|
||||
|
||||
Assert.False(hasAir);
|
||||
Assert.Null(air);
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Buckle;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Utility;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -193,7 +194,7 @@ namespace Content.IntegrationTests.Tests
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.CreateGrid(mapId, gridId);
|
||||
var coordinates = new GridCoordinates((0, 0), gridId);
|
||||
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||
var tileManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||
var tileId = tileManager["underplating"].TileId;
|
||||
var tile = new Tile(tileId);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Utility;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Interfaces.Timing;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -52,7 +53,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
|
||||
@@ -61,7 +62,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
var testLocation = new GridCoordinates(new Vector2(0, 0), grid);
|
||||
var testLocation = grid.ToCoordinates();
|
||||
|
||||
//Generate list of non-abstract prototypes to test
|
||||
foreach (var prototype in prototypeMan.EnumeratePrototypes<EntityPrototype>())
|
||||
@@ -160,7 +161,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
|
||||
@@ -169,7 +170,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
var testLocation = new GridCoordinates(new Vector2(0, 0), grid);
|
||||
var testLocation = grid.ToCoordinates();
|
||||
|
||||
foreach (var type in componentFactory.AllRegisteredTypes)
|
||||
{
|
||||
@@ -255,7 +256,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
|
||||
@@ -300,7 +301,7 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
foreach (var distinct in distinctComponents)
|
||||
{
|
||||
var testLocation = new GridCoordinates(new Vector2(0, 0), grid);
|
||||
var testLocation = grid.ToCoordinates();
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
||||
|
||||
Assert.That(entity.Initialized);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Fluids;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Utility;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Interfaces.Timing;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -23,7 +24,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
||||
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
||||
|
||||
GridCoordinates coordinates = default;
|
||||
EntityCoordinates coordinates = default;
|
||||
|
||||
// Build up test environment
|
||||
server.Post(() =>
|
||||
@@ -42,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
coordinates = new GridCoordinates(0, 0, gridId);
|
||||
coordinates = grid.ToCoordinates();
|
||||
|
||||
grid.SetTile(coordinates, tile);
|
||||
|
||||
@@ -69,6 +70,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
await server.WaitIdleAsync();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
||||
IMapGrid grid = null;
|
||||
|
||||
// Build up test environment
|
||||
server.Post(() =>
|
||||
@@ -79,9 +81,9 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
|
||||
var gridId = new GridId(1);
|
||||
|
||||
if (!mapManager.GridExists(gridId))
|
||||
if (!mapManager.TryGetGrid(gridId, out grid))
|
||||
{
|
||||
mapManager.CreateGrid(mapId, gridId);
|
||||
grid = mapManager.CreateGrid(mapId, gridId);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -90,7 +92,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
server.Assert(() =>
|
||||
{
|
||||
var gridId = new GridId(1);
|
||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
||||
var coordinates = grid.ToCoordinates();
|
||||
var solution = new Solution("water", ReagentUnit.New(20));
|
||||
var puddle = solution.SpillAt(coordinates, "PuddleSmear");
|
||||
Assert.Null(puddle);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Gravity;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Shared.Utility;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -37,7 +38,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
generator = entityMan.SpawnEntity("GravityGenerator", new GridCoordinates(new Vector2(0, 0), grid2.Index));
|
||||
generator = entityMan.SpawnEntity("GravityGenerator", grid2.ToCoordinates());
|
||||
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
||||
Assert.That(generator.HasComponent<PowerReceiverComponent>());
|
||||
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.IntegrationTests.Tests
|
||||
List<IEntity> entities;
|
||||
var mapOne = mapManager.CreateMap();
|
||||
var gridOne = mapManager.CreateGrid(mapOne);
|
||||
|
||||
|
||||
var tileDefinition = tileDefinitionManager["underplating"];
|
||||
var underplating = new Tile(tileDefinition.TileId);
|
||||
gridOne.SetTile(new MapIndices(0, 0), underplating);
|
||||
@@ -45,8 +45,8 @@ namespace Content.IntegrationTests.Tests
|
||||
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(1000, 1000)).ToList();
|
||||
Assert.That(entities.Count, Is.EqualTo(0));
|
||||
|
||||
var entityOne = entityManager.SpawnEntity("HumanMob_Content", new GridCoordinates(Vector2.Zero, gridOne));
|
||||
entityManager.SpawnEntity("HumanMob_Content", new GridCoordinates(Vector2.One, gridOne));
|
||||
var entityOne = entityManager.SpawnEntity("HumanMob_Content", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
|
||||
entityManager.SpawnEntity("HumanMob_Content", new EntityCoordinates(gridOne.GridEntityId, Vector2.One));
|
||||
|
||||
var entityTiles = tileLookup.GetIndices(entityOne);
|
||||
Assert.That(entityTiles.Count, Is.EqualTo(2));
|
||||
@@ -54,11 +54,11 @@ namespace Content.IntegrationTests.Tests
|
||||
entities = tileLookup.GetEntitiesIntersecting(entityOne).ToList();
|
||||
// Includes station entity
|
||||
Assert.That(entities.Count, Is.EqualTo(3));
|
||||
|
||||
|
||||
// Both dummies should be in each corner of the 0,0 tile but only one dummy intersects -1,-1
|
||||
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(-1, -1)).ToList();
|
||||
Assert.That(entities.Count, Is.EqualTo(1));
|
||||
|
||||
|
||||
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(0, 0)).ToList();
|
||||
Assert.That(entities.Count, Is.EqualTo(2));
|
||||
});
|
||||
@@ -66,4 +66,4 @@ namespace Content.IntegrationTests.Tests
|
||||
await server.WaitIdleAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
IEntity other = null;
|
||||
IContainer container = null;
|
||||
IComponent component = null;
|
||||
GridCoordinates gridCoordinates = default;
|
||||
EntityCoordinates entityCoordinates = default;
|
||||
MapCoordinates mapCoordinates = default;
|
||||
|
||||
server.Assert(() =>
|
||||
@@ -53,7 +53,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
other = entityManager.SpawnEntity(HumanId, coordinates);
|
||||
container = ContainerManagerComponent.Ensure<Container>("InRangeUnobstructedTestOtherContainer", other);
|
||||
component = other.Transform;
|
||||
gridCoordinates = other.Transform.GridPosition;
|
||||
entityCoordinates = other.Transform.Coordinates;
|
||||
mapCoordinates = other.Transform.MapPosition;
|
||||
});
|
||||
|
||||
@@ -73,9 +73,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
Assert.True(origin.InRangeUnobstructed(container));
|
||||
Assert.True(container.InRangeUnobstructed(origin));
|
||||
|
||||
// Entity <-> GridCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(gridCoordinates));
|
||||
Assert.True(gridCoordinates.InRangeUnobstructed(origin));
|
||||
// Entity <-> EntityCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(entityCoordinates));
|
||||
Assert.True(entityCoordinates.InRangeUnobstructed(origin));
|
||||
|
||||
// Entity <-> MapCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(mapCoordinates));
|
||||
@@ -97,9 +97,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
Assert.True(origin.InRangeUnobstructed(container));
|
||||
Assert.True(container.InRangeUnobstructed(origin));
|
||||
|
||||
// Entity <-> GridCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(gridCoordinates));
|
||||
Assert.True(gridCoordinates.InRangeUnobstructed(origin));
|
||||
// Entity <-> EntityCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(entityCoordinates));
|
||||
Assert.True(entityCoordinates.InRangeUnobstructed(origin));
|
||||
|
||||
// Entity <-> MapCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(mapCoordinates));
|
||||
@@ -121,9 +121,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
Assert.False(origin.InRangeUnobstructed(container));
|
||||
Assert.False(container.InRangeUnobstructed(origin));
|
||||
|
||||
// Entity <-> GridCoordinates
|
||||
Assert.False(origin.InRangeUnobstructed(gridCoordinates));
|
||||
Assert.False(gridCoordinates.InRangeUnobstructed(origin));
|
||||
// Entity <-> EntityCoordinates
|
||||
Assert.False(origin.InRangeUnobstructed(entityCoordinates));
|
||||
Assert.False(entityCoordinates.InRangeUnobstructed(origin));
|
||||
|
||||
// Entity <-> MapCoordinates
|
||||
Assert.False(origin.InRangeUnobstructed(mapCoordinates));
|
||||
@@ -144,9 +144,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
Assert.True(origin.InRangeUnobstructed(container, InteractionRangeDivided15Times3));
|
||||
Assert.True(container.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
||||
|
||||
// Entity <-> GridCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(gridCoordinates, InteractionRangeDivided15Times3));
|
||||
Assert.True(gridCoordinates.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
||||
// Entity <-> EntityCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(entityCoordinates, InteractionRangeDivided15Times3));
|
||||
Assert.True(entityCoordinates.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
||||
|
||||
// Entity <-> MapCoordinates
|
||||
Assert.True(origin.InRangeUnobstructed(mapCoordinates, InteractionRangeDivided15Times3));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Mobs;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Utility;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
@@ -128,7 +129,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
mapMan.CreateNewMapEntity(MapId.Nullspace);
|
||||
|
||||
playerEnt = entMgr.SpawnEntity(null, new GridCoordinates(Vector2.Zero, grid.Index));
|
||||
playerEnt = entMgr.SpawnEntity(null, grid.ToCoordinates());
|
||||
|
||||
mind = new Mind(player.SessionId);
|
||||
player.ContentData().Mind = mind;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
var lastSvEntity = svEntityManager.GetEntities().Last();
|
||||
var lastClEntity = clEntityManager.GetEntity(lastSvEntity.Uid);
|
||||
|
||||
Assert.That(lastClEntity.Transform.GridPosition, Is.EqualTo(lastSvEntity.Transform.GridPosition));
|
||||
Assert.That(lastClEntity.Transform.Coordinates, Is.EqualTo(lastSvEntity.Transform.Coordinates));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Utility;
|
||||
|
||||
namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
@@ -30,9 +31,9 @@ namespace Content.IntegrationTests.Tests
|
||||
mapMan.CreateMap(new MapId(1));
|
||||
var grid = mapMan.CreateGrid(new MapId(1));
|
||||
|
||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", new GridCoordinates(new Vector2(0, 0), grid.Index));
|
||||
var consumerEnt1 = entityMan.SpawnEntity("DebugConsumer", new GridCoordinates(new Vector2(0, 1), grid.Index));
|
||||
var consumerEnt2 = entityMan.SpawnEntity("DebugConsumer", new GridCoordinates(new Vector2(0, 2), grid.Index));
|
||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates());
|
||||
var consumerEnt1 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 1));
|
||||
var consumerEnt2 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 2));
|
||||
|
||||
Assert.That(generatorEnt.TryGetComponent(out supplier));
|
||||
Assert.That(consumerEnt1.TryGetComponent(out consumer1));
|
||||
@@ -74,9 +75,9 @@ namespace Content.IntegrationTests.Tests
|
||||
mapMan.CreateMap(new MapId(1));
|
||||
var grid = mapMan.CreateGrid(new MapId(1));
|
||||
|
||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", new GridCoordinates(new Vector2(0, 0), grid.Index));
|
||||
var substationEnt = entityMan.SpawnEntity("DebugSubstation", new GridCoordinates(new Vector2(0, 1), grid.Index));
|
||||
var apcEnt = entityMan.SpawnEntity("DebugApc", new GridCoordinates(new Vector2(0, 2), grid.Index));
|
||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates());
|
||||
var substationEnt = entityMan.SpawnEntity("DebugSubstation", grid.ToCoordinates(0, 1));
|
||||
var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 2));
|
||||
|
||||
Assert.That(generatorEnt.TryGetComponent<PowerSupplierComponent>(out var generatorSupplier));
|
||||
|
||||
@@ -120,9 +121,9 @@ namespace Content.IntegrationTests.Tests
|
||||
mapMan.CreateMap(new MapId(1));
|
||||
var grid = mapMan.CreateGrid(new MapId(1));
|
||||
|
||||
var apcEnt = entityMan.SpawnEntity("DebugApc", new GridCoordinates(new Vector2(0, 0), grid.Index));
|
||||
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCable", new GridCoordinates(new Vector2(0, 1), grid.Index));
|
||||
var powerReceiverEnt = entityMan.SpawnEntity("DebugPowerReceiver", new GridCoordinates(new Vector2(0, 2), grid.Index));
|
||||
var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 0));
|
||||
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCable", grid.ToCoordinates(0, 1));
|
||||
var powerReceiverEnt = entityMan.SpawnEntity("DebugPowerReceiver", grid.ToCoordinates(0, 2));
|
||||
|
||||
Assert.That(apcEnt.TryGetComponent<ApcComponent>(out var apc));
|
||||
Assert.That(apcExtensionEnt.TryGetComponent<PowerProviderComponent>(out var provider));
|
||||
|
||||
Reference in New Issue
Block a user