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
This commit is contained in:
pyure 2015-08-12 15:14:06 -04:00
parent 6d61dead98
commit 27da7acbb3

View file

@ -58,21 +58,32 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
@Override @Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) { int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
int tEU=0; int tEU = 0;
int tOut=0; int totalFlow = 0; // Byproducts are based on actual flow
for(int i=0;i<aFluids.size();i++){ int flow = 0;
if(aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i)).equals("ic2.fluidSuperheatedSteam")){ int remainingFlow = (int) (aOptFlow * 1.25f); // Allowed to use up to 125% of optimal flow
tOut = Math.min((int)(aOptFlow*1.5f),aFluids.get(i).amount);
depleteInput(new FluidStack(aFluids.get(i),tOut)); 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
} }
} }
tOut = getAverage(tOut);
tEU = Math.min(aOptFlow,tOut); tEU = (int) (Math.min((float) aOptFlow, totalFlow));
addOutput(GT_ModHandler.getSteam(tOut)); addOutput(GT_ModHandler.getSteam(totalFlow));
if(tOut>0&&tOut<aOptFlow){ if (totalFlow > 0 && totalFlow != aOptFlow) {
tEU = tEU*(tOut*100/aOptFlow)+3; 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 * aBaseEff / 10000;
return tEU;
} }