aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkekzdealer <kekzdealer@gmail.com>2020-05-14 17:25:00 +0200
committerkekzdealer <kekzdealer@gmail.com>2020-05-14 17:25:00 +0200
commitfd6903cc5d37ea3942244497be23572084cc3d0e (patch)
tree5045663fbee9176eb3ef2d3e3738588a3e3b08fb
parent590fe5d0095fe6fbabbb625d8b4217177c6979a2 (diff)
downloadGT5-Unofficial-fd6903cc5d37ea3942244497be23572084cc3d0e.tar.gz
GT5-Unofficial-fd6903cc5d37ea3942244497be23572084cc3d0e.tar.bz2
GT5-Unofficial-fd6903cc5d37ea3942244497be23572084cc3d0e.zip
Implemented maintenance effects for the LSC
-rw-r--r--src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java
index 00c5f267f0..52a3b356fe 100644
--- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java
+++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java
@@ -55,6 +55,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_MultiBlock
private BigInteger capacity = BigInteger.ZERO;
private BigInteger stored = BigInteger.ZERO;
private BigInteger passiveDischargeAmount = BigInteger.ZERO;
+ private int repairStatusCache = 0;
public GTMTE_LapotronicSuperCapacitor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -444,6 +445,13 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_MultiBlock
}
}
// Loose some energy
+ // Recalculate if the repair status changed
+ final int repairStatus = super.getRepairStatus();
+ if(repairStatus != repairStatusCache) {
+ repairStatusCache = repairStatus;
+ passiveDischargeAmount = new BigDecimal(passiveDischargeAmount)
+ .multiply(BigDecimal.valueOf(1.0D + 0.2D * repairStatus)).toBigInteger();
+ }
stored = stored.subtract(passiveDischargeAmount);
stored = (stored.compareTo(BigInteger.ZERO) <= 0) ? BigInteger.ZERO : stored;