1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 08:12:39 +00:00

Various fixes

This commit is contained in:
Harley White 2021-06-17 11:51:40 -04:00
parent fba4bbf5e7
commit a1d11ccf2b
4 changed files with 19 additions and 22 deletions

View file

@ -1,8 +1,13 @@
# The Modding Tree changelog:
# v2.6.4 - 6/17/21
- The game now autosaves before closing, if autosave is on. (Thank you to thepaperpilot for this!)
- More Anti-NaN safety.
- canReset now works properly for non-custom layers.
- Fixed baseAmount being set to 0 even when a layer resets nothing.
- Fixed centering on tooltips.
- Changed some default values on startup to prevent potential issues.
- Cleaned up resetting.
# v2.6.3 - 6/11/21
- Added better support for using multiple layer files and similar. See modFiles in modInfo.

View file

@ -13,7 +13,7 @@ let modInfo = {
// Set your version in num and name
let VERSION = {
num: "2.6.3",
num: "2.6.4",
name: "Fixed Reality",
}

View file

@ -4,7 +4,7 @@ var gameEnded = false;
// Don't change this
const TMT_VERSION = {
tmtNum: "2.6.3",
tmtNum: "2.6.4",
tmtName: "Fixed Reality"
}
@ -145,29 +145,14 @@ function layerDataReset(layer, keep = []) {
if (player[layer][keep[thing]] !== undefined)
storedData[keep[thing]] = player[layer][keep[thing]]
}
Vue.set(player[layer], "buyables", getStartBuyables(layer))
Vue.set(player[layer], "clickables", getStartClickables(layer))
Vue.set(player[layer], "challenges", getStartChallenges(layer))
layOver(player[layer], getStartLayerData(layer))
player[layer].upgrades = []
player[layer].milestones = []
player[layer].achievements = []
player[layer].challenges = getStartChallenges(layer)
resetBuyables(layer)
if (layers[layer].clickables && !player[layer].clickables)
player[layer].clickables = getStartClickables(layer)
for (thing in storedData) {
player[layer][thing] =storedData[thing]
}
}
function resetBuyables(layer){
if (layers[layer].buyables)
player[layer].buyables = getStartBuyables(layer)
player[layer].spentOnBuyables = decimalZero
}
function addPoints(layer, gain) {
@ -184,15 +169,16 @@ function doReset(layer, force=false) {
if (tmp[layer].type == "none") return
let row = tmp[layer].row
if (!force) {
if (tmp[layer].canReset === false) return;
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return;
let gain = tmp[layer].resetGain
if (tmp[layer].type=="static") {
if (tmp[layer].baseAmount.lt(tmp[layer].nextAt)) return;
gain =(tmp[layer].canBuyMax ? gain : 1)
}
if (tmp[layer].type=="custom") {
if (!tmp[layer].canReset) return;
}
if (layers[layer].onPrestige)
run(layers[layer].onPrestige, layers[layer], gain)

View file

@ -243,13 +243,13 @@ function NaNcheck(data) {
}
else if (data[item] !== data[item] || checkDecimalNaN(data[item])) {
if (!NaNalert) {
confirm("Invalid value found in player, named '" + item + "'. Please let the creator of this mod know! You can refresh the page, and you will be un-NaNed.")
clearInterval(interval);
NaNalert = true;
alert("Invalid value found in player, named '" + item + "'. Please let the creator of this mod know! You can refresh the page, and you will be un-NaNed.")
return
}
}
else if (data[item] instanceof Decimal) { // Convert to Decimal
else if (data[item] instanceof Decimal) {
}
else if ((!!data[item]) && (data[item].constructor === Object)) {
NaNcheck(data[item]);
@ -313,3 +313,9 @@ var saveInterval = setInterval(function () {
if (options.autosave)
save();
}, 5000);
window.onbeforeunload = () => {
if (player.autosave) {
save();
}
};