diff --git a/docs/layer-features.md b/docs/layer-features.md
index 39e5b34..1951c8c 100644
--- a/docs/layer-features.md
+++ b/docs/layer-features.md
@@ -131,11 +131,6 @@ Key:
Without it, the default is to reset everything on the row, but only
if it was triggered by a layer in a higher row.
-- convertToDecimal(): **sometimes required**, required if you add non-standard Decimals to startData.
- This function converts those values from a string to a Decimal (used when loading).
- Convert a value to Decimal with `value = new Decimal(value)`
-
-
- update(diff): **optional**, this function is called every game tick. Use it for any passive resource production or
time-based things. diff is the time since the last tick.
Suggestion: use addPoints(layer, gain) when generating points to automatically
diff --git a/index.html b/index.html
index 86fcf48..da1e46c 100644
--- a/index.html
+++ b/index.html
@@ -49,6 +49,15 @@
+
v1.3.5
+
+
The system now handles convertToDecimal for everything automatically!
+
+
v1.3.4
+
+
Added "midsection" feature to add things to a tab's layout while still keeping the standard layout.
+
Fix for being able to buy more buyables than you should.
+
v1.3.3
Fix for the "order of operations" issue in temp.
diff --git a/js/game.js b/js/game.js
index e34d7da..d6d1225 100644
--- a/js/game.js
+++ b/js/game.js
@@ -5,7 +5,7 @@ var NaNalert = false;
var gameEnded = false;
let VERSION = {
- num: "1.3.4",
+ num: "1.3.5 maybe",
name: "Tabception... ception!"
}
@@ -35,24 +35,6 @@ function inChallenge(layer, id){
return layers[layer].challs[id].countsAs.includes(id)
}
-function convertToDecimal() {
- player.points = new Decimal(player.points)
- for (layer in layers) {
- player[layer].points = new Decimal(player[layer].points)
- if (player[layer].best != undefined) player[layer].best = new Decimal(player[layer].best)
- if (player[layer].total !== undefined) player[layer].total = new Decimal(player[layer].total)
- player[layer].spentOnBuyables = new Decimal(player[layer].spentOnBuyables)
-
- if (player[layer].buyables != undefined) {
- for (id in player[layer].buyables)
- player[layer].buyables[id] = new Decimal(player[layer].buyables[id])
- }
- player[layer].best = new Decimal(player[layer].best)
-
- if (layers[layer].convertToDecimal) layers[layer].convertToDecimal();
- }
-}
-
function getResetGain(layer, useType = null) {
let type = useType
if (!useType) type = layers[layer].type
diff --git a/js/layers.js b/js/layers.js
index 52be58a..2bfb434 100644
--- a/js/layers.js
+++ b/js/layers.js
@@ -167,9 +167,6 @@ addLayer("c", {
doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row.
if(layers[resettingLayer].row > this.row) fullLayerReset(this.layer) // This is actually the default behavior
},
- convertToDecimal() {
- // Convert any layer-specific Decimal values (besides points, total, and best) from String to Decimal (used when loading save)
- },
layerShown() {return true}, // Condition for when layer appears on the tree
update(diff) {
if (player[this.layer].upgrades.includes(11)) player.points = player.points.add(tmp.pointGen.times(diff)).max(0)
diff --git a/js/utils.js b/js/utils.js
index 73c460b..05f899b 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -107,6 +107,48 @@ function getStartPlayer() {
}
function fixSave() {
+ defaultData = getStartPlayer()
+ fixData(defaultData, player)
+
+ for(layer in layers)
+ {
+ if (player[layer].best !== undefined) player[layer].best = new Decimal (player[layer].best)
+ if (player[layer].total !== undefined) player[layer].total = new Decimal (player[layer].total)
+ }
+}
+
+function fixData(defaultData, newData) {
+ for (item in defaultData){
+ if (defaultData[item] == null) {
+ if (newData[item] === undefined)
+ newData[item] = null
+ }
+ else if (Array.isArray(defaultData[item])) {
+ if (newData[item] === undefined)
+ newData[item] = defaultData[item]
+ else
+ fixData(defaultData[item], newData[item])
+ }
+ else if (defaultData[item] instanceof Decimal) { // Convert to Decimal
+ if (newData[item] === undefined)
+ newData[item] = defaultData[item]
+ else
+ newData[item] = new Decimal(newData[item])
+ }
+ else if ((!!defaultData[item]) && (defaultData[item].constructor === Object)) {
+ if (newData[item] === undefined)
+ newData[item] = defaultData[item]
+ else
+ fixData(defaultData[item], newData[item])
+ }
+ else {
+ if (newData[item] === undefined)
+ newData[item] = defaultData[item]
+ }
+ }
+}
+
+function hecj() {
defaultData = startPlayerBase()
for (datum in defaultData){
if (player[datum] == undefined){
@@ -154,6 +196,8 @@ function fixSave() {
}
}
+
+
function load() {
let get = localStorage.getItem(modInfo.id);
if (get===null || get===undefined) player = getStartPlayer()
@@ -166,7 +210,6 @@ function load() {
player.offTime.remain += (Date.now() - player.time) / 1000
}
player.time = Date.now();
- convertToDecimal();
versionCheck();
changeTheme();
changeTreeQuality();