From 27da7acbb3988fb2e4d47a83e7df7b833945ce63 Mon Sep 17 00:00:00 2001 From: pyure Date: Wed, 12 Aug 2015 15:14:06 -0400 Subject: [PATCH] HP Steam turbine fixes * Math fixes (no more crazy output numbers) * getAverage() references removed * multiple input hatch support (no more exploits by feeding HP Steam to multiple hatches) * 125% maximum overflow inefficiency * Output ties directly to actual HP Steam consumed --- ...T_MetaTileEntity_LargeTurbine_HPSteam.java | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java index 4acae119..cc881a19 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -56,24 +56,35 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La return 0; } - @Override - int fluidIntoPower(ArrayList aFluids, int aOptFlow, int aBaseEff) { - int tEU=0; - int tOut=0; - for(int i=0;i0&&tOut aFluids, int aOptFlow, int aBaseEff) { + int tEU = 0; + int totalFlow = 0; // Byproducts are based on actual flow + int flow = 0; + int remainingFlow = (int) (aOptFlow * 1.25f); // Allowed to use up to 125% of optimal flow + + for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { + if (aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i)).equals("ic2.fluidSuperheatedSteam")) { + flow = aFluids.get(i).amount; // Get all (steam) in hatch + flow = Math.min(flow, Math.min(remainingFlow, (int) (aOptFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow + depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount + remainingFlow -= flow; // track amount we're allowed to keep depleting from hatches + totalFlow += flow; // track total used + } + } + + tEU = (int) (Math.min((float) aOptFlow, totalFlow)); + addOutput(GT_ModHandler.getSteam(totalFlow)); + if (totalFlow > 0 && totalFlow != aOptFlow) { + float efficiency = 1.0f - Math.abs(((totalFlow - (float) aOptFlow) / aOptFlow)); + tEU *= efficiency; + tEU = Math.max(1, tEU * aBaseEff / 10000); + } else { + tEU = tEU * aBaseEff / 10000; + } + + return tEU; + } }