mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-30 20:02:07 +00:00
Pre-Release 3 Patch 2
This commit is contained in:
parent
3ed99e5dff
commit
7ac6bf8cd4
1 changed files with 8 additions and 3 deletions
11
js/game.js
11
js/game.js
|
@ -3851,6 +3851,12 @@ function keepGoing() {
|
||||||
showTab("tree")
|
showTab("tree")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toNumber(x) {
|
||||||
|
if (x.mag !== undefined) return x.toNumber()
|
||||||
|
if (x + 0 !== x) return parseFloat(x)
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
function addTime(diff, layer) {
|
function addTime(diff, layer) {
|
||||||
let data = player
|
let data = player
|
||||||
let time = data.timePlayed
|
let time = data.timePlayed
|
||||||
|
@ -3862,15 +3868,14 @@ function addTime(diff, layer) {
|
||||||
//I am not that good to perfectly fix that leak. ~ DB Aarex
|
//I am not that good to perfectly fix that leak. ~ DB Aarex
|
||||||
if (time + 0 !== time) {
|
if (time + 0 !== time) {
|
||||||
console.log("Memory leak detected. Trying to fix...")
|
console.log("Memory leak detected. Trying to fix...")
|
||||||
if (time.mag !== undefined) time = time.toNumber()
|
time = toNumber(time)
|
||||||
else time = parseFloat(time)
|
|
||||||
if (isNaN(time) || time == 0) {
|
if (isNaN(time) || time == 0) {
|
||||||
console.log("Couldn't fix! Resetting...")
|
console.log("Couldn't fix! Resetting...")
|
||||||
time = layer ? player.timePlayed : 0
|
time = layer ? player.timePlayed : 0
|
||||||
if (!layer) player.timePlayedReset = true
|
if (!layer) player.timePlayedReset = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
time += diff
|
time += toNumber(diff)
|
||||||
|
|
||||||
if (layer) data.time = time
|
if (layer) data.time = time
|
||||||
else data.timePlayed = time
|
else data.timePlayed = time
|
||||||
|
|
Loading…
Reference in a new issue