Merge pull request #2073 from adudney/EnergyDisplayHelper
Energy display helper
This commit is contained in:
commit
bc142a1c6e
1 changed files with 3 additions and 7 deletions
|
@ -109,7 +109,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPowerRec
|
|||
return;
|
||||
}
|
||||
|
||||
int energyToRemove = requestedEnergy;
|
||||
int energyToRemove = Math.min(battery.getEnergyStored(), requestedEnergy);
|
||||
|
||||
// TODO: Have energyToRemove be precalculated
|
||||
// and used in receiveEnergy and extractEnergy.
|
||||
|
@ -133,12 +133,8 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPowerRec
|
|||
}
|
||||
|
||||
System.out.println("Sent " + energyToRemove + " energy to " + o.name());
|
||||
|
||||
int energyUsable = Math.min(battery.getEnergyStored(), energyToRemove);
|
||||
|
||||
if (energyUsable > 0) {
|
||||
battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyUsable));
|
||||
}
|
||||
|
||||
battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyToRemove));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue