From a121c4d0423a5df38a201eb84c20bb4ec1c26b0d Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 21 Jan 2022 00:08:56 -0500 Subject: [PATCH] Fixed square numbers in stats --- .../blocks/turrets/afflict/afflict.png | Bin 1800 -> 1760 bytes .../maps/planet/ErekirPlanetGenerator.java | 2 +- core/src/mindustry/type/UnitType.java | 4 ++-- .../blocks/payloads/PayloadConveyor.java | 2 +- .../blocks/payloads/PayloadMassDriver.java | 2 +- core/src/mindustry/world/meta/StatValues.java | 17 ++++++++++++++--- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png b/core/assets-raw/sprites/blocks/turrets/afflict/afflict.png index 69f2a1b06593b1ba8433943d54fb35a731c09c8e..bc1d57ddc0f4e1d35795f9866803d77b40de3fa6 100644 GIT binary patch delta 1731 zcmV;!20ZzQ4&V)tF@Ks#L_t(|ob8=EjwD48hGRw;8~~v`09c4qj0YNP@3Crg4U9H0 z)@)4i{8U#4XVTU4J$1P{CkD+~O_hiZO2q z69`AhD_(-G7;{O8AZCQTVlC*3G1qVpKtjkXR)Ve=bMyS3CznPtF`nnJWLE}A=(rl- z&1qj(69;b%+zjB|@JM)S;bMSH{w-dbh#26_>HG=XfJ}ZHiiT1;P8pyKWE4~;e+)%K z2_vu#kjae0On)v|2H>194THy0U$OzDgF8J@kG3CrZMQN3$pBhc@exg+)n;mr&<5Zp zANxHCK`iFgCC-6utG4C6D<)P6wlPUn+@=8{Ox)Cjqa=O{ zr9GUsx8jO0uLQK+lKqkv(j#auxLViRfAc}~#&e;T%%kX#Tfz=b8sOj@!T_8R zv(zX%I)8^SK+z2LRyzcs1u~ zVNVl;oeJh8AHerT&cYuAn^y2yIoEMC3tpe z0FCtk?~Nx~pbW55|F4;-l}v!m+0XzhB|muyCU;!}{Qd6jQUkzMUK3}@D2Gi0Xe1vy z#mT{PdzI$7G&Jhvvg&5-D_?p|V4D!_MSraAt(ElZo#q7s0PywO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FrLHid; z0Oo49)SNyA=^)H7-hy3LYC|dndo>?m=K 0.41f){ + if(floor == Blocks.yellowStonePlates && noise(x + 78 + y, y, 3, 0.8f, 6f, 1f) > 0.44f){ floor = Blocks.yellowStone; } }); diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 57a9604607..867ec87dfc 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -320,7 +320,7 @@ public class UnitType extends UnlockableContent{ stats.add(Stat.health, health); stats.add(Stat.armor, armor); stats.add(Stat.speed, speed * 60f / tilesize, StatUnit.tilesSecond); - stats.add(Stat.size, hitSize / tilesize, StatUnit.blocksSquared); + stats.add(Stat.size, StatValues.squared(hitSize / tilesize, StatUnit.blocksSquared)); stats.add(Stat.itemCapacity, itemCapacity); stats.add(Stat.range, (int)(maxRange / tilesize), StatUnit.blocks); stats.add(Stat.commandLimit, commandLimit); @@ -349,7 +349,7 @@ public class UnitType extends UnlockableContent{ stats.addPercent(Stat.buildSpeed, buildSpeed); } if(inst instanceof Payloadc){ - stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared); + stats.add(Stat.payloadCapacity, StatValues.squared(Mathf.sqrt(payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared)); } var reqs = getFirstRequirements(); diff --git a/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java b/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java index 1e682f2824..6880b6662a 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java @@ -54,7 +54,7 @@ public class PayloadConveyor extends Block{ public void setStats(){ super.setStats(); - stats.add(Stat.payloadCapacity, (payloadLimit), StatUnit.blocksSquared); + stats.add(Stat.payloadCapacity, StatValues.squared(payloadLimit, StatUnit.blocksSquared)); } @Override diff --git a/core/src/mindustry/world/blocks/payloads/PayloadMassDriver.java b/core/src/mindustry/world/blocks/payloads/PayloadMassDriver.java index 1aa6e3100c..02eaa64955 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadMassDriver.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadMassDriver.java @@ -78,7 +78,7 @@ public class PayloadMassDriver extends PayloadBlock{ public void setStats(){ super.setStats(); - stats.add(Stat.payloadCapacity, maxPayloadSize, StatUnit.blocksSquared); + stats.add(Stat.payloadCapacity, StatValues.squared(maxPayloadSize, StatUnit.blocksSquared)); stats.add(Stat.reload, 60f / (chargeTime + reloadTime), StatUnit.seconds); } diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 064bd095aa..7f0ad1e1bf 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -34,11 +34,22 @@ public class StatValues{ return table -> table.add(!value ? "@no" : "@yes"); } + public static String fixValue(float value){ + int precision = Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2; + return Strings.fixed(value, precision); + } + + public static StatValue squared(float value, StatUnit unit){ + return table -> { + String fixed = fixValue(value); + table.add(fixed + "x" + fixed); + table.add((unit.space ? " " : "") + unit.localized()); + }; + } + public static StatValue number(float value, StatUnit unit, boolean merge){ return table -> { - int precision = Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2; - - String l1 = Strings.fixed(value, precision), l2 = (unit.space ? " " : "") + unit.localized(); + String l1 = fixValue(value), l2 = (unit.space ? " " : "") + unit.localized(); if(merge){ table.add(l1 + l2);