Fix jetpack (not) running out of fuel (#19696)

This commit is contained in:
Wrexbe (Josh)
2023-08-31 11:54:08 -07:00
committed by GitHub
parent cf6b760910
commit 63c1b7b061

View File

@@ -32,12 +32,17 @@ public sealed class JetpackSystem : SharedJetpackSystem
continue; continue;
active.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(active.EffectCooldown); active.TargetTime = _timing.CurTime + TimeSpan.FromSeconds(active.EffectCooldown);
var air = _gasTank.RemoveAir(gasTank, comp.MoleUsage); var usedAir = _gasTank.RemoveAir(gasTank, comp.MoleUsage);
if (air == null || !MathHelper.CloseTo(air.TotalMoles, comp.MoleUsage, 0.001f)) if (usedAir == null)
continue;
var usedEnoughAir =
MathHelper.CloseTo(usedAir.TotalMoles, comp.MoleUsage, comp.MoleUsage/100);
if (!usedEnoughAir)
{ {
toDisable.Add((uid, comp)); toDisable.Add((uid, comp));
continue;
} }
_gasTank.UpdateUserInterface(gasTank); _gasTank.UpdateUserInterface(gasTank);