Fix lung test (#14325)
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Body.Components;
|
using Content.Server.Body.Components;
|
||||||
using Content.Server.Body.Systems;
|
using Content.Server.Body.Systems;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Maps;
|
using Robust.Shared;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -134,6 +136,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
|
var cfg = server.ResolveDependency<IConfigurationManager>();
|
||||||
var mapLoader = entityManager.System<MapLoaderSystem>();
|
var mapLoader = entityManager.System<MapLoaderSystem>();
|
||||||
|
|
||||||
MapId mapId;
|
MapId mapId;
|
||||||
@@ -153,10 +156,14 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var center = new Vector2(0.5f, -1.5f);
|
var center = new Vector2(0.5f, 0.5f);
|
||||||
|
|
||||||
var coordinates = new EntityCoordinates(grid.Value, center);
|
var coordinates = new EntityCoordinates(grid.Value, center);
|
||||||
human = entityManager.SpawnEntity("HumanBodyDummy", coordinates);
|
human = entityManager.SpawnEntity("HumanBodyDummy", coordinates);
|
||||||
|
|
||||||
|
var mixture = entityManager.System<AtmosphereSystem>().GetContainingMixture(human);
|
||||||
|
Assert.That(mixture.TotalMoles, Is.GreaterThan(0));
|
||||||
|
|
||||||
Assert.True(entityManager.HasComponent<BodyComponent>(human));
|
Assert.True(entityManager.HasComponent<BodyComponent>(human));
|
||||||
Assert.True(entityManager.TryGetComponent(human, out respirator));
|
Assert.True(entityManager.TryGetComponent(human, out respirator));
|
||||||
Assert.False(respirator.SuffocationCycles > respirator.SuffocationCycleThreshold);
|
Assert.False(respirator.SuffocationCycles > respirator.SuffocationCycleThreshold);
|
||||||
@@ -164,7 +171,10 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
|
|
||||||
var increment = 10;
|
var increment = 10;
|
||||||
|
|
||||||
for (var tick = 0; tick < 600; tick += increment)
|
// 20 seconds
|
||||||
|
var total = 20 * cfg.GetCVar(CVars.NetTickrate);
|
||||||
|
|
||||||
|
for (var tick = 0; tick < total; tick += increment)
|
||||||
{
|
{
|
||||||
await server.WaitRunTicks(increment);
|
await server.WaitRunTicks(increment);
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
|
|||||||
@@ -97,7 +97,10 @@ public partial class AtmosphereSystem
|
|||||||
|
|
||||||
// If we've been passed a grid, try to let it handle it.
|
// If we've been passed a grid, try to let it handle it.
|
||||||
if (gridUid.HasValue)
|
if (gridUid.HasValue)
|
||||||
|
{
|
||||||
|
DebugTools.Assert(_mapManager.IsGrid(gridUid.Value));
|
||||||
RaiseLocalEvent(gridUid.Value, ref ev, false);
|
RaiseLocalEvent(gridUid.Value, ref ev, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (ev.Handled)
|
if (ev.Handled)
|
||||||
return ev.Mixtures;
|
return ev.Mixtures;
|
||||||
@@ -105,7 +108,10 @@ public partial class AtmosphereSystem
|
|||||||
// We either don't have a grid, or the event wasn't handled.
|
// We either don't have a grid, or the event wasn't handled.
|
||||||
// Let the map handle it instead, and also broadcast the event.
|
// Let the map handle it instead, and also broadcast the event.
|
||||||
if (mapUid.HasValue)
|
if (mapUid.HasValue)
|
||||||
|
{
|
||||||
|
DebugTools.Assert(_mapManager.IsMap(mapUid.Value));
|
||||||
RaiseLocalEvent(mapUid.Value, ref ev, true);
|
RaiseLocalEvent(mapUid.Value, ref ev, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
RaiseLocalEvent(ref ev);
|
RaiseLocalEvent(ref ev);
|
||||||
|
|
||||||
@@ -127,7 +133,10 @@ public partial class AtmosphereSystem
|
|||||||
|
|
||||||
// If we've been passed a grid, try to let it handle it.
|
// If we've been passed a grid, try to let it handle it.
|
||||||
if(gridUid.HasValue)
|
if(gridUid.HasValue)
|
||||||
|
{
|
||||||
|
DebugTools.Assert(_mapManager.IsGrid(gridUid.Value));
|
||||||
RaiseLocalEvent(gridUid.Value, ref ev, false);
|
RaiseLocalEvent(gridUid.Value, ref ev, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (ev.Handled)
|
if (ev.Handled)
|
||||||
return ev.Mixture;
|
return ev.Mixture;
|
||||||
@@ -135,7 +144,10 @@ public partial class AtmosphereSystem
|
|||||||
// We either don't have a grid, or the event wasn't handled.
|
// We either don't have a grid, or the event wasn't handled.
|
||||||
// Let the map handle it instead, and also broadcast the event.
|
// Let the map handle it instead, and also broadcast the event.
|
||||||
if(mapUid.HasValue)
|
if(mapUid.HasValue)
|
||||||
|
{
|
||||||
|
DebugTools.Assert(_mapManager.IsMap(mapUid.Value));
|
||||||
RaiseLocalEvent(mapUid.Value, ref ev, true);
|
RaiseLocalEvent(mapUid.Value, ref ev, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
RaiseLocalEvent(ref ev);
|
RaiseLocalEvent(ref ev);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user