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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int energyToRemove = requestedEnergy;
|
int energyToRemove = Math.min(battery.getEnergyStored(), requestedEnergy);
|
||||||
|
|
||||||
// TODO: Have energyToRemove be precalculated
|
// TODO: Have energyToRemove be precalculated
|
||||||
// and used in receiveEnergy and extractEnergy.
|
// 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());
|
System.out.println("Sent " + energyToRemove + " energy to " + o.name());
|
||||||
|
|
||||||
int energyUsable = Math.min(battery.getEnergyStored(), energyToRemove);
|
battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyToRemove));
|
||||||
|
|
||||||
if (energyUsable > 0) {
|
|
||||||
battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyUsable));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue