diff --git a/mods/betterStats.js b/mods/betterStats.js new file mode 100644 index 00000000..9a14cf8f --- /dev/null +++ b/mods/betterStats.js @@ -0,0 +1,56 @@ +enabledMods.includes("mods/libpacman-v1.js") || (enabledMods.push("mods/libpacman-v1.js"), localStorage.setItem("enabledMods", JSON.stringify(enabledMods)), location.reload()); + +let realTps = 0; +let lastTps = 0; +window.addEventListener("load", ()=>{ + requireMods(["mods/libhooktick.js"], () => { + everyTick(()=>{ + lastTps++; + }); + setInterval(()=>{ + realTps = lastTps; + lastTps = 0; + }, 1000); + }); +}); +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 currentPixel = pixelMap[mousePos.x][mousePos.y]; + if (currentPixel != undefined) { + stats += "Elem:" + (elements[currentPixel.element].name || currentPixel.element).toUpperCase() + ""; + stats += "Temp:" + formatTemp(currentPixel.temp) + ""; + if (currentPixel.charge) { + stats += "C" + currentPixel.charge + ""; + } + if (currentPixel.burning) { + stats += "Burning"; + } + } + } + if (shiftDown) { + if (shiftDown == 1) { + stats += "[↑ ]"; + } else if (shiftDown == 2) { + stats += "[A ]"; + } else if (shiftDown == 3) { + stats += "[ ↑]"; + } else if (shiftDown == 4) { + stats += "[ A]"; + } + } + // If the view is not null, show the view in all caps + if (view != null) { + stats += "" + viewKey[view].toUpperCase() + ""; + } + statsDiv.innerHTML = stats; +} +updateStats = updateStatsNew;