Engine Entity Anchoring Changes (#4195)

* Converted all SnapGridPositionChangedEvent subscriptions to AnchorStateChangedEvent.

* Fixes power tests with new anchored requirements.

* Moved AnchorableComponent into construction.
AnchorableComponent now uses Transform.Anchored.

* Fixed bug with nodes, power works again.

* Adds lifetime stages to Component.

* Update Engine to v0.4.70.
This commit is contained in:
Acruid
2021-06-19 19:41:26 -07:00
committed by GitHub
parent 0ab7b3a5d2
commit 15fb554c28
187 changed files with 279 additions and 287 deletions

View File

@@ -9,6 +9,7 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
namespace Content.IntegrationTests.Tests
@@ -29,15 +30,15 @@ namespace Content.IntegrationTests.Tests
- type: PowerSupplier
supplyRate: 3000
- type: Anchorable
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: entity
name: ConsumerDummy
id: ConsumerDummy
components:
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: NodeContainer
nodes:
input:
@@ -68,8 +69,8 @@ namespace Content.IntegrationTests.Tests
voltage: Medium
- type: BatteryDischarger
activeSupplyRate: 1000
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: entity
name: ApcDummy
@@ -94,8 +95,8 @@ namespace Content.IntegrationTests.Tests
output:
!type:AdjacentNode
nodeGroupID: Apc
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: UserInterface
interfaces:
- key: enum.ApcUiKey.Key
@@ -119,16 +120,16 @@ namespace Content.IntegrationTests.Tests
voltage: Apc
- type: Wire
wireType: Apc
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: entity
name: PowerReceiverDummy
id: PowerReceiverDummy
components:
- type: PowerReceiver
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
";
[Test]
public async Task PowerNetTest()
@@ -147,6 +148,11 @@ namespace Content.IntegrationTests.Tests
mapMan.CreateMap(new MapId(1));
var grid = mapMan.CreateGrid(new MapId(1));
// Power only works when anchored
grid.SetTile(new Vector2i(0, 0), new Tile(1));
grid.SetTile(new Vector2i(0, 1), new Tile(1));
grid.SetTile(new Vector2i(0, 2), new Tile(1));
var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
var consumerEnt1 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
var consumerEnt2 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
@@ -197,6 +203,11 @@ namespace Content.IntegrationTests.Tests
mapMan.CreateMap(new MapId(1));
var grid = mapMan.CreateGrid(new MapId(1));
// Power only works when anchored
grid.SetTile(new Vector2i(0, 0), new Tile(1));
grid.SetTile(new Vector2i(0, 1), new Tile(1));
grid.SetTile(new Vector2i(0, 2), new Tile(1));
var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
var substationEnt = entityMan.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1));
var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2));
@@ -245,6 +256,11 @@ namespace Content.IntegrationTests.Tests
mapMan.CreateMap(mapId);
var grid = mapMan.CreateGrid(mapId);
// Power only works when anchored
grid.SetTile(new Vector2i(0, 0), new Tile(1));
grid.SetTile(new Vector2i(0, 1), new Tile(1));
grid.SetTile(new Vector2i(0, 2), new Tile(1));
var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 0));
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCableDummy", grid.ToCoordinates(0, 1));
var powerReceiverEnt = entityMan.SpawnEntity("PowerReceiverDummy", grid.ToCoordinates(0, 2));