More Dark UI in stats display (#8473)

* The Dark UI Menace

* Attack of the Dark UI
This commit is contained in:
JniTrRny
2023-04-07 06:07:24 +07:00
committed by GitHub
parent cdb9fa0d7d
commit 6dc3b7e729
14 changed files with 161 additions and 64 deletions

View File

@@ -900,6 +900,7 @@ stat.repairspeed = Repair Speed
stat.weapons = Weapons stat.weapons = Weapons
stat.bullet = Bullet stat.bullet = Bullet
stat.moduletier = Module Tier stat.moduletier = Module Tier
stat.unittype = Unit Type
stat.speedincrease = Speed Increase stat.speedincrease = Speed Increase
stat.range = Range stat.range = Range
stat.drilltier = Drillables stat.drilltier = Drillables
@@ -1796,54 +1797,54 @@ hint.payloadDrop.mobile = [accent]Tap and hold[] an empty location to drop a pay
hint.waveFire = [accent]Wave[] turrets with water as ammunition will automatically put out nearby fires. hint.waveFire = [accent]Wave[] turrets with water as ammunition will automatically put out nearby fires.
hint.generator = \uF879 [accent]Combustion Generators[] burn coal and transmit power to adjacent blocks.\n\nPower transmission range can be extended with \uF87F [accent]Power Nodes[]. hint.generator = \uF879 [accent]Combustion Generators[] burn coal and transmit power to adjacent blocks.\n\nPower transmission range can be extended with \uF87F [accent]Power Nodes[].
hint.guardian = [accent]Guardian[] units are armored. Weak ammo such as [accent]Copper[] and [accent]Lead[] is [scarlet]not effective[].\n\nUse higher tier turrets or \uF835 [accent]Graphite[] \uF861Duo/\uF859Salvo ammunition to take Guardians down. hint.guardian = [accent]Guardian[] units are armored. Weak ammo such as [accent]Copper[] and [accent]Lead[] is [scarlet]not effective[].\n\nUse higher tier turrets or \uF835 [accent]Graphite[] \uF861Duo/\uF859Salvo ammunition to take Guardians down.
hint.coreUpgrade = Cores can be upgraded by [accent]placing higher-tier cores over them[].\n\nPlace a \uf868 [accent]Foundation[] core over the \uf869 [accent]Shard[] core. Make sure it is free from nearby obstructions. hint.coreUpgrade = Cores can be upgraded by [accent]placing higher-tier cores over them[].\n\nPlace a \uF868 [accent]Foundation[] core over the \uF869 [accent]Shard[] core. Make sure it is free from nearby obstructions.
hint.presetLaunch = Gray [accent]landing zone sectors[], such as [accent]Frozen Forest[], can be launched to from anywhere. They do not require capture of nearby territory.\n\n[accent]Numbered sectors[], such as this one, are [accent]optional[]. hint.presetLaunch = Gray [accent]landing zone sectors[], such as [accent]Frozen Forest[], can be launched to from anywhere. They do not require capture of nearby territory.\n\n[accent]Numbered sectors[], such as this one, are [accent]optional[].
hint.presetDifficulty = This sector has a [scarlet]high enemy threat level[].\nLaunching to such sectors is [accent]not recommended[] without proper technology and preparation. hint.presetDifficulty = This sector has a [scarlet]high enemy threat level[].\nLaunching to such sectors is [accent]not recommended[] without proper technology and preparation.
hint.coreIncinerate = After the core is filled to capacity with an item, any extra items of that type it receives will be [accent]incinerated[]. hint.coreIncinerate = After the core is filled to capacity with an item, any extra items of that type it receives will be [accent]incinerated[].
hint.factoryControl = To set a unit factory's [accent]output destination[], click a factory block while in command mode, then right-click a location.\nUnits produced by it will automatically move there. hint.factoryControl = To set a unit factory's [accent]output destination[], click a factory block while in command mode, then right-click a location.\nUnits produced by it will automatically move there.
hint.factoryControl.mobile = To set a unit factory's [accent]output destination[], tap a factory block while in command mode, then tap a location.\nUnits produced by it will automatically move there. hint.factoryControl.mobile = To set a unit factory's [accent]output destination[], tap a factory block while in command mode, then tap a location.\nUnits produced by it will automatically move there.
gz.mine = Move near the \uf8c4 [accent]copper ore[] on the ground and click to begin mining. gz.mine = Move near the \uF8C4 [accent]copper ore[] on the ground and click to begin mining.
gz.mine.mobile = Move near the \uf8c4 [accent]copper ore[] on the ground and tap it to begin mining. gz.mine.mobile = Move near the \uF8C4 [accent]copper ore[] on the ground and tap it to begin mining.
gz.research = Open the \ue875 tech tree.\nResearch the \uf870 [accent]Mechanical Drill[], then select it from the menu in the bottom right.\nClick on a copper patch to place it. gz.research = Open the \uE875 tech tree.\nResearch the \uF870 [accent]Mechanical Drill[], then select it from the menu in the bottom right.\nClick on a copper patch to place it.
gz.research.mobile = Open the \ue875 tech tree.\nResearch the \uf870 [accent]Mechanical Drill[], then select it from the menu in the bottom right.\nTap on a copper patch to place it.\n\nPress the \uE800 [accent]checkmark[] at the bottom right to confirm. gz.research.mobile = Open the \uE875 tech tree.\nResearch the \uF870 [accent]Mechanical Drill[], then select it from the menu in the bottom right.\nTap on a copper patch to place it.\n\nPress the \uE800 [accent]checkmark[] at the bottom right to confirm.
gz.conveyors = Research and place \uf896 [accent]conveyors[] to move the mined resources\nfrom drills to the core.\n\nClick and drag to place multiple conveyors.\n[accent]Scroll[] to rotate. gz.conveyors = Research and place \uF896 [accent]conveyors[] to move the mined resources\nfrom drills to the core.\n\nClick and drag to place multiple conveyors.\n[accent]Scroll[] to rotate.
gz.conveyors.mobile = Research and place \uf896 [accent]conveyors[] to move the mined resources\nfrom drills to the core.\n\nHold down your finger for a second and drag to place multiple conveyors. gz.conveyors.mobile = Research and place \uF896 [accent]conveyors[] to move the mined resources\nfrom drills to the core.\n\nHold down your finger for a second and drag to place multiple conveyors.
gz.drills = Expand the mining operation.\nPlace more Mechanical Drills.\nMine 100 copper. gz.drills = Expand the mining operation.\nPlace more Mechanical Drills.\nMine 100 copper.
gz.lead = \uf837 [accent]Lead[] is another commonly used resource.\nSet up drills to mine lead. gz.lead = \uF837 [accent]Lead[] is another commonly used resource.\nSet up drills to mine lead.
gz.moveup = \ue804 Move up for further objectives. gz.moveup = \uE804 Move up for further objectives.
gz.turrets = Research and place 2 \uf861 [accent]Duo[] turrets to defend the core.\nDuo turrets require \uf838 [accent]ammo[] from conveyors. gz.turrets = Research and place 2 \uF861 [accent]Duo[] turrets to defend the core.\nDuo turrets require \uF838 [accent]ammo[] from conveyors.
gz.duoammo = Supply the Duo turrets with [accent]copper[], using conveyors. gz.duoammo = Supply the Duo turrets with [accent]copper[], using conveyors.
gz.walls = [accent]Walls[] can prevent oncoming damage from reaching buildings.\nPlace \uf8ae [accent]copper walls[] around the turrets. gz.walls = [accent]Walls[] can prevent oncoming damage from reaching buildings.\nPlace \uF8AE [accent]copper walls[] around the turrets.
gz.defend = Enemy incoming, prepare to defend. gz.defend = Enemy incoming, prepare to defend.
gz.aa = Flying units cannot easily be dispatched with standard turrets.\n\uf860 [accent]Scatter[] turrets provide excellent anti-air, but require \uf837 [accent]lead[] as ammo. gz.aa = Flying units cannot easily be dispatched with standard turrets.\n\uF860 [accent]Scatter[] turrets provide excellent anti-air, but require \uF837 [accent]lead[] as ammo.
gz.scatterammo = Supply the Scatter turret with \uf837 [accent]lead[], using conveyors. gz.scatterammo = Supply the Scatter turret with \uF837 [accent]lead[], using conveyors.
gz.supplyturret = [accent]Supply Turret gz.supplyturret = [accent]Supply Turret
gz.zone1 = This is the enemy drop zone. gz.zone1 = This is the enemy drop zone.
gz.zone2 = Anything built in the radius is destroyed when a wave starts. gz.zone2 = Anything built in the radius is destroyed when a wave starts.
gz.zone3 = A wave will begin now.\nGet ready. gz.zone3 = A wave will begin now.\nGet ready.
gz.finish = Build more turrets, mine more resources,\nand defend against all the waves to [accent]capture the sector[]. gz.finish = Build more turrets, mine more resources,\nand defend against all the waves to [accent]capture the sector[].
onset.mine = Click to mine \uf748 [accent]beryllium[] from walls.\n\nUse [accent][[WASD] to move. onset.mine = Click to mine \uF748 [accent]beryllium[] from walls.\n\nUse [accent][[WASD] to move.
onset.mine.mobile = Tap to mine \uf748 [accent]beryllium[] from walls. onset.mine.mobile = Tap to mine \uF748 [accent]beryllium[] from walls.
onset.research = Open the \ue875 tech tree.\nResearch, then place a \uf73e [accent]turbine condenser[] on the vent.\nThis will generate [accent]power[]. onset.research = Open the \uE875 tech tree.\nResearch, then place a \uF73E [accent]turbine condenser[] on the vent.\nThis will generate [accent]power[].
onset.bore = Research and place a \uf741 [accent]plasma bore[].\nThis automatically mines resources from walls. onset.bore = Research and place a \uF741 [accent]plasma bore[].\nThis automatically mines resources from walls.
onset.power = To [accent]power[] the plasma bore, research and place a \uf73d [accent]beam node[].\nConnect the turbine condenser to the plasma bore. onset.power = To [accent]power[] the plasma bore, research and place a \uF73D [accent]beam node[].\nConnect the turbine condenser to the plasma bore.
onset.ducts = Research and place \uf799 [accent]ducts[] to move the mined resources from the plasma bore to the core.\nClick and drag to place multiple ducts.\n[accent]Scroll[] to rotate. onset.ducts = Research and place \uF799 [accent]ducts[] to move the mined resources from the plasma bore to the core.\nClick and drag to place multiple ducts.\n[accent]Scroll[] to rotate.
onset.ducts.mobile = Research and place \uf799 [accent]ducts[] to move the mined resources from the plasma bore to the core.\n\nHold down your finger for a second and drag to place multiple ducts. onset.ducts.mobile = Research and place \uF799 [accent]ducts[] to move the mined resources from the plasma bore to the core.\n\nHold down your finger for a second and drag to place multiple ducts.
onset.moremine = Expand the mining operation.\nPlace more Plasma Bores and use beam nodes and ducts to support them.\nMine 200 beryllium. onset.moremine = Expand the mining operation.\nPlace more Plasma Bores and use beam nodes and ducts to support them.\nMine 200 beryllium.
onset.graphite = More complex blocks require \uf835 [accent]graphite[].\nSet up plasma bores to mine graphite. onset.graphite = More complex blocks require \uF835 [accent]graphite[].\nSet up plasma bores to mine graphite.
onset.research2 = Begin researching [accent]factories[].\nResearch the \uf74d [accent]cliff crusher[] and \uf779 [accent]silicon arc furnace[]. onset.research2 = Begin researching [accent]factories[].\nResearch the \uF74D [accent]cliff crusher[] and \uF779 [accent]silicon arc furnace[].
onset.arcfurnace = The arc furnace needs \uf834 [accent]sand[] and \uf835 [accent]graphite[] to create \uf82f [accent]silicon[].\n[accent]Power[] is also required. onset.arcfurnace = The arc furnace needs \uF834 [accent]sand[] and \uF835 [accent]graphite[] to create \uF82F [accent]silicon[].\n[accent]Power[] is also required.
onset.crusher = Use \uf74d [accent]cliff crushers[] to mine sand. onset.crusher = Use \uF74D [accent]cliff crushers[] to mine sand.
onset.fabricator = Use [accent]units[] to explore the map, defend buildings, and attack the enemy. Research and place a \uf6a2 [accent]tank fabricator[]. onset.fabricator = Use [accent]units[] to explore the map, defend buildings, and attack the enemy. Research and place a \uF6A2 [accent]tank fabricator[].
onset.makeunit = Produce a unit.\nUse the "?" button to see selected factory requirements. onset.makeunit = Produce a unit.\nUse the "?" button to see selected factory requirements.
onset.turrets = Units are effective, but [accent]turrets[] provide better defensive capabilities if used effectively.\nPlace a \uf6eb [accent]Breach[] turret.\nTurrets require \uf748 [accent]ammo[]. onset.turrets = Units are effective, but [accent]turrets[] provide better defensive capabilities if used effectively.\nPlace a \uF6EB [accent]Breach[] turret.\nTurrets require \uF748 [accent]ammo[].
onset.turretammo = Supply the turret with [accent]beryllium ammo.[] onset.turretammo = Supply the turret with [accent]beryllium ammo.[]
onset.walls = [accent]Walls[] can prevent oncoming damage from reaching buildings.\nPlace some \uf6ee [accent]beryllium walls[] around the turret. onset.walls = [accent]Walls[] can prevent oncoming damage from reaching buildings.\nPlace some \uF6EE [accent]beryllium walls[] around the turret.
onset.enemies = Enemy incoming, prepare to defend. onset.enemies = Enemy incoming, prepare to defend.
onset.attack = The enemy is vulnerable. Counter-attack. onset.attack = The enemy is vulnerable. Counter-attack.
onset.cores = New cores can be placed on [accent]core tiles[].\nNew cores function as forward bases and share a resource inventory with other cores.\nPlace a \uf725 core. onset.cores = New cores can be placed on [accent]core tiles[].\nNew cores function as forward bases and share a resource inventory with other cores.\nPlace a \uF725 core.
onset.detect = The enemy will be able to detect you in 2 minutes.\nSet up defenses, mining, and production. onset.detect = The enemy will be able to detect you in 2 minutes.\nSet up defenses, mining, and production.
split.pickup = Some blocks can be picked up by the core unit.\nPick up this [accent]container[] and place it onto the [accent]payload loader[].\n(Default keys are [[ and ] to pick up and drop) split.pickup = Some blocks can be picked up by the core unit.\nPick up this [accent]container[] and place it onto the [accent]payload loader[].\n(Default keys are [[ and ] to pick up and drop)

View File

@@ -619,7 +619,7 @@ public class UnitType extends UnlockableContent{
if(mineTier >= 1){ if(mineTier >= 1){
stats.addPercent(Stat.mineSpeed, mineSpeed); stats.addPercent(Stat.mineSpeed, mineSpeed);
stats.add(Stat.mineTier, StatValues.blocks(b -> stats.add(Stat.mineTier, StatValues.drillables(mineSpeed, 1f, 1, null, b ->
b.itemDrop != null && b.itemDrop != null &&
(b instanceof Floor f && (((f.wallOre && mineWalls) || (!f.wallOre && mineFloor))) || (b instanceof Floor f && (((f.wallOre && mineWalls) || (!f.wallOre && mineFloor))) ||
(!(b instanceof Floor) && mineWalls)) && (!(b instanceof Floor) && mineWalls)) &&

View File

@@ -65,6 +65,13 @@ public class BuildTurret extends BaseTurret{
}}; }};
} }
@Override
public void setStats(){
super.setStats();
stats.addPercent(Stat.buildSpeed, buildSpeed);
}
@Override @Override
public TextureRegion[] icons(){ public TextureRegion[] icons(){
return new TextureRegion[]{baseRegion, region}; return new TextureRegion[]{baseRegion, region};

View File

@@ -100,8 +100,9 @@ public class ForceProjector extends Block{
stats.add(Stat.cooldownTime, (int) (shieldHealth / cooldownBrokenBase / 60f), StatUnit.seconds); stats.add(Stat.cooldownTime, (int) (shieldHealth / cooldownBrokenBase / 60f), StatUnit.seconds);
if(consItems){ if(consItems){
stats.add(Stat.boostEffect, phaseRadiusBoost / tilesize, StatUnit.blocks); stats.remove(Stat.booster);
stats.add(Stat.boostEffect, phaseShieldBoost, StatUnit.shieldHealth); stats.add(Stat.booster, StatValues.itemBoosters("+{0} " + StatUnit.shieldHealth.localized(), stats.timePeriod, phaseShieldBoost, phaseRadiusBoost, ((ConsumeItems)findConsumer(f -> f instanceof ConsumeItems)).items, this::consumesItem));
stats.add(Stat.booster, StatValues.speedBoosters("", coolantConsumption, Float.MAX_VALUE, true, this::consumesLiquid));
} }
} }

View File

@@ -11,6 +11,7 @@ import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.*; import mindustry.logic.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -53,8 +54,8 @@ public class MendProjector extends Block{
stats.add(Stat.repairTime, (int)(100f / healPercent * reload / 60f), StatUnit.seconds); stats.add(Stat.repairTime, (int)(100f / healPercent * reload / 60f), StatUnit.seconds);
stats.add(Stat.range, range / tilesize, StatUnit.blocks); stats.add(Stat.range, range / tilesize, StatUnit.blocks);
stats.add(Stat.boostEffect, phaseRangeBoost / tilesize, StatUnit.blocks); stats.remove(Stat.booster);
stats.add(Stat.boostEffect, (phaseBoost + healPercent) / healPercent, StatUnit.timesSpeed); stats.add(Stat.booster, StatValues.itemBoosters("{0}" + StatUnit.timesSpeed.localized(), stats.timePeriod, (phaseBoost + healPercent) / healPercent, phaseRangeBoost, ((ConsumeItems)findConsumer(f -> f instanceof ConsumeItems)).items, this::consumesItem));
} }
@Override @Override

View File

@@ -13,6 +13,7 @@ import mindustry.graphics.*;
import mindustry.logic.*; import mindustry.logic.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -68,8 +69,8 @@ public class OverdriveProjector extends Block{
stats.add(Stat.productionTime, useTime / 60f, StatUnit.seconds); stats.add(Stat.productionTime, useTime / 60f, StatUnit.seconds);
if(hasBoost){ if(hasBoost){
stats.add(Stat.boostEffect, (range + phaseRangeBoost) / tilesize, StatUnit.blocks); stats.remove(Stat.booster);
stats.add(Stat.boostEffect, "+" + (int)((speedBoost + speedBoostPhase) * 100f - 100) + "%"); stats.add(Stat.booster, StatValues.itemBoosters("+{0}%", stats.timePeriod, speedBoostPhase * 100f, phaseRangeBoost, ((ConsumeItems)findConsumer(f -> f instanceof ConsumeItems)).items, this::consumesItem));
} }
} }

View File

@@ -18,6 +18,7 @@ public class ReloadTurret extends BaseTurret{
super.setStats(); super.setStats();
if(coolant != null){ if(coolant != null){
stats.remove(Stat.booster);
stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l))); stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l)));
} }
} }

View File

@@ -17,6 +17,7 @@ import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.environment.*; import mindustry.world.blocks.environment.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -110,11 +111,12 @@ public class BeamDrill extends Block{
public void setStats(){ public void setStats(){
super.setStats(); super.setStats();
stats.add(Stat.drillTier, StatValues.blocks(b -> (b instanceof Floor f && f.wallOre && f.itemDrop != null && f.itemDrop.hardness <= tier) || (b instanceof StaticWall w && w.itemDrop != null && w.itemDrop.hardness <= tier))); stats.add(Stat.drillTier, StatValues.drillables(drillTime, 0f, size, drillMultipliers, b -> (b instanceof Floor f && f.wallOre && f.itemDrop != null && f.itemDrop.hardness <= tier) || (b instanceof StaticWall w && w.itemDrop != null && w.itemDrop.hardness <= tier)));
stats.add(Stat.drillSpeed, 60f / drillTime * size, StatUnit.itemsSecond); stats.add(Stat.drillSpeed, 60f / drillTime * size, StatUnit.itemsSecond);
if(optionalBoostIntensity != 1){ if(optionalBoostIntensity != 1){
stats.add(Stat.boostEffect, optionalBoostIntensity, StatUnit.timesSpeed); stats.remove(Stat.booster);
stats.add(Stat.booster, StatValues.speedBoosters("{0}" + StatUnit.timesSpeed.localized(), ((ConsumeLiquidBase)findConsumer(f -> f instanceof ConsumeLiquidBase)).amount, optionalBoostIntensity, false, l -> (consumesLiquid(l) && (findConsumer(f -> f instanceof ConsumeLiquid).booster || ((ConsumeLiquid)findConsumer(f -> f instanceof ConsumeLiquid)).liquid != l))));
} }
} }

View File

@@ -19,6 +19,7 @@ import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.environment.*; import mindustry.world.blocks.environment.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -170,12 +171,13 @@ public class Drill extends Block{
public void setStats(){ public void setStats(){
super.setStats(); super.setStats();
stats.add(Stat.drillTier, StatValues.blocks(b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null && stats.add(Stat.drillTier, StatValues.drillables(drillTime, hardnessDrillMultiplier, size * size, drillMultipliers, b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null &&
f.itemDrop.hardness <= tier && f.itemDrop != blockedItem && (indexer.isBlockPresent(f) || state.isMenu()))); f.itemDrop.hardness <= tier && f.itemDrop != blockedItem && (indexer.isBlockPresent(f) || state.isMenu())));
stats.add(Stat.drillSpeed, 60f / drillTime * size * size, StatUnit.itemsSecond); stats.add(Stat.drillSpeed, 60f / drillTime * size * size, StatUnit.itemsSecond);
if(liquidBoostIntensity != 1){ if(liquidBoostIntensity != 1){
stats.add(Stat.boostEffect, liquidBoostIntensity * liquidBoostIntensity, StatUnit.timesSpeed); stats.remove(Stat.booster);
stats.add(Stat.booster, StatValues.speedBoosters("{0}" + StatUnit.timesSpeed.localized(), ((ConsumeLiquidBase)findConsumer(f -> f instanceof ConsumeLiquidBase)).amount, liquidBoostIntensity * liquidBoostIntensity, false, this::consumesLiquid));
} }
} }

View File

@@ -95,6 +95,20 @@ public class CoreBlock extends StorageBlock{
super.setStats(); super.setStats();
stats.remove(Stat.buildTime); stats.remove(Stat.buildTime);
stats.add(Stat.unitType, table -> {
table.row();
table.table(Styles.grayPanel, b -> {
b.image(unitType.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit);
b.table(info -> {
info.add(unitType.localizedName).left();
if(Core.settings.getBool("console")){
info.row();
info.add(unitType.name).left().color(Color.lightGray);
}
});
b.button("?", Styles.flatBordert, () -> ui.content.show(unitType)).size(40f).pad(10).right().grow().visible(() -> unitType.unlockedNow());
}).growX().pad(5).row();
});
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package mindustry.world.blocks.units; package mindustry.world.blocks.units;
import arc.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
@@ -70,7 +71,8 @@ public class RepairTurret extends Block{
stats.add(Stat.repairSpeed, repairSpeed * 60f, StatUnit.perSecond); stats.add(Stat.repairSpeed, repairSpeed * 60f, StatUnit.perSecond);
if(acceptCoolant){ if(acceptCoolant){
stats.add(Stat.booster, StatValues.strengthBoosters(coolantMultiplier, this::consumesLiquid)); stats.remove(Stat.booster);
stats.add(Stat.booster, StatValues.speedBoosters(Core.bundle.get("bar.strength"), coolantUse, coolantMultiplier, true, this::consumesLiquid));
} }
} }

View File

@@ -90,6 +90,7 @@ public class Stat implements Comparable<Stat>{
shieldHealth = new Stat("shieldHealth", StatCat.function), shieldHealth = new Stat("shieldHealth", StatCat.function),
cooldownTime = new Stat("cooldownTime", StatCat.function), cooldownTime = new Stat("cooldownTime", StatCat.function),
moduleTier = new Stat("moduletier", StatCat.function), moduleTier = new Stat("moduletier", StatCat.function),
unitType = new Stat("unittype", StatCat.function),
booster = new Stat("booster", StatCat.optional), booster = new Stat("booster", StatCat.optional),
boostEffect = new Stat("boostEffect", StatCat.optional), boostEffect = new Stat("boostEffect", StatCat.optional),

View File

@@ -16,9 +16,9 @@ public class StatUnit{
blocksSquared = new StatUnit("blocksSquared"), blocksSquared = new StatUnit("blocksSquared"),
tilesSecond = new StatUnit("tilesSecond"), tilesSecond = new StatUnit("tilesSecond"),
powerSecond = new StatUnit("powerSecond", "[accent]" + Iconc.power + "[]"), powerSecond = new StatUnit("powerSecond", "[accent]" + Iconc.power + "[]"),
liquidSecond = new StatUnit("liquidSecond"), liquidSecond = new StatUnit("liquidSecond", "[sky]" + Iconc.liquid + "[]"),
itemsSecond = new StatUnit("itemsSecond"), itemsSecond = new StatUnit("itemsSecond"),
liquidUnits = new StatUnit("liquidUnits"), liquidUnits = new StatUnit("liquidUnits", "[sky]" + Iconc.liquid + "[]"),
powerUnits = new StatUnit("powerUnits", "[accent]" + Iconc.power + "[]"), powerUnits = new StatUnit("powerUnits", "[accent]" + Iconc.power + "[]"),
heatUnits = new StatUnit("heatUnits", "[red]" + Iconc.waves + "[]"), heatUnits = new StatUnit("heatUnits", "[red]" + Iconc.waves + "[]"),
degrees = new StatUnit("degrees"), degrees = new StatUnit("degrees"),

View File

@@ -2,6 +2,7 @@ package mindustry.world.meta;
import arc.*; import arc.*;
import arc.func.*; import arc.func.*;
import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.scene.ui.*; import arc.scene.ui.*;
@@ -235,6 +236,32 @@ public class StatValues{
return content(list.as()); return content(list.as());
} }
public static StatValue drillables(float drillTime, float drillMultiplier, float size, ObjectFloatMap<Item> multipliers, Boolf<Block> filter){
return table -> {
table.row();
table.table(c -> {
int i = 0;
for(Block block : content.blocks()){
if(!filter.get(block)) continue;
c.table(Styles.grayPanel, b -> {
b.image(block.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit);
b.table(info -> {
info.left();
info.add(block.localizedName).left().row();
info.add(block.itemDrop.emoji()).left();
}).grow();
if(multipliers != null){
b.add(Strings.autoFixed(60f / (Math.max(drillTime + drillMultiplier * block.itemDrop.hardness, drillTime) / multipliers.get(block.itemDrop, 1f)) * size, 2) + StatUnit.perSecond.localized())
.right().pad(10f).padRight(15f).color(Color.lightGray);
}
}).growX().pad(5);
if(++i % 2 == 0) c.row();
}
}).growX().colspan(table.getColumns());
};
}
public static StatValue boosters(float reload, float maxUsed, float multiplier, boolean baseReload, Boolf<Liquid> filter){ public static StatValue boosters(float reload, float maxUsed, float multiplier, boolean baseReload, Boolf<Liquid> filter){
return table -> { return table -> {
table.row(); table.row();
@@ -242,41 +269,78 @@ public class StatValues{
for(Liquid liquid : content.liquids()){ for(Liquid liquid : content.liquids()){
if(!filter.get(liquid)) continue; if(!filter.get(liquid)) continue;
c.image(liquid.uiIcon).size(3 * 8).scaling(Scaling.fit).padRight(4).right().top(); c.table(Styles.grayPanel, b -> {
c.add(liquid.localizedName).padRight(10).left().top(); b.image(liquid.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit);
c.table(Tex.underline, bt -> { b.table(info -> {
bt.left().defaults().padRight(3).left(); info.add(liquid.localizedName).left().row();
info.add(Strings.autoFixed(maxUsed * 60f, 1) + StatUnit.perSecond.localized()).left().color(Color.lightGray);
});
float reloadRate = (baseReload ? 1f : 0f) + maxUsed * multiplier * liquid.heatCapacity; b.table(bt -> {
float standardReload = baseReload ? reload : reload / (maxUsed * multiplier * 0.4f); bt.right().defaults().padRight(3).left();
float result = standardReload / (reload / reloadRate);
bt.add(Core.bundle.format("bullet.reload", Strings.autoFixed(result * 100, 1))); float reloadRate = (baseReload ? 1f : 0f) + maxUsed * multiplier * liquid.heatCapacity;
}).left().padTop(-9); float standardReload = baseReload ? reload : reload / (maxUsed * multiplier * 0.4f);
c.row(); float result = standardReload / (reload / reloadRate);
bt.add(Core.bundle.format("bullet.reload", Strings.autoFixed(result * 100, 1))).pad(5);
}).right().grow().pad(10f).padRight(15f);
}).growX().pad(5).row();
} }
}).colspan(table.getColumns()); }).growX().colspan(table.getColumns());
table.row(); table.row();
}; };
} }
public static StatValue strengthBoosters(float multiplier, Boolf<Liquid> filter){ public static StatValue speedBoosters(String unit, float amount, float speed, boolean strength, Boolf<Liquid> filter){
return table -> { return table -> {
table.row(); table.row();
table.table(c -> { table.table(c -> {
for(Liquid liquid : content.liquids()){ for(Liquid liquid : content.liquids()){
if(!filter.get(liquid)) continue; if(!filter.get(liquid)) continue;
c.image(liquid.uiIcon).size(3 * 8).scaling(Scaling.fit).padRight(4).right().top(); c.table(Styles.grayPanel, b -> {
c.add(liquid.localizedName).padRight(10).left().top(); b.image(liquid.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit);
c.table(Tex.underline, bt -> { b.table(info -> {
bt.left().defaults().padRight(3).left(); info.add(liquid.localizedName).left().row();
info.add(Strings.autoFixed(amount * 60f, 1) + StatUnit.perSecond.localized()).left().color(Color.lightGray);
});
float newRate = (1f + multiplier * liquid.heatCapacity); b.table(bt -> {
bt.add(Core.bundle.format("bar.strength", Strings.autoFixed(newRate, 2))); bt.right().defaults().padRight(3).left();
}).left().padTop(-9); if(speed != Float.MAX_VALUE) bt.add(unit.replace("{0}", "[stat]" + Strings.autoFixed(speed * (strength ? liquid.heatCapacity : 1f) + (strength ? 1f : 0f), 2) + "[lightgray]")).pad(5);
c.row(); }).right().grow().pad(10f).padRight(15f);
}).growX().pad(5).row();
} }
}).colspan(table.getColumns()); }).growX().colspan(table.getColumns());
table.row();
};
}
public static StatValue itemBoosters(String unit, float timePeriod, float speedBoost, float rangeBoost, ItemStack[] items, Boolf<Item> filter){
return table -> {
table.row();
table.table(c -> {
for(Item item : content.items()){
if(!filter.get(item)) continue;
c.table(Styles.grayPanel, b -> {
for(ItemStack stack : items){
if(timePeriod < 0){
b.add(new ItemDisplay(stack.item, stack.amount, true)).pad(20f).left();
}else{
b.add(new ItemDisplay(stack.item, stack.amount, timePeriod, true)).pad(20f).left();
}
if(items.length > 1) b.row();
}
b.table(bt -> {
bt.right().defaults().padRight(3).left();
if(rangeBoost != 0) bt.add("[lightgray]+[stat]" + Strings.autoFixed(rangeBoost / tilesize, 2) + "[lightgray] " + StatUnit.blocks.localized()).row();
if(speedBoost != 0) bt.add("[lightgray]" + unit.replace("{0}", "[stat]" + Strings.autoFixed(speedBoost, 2) + "[lightgray]"));
}).right().grow().pad(10f).padRight(15f);
}).growX().pad(5).padBottom(-5).row();
}
}).growX().colspan(table.getColumns());
table.row(); table.row();
}; };
} }
@@ -468,4 +532,4 @@ public class StatValues{
private static TextureRegion icon(UnlockableContent t){ private static TextureRegion icon(UnlockableContent t){
return t.uiIcon; return t.uiIcon;
} }
} }