From 961f80254db044bb80a7c3395f844e9c3d1d7b14 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 24 Jan 2021 16:38:01 +0100 Subject: [PATCH] You now stop breathing while in crit. --- .../GameObjects/Components/Body/Behavior/LungBehavior.cs | 6 ++++++ .../Components/Metabolism/MetabolismComponent.cs | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameObjects/Components/Body/Behavior/LungBehavior.cs b/Content.Server/GameObjects/Components/Body/Behavior/LungBehavior.cs index 4c60bdecfb..cf402231ec 100644 --- a/Content.Server/GameObjects/Components/Body/Behavior/LungBehavior.cs +++ b/Content.Server/GameObjects/Components/Body/Behavior/LungBehavior.cs @@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.Body.Respiratory; using Content.Server.Utility; using Content.Shared.Atmos; using Content.Shared.GameObjects.Components.Body.Behavior; +using Content.Shared.GameObjects.Components.Mobs.State; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Localization; @@ -99,6 +100,11 @@ namespace Content.Server.GameObjects.Components.Body.Behavior public override void Update(float frameTime) { + if (Body != null && Body.Owner.TryGetComponent(out IMobStateComponent? mobState) && mobState.IsCritical()) + { + return; + } + if (Status == LungStatus.None) { Status = LungStatus.Inhaling; diff --git a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs index 180e73897b..b9f98a6ec4 100644 --- a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs +++ b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs @@ -206,10 +206,13 @@ namespace Content.Server.GameObjects.Components.Metabolism if (bloodstreamAmount < amountNeeded) { - // Panic inhale - foreach (var lung in lungs) + if (!Owner.GetComponent().IsCritical()) { - lung.Gasp(); + // Panic inhale + foreach (var lung in lungs) + { + lung.Gasp(); + } } bloodstreamAmount = bloodstream.Air.GetMoles(gas);