-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix AtmosDeviceSystem debug assert Heisenbug (#29752)
Fix AtmosDeviceSystem debug assertion Heisenbug
- Loading branch information
1 parent
72ddf80
commit b96307e
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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)); | ||
|
||
// 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); | ||
}); | ||
|
||
await pair.CleanReturnAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters