From 2d136cc31017f795a41557f3b08508f69304d136 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:59:30 -0500 Subject: [PATCH] emergency update i don't like unilaterally editing people's mods but the move away from viewKey fatally broke the mod --- mods/betterStats.js | 47 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/mods/betterStats.js b/mods/betterStats.js index 2cb49bdb..f1cce9a7 100644 --- a/mods/betterStats.js +++ b/mods/betterStats.js @@ -15,41 +15,40 @@ window.addEventListener("load", ()=>{ }); function updateStatsNew() { var statsDiv = document.getElementById("stats"); - var stats = "x" + mousePos.x + ",y" + mousePos.y + ""; - stats += "Pxls:" + currentPixels.length + ""; - stats += "" + tps + " set tps"; - stats += "" + realTps + "tps"; - stats += "" + pixelTicks + ""; - if (typeof pixelMap == 'undefined') { - return; - } - if (pixelMap[mousePos.x] != undefined) { + var stats = "x"+mousePos.x+",y"+mousePos.y+""; + stats += "Pxls:" + currentPixels.length+""; + stats += "" + tps+"tps"; + stats += "" + realTps + "tps"; + stats += "" + pixelTicks+""; + if ((typeof pixelMap).length === 9) { return; } + if (pixelMap[mousePos.x] !== undefined) { var currentPixel = pixelMap[mousePos.x][mousePos.y]; - if (currentPixel != undefined) { - stats += "Elem:" + (elements[currentPixel.element].name || currentPixel.element).toString().toUpperCase() + ""; - stats += "Temp:" + formatTemp(currentPixel.temp) + ""; + if (currentPixel !== undefined) { + stats += "Elem:"+(elements[currentPixel.element].name || currentPixel.element).toUpperCase()+""; + stats += "Temp:"+formatTemp(currentPixel.temp)+""; if (currentPixel.charge) { - stats += "C" + currentPixel.charge + ""; + stats += "C"+parseFloat(currentPixel.charge)+""; } if (currentPixel.burning) { stats += "Burning"; } + if (elements[currentPixel.element].hoverStat) { + stats += ""+elements[currentPixel.element].hoverStat(currentPixel).toString().replaceAll("<","<")+""; + } + else if (currentPixel.clone) { + stats += ""+currentPixel.clone.toString().toUpperCase().replaceAll("<","<")+""; + } + else if (currentPixel.con && currentPixel.con.element) { + stats += ""+currentPixel.con.element.toString().toUpperCase().replaceAll("<","<")+""; + } } } if (shiftDown) { - if (shiftDown == 1) { - stats += "[↑ ]"; - } else if (shiftDown == 2) { - stats += "[A ]"; - } else if (shiftDown == 3) { - stats += "[ ↑]"; - } else if (shiftDown == 4) { - stats += "[ A]"; - } + stats += ""+shiftDownTypes[shiftDown]+""; } // If the view is not null, show the view in all caps - if (view != null) { - stats += "" + viewKey[view].toString().toUpperCase() + ""; + if (view !== null) { + stats += ""+(viewInfo[view] ? viewInfo[view].name : view)+""; } statsDiv.innerHTML = stats; }