From 23cbfc7a9e6b90148a67f23c553ebe46dfaac48e Mon Sep 17 00:00:00 2001 From: Harley White Date: Tue, 18 May 2021 18:36:17 -0400 Subject: [PATCH] Made text inputs never give NaNs --- changelog.md | 3 +++ js/Demo/demoMod.js | 2 +- js/game.js | 2 +- js/utils.js | 9 ++++++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 50f40d9..5fac80d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # The Modding Tree changelog: +### v2.5.9.1 - 5/18/21 +- Made text inputs never give NaNs. + ### v2.5.9 - 5/18/21 - Fixed issue when using text inputs for Numbers. - Added particle color feature. diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index a01db33..a691dee 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -11,7 +11,7 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.5.9", + num: "2.5.9.1", name: "Dreams Really Do Come True", } diff --git a/js/game.js b/js/game.js index 7918844..990c59c 100644 --- a/js/game.js +++ b/js/game.js @@ -5,7 +5,7 @@ var scrolled = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.5.9", + tmtNum: "2.5.9.1", tmtName: "Dreams Really Do Come True" } diff --git a/js/utils.js b/js/utils.js index d950d03..8473b43 100644 --- a/js/utils.js +++ b/js/utils.js @@ -334,10 +334,13 @@ document.title = modInfo.name // Converts a string value to whatever it's supposed to be function toValue(value, oldValue) { - if (oldValue instanceof Decimal) - return new Decimal (value) + if (oldValue instanceof Decimal) { + value = new Decimal (value) + if (value.eq(decimalNaN)) return decimalZero + return value + } if (!isNaN(oldValue)) - return parseFloat(value) + return parseFloat(value) || 0 return value }