Skip to content

Commit

Permalink
Fix disposals test (#26535)
Browse files Browse the repository at this point in the history
The rounding at 0,0 got memed.
  • Loading branch information
metalgearsloth authored and VMSolidus committed Jul 10, 2024
1 parent f84b4a9 commit 090ec15
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,14 @@ public async Task Test()
var entityManager = server.ResolveDependency<IEntityManager>();
var xformSystem = entityManager.System<SharedTransformSystem>();
var disposalSystem = entityManager.System<DisposalUnitSystem>();

await server.WaitAssertion(() =>
{
// Spawn the entities
var coordinates = testMap.GridCoords;
human = entityManager.SpawnEntity("HumanDisposalDummy", coordinates);
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy",
entityManager.GetComponent<TransformComponent>(disposalUnit).MapPosition);
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", coordinates);
// Test for components existing
unitUid = disposalUnit;
Expand Down Expand Up @@ -204,21 +202,23 @@ await server.WaitAssertion(() =>

await server.WaitAssertion(() =>
{
// Move the disposal trunk away
var xform = entityManager.GetComponent<TransformComponent>(disposalTrunk);
var worldPos = xformSystem.GetWorldPosition(disposalTrunk);
xformSystem.SetWorldPosition(xform, worldPos + new Vector2(1, 0));
// Move the disposal trunk away
xformSystem.SetWorldPosition(disposalTrunk, worldPos + new Vector2(1, 0));
// Fail to flush with a mob and an item
Flush(disposalUnit, unitComponent, false, disposalSystem, human, wrench);
});

await server.WaitAssertion(() =>
{
// Move the disposal trunk back
var xform = entityManager.GetComponent<TransformComponent>(disposalTrunk);
var worldPos = xformSystem.GetWorldPosition(disposalTrunk);
xformSystem.SetWorldPosition(xform, worldPos - new Vector2(1, 0));
var worldPos = xformSystem.GetWorldPosition(disposalUnit);
// Move the disposal trunk back
xformSystem.SetWorldPosition(disposalTrunk, worldPos);
xformSystem.AnchorEntity((disposalTrunk, xform));
// Fail to flush with a mob and an item, no power
Flush(disposalUnit, unitComponent, false, disposalSystem, human, wrench);
Expand All @@ -240,6 +240,7 @@ await server.WaitAssertion(() =>
// Re-pressurizing
Flush(disposalUnit, unitComponent, false, disposalSystem);
});

await pair.CleanReturnAsync();
}
}
Expand Down

0 comments on commit 090ec15

Please sign in to comment.