More precision in block stats

This commit is contained in:
Anuken
2025-08-15 20:35:36 -04:00
parent 915c8090c7
commit 8251b33a03
7 changed files with 11 additions and 16 deletions

View File

@@ -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. */

View File

@@ -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"

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -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();
}