]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix lung test (#14325)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Wed, 1 Mar 2023 02:57:48 +0000 (15:57 +1300)
committerGitHub <noreply@github.com>
Wed, 1 Mar 2023 02:57:48 +0000 (13:57 +1100)
Content.IntegrationTests/Tests/Body/LungTest.cs
Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs

index 18e2d7f5f82447ead8e791d975bf1e46cea11038..7cb54d39371390b52428308ecf724b61ca039027 100644 (file)
@@ -1,11 +1,13 @@
-using System.Threading.Tasks;
+using System.Threading.Tasks;
 using Content.Server.Atmos.Components;
+using Content.Server.Atmos.EntitySystems;
 using Content.Server.Body.Components;
 using Content.Server.Body.Systems;
 using Content.Shared.Body.Components;
 using NUnit.Framework;
 using Robust.Server.GameObjects;
-using Robust.Server.Maps;
+using Robust.Shared;
+using Robust.Shared.Configuration;
 using Robust.Shared.GameObjects;
 using Robust.Shared.Map;
 using Robust.Shared.Maths;
@@ -134,6 +136,7 @@ namespace Content.IntegrationTests.Tests.Body
 
             var mapManager = server.ResolveDependency<IMapManager>();
             var entityManager = server.ResolveDependency<IEntityManager>();
+            var cfg = server.ResolveDependency<IConfigurationManager>();
             var mapLoader = entityManager.System<MapLoaderSystem>();
 
             MapId mapId;
@@ -153,10 +156,14 @@ namespace Content.IntegrationTests.Tests.Body
 
             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);
                 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.TryGetComponent(human, out respirator));
                 Assert.False(respirator.SuffocationCycles > respirator.SuffocationCycleThreshold);
@@ -164,7 +171,10 @@ namespace Content.IntegrationTests.Tests.Body
 
             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.WaitAssertion(() =>
index 03a07a2e5f368d81049c2fa0f9eec47949296b63..00ed05449cbe9ff991f5640ea4ab7a267bc9c5f3 100644 (file)
@@ -97,7 +97,10 @@ public partial class AtmosphereSystem
 
         // If we've been passed a grid, try to let it handle it.
         if (gridUid.HasValue)
+        {
+            DebugTools.Assert(_mapManager.IsGrid(gridUid.Value));
             RaiseLocalEvent(gridUid.Value, ref ev, false);
+        }
 
         if (ev.Handled)
             return ev.Mixtures;
@@ -105,7 +108,10 @@ public partial class AtmosphereSystem
         // We either don't have a grid, or the event wasn't handled.
         // Let the map handle it instead, and also broadcast the event.
         if (mapUid.HasValue)
+        {
+            DebugTools.Assert(_mapManager.IsMap(mapUid.Value));
             RaiseLocalEvent(mapUid.Value, ref ev, true);
+        }
         else
             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(gridUid.HasValue)
+        {
+            DebugTools.Assert(_mapManager.IsGrid(gridUid.Value));
             RaiseLocalEvent(gridUid.Value, ref ev, false);
+        }
 
         if (ev.Handled)
             return ev.Mixture;
@@ -135,7 +144,10 @@ public partial class AtmosphereSystem
         // We either don't have a grid, or the event wasn't handled.
         // Let the map handle it instead, and also broadcast the event.
         if(mapUid.HasValue)
+        {
+            DebugTools.Assert(_mapManager.IsMap(mapUid.Value));
             RaiseLocalEvent(mapUid.Value, ref ev, true);
+        }
         else
             RaiseLocalEvent(ref ev);