From eb763886cdda9364ffb3a9a99d71b531d98ae57b Mon Sep 17 00:00:00 2001 From: Dmitry <57028746+DIMMoon1@users.noreply.github.com> Date: Tue, 27 Jan 2026 05:17:52 +0700 Subject: [PATCH] fixing the handling of the RespiratorComponent without checking (#42665) * the correction itself * it will be more adequate * doc * not log - not debug * ohhh --- .../Tests/GameRules/NukeOpsTest.cs | 20 ++++++++++--------- .../Body/Systems/RespiratorSystem.cs | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs b/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs index 246a7701902..ebb58a173c1 100644 --- a/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs +++ b/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs @@ -226,16 +226,18 @@ public sealed class NukeOpsTest Assert.That(total, Is.GreaterThan(3)); // Check the nukie commander passed basic training and figured out how to breathe. - var totalSeconds = 30; - var totalTicks = (int) Math.Ceiling(totalSeconds / server.Timing.TickPeriod.TotalSeconds); - var increment = 5; - var resp = entMan.GetComponent(player); - var damage = entMan.GetComponent(player); - for (var tick = 0; tick < totalTicks; tick += increment) + if (entMan.TryGetComponent(player, out var resp)) { - await pair.RunTicksSync(increment); - Assert.That(resp.SuffocationCycles, Is.LessThanOrEqualTo(resp.SuffocationCycleThreshold)); - Assert.That(damage.TotalDamage, Is.EqualTo(FixedPoint2.Zero)); + var totalSeconds = 30; + var totalTicks = (int)Math.Ceiling(totalSeconds / server.Timing.TickPeriod.TotalSeconds); + var increment = 5; + var damage = entMan.GetComponent(player); + for (var tick = 0; tick < totalTicks; tick += increment) + { + await pair.RunTicksSync(increment); + Assert.That(resp.SuffocationCycles, Is.LessThanOrEqualTo(resp.SuffocationCycleThreshold)); + Assert.That(damage.TotalDamage, Is.EqualTo(FixedPoint2.Zero)); + } } // Check that the round does not end prematurely when agents are deleted in the outpost diff --git a/Content.Server/Body/Systems/RespiratorSystem.cs b/Content.Server/Body/Systems/RespiratorSystem.cs index aad485cc7e8..446ed753c9e 100644 --- a/Content.Server/Body/Systems/RespiratorSystem.cs +++ b/Content.Server/Body/Systems/RespiratorSystem.cs @@ -204,7 +204,7 @@ public sealed class RespiratorSystem : EntitySystem /// Returns true only if the air is not toxic, and it wouldn't suffocate. public bool CanMetabolizeInhaledAir(Entity ent) { - if (!Resolve(ent, ref ent.Comp)) + if (!Resolve(ent, ref ent.Comp, false)) return false; // Get the gas at our location but don't actually remove it from the gas mixture.