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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -32,12 +32,17 @@ public sealed class JetpackSystem : SharedJetpackSystem
continue;
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));
continue;
}
_gasTank.UpdateUserInterface(gasTank);