From 8251b33a03b81edfdabccf545246abad848eb4aa Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 15 Aug 2025 20:35:36 -0400 Subject: [PATCH] More precision in block stats --- core/src/mindustry/mod/Mods.java | 8 -------- core/src/mindustry/net/CrashHandler.java | 2 +- core/src/mindustry/type/Sector.java | 2 +- core/src/mindustry/ui/fragments/HudFragment.java | 1 + core/src/mindustry/world/Tile.java | 2 ++ core/src/mindustry/world/meta/StatValues.java | 10 +++++----- gradle.properties | 2 +- 7 files changed, 11 insertions(+), 16 deletions(-) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 6a21fb042e..677d479cd1 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -816,9 +816,6 @@ public class Mods implements Loadable{ public void loadScripts(){ if(skipModCode) return; - Time.mark(); - boolean[] any = {false}; - try{ eachEnabled(mod -> { if(mod.root.child("scripts").exists()){ @@ -831,7 +828,6 @@ public class Mods implements Loadable{ if(scripts == null){ scripts = platform.createScripts(); } - any[0] = true; scripts.run(mod, main); }catch(Throwable e){ Core.app.post(() -> { @@ -847,10 +843,6 @@ public class Mods implements Loadable{ }finally{ content.setCurrentMod(null); } - - if(any[0]){ - Log.info("Time to initialize modded scripts: @", Time.elapsed()); - } } /** Creates all the content found in mod files. */ diff --git a/core/src/mindustry/net/CrashHandler.java b/core/src/mindustry/net/CrashHandler.java index 1b52810d28..4e09ba0f8a 100644 --- a/core/src/mindustry/net/CrashHandler.java +++ b/core/src/mindustry/net/CrashHandler.java @@ -33,7 +33,7 @@ public class CrashHandler{ return report + "Version: " + Version.combined() + (Version.buildDate.equals("unknown") ? "" : " (Built " + Version.buildDate + ")") + (Vars.headless ? " (Server)" : "") + "\n" + "Date: " + new SimpleDateFormat("MMMM d, yyyy HH:mm:ss a", Locale.getDefault()).format(new Date()) + "\n" - + "OS: " + OS.osName + " x" + (OS.osArchBits) + " (" + OS.osArch + ")\n" + + "OS: " + OS.osName + (OS.osArchBits != null ? " x" + (OS.osArchBits) : "") + " (" + OS.osArch + ")\n" + ((OS.isAndroid || OS.isIos) && app != null ? "Android API level: " + Core.app.getVersion() + "\n" : "") + "Java Version: " + OS.javaVersion + "\n" + "Runtime Available Memory: " + (Runtime.getRuntime().maxMemory() / 1024 / 1024) + "mb\n" diff --git a/core/src/mindustry/type/Sector.java b/core/src/mindustry/type/Sector.java index bf84ffa260..fbdab2cd2a 100644 --- a/core/src/mindustry/type/Sector.java +++ b/core/src/mindustry/type/Sector.java @@ -152,7 +152,7 @@ public class Sector{ @Nullable public TextureRegion icon(){ - return info.contentIcon != null ? info.contentIcon.uiIcon : info.icon == null ? (preset != null && preset.uiIcon.found() && preset.unlocked() ? preset.uiIcon : null) : Fonts.getLargeIcon(info.icon); + return info.contentIcon != null ? info.contentIcon.uiIcon : info.icon == null ? (preset != null && preset.requireUnlock && preset.uiIcon.found() && preset.unlocked() ? preset.uiIcon : null) : Fonts.getLargeIcon(info.icon); } @Nullable diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index b0e64a0ddf..2e7f555830 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -988,6 +988,7 @@ public class HudFragment{ table.table().update(t -> { if(player.unit() instanceof Payloadc payload){ if(count[0] != payload.payloadUsed()){ + t.clear(); payload.contentInfo(t, 8 * 2, 275f); count[0] = payload.payloadUsed(); } diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index 78f5cdb1cf..2ab4a4ab73 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -683,10 +683,12 @@ public class Tile implements Position, QuadTreeObject, Displayable{ } } + /** @return all extra tile data, packed into a single long for data transfer convenience. */ public long getPackedData(){ return PackedTileData.get(extraData, data, floorData, overlayData); } + /** Sets the packed data as obtained from {@link #getPackedData()}*/ public void setPackedData(long packed){ extraData = PackedTileData.extraData(packed); data = PackedTileData.data(packed); diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 886fa305ab..8bad161976 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -41,7 +41,7 @@ public class StatValues{ } public static String fixValue(float value){ - return Strings.autoFixed(value, 2); + return Strings.autoFixed(value, 3); } public static StatValue squared(float value, StatUnit unit){ @@ -189,10 +189,10 @@ public class StatValues{ if(amount != 0){ Table t = new Table().left().bottom(); - t.add(Strings.autoFixed(amount, 2)).style(Styles.outlineLabel); + t.add(Strings.autoFixed(amount, 3)).style(Styles.outlineLabel); add(t); } - }}).size(iconMed).padRight(3 + (amount != 0 ? (Strings.autoFixed(amount, 2).length() - 1) * 10 : 0)).with(s -> withTooltip(s, liquid, false)); + }}).size(iconMed).padRight(3 + (amount != 0 ? (Strings.autoFixed(amount, 3).length() - 1) * 10 : 0)).with(s -> withTooltip(s, liquid, false)); if(perSecond && amount != 0){ t.add(StatUnit.perSecond.localized()).padLeft(2).padRight(5).color(Color.lightGray).style(Styles.outlineLabel); @@ -290,7 +290,7 @@ public class StatValues{ public static Table displayItem(Item item, int amount, float timePeriod, boolean showName){ Table t = new Table(); t.add(stack(item, amount, !showName)); - t.add((showName ? item.localizedName + "\n" : "") + "[lightgray]" + Strings.autoFixed(amount / (timePeriod / 60f), 2) + StatUnit.perSecond.localized()).padLeft(2).padRight(5).style(Styles.outlineLabel); + t.add((showName ? item.localizedName + "\n" : "") + "[lightgray]" + Strings.autoFixed(amount / (timePeriod / 60f), 3) + StatUnit.perSecond.localized()).padLeft(2).padRight(5).style(Styles.outlineLabel); return t; } @@ -474,7 +474,7 @@ public class StatValues{ c.table(Styles.grayPanel, b -> { b.image(item.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit); - b.add(item.localizedName + (timePeriod > 0 ? "\n[lightgray]" + (time < 0.01f ? Strings.fixed(time, 4) : Strings.autoFixed(time, 2)) + StatUnit.perSecond.localized() : "")).left().grow(); + b.add(item.localizedName + (timePeriod > 0 ? "\n[lightgray]" + Strings.autoFixed(time, time < 0.01f ? 4 : 2) + StatUnit.perSecond.localized() : "")).left().grow(); b.add(Core.bundle.format("stat.efficiency", fixValue(efficiency.get(item) * 100f))).right().pad(10f).padRight(15f); }).growX().pad(5).row(); } diff --git a/gradle.properties b/gradle.properties index c8cbc07ece..82fd405e08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ org.gradle.caching=true org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 android.enableR8.fullMode=false -archash=bceaf78774 +archash=5677d5c798