diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIndustrialTurbine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIndustrialTurbine.java index 67fec5dad..cbdb9fba3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIndustrialTurbine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIndustrialTurbine.java @@ -32,9 +32,11 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im public float lastRotor; public double spin = 0; - public static double ACCELERATION = 1D / 400D; + public static double FLYWHEEL_MAX_ENERGY = 0.5e8; //aka flywheel mass + public long maxPower = 0; public long lastPowerTarget = 0; - + public long flywheel_energy = 0; + private AudioWrapper audio; private float audioDesync; @@ -52,7 +54,7 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im @Override public void writeConfig(JsonWriter writer) throws IOException { - writer.name("INFO").value("industrial steam turbine consumes 20% of availible steam per tick"); + writer.name("INFO").value("industrial steam turbine consumes 20% of available steam per tick"); writer.name("I:inputTankSize").value(inputTankSize); writer.name("I:outputTankSize").value(outputTankSize); writer.name("D:efficiency").value(efficiency); @@ -73,29 +75,17 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im FT_Coolable trait = tanks[0].getTankType().getTrait(FT_Coolable.class); double eff = trait.getEfficiency(CoolingType.TURBINE) * getEfficiency(); int maxOps = (int) Math.ceil((tanks[0].getMaxFill() * consumptionPercent()) / trait.amountReq); - this.lastPowerTarget = (long) (maxOps * trait.heatEnergy * eff); // theoretical max output at full blast with this type - double fraction = (double) steamConsumed / (double) (trait.amountReq * maxOps); // % of max steam throughput currently achieved + this.maxPower = (long) (maxOps * trait.heatEnergy * eff); - if(Math.abs(spin - fraction) <= ACCELERATION) { - this.spin = fraction; - } else if(spin < fraction) { - this.spin += ACCELERATION; - } else if(spin > fraction) { - this.spin -= ACCELERATION; - } + this.flywheel_energy += power; } @Override public void onServerTick() { - if(!operational) { - this.spin -= ACCELERATION; - } - - if(this.spin <= 0) { - this.spin = 0; - } else { - this.powerBuffer = (long) (this.lastPowerTarget * this.spin); - } + this.spin = (double) flywheel_energy / FLYWHEEL_MAX_ENERGY; //because dense steams have way lower energy output, turbines running them take a lot longer to spool up + this.lastPowerTarget = (long) (this.spin * maxPower); + this.flywheel_energy -= this.lastPowerTarget; + this.powerBuffer = (long) (this.lastPowerTarget); } @Override