Files
tbd-station-14/Content.IntegrationTests/Tests/Tiles/TileConstructionTests.cs
Nemanja 524725d378 HandsSystem Refactor (#38438)
* checkpoint

* pt 2

* pt... i forgot

* pt 4

* patch

* More test fixes

* optimization!!!

* the REAL hand system

* fix RetractableItemActionSystem.cs oversight

* the review

* test

* remove test usage of body prototype

* Update Content.IntegrationTests/Tests/Interaction/InteractionTest.cs

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>

* hellcode

* hellcode 2

* Minor cleanup

* test

* Chasing the last of the bugs

* changes

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2025-06-25 15:13:03 +02:00

104 lines
3.1 KiB
C#

using Content.IntegrationTests.Tests.Interaction;
using Robust.Shared.Map;
namespace Content.IntegrationTests.Tests.Tiles;
public sealed class TileConstructionTests : InteractionTest
{
/// <summary>
/// Test placing and cutting a single lattice.
/// </summary>
[Test]
public async Task PlaceThenCutLattice()
{
await AssertTile(Plating);
await AssertTile(Plating, PlayerCoords);
AssertGridCount(1);
await SetTile(null);
await InteractUsing(Rod);
await AssertTile(Lattice);
Assert.That(HandSys.GetActiveItem((SEntMan.GetEntity(Player), Hands)), Is.Null);
await InteractUsing(Cut);
await AssertTile(null);
await AssertEntityLookup((Rod, 1));
AssertGridCount(1);
}
/// <summary>
/// Test placing and cutting a single lattice in space (not adjacent to any existing grid.
/// </summary>
[Test]
public async Task CutThenPlaceLatticeNewGrid()
{
await AssertTile(Plating);
await AssertTile(Plating, PlayerCoords);
AssertGridCount(1);
// Remove grid
await SetTile(null);
await SetTile(null, PlayerCoords);
Assert.That(MapData.Grid.Comp.Deleted);
AssertGridCount(0);
// Place Lattice
var oldPos = TargetCoords;
TargetCoords = SEntMan.GetNetCoordinates(new EntityCoordinates(MapData.MapUid, 1, 0));
await InteractUsing(Rod);
TargetCoords = oldPos;
await AssertTile(Lattice);
AssertGridCount(1);
// Cut lattice
Assert.That(HandSys.GetActiveItem((SEntMan.GetEntity(Player), Hands)), Is.Null);
await InteractUsing(Cut);
await AssertTile(null);
AssertGridCount(0);
await AssertEntityLookup((Rod, 1));
}
/// <summary>
/// Test space -> floor -> plating
/// </summary>
[Test]
public async Task FloorConstructDeconstruct()
{
await AssertTile(Plating);
await AssertTile(Plating, PlayerCoords);
AssertGridCount(1);
// Remove grid
await SetTile(null);
await SetTile(null, PlayerCoords);
Assert.That(MapData.Grid.Comp.Deleted);
AssertGridCount(0);
// Space -> Lattice
var oldPos = TargetCoords;
TargetCoords = SEntMan.GetNetCoordinates(new EntityCoordinates(MapData.MapUid, 1, 0));
await InteractUsing(Rod);
TargetCoords = oldPos;
await AssertTile(Lattice);
AssertGridCount(1);
// Lattice -> Plating
await InteractUsing(FloorItem);
Assert.That(HandSys.GetActiveItem((SEntMan.GetEntity(Player), Hands)), Is.Null);
await AssertTile(Plating);
AssertGridCount(1);
// Plating -> Tile
await InteractUsing(FloorItem);
Assert.That(HandSys.GetActiveItem((SEntMan.GetEntity(Player), Hands)), Is.Null);
await AssertTile(Floor);
AssertGridCount(1);
// Tile -> Plating
await InteractUsing(Pry);
await AssertTile(Plating);
AssertGridCount(1);
await AssertEntityLookup((FloorItem, 1));
}
}