From 59b7cddd7d21e45865f21193a8a2367eedd0eb5f Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 20 Jun 2022 16:36:52 -0700 Subject: [PATCH] Module tier stat display (#7054) --- core/assets/bundles/bundle.properties | 1 + .../mindustry/world/blocks/units/UnitAssembler.java | 10 +++++++++- .../world/blocks/units/UnitAssemblerModule.java | 7 +++++++ core/src/mindustry/world/meta/Stat.java | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a2b39eb96c..bff8316195 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -792,6 +792,7 @@ stat.repairtime = Block Full Repair Time stat.repairspeed = Repair Speed stat.weapons = Weapons stat.bullet = Bullet +stat.moduletier = Module Tier stat.speedincrease = Speed Increase stat.range = Range stat.drilltier = Drillables diff --git a/core/src/mindustry/world/blocks/units/UnitAssembler.java b/core/src/mindustry/world/blocks/units/UnitAssembler.java index 277a32217a..569e276984 100644 --- a/core/src/mindustry/world/blocks/units/UnitAssembler.java +++ b/core/src/mindustry/world/blocks/units/UnitAssembler.java @@ -133,7 +133,9 @@ public class UnitAssembler extends PayloadBlock{ stats.add(Stat.output, table -> { table.row(); + int tier = 0; for(var plan : plans){ + int ttier = tier; table.table(t -> { t.setBackground(Tex.whiteui); t.setColor(Pal.darkestGray); @@ -146,9 +148,14 @@ public class UnitAssembler extends PayloadBlock{ if(plan.unit.unlockedNow()){ t.image(plan.unit.uiIcon).size(40).pad(10f).left(); t.table(info -> { - info.add(plan.unit.localizedName).left(); + info.defaults().left(); + info.add(plan.unit.localizedName); info.row(); info.add(Strings.autoFixed(plan.time / 60f, 1) + " " + Core.bundle.get("unit.seconds")).color(Color.lightGray); + if(ttier > 0){ + info.row(); + info.add(Stat.moduleTier.localized() + ": " + ttier).color(Color.lightGray); + } }).left(); t.table(req -> { @@ -167,6 +174,7 @@ public class UnitAssembler extends PayloadBlock{ } }).growX().pad(5); table.row(); + tier++; } }); } diff --git a/core/src/mindustry/world/blocks/units/UnitAssemblerModule.java b/core/src/mindustry/world/blocks/units/UnitAssemblerModule.java index 63f4ef52b1..79cd4ddc9e 100644 --- a/core/src/mindustry/world/blocks/units/UnitAssemblerModule.java +++ b/core/src/mindustry/world/blocks/units/UnitAssemblerModule.java @@ -28,6 +28,13 @@ public class UnitAssemblerModule extends PayloadBlock{ acceptsPayload = true; } + @Override + public void setStats(){ + super.setStats(); + + stats.add(Stat.moduleTier, tier); + } + @Override public void drawPlace(int x, int y, int rotation, boolean valid){ super.drawPlace(x, y, rotation, valid); diff --git a/core/src/mindustry/world/meta/Stat.java b/core/src/mindustry/world/meta/Stat.java index 8909a0c454..44f64c50cd 100644 --- a/core/src/mindustry/world/meta/Stat.java +++ b/core/src/mindustry/world/meta/Stat.java @@ -89,6 +89,7 @@ public class Stat implements Comparable{ ammoUse = new Stat("ammoUse", StatCat.function), shieldHealth = new Stat("shieldHealth", StatCat.function), cooldownTime = new Stat("cooldownTime", StatCat.function), + moduleTier = new Stat("moduletier", StatCat.function), booster = new Stat("booster", StatCat.optional), boostEffect = new Stat("boostEffect", StatCat.optional),