You now stop breathing while in crit.

This commit is contained in:
Pieter-Jan Briers
2021-01-24 16:38:01 +01:00
parent 526c3d1ebf
commit 961f80254d
2 changed files with 12 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.Body.Respiratory;
using Content.Server.Utility; using Content.Server.Utility;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.GameObjects.Components.Body.Behavior; using Content.Shared.GameObjects.Components.Body.Behavior;
using Content.Shared.GameObjects.Components.Mobs.State;
using Robust.Shared.Interfaces.Timing; using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
@@ -99,6 +100,11 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
if (Body != null && Body.Owner.TryGetComponent(out IMobStateComponent? mobState) && mobState.IsCritical())
{
return;
}
if (Status == LungStatus.None) if (Status == LungStatus.None)
{ {
Status = LungStatus.Inhaling; Status = LungStatus.Inhaling;

View File

@@ -206,10 +206,13 @@ namespace Content.Server.GameObjects.Components.Metabolism
if (bloodstreamAmount < amountNeeded) if (bloodstreamAmount < amountNeeded)
{ {
// Panic inhale if (!Owner.GetComponent<IMobStateComponent>().IsCritical())
foreach (var lung in lungs)
{ {
lung.Gasp(); // Panic inhale
foreach (var lung in lungs)
{
lung.Gasp();
}
} }
bloodstreamAmount = bloodstream.Air.GetMoles(gas); bloodstreamAmount = bloodstream.Air.GetMoles(gas);