From e6c03dbf4ddb2e8e296b8ec201851ed35830534c Mon Sep 17 00:00:00 2001 From: Harley White Date: Thu, 6 May 2021 16:26:44 -0400 Subject: [PATCH] Setting that shows last milestone gained Also fixed the screen width detection --- changelog.md | 1 + js/game.js | 3 ++- js/technical/displays.js | 41 ++++++++++++++++++++++++++++++++ js/technical/systemComponents.js | 2 +- js/technical/temp.js | 37 +--------------------------- js/utils.js | 1 + js/utils/options.js | 11 +++++++-- js/utils/save.js | 1 + 8 files changed, 57 insertions(+), 40 deletions(-) diff --git a/changelog.md b/changelog.md index a319b01..e14f321 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ - Optimizations, hopefully a significant amount. - Added OOM/s point gen display at high values (thanks to Ducdat!) - Only one tab will display if the window is not wide enough (also thanks to Ducdat!) +- New milestone setting will also show the most recently unlocked milestone. (Also renamed all settings to be clearer) - Layer nodes will be highlighted even if the player is on the same tab. - Added customizable node glowColor. - Added buyable purchaseLimit. diff --git a/js/game.js b/js/game.js index 035b4a8..8935d52 100644 --- a/js/game.js +++ b/js/game.js @@ -409,7 +409,8 @@ var interval = setInterval(function() { } tmp.scrolled = document.getElementById('treeTab') && document.getElementById('treeTab').scrollTop > 30 updateTemp(); - updateOther(diff); + updateOomps(diff); + updateWidth() gameLoop(diff) fixNaNs() adjustPopupTime(0.05) diff --git a/js/technical/displays.js b/js/technical/displays.js index 109ccb1..09440ce 100644 --- a/js/technical/displays.js +++ b/js/technical/displays.js @@ -48,3 +48,44 @@ function achievementStyle(layer, id){ } + + +function updateWidth() { + var screenWidth = window.innerWidth + var splitScreen = screenWidth >= 1024 + if (player.splitMode === "disabled") splitScreen = false + if (player.splitMode === "enabled") splitScreen = true + + tmp.other = { + screenWidth: screenWidth, + splitScreen: splitScreen, + lastPoints: player.points, + oomps: tmp.other.oomps, + oompsMag: tmp.other.oompsMag, + } +} + +function updateOomps(diff) +{ + tmp.other.oompsMag = 0 + if (player.points.lte(new Decimal(1e100))) return + + var pp = new Decimal(player.points); + var lp = tmp.other.lastPoints || new Decimal(0); + if (pp.gt(lp)) { + if (pp.gte("10^^8")) { + pp = pp.slog(1e10) + lp = lp.slog(1e10) + tmp.other.oomps = pp.sub(lp).div(diff) + tmp.other.oompsMag = -1; + } else { + while (pp.div(lp).log(10).div(diff).gte("100") && tmp.other.oompsMag <= 5 && lp.gt(0)) { + pp = pp.log(10) + lp = lp.log(10) + tmp.other.oomps = pp.sub(lp).div(diff) + tmp.other.oompsMag++; + } + } + } + +} \ No newline at end of file diff --git a/js/technical/systemComponents.js b/js/technical/systemComponents.js index 86f4166..41ad73c 100644 --- a/js/technical/systemComponents.js +++ b/js/technical/systemComponents.js @@ -155,7 +155,7 @@ var systemComponents = { - + diff --git a/js/technical/temp.js b/js/technical/temp.js index 6253290..6f516bf 100644 --- a/js/technical/temp.js +++ b/js/technical/temp.js @@ -41,6 +41,7 @@ function setupTemp() { tmp.other = { screenWidth: window.innerWidth, + splitScreen: window.innerWidth >=1024, lastPoints: player.points || new Decimal(0), oomps: new Decimal(0), } @@ -212,40 +213,4 @@ function setupBuyables(layer) { } } } -} - -function updateOther(diff) { - tmp.other.oompsMag = 0 - if (player.points.lte(new Decimal(1e100))) return - - var pp = new Decimal(player.points); - var lp = tmp.other.lastPoints || new Decimal(0); - if (pp.gt(lp)) { - if (pp.gte("10^^8")) { - pp = pp.slog(1e10) - lp = lp.slog(1e10) - tmp.other.oomps = pp.sub(lp).div(diff) - tmp.other.oompsMag = -1; - } else { - while (pp.div(lp).log(10).div(diff).gte("100") && tmp.other.oompsMag <= 5 && lp.gt(0)) { - pp = pp.log(10) - lp = lp.log(10) - tmp.other.oomps = pp.sub(lp).div(diff) - tmp.other.oompsMag++; - } - } - } - - var screenWidth = window.innerWidth - var splitScreen = screenWidth >= 1024 - if (player.splitMode === "disabled") splitScreen = false - if (player.splitMode === "enabled") splitScreen = true - - tmp.other = { - screenWidth: screenWidth, - splitScreen: splitScreen, - lastPoints: player.points, - oomps: tmp.other.oomps, - oompsMag: tmp.other.oompsMag, - } } \ No newline at end of file diff --git a/js/utils.js b/js/utils.js index ae5db2f..2cf9a44 100644 --- a/js/utils.js +++ b/js/utils.js @@ -297,6 +297,7 @@ function updateMilestones(layer) { if (!(hasMilestone(layer, id)) && layers[layer].milestones[id].done()) { player[layer].milestones.push(id) if (tmp[layer].milestonePopups || tmp[layer].milestonePopups === undefined) doPopup("milestone", tmp[layer].milestones[id].requirementDescription, "Milestone Gotten!", 3, tmp[layer].color); + player[layer].lastMilestone = id } } } diff --git a/js/utils/options.js b/js/utils/options.js index 01e03be..737e6bf 100644 --- a/js/utils/options.js +++ b/js/utils/options.js @@ -26,9 +26,13 @@ function changeTreeQuality() { function toggleAuto(toggle) { player[toggle[0]][toggle[1]] = !player[toggle[0]][toggle[1]]; } + +const MS_DISPLAYS = ["ALL", "LAST, AUTO, INCOMPLETE", "AUTOMATION, INCOMPLETE", "INCOMPLETE", "NONE"]; + +const MS_SETTINGS = ["always", "last", "automation", "incomplete", "never"]; + function adjustMSDisp() { - let displays = ["always", "automation", "incomplete", "never"]; - player.msDisplay = displays[(displays.indexOf(player.msDisplay) + 1) % 4]; + player.msDisplay = MS_SETTINGS[(MS_SETTINGS.indexOf(player.msDisplay) + 1) % 5]; } function milestoneShown(layer, id) { complete = player[layer].milestones.includes(id); @@ -38,6 +42,9 @@ function milestoneShown(layer, id) { case "always": return true; break; + case "last": + return (auto) || !complete || player[layer].lastMilestone === id; + break; case "automation": return (auto) || !complete; break; diff --git a/js/utils/save.js b/js/utils/save.js index f8004cc..1488a3b 100644 --- a/js/utils/save.js +++ b/js/utils/save.js @@ -80,6 +80,7 @@ function getStartLayerData(layer) { layerdata.spentOnBuyables = new Decimal(0); layerdata.upgrades = []; layerdata.milestones = []; + layerdata.lastMilestone = null; layerdata.achievements = []; layerdata.challenges = getStartChallenges(layer); return layerdata;