aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGDCloud <gdcloudstrike@gmail.com>2023-02-02 21:26:10 +0100
committerGDCloud <gdcloudstrike@gmail.com>2023-02-02 21:26:10 +0100
commit79b1212b00cb16aeaf14a548aced73b3337bed3d (patch)
treea9e664f60b1ef7e036e1f8234a48a98722119f3b
parent322e11461b2a5cdd381fcb643c8f1178d8f63c2a (diff)
downloadGT5-Unofficial-79b1212b00cb16aeaf14a548aced73b3337bed3d.tar.gz
GT5-Unofficial-79b1212b00cb16aeaf14a548aced73b3337bed3d.tar.bz2
GT5-Unofficial-79b1212b00cb16aeaf14a548aced73b3337bed3d.zip
First attempt
-rw-r--r--src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java
index a020502bad..cf261dec3d 100644
--- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java
+++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java
@@ -70,6 +70,7 @@ public class GTMTE_LapotronicSuperCapacitor
private final Queue<Long> energyOutputValues = new LinkedList<>();
private long max_passive_drain_eu_per_tick_per_uhv_cap = 1_000_000;
+ private long max_passive_drain_eu_per_tick_per_uev_cap = 100_000_000;
private enum Capacitor {
IV(2, BigInteger.valueOf(IV_cap_storage)),
@@ -77,6 +78,7 @@ public class GTMTE_LapotronicSuperCapacitor
ZPM(4, BigInteger.valueOf(ZPM_cap_storage)),
UV(5, BigInteger.valueOf(UV_cap_storage)),
UHV(6, MAX_LONG),
+ UEV(7, MAX_LONG),
None(0, BigInteger.ZERO),
EV(1, BigInteger.valueOf(EV_cap_storage));
@@ -300,7 +302,7 @@ public class GTMTE_LapotronicSuperCapacitor
* Count the amount of capacitors of each tier in each slot.
* Index = meta - 1
*/
- private final int[] capacitors = new int[7];
+ private final int[] capacitors = new int[8];
private BigInteger capacity = BigInteger.ZERO;
private BigInteger stored = BigInteger.ZERO;
@@ -395,16 +397,21 @@ public class GTMTE_LapotronicSuperCapacitor
private int getUHVCapacitorCount() {
return capacitors[4];
}
+ private int getUEVCapacitorCount() {
+ return capacitors[7];
+ }
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Energy Storage")
- .addInfo("Loses energy equal to 1% of the total capacity every 24 hours. Capped")
- .addInfo("at " + EnumChatFormatting.RED
+ .addInfo("Loses energy equal to 1% of the total capacity every 24 hours.")
+ .addInfo("Capped at " + EnumChatFormatting.RED
+ GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + EnumChatFormatting.GRAY
- + "EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9]
- + EnumChatFormatting.GRAY + " capacitor.")
+ + " EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9]
+ + EnumChatFormatting.GRAY + " capacitor and ")
+ .addInfo( EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uev_cap) + EnumChatFormatting.GRAY + " EU/t passive loss per "
+ + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor.")
.addInfo("Passive loss is multiplied by the number of maintenance issues present.")
.addSeparator()
.addInfo("Glass shell has to be Tier - 3 of the highest capacitor tier.")
@@ -415,12 +422,12 @@ public class GTMTE_LapotronicSuperCapacitor
.addSeparator()
.addInfo("Wireless mode can be enabled by right clicking with a screwdriver.")
.addInfo("This mode can only be enabled if you have a " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9]
- + EnumChatFormatting.GRAY + " capacitor in the multiblock.")
+ + EnumChatFormatting.GRAY + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor in the multiblock.")
.addInfo("When enabled every " + EnumChatFormatting.BLUE
+ GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks)
+ EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your")
- .addInfo("wireless EU network. If there is less than " + EnumChatFormatting.RED
- + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "EU in the LSC")
+ .addInfo("wireless EU network. If there is less than " + GT_Values.TIER_COLORS[9]
+ + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " + GT_Values.TIER_COLORS[10] + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + ")" + "EU in the LSC")
.addInfo("it will withdraw from the network and add to the LSC. If there is more it will add")
.addInfo("the EU to the network and remove it from the LSC.")
.addSeparator()
@@ -551,13 +558,14 @@ public class GTMTE_LapotronicSuperCapacitor
}
// Check if enough (more than 50%) non-empty caps
- if (capacitors[5]
+ if (capacitors[6]
> capacitors[0]
+ capacitors[1]
+ capacitors[2]
+ capacitors[3]
+ getUHVCapacitorCount()
- + capacitors[6]) return false;
+ + capacitors[6]
+ + getUEVCapacitorCount()) return false;
// Calculate total capacity
capacity = BigInteger.ZERO;
@@ -684,7 +692,7 @@ public class GTMTE_LapotronicSuperCapacitor
}
}
- if (getUHVCapacitorCount() <= 0) {
+ if (getUHVCapacitorCount() <= 0 && getUEVCapacitorCount() <= 0) {
wireless_mode = false;
}
@@ -697,7 +705,7 @@ public class GTMTE_LapotronicSuperCapacitor
// Find difference.
BigInteger transferred_eu =
- stored.subtract(LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())));
+ stored.subtract((LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))).add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount()))));
if (transferred_eu.signum() == 1) {
inputLastTick += transferred_eu.longValue();
@@ -708,7 +716,7 @@ public class GTMTE_LapotronicSuperCapacitor
// If that difference can be added then do so.
if (addEUToGlobalEnergyMap(global_energy_user_uuid, transferred_eu)) {
// If it succeeds there was sufficient energy so set the internal capacity as such.
- stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()));
+ stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())).add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount())));
}
}
@@ -758,13 +766,16 @@ public class GTMTE_LapotronicSuperCapacitor
long temp_capacity_divided =
capacity.divide(BigInteger.valueOf(100L * 86400L * 20L)).longValue();
- // Passive loss is multiplied by number of UHV caps. Minimum of 1 otherwise loss is 0 for non-UHV caps
+ // Passive loss is multiplied by number of UHV/UEV caps. Minimum of 1 otherwise loss is 0 for non-UHV/UEV caps
// calculations.
long uhv_cap_multiplier =
min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uhv_cap * max(1, getUHVCapacitorCount()));
+ long uev_cap_multiplier =
+ min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uev_cap * max(1, getUEVCapacitorCount()));
+
// Passive loss is multiplied by number of maintenance issues.
- long total_passive_loss = uhv_cap_multiplier * (getIdealStatus() - repairStatus + 1);
+ long total_passive_loss = (uhv_cap_multiplier + uev_cap_multiplier) * (getIdealStatus() - repairStatus + 1);
// Maximum of 100,000 EU/t drained per UHV cell. The logic is 1% of EU capacity should be drained every 86400
// seconds (1 day).
@@ -936,14 +947,15 @@ public class GTMTE_LapotronicSuperCapacitor
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (getUHVCapacitorCount() != 0) {
+ if (getUHVCapacitorCount() != 0 || getUEVCapacitorCount() != 0) {
wireless_mode = !wireless_mode;
GT_Utility.sendChatToPlayer(aPlayer, "Wireless network mode " + (wireless_mode ? "enabled." : "disabled."));
} else {
GT_Utility.sendChatToPlayer(
aPlayer,
"Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9]
- + EnumChatFormatting.RESET + " capacitor.");
+ + EnumChatFormatting.RESET + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10]
+ + EnumChatFormatting.RESET + " capacitor.");
wireless_mode = false;
}
}