diff options
author | Daniel Mendes <70096037+Steelux8@users.noreply.github.com> | 2023-02-08 08:40:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-08 09:40:52 +0100 |
commit | 099bcf37eeecaac820279ebd67a7d3156aa26583 (patch) | |
tree | 5bd84b5331d68dd1436be689a05e53be8c733373 /src | |
parent | 2556dfb92a7c7c73a72caa7d72129cef47b017ea (diff) | |
download | GT5-Unofficial-099bcf37eeecaac820279ebd67a7d3156aa26583.tar.gz GT5-Unofficial-099bcf37eeecaac820279ebd67a7d3156aa26583.tar.bz2 GT5-Unofficial-099bcf37eeecaac820279ebd67a7d3156aa26583.zip |
Fix HOG Consumption Rate in LCE (#1687)
* Fix HOG Consumption Rate in LCE
* Moved New Variables to checkRecipe
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index 83ffdd014f..bd3dfdc2a3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -167,28 +167,50 @@ public class GT_MetaTileEntity_DieselEngine extends // fast track lookup if (!tFluids.isEmpty()) { + double boostedFuelValue = 0; + double boostedOutput = 0; + double extraFuelFraction = 0; for (FluidStack tFluid : tFluids) { GT_Recipe tRecipe = getFuelMap().findFuel(tFluid); if (tRecipe == null) continue; + fuelValue = tRecipe.mSpecialValue; FluidStack tLiquid = tFluid.copy(); - fuelConsumption = tLiquid.amount = boostEu - ? (getBoostFactor() * getNominalOutput() / tRecipe.mSpecialValue) - : (getNominalOutput() / tRecipe.mSpecialValue); // Calc fuel consumption + if (boostEu) { + boostedFuelValue = GT_Utility.safeInt((long) (fuelValue * 1.5)); + boostedOutput = getNominalOutput() * 3; + + fuelConsumption = tLiquid.amount = getBoostFactor() * getNominalOutput() / fuelValue; + + // HOG consumption rate is normally 1 L/t, when it's supposed to be around 1.64 L/t + // This code increases fuel consumption by 1 at random, but with a weighted chance + if (boostedFuelValue * 2 > boostedOutput) { + extraFuelFraction = boostedOutput / boostedFuelValue; + extraFuelFraction = extraFuelFraction - (int) extraFuelFraction; + double rand = Math.random(); + if (rand < extraFuelFraction) { + tLiquid.amount += 1; + } + } + + } else { + fuelConsumption = tLiquid.amount = getNominalOutput() / fuelValue; + } + // Deplete that amount if (!depleteInput(tLiquid)) return false; boostEu = depleteInput(getBooster().getGas(2L * getAdditiveFactor())); + // Check to prevent burning HOG without consuming it, if not boosted + if (!boostEu && fuelValue > getNominalOutput()) { + return false; + } + // Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048) if ((mRuntime % 72 == 0 || mRuntime == 0) && !depleteInput(Materials.Lubricant.getFluid((boostEu ? 2L : 1L) * getAdditiveFactor()))) return false; - fuelValue = tRecipe.mSpecialValue; - // Check to prevent burning HOG without consuming it, if not boosted - if (!boostEu && fuelValue > getNominalOutput()) { - return false; - } fuelRemaining = tFluid.amount; // Record available fuel this.mEUt = mEfficiency < 2000 ? 0 : getNominalOutput(); // Output 0 if startup is less than 20% this.mProgresstime = 1; |