mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
fix CCGT allowing throttle over max when using OpenComputers callbacks
This commit is contained in:
parent
5fb88801ec
commit
8686a64141
@ -105,11 +105,11 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
tanks[0].setTankType(fluid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(autoMode) { //power production depending on power requirement and fuel level
|
||||
|
||||
|
||||
int powerSliderTarget;
|
||||
|
||||
|
||||
//when low on fuel, decrease consumption linearly
|
||||
if(tanks[0].getFill() * 10 > tanks[0].getMaxFill()) {
|
||||
powerSliderTarget = 60 - (int) (60 * power / maxPower); //scales the slider proportionally to the power gauge
|
||||
@ -117,7 +117,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
else {
|
||||
powerSliderTarget = (int) ( tanks[0].getFill() * 0.0001 * (60 - (int) (60 * power / maxPower)) );
|
||||
}
|
||||
|
||||
|
||||
if(powerSliderTarget > powerSliderPos) { //makes the auto slider slide instead of snapping into position
|
||||
powerSliderPos++;
|
||||
}
|
||||
@ -403,12 +403,12 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
double waterPerTick = (consMax * energy * (temp - tempIdle) / 220000); //it just works fuck you
|
||||
|
||||
this.waterToBoil = waterPerTick; //caching in a field for the EC compat to use
|
||||
|
||||
|
||||
int heatCycles = (int) Math.floor(waterToBoil);
|
||||
int waterCycles = tanks[2].getFill();
|
||||
int steamCycles = (tanks[3].getMaxFill() - tanks[3].getFill()) / 10;
|
||||
int cycles = BobMathUtil.min(heatCycles, waterCycles, steamCycles);
|
||||
|
||||
|
||||
tanks[2].setFill(tanks[2].getFill() - cycles);
|
||||
tanks[3].setFill(tanks[3].getFill() + cycles * 10);
|
||||
}
|
||||
@ -619,8 +619,11 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setThrottle(Context context, Arguments args) {
|
||||
powerSliderPos = (int) (args.checkInteger(0) * 60D / 100D);
|
||||
return new Object[] {};
|
||||
double input = args.checkInteger(0) * 60D / 100D;
|
||||
if (input < 0 || input > 100)
|
||||
return new Object[] {null, "Input out of range."};
|
||||
powerSliderPos = (int) (input);
|
||||
return new Object[] {true};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user