1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 09:21:46 +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: # The Modding Tree changelog:
- Added fixOldSaves.
### v2.2.3 - 11/28/20 ### v2.2.3 - 11/28/20
- Layers will be highlighted if you can finish a challenge. - Layers will be highlighted if you can finish a challenge.
- The "can complete challenge" color now overrides the "already completed" color. - The "can complete challenge" color now overrides the "already completed" color.

View file

@ -52,4 +52,4 @@ function addedPlayerData() { return {
Less important things beyond this point! Less important things beyond this point!
- maxTickLength(): Returns the maximum tick length, in milliseconds. Only really useful if you have something that reduces over time, which long ticks mess up (usually a challenge). - maxTickLength(): Returns the maximum tick length, in milliseconds. Only really useful if you have something that reduces over time, which long ticks mess up (usually a challenge).

View file

@ -12,7 +12,7 @@ let modInfo = {
// Set your version in num and name // Set your version in num and name
let VERSION = { let VERSION = {
num: "2.2.2", num: "2.2.3",
name: "Uprooted", name: "Uprooted",
} }
@ -64,4 +64,9 @@ function isEndgame() {
// You can change this if you have things that can be messed up by long tick lengths // You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() { function maxTickLength() {
return(3600000) // Default is 1 hour which is just arbitrarily large 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) layers[lr].doReset(layer)
} }
else 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 var prevOnReset
function doReset(layer, force=false) { function doReset(layer, force=false) {
if (tmp[layer].type == "none") return
let row = tmp[layer].row let row = tmp[layer].row
if (!force) { if (!force) {
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return; if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return;
@ -282,10 +283,11 @@ function gameLoop(diff) {
} }
if (player.devSpeed) diff *= player.devSpeed if (player.devSpeed) diff *= player.devSpeed
let limit = maxTickLength() if (maxTickLength) {
if(diff > limit) let limit = maxTickLength()
diff = limit if(diff > limit)
diff = limit
}
addTime(diff) addTime(diff)
player.points = player.points.add(tmp.pointGen.times(diff)).max(0) player.points = player.points.add(tmp.pointGen.times(diff)).max(0)

View file

@ -59,4 +59,9 @@ function isEndgame() {
// You can change this if you have things that can be messed up by long tick lengths // You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() { function maxTickLength() {
return(3600000) // Default is 1 hour which is just arbitrarily large 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 = tempPlr;
player.versionType = modInfo.id player.versionType = modInfo.id
fixSave() fixSave()
versionCheck()
save() save()
window.location.reload() window.location.reload()
} catch(e) { } catch(e) {
@ -317,7 +318,10 @@ function versionCheck() {
} }
if (setVersion) { 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.versionType = getStartPlayer().versionType
player.version = VERSION.num player.version = VERSION.num
player.beta = VERSION.beta player.beta = VERSION.beta