1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00

Added fixOldSave and work on reset logic for side layers

This commit is contained in:
Acamaeda 2020-11-28 20:10:13 -05:00
parent a50326a430
commit 03cd7f11da
6 changed files with 26 additions and 8 deletions

View file

@ -1,5 +1,7 @@
# The Modding Tree changelog:
- Added fixOldSaves.
### v2.2.3 - 11/28/20
- Layers will be highlighted if you can finish a challenge.
- The "can complete challenge" color now overrides the "already completed" color.

View file

@ -12,7 +12,7 @@ let modInfo = {
// Set your version in num and name
let VERSION = {
num: "2.2.2",
num: "2.2.3",
name: "Uprooted",
}
@ -65,3 +65,8 @@ function isEndgame() {
function maxTickLength() {
return(3600000) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,
// you can cap their current resources with this.
function fixOldSave(oldVersion){
}

View file

@ -99,7 +99,7 @@ function rowReset(row, layer) {
layers[lr].doReset(layer)
}
else
if(tmp[layer].row > tmp[lr].row && row !== "side") layerDataReset(lr)
if(tmp[layer].row > tmp[lr].row && row !== "side" && !isNaN(row)) layerDataReset(lr)
}
}
@ -144,6 +144,7 @@ function generatePoints(layer, diff) {
var prevOnReset
function doReset(layer, force=false) {
if (tmp[layer].type == "none") return
let row = tmp[layer].row
if (!force) {
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return;
@ -282,10 +283,11 @@ function gameLoop(diff) {
}
if (player.devSpeed) diff *= player.devSpeed
let limit = maxTickLength()
if(diff > limit)
diff = limit
if (maxTickLength) {
let limit = maxTickLength()
if(diff > limit)
diff = limit
}
addTime(diff)
player.points = player.points.add(tmp.pointGen.times(diff)).max(0)

View file

@ -60,3 +60,8 @@ function isEndgame() {
function maxTickLength() {
return(3600000) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,
// you can cap their current resources with this.
function fixOldSave(oldVersion){
}

View file

@ -301,6 +301,7 @@ function importSave(imported=undefined, forced=false) {
player = tempPlr;
player.versionType = modInfo.id
fixSave()
versionCheck()
save()
window.location.reload()
} catch(e) {
@ -317,7 +318,10 @@ function versionCheck() {
}
if (setVersion) {
if (player.versionType == modInfo.id && VERSION.num > player.version) player.keepGoing = false
if (player.versionType == modInfo.id && VERSION.num > player.version) {
player.keepGoing = false
if (fixOldSave) fixOldSave(player.version)
}
player.versionType = getStartPlayer().versionType
player.version = VERSION.num
player.beta = VERSION.beta