Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Let remainingFlow become 125% of realOptFlow, rather than raw optimal… #841

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected boolean filtersFluid() {
}

@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
if (aFluids.size() >= 1) {
int tEU = 0;
int actualOptimalFlow = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected boolean filtersFluid() {
}

// How much the turbine should be producing with this flow
int newPower = fluidIntoPower(tFluids, optFlow, baseEff, flowMultipliers);
long newPower = fluidIntoPower(tFluids, optFlow, baseEff, flowMultipliers);

// Reduce produced power depending on the ratio between fuel value and turbine EU/t with the following
// formula:
Expand All @@ -182,7 +182,7 @@ protected boolean filtersFluid() {
fuelValue = getFuelValue(new FluidStack(tFluids.get(0), 0));
}
float magicValue = (fuelValue * 0.005f) * (fuelValue * 0.005f);
float efficiencyLoss = Math.min(1.0f, magicValue / euPerTurbine);
long efficiencyLoss = (long) Math.min(1.0f, magicValue / euPerTurbine);
newPower *= efficiencyLoss;

long difference = newPower - this.lEUt; // difference between current output and new output
Expand Down Expand Up @@ -218,7 +218,7 @@ protected boolean filtersFluid() {
}

@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
if (aFluids.size() >= 1) {
aOptFlow *= 800; // CHANGED THINGS HERE, check recipe runs once per 20 ticks
int tEU = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ public int getFuelValue(FluidStack aLiquid) {
}

@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
int remainingFlow = MathUtils.safeInt((long) (aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow.
// Variable required outside of loop for
// Variable required outside of loop for
// multi-hatch scenarios.
this.realOptFlow = (double) aOptFlow * (double) flowMultipliers[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was just here from a copy paste error or something like that.
SC does not (!) use flowmultipliers. see https://github.com/GTNewHorizons/GoodGenerator/blob/master/src/main/java/goodgenerator/blocks/tileEntity/SupercriticalFluidTurbine.java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I don't know what original author thought, maybe we can fix that together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if necessery we can add a new multiplier to SC steam for turbines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can talk with some more devs. But I dont think we want to buff SC steam. its already the meta for plasma.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! a material specific multiplier for SC will have to wait I think until someone really wants go into balancing SC as a whole. (steelux agreed with me on discord)
I made a PR to add SC to the tooltip so it is clear to the player.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tooltip is really misleading, I wasted a whole day build fusions for duranium :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to use up to
// 125% of optimal flow.

storedFluid = 0;
FluidStack tSCSteam = FluidRegistry.getFluidStack("supercriticalsteam", 1);
Expand All @@ -78,16 +79,16 @@ int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, f
if (totalFlow <= 0) return 0;
tEU = totalFlow;
addOutput(GT_ModHandler.getSteam(totalFlow));
if (totalFlow != aOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float) aOptFlow);
if (totalFlow != realOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow);
chochem marked this conversation as resolved.
Show resolved Hide resolved
// if(totalFlow>aOptFlow){efficiency = 1.0f;}
tEU *= efficiency;
tEU = Math.max(1, MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L));
} else {
tEU = MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L);
}

return (int) Math.min(tEU * 100L, Integer.MAX_VALUE);
return tEU * 100L;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public int getFuelValue(FluidStack aLiquid) {
}

@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
if (looseFit) {
aOptFlow *= 4;
if (aBaseEff > 10000) {
Expand All @@ -80,11 +80,14 @@ int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, f
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
int remainingFlow = MathUtils.safeInt((long) (aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow.
// Variable required outside of loop for

// Variable required outside of loop for
// multi-hatch scenarios.
this.realOptFlow = (double) aOptFlow * (double) flowMultipliers[0];

int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to use up to
// 125% of optimal flow.

storedFluid = 0;
for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) {
String fluidName = aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i));
Expand All @@ -111,8 +114,8 @@ int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, f
if (totalFlow <= 0) return 0;
tEU = totalFlow;
addOutput(GT_ModHandler.getSteam(totalFlow));
if (totalFlow != aOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float) aOptFlow);
if (totalFlow != realOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow);
// if(totalFlow>aOptFlow){efficiency = 1.0f;}
tEU *= efficiency;
tEU = Math.max(1, MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public int getFuelValue(FluidStack aLiquid) {
}

@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
if (looseFit) {
aOptFlow *= 4;
if (aBaseEff > 10000) {
Expand All @@ -89,11 +89,16 @@ int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, f
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
int remainingFlow = MathUtils.safeInt((long) (aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow.
// Variable required outside of loop for

// Variable required outside of loop for
// multi-hatch scenarios.
this.realOptFlow = (double) aOptFlow * (double) flowMultipliers[0];

int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to
// use up to
// 125% of
// optimal flow.

storedFluid = 0;
for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { // loop through each hatch; extract inputs and
// track totals.
Expand All @@ -120,8 +125,8 @@ int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, f
tEU = totalFlow;
int waterToOutput = useWater(totalFlow / 160.0f);
addOutput(GT_ModHandler.getDistilledWater(waterToOutput));
if (totalFlow != aOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float) aOptFlow);
if (totalFlow != realOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow);
// if(totalFlow>aOptFlow){efficiency = 1.0f;}
tEU *= efficiency;
tEU = Math.max(1, MathUtils.safeInt((long) tEU * (long) aBaseEff / 20000L));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ protected void depleteTurbineFromStock(ItemStack aTurbine) {
}

// How much the turbine should be producing with this flow
int newPower = fluidIntoPower(tFluids, optFlow, baseEff, flowMultipliers);
long newPower = fluidIntoPower(tFluids, optFlow, baseEff, flowMultipliers);
long difference = newPower - this.lEUt; // difference between current output and new output

// Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the
Expand Down Expand Up @@ -553,7 +553,7 @@ public int getMaxParallelRecipes() {
return (getFullTurbineAssemblies().size());
}

abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers);
abstract long fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers);

@Override
public int getDamageToComponent(ItemStack aStack) {
Expand Down