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

@ -56,24 +56,35 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
return 0; return 0;
} }
@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
tOut = getAverage(tOut); flow = Math.min(flow, Math.min(remainingFlow, (int) (aOptFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
tEU = Math.min(aOptFlow,tOut); depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
addOutput(GT_ModHandler.getSteam(tOut)); remainingFlow -= flow; // track amount we're allowed to keep depleting from hatches
if(tOut>0&&tOut<aOptFlow){ totalFlow += flow; // track total used
tEU = tEU*(tOut*100/aOptFlow)+3; }
} }
return tEU * aBaseEff / 10000;
} 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;
}
} }