Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Fix AtmosDeviceSystem Debug Assert Heisenbug #1181

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.EntitySystems;
using Robust.Shared.GameObjects;

namespace Content.IntegrationTests.Tests.Atmos;

[TestFixture]
public sealed class GridJoinTest
{
private const string CanisterProtoId = "AirCanister";

[Test]
public async Task TestGridJoinAtmosphere()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var entMan = server.EntMan;
var protoMan = server.ProtoMan;
var atmosSystem = entMan.System<AtmosphereSystem>();
var atmosDeviceSystem = entMan.System<AtmosDeviceSystem>();
var transformSystem = entMan.System<SharedTransformSystem>();

var testMap = await pair.CreateTestMap();

await server.WaitPost(() =>
{
// Spawn an atmos device on the grid
var canister = entMan.Spawn(CanisterProtoId);
transformSystem.SetCoordinates(canister, testMap.GridCoords);
var deviceComp = entMan.GetComponent<AtmosDeviceComponent>(canister);
var canisterEnt = (canister, deviceComp);
// Make sure the canister is tracked as an off-grid device
Assert.That(atmosDeviceSystem.IsJoinedOffGrid(canisterEnt));

Check failure on line 36 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)
// Add an atmosphere to the grid
entMan.AddComponent<GridAtmosphereComponent>(testMap.Grid);
// Force AtmosDeviceSystem to update off-grid devices
// This means the canister is now considered on-grid,
// but it's still tracked as off-grid!
Assert.DoesNotThrow(() => atmosDeviceSystem.Update(atmosSystem.AtmosTime));
// Make sure that the canister is now properly tracked as on-grid
Assert.That(atmosDeviceSystem.IsJoinedOffGrid(canisterEnt), Is.False);

Check failure on line 44 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 44 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 44 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 44 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 44 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 44 in Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'AtmosDeviceSystem' does not contain a definition for 'IsJoinedOffGrid' and no accessible extension method 'IsJoinedOffGrid' accepting a first argument of type 'AtmosDeviceSystem' could be found (are you missing a using directive or an assembly reference?)
});

await pair.CleanReturnAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ public override void Update(float frameTime)
var ev = new AtmosDeviceUpdateEvent(_atmosphereSystem.AtmosTime, null, null);
foreach (var device in _joinedDevices)
{
DebugTools.Assert(!HasComp<GridAtmosphereComponent>(Transform(device).GridUid));
var deviceGrid = Transform(device).GridUid;
if (HasComp<GridAtmosphereComponent>(deviceGrid))
RejoinAtmosphere(device);

RaiseLocalEvent(device, ref ev);
device.Comp.LastProcess = time;
}
Expand Down
Loading