diff options
author | David Vierra <codewarrior@hawaii.rr.com> | 2018-04-05 20:27:24 -1000 |
---|---|---|
committer | David Vierra <codewarrior@hawaii.rr.com> | 2018-04-05 20:27:24 -1000 |
commit | c461f50dcd3705a350012ab1f8ae8482c2290a18 (patch) | |
tree | f2dfd6037c8b544473912a65bc72bc74d3617fbb | |
parent | 739b1b7676db0d7b302a82722c2c8e1d440e1194 (diff) | |
download | GT5-Unofficial-c461f50dcd3705a350012ab1f8ae8482c2290a18.tar.gz GT5-Unofficial-c461f50dcd3705a350012ab1f8ae8482c2290a18.tar.bz2 GT5-Unofficial-c461f50dcd3705a350012ab1f8ae8482c2290a18.zip |
Overcharged power substation drains energy gradually instead of immediately
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index 1bed942cc1..2aa30a0c30 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -276,10 +276,9 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe this.mAverageEuUsage = 0; } - // Only set these here, after the machine check is 100% passed. + // Only set this here, after the machine check is 100% passed. this.mBatteryCapacity = getCapacityFromCellTier(tOverallCellTier) * tCellCount; - this.setEUVar(Math.min(this.getEUVar(), this.mBatteryCapacity)); return true; } @@ -394,7 +393,13 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe @Override public boolean onRunningTick(ItemStack aStack) { - // First, Pay Tax + // First, decay overcharge (0.1% of stored energy plus 1000 EU per tick) + if (this.getEUVar() > this.mBatteryCapacity) { + long energy = (long) (this.getEUVar() * 0.999f) - 1000; + this.setEUVar(energy); + } + + // Pay Tax long mDecrease = computeEnergyTax(); this.mTotalEnergyLost += Math.min(mDecrease, this.getEUVar()); this.setEUVar(Math.max(0, this.getEUVar() - mDecrease)); @@ -457,9 +462,17 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } else { mode = EnumChatFormatting.BLUE + "Input" + EnumChatFormatting.RESET; } + + String storedEnergyText; + if (this.getEUVar() > this.mBatteryCapacity) { + storedEnergyText = EnumChatFormatting.RED + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET; + } else { + storedEnergyText = EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET; + } + return new String[]{ "Ergon Energy - District Sub-Station", - "Stored EU:" + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET, + "Stored EU:" + storedEnergyText, "Capacity: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxEUStore()) + EnumChatFormatting.RESET, "Running Costs: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.computeEnergyTax()) + EnumChatFormatting.RESET + " EU/t", "Controller Mode: " + mode, |