1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-25 01:41:45 +00:00

Setting that shows last milestone gained

Also fixed the screen width detection
This commit is contained in:
Harley White 2021-05-06 16:26:44 -04:00
parent 69dc926eb6
commit e6c03dbf4d
8 changed files with 57 additions and 40 deletions

View file

@ -4,6 +4,7 @@
- Optimizations, hopefully a significant amount. - Optimizations, hopefully a significant amount.
- Added OOM/s point gen display at high values (thanks to Ducdat!) - 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!) - 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. - Layer nodes will be highlighted even if the player is on the same tab.
- Added customizable node glowColor. - Added customizable node glowColor.
- Added buyable purchaseLimit. - Added buyable purchaseLimit.

View file

@ -409,7 +409,8 @@ var interval = setInterval(function() {
} }
tmp.scrolled = document.getElementById('treeTab') && document.getElementById('treeTab').scrollTop > 30 tmp.scrolled = document.getElementById('treeTab') && document.getElementById('treeTab').scrollTop > 30
updateTemp(); updateTemp();
updateOther(diff); updateOomps(diff);
updateWidth()
gameLoop(diff) gameLoop(diff)
fixNaNs() fixNaNs()
adjustPopupTime(0.05) adjustPopupTime(0.05)

View file

@ -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++;
}
}
}
}

View file

@ -155,7 +155,7 @@ var systemComponents = {
</tr> </tr>
<tr> <tr>
<td><button class="opt" onclick="switchTheme()">Theme: {{ getThemeName() }}</button></td> <td><button class="opt" onclick="switchTheme()">Theme: {{ getThemeName() }}</button></td>
<td><button class="opt" onclick="adjustMSDisp()">Show Milestones: {{ player.msDisplay.toUpperCase() }}</button></td> <td><button class="opt" onclick="adjustMSDisp()">Show Milestones: {{ MS_DISPLAYS[MS_SETTINGS.indexOf(player.msDisplay)]}}</button></td>
<td><button class="opt" onclick="toggleOpt('hqTree')">High-Quality Tree: {{ player.hqTree?"ON":"OFF" }}</button></td> <td><button class="opt" onclick="toggleOpt('hqTree')">High-Quality Tree: {{ player.hqTree?"ON":"OFF" }}</button></td>
</tr> </tr>
<tr> <tr>

View file

@ -41,6 +41,7 @@ function setupTemp() {
tmp.other = { tmp.other = {
screenWidth: window.innerWidth, screenWidth: window.innerWidth,
splitScreen: window.innerWidth >=1024,
lastPoints: player.points || new Decimal(0), lastPoints: player.points || new Decimal(0),
oomps: new Decimal(0), oomps: new Decimal(0),
} }
@ -213,39 +214,3 @@ 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,
}
}

View file

@ -297,6 +297,7 @@ function updateMilestones(layer) {
if (!(hasMilestone(layer, id)) && layers[layer].milestones[id].done()) { if (!(hasMilestone(layer, id)) && layers[layer].milestones[id].done()) {
player[layer].milestones.push(id) 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); 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
} }
} }
} }

View file

@ -26,9 +26,13 @@ function changeTreeQuality() {
function toggleAuto(toggle) { function toggleAuto(toggle) {
player[toggle[0]][toggle[1]] = !player[toggle[0]][toggle[1]]; 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() { function adjustMSDisp() {
let displays = ["always", "automation", "incomplete", "never"]; player.msDisplay = MS_SETTINGS[(MS_SETTINGS.indexOf(player.msDisplay) + 1) % 5];
player.msDisplay = displays[(displays.indexOf(player.msDisplay) + 1) % 4];
} }
function milestoneShown(layer, id) { function milestoneShown(layer, id) {
complete = player[layer].milestones.includes(id); complete = player[layer].milestones.includes(id);
@ -38,6 +42,9 @@ function milestoneShown(layer, id) {
case "always": case "always":
return true; return true;
break; break;
case "last":
return (auto) || !complete || player[layer].lastMilestone === id;
break;
case "automation": case "automation":
return (auto) || !complete; return (auto) || !complete;
break; break;

View file

@ -80,6 +80,7 @@ function getStartLayerData(layer) {
layerdata.spentOnBuyables = new Decimal(0); layerdata.spentOnBuyables = new Decimal(0);
layerdata.upgrades = []; layerdata.upgrades = [];
layerdata.milestones = []; layerdata.milestones = [];
layerdata.lastMilestone = null;
layerdata.achievements = []; layerdata.achievements = [];
layerdata.challenges = getStartChallenges(layer); layerdata.challenges = getStartChallenges(layer);
return layerdata; return layerdata;