using Content.IntegrationTests.Fixtures; using Content.Server.Fluids.EntitySystems; using Content.Shared.Chemistry.Components; using Content.Shared.Coordinates; using Content.Shared.FixedPoint; using Content.Shared.Fluids.Components; using Robust.Shared.GameObjects; using Robust.Shared.Map; namespace Content.IntegrationTests.Tests.Fluids { [TestFixture] [TestOf(typeof(PuddleComponent))] public sealed class PuddleTest : GameTest { [Test] public async Task TilePuddleTest() { var pair = Pair; var server = pair.Server; var testMap = await pair.CreateTestMap(); var spillSystem = server.System(); await server.WaitAssertion(() => { var solution = new Solution("Water", FixedPoint2.New(20)); var tile = testMap.Tile; var gridUid = tile.GridUid; var (x, y) = tile.GridIndices; var coordinates = new EntityCoordinates(gridUid, x, y); Assert.That(spillSystem.TrySpillAt(coordinates, solution, out _), Is.True); }); } [Test] public async Task SpaceNoPuddleTest() { var pair = Pair; var server = pair.Server; var testMap = await pair.CreateTestMap(); var grid = testMap.Grid; var entitySystemManager = server.ResolveDependency(); var spillSystem = server.System(); var mapSystem = server.System(); // Remove all tiles await server.WaitPost(() => { var tiles = mapSystem.GetAllTiles(grid.Owner, grid.Comp); foreach (var tile in tiles) { mapSystem.SetTile(grid, tile.GridIndices, Tile.Empty); } }); await pair.RunTicksSync(5); await server.WaitAssertion(() => { var coordinates = grid.Owner.ToCoordinates(); var solution = new Solution("Water", FixedPoint2.New(20)); Assert.That(spillSystem.TrySpillAt(coordinates, solution, out _), Is.False); }); } } }