From 380da5069e83321c9e9dd7604512d074b3c30f22 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 27 Jun 2021 13:22:07 -0500 Subject: [PATCH] Fixed issues with debugging vue Particularly when switching saves --- src/components/system/LayerTab.vue | 3 -- src/store/layers.js | 50 +++++++++++++++++++++++++++--- src/store/proxies.js | 5 ++- 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/components/system/LayerTab.vue b/src/components/system/LayerTab.vue index 6800a8a..6c84a24 100644 --- a/src/components/system/LayerTab.vue +++ b/src/components/system/LayerTab.vue @@ -136,9 +136,6 @@ export default { }, methods: { selectSubtab(subtab) { - if (player.subtabs[this.layer] == undefined) { - player.subtabs[this.layer] = {}; - } player.subtabs[this.layer].mainTabs = subtab; }, toggleMinimized() { diff --git a/src/store/layers.js b/src/store/layers.js index 486bd94..b8fd177 100644 --- a/src/store/layers.js +++ b/src/store/layers.js @@ -145,6 +145,9 @@ export function addLayer(layer, player = null) { layer.achievements[id].earned = function() { return !layer.deactivated && player[layer.id].achievements.some(achievement => achievement == id); } + if (layer.achievements[id].onComplete != undefined) { + layer.achievements[id].onComplete.forceCached = false; + } } } } @@ -289,8 +292,12 @@ export function addLayer(layer, player = null) { if (layer.clickables[id].click != undefined) { layer.clickables[id].click.forceCached = false; } + if (layer.clickables[id].onHold != undefined) { + layer.clickables[id].onHold.forceCached = false; + } } } + layer.clickables.layer = layer.id; if (layer.clickables.masterButtonClick != undefined) { layer.clickables.masterButtonClick.forceCached = false; } @@ -338,12 +345,33 @@ export function addLayer(layer, player = null) { } if (layer.grids[id].getUnlocked == undefined) { layer.grids[id].getUnlocked = true; + } else { + layer.grids[id].getUnlocked.forceCached = false; } if (layer.grids[id].getCanClick == undefined) { layer.grids[id].getCanClick = true; + } else { + layer.grids[id].getCanClick.forceCached = false; } if (layer.grids[id].getStartData == undefined) { layer.grids[id].getStartData = ""; + } else { + layer.grids[id].getStartData.forceCached = false; + } + if (layer.grids[id].getStyle != undefined) { + layer.grids[id].getStyle.forceCached = false; + } + if (layer.grids[id].onClick != undefined) { + layer.grids[id].onClick.forceCached = false; + } + if (layer.grids[id].onHold != undefined) { + layer.grids[id].onHold.forceCached = false; + } + if (layer.grids[id].getTitle != undefined) { + layer.grids[id].getTitle.forceCached = false; + } + if (layer.grids[id].getDisplay != undefined) { + layer.grids[id].getDisplay.forceCached = false; } layer.grids[id].getData = function(cell) { if (player[layer.id].grids[id][cell] != undefined) { @@ -362,16 +390,22 @@ export function addLayer(layer, player = null) { } } if (layer.subtabs) { + if (player.subtabs[layer.id] == undefined) { + player.subtabs[layer.id] = {}; + } + if (player.subtabs[layer.id].mainTabs == undefined) { + player.subtabs[layer.id].mainTabs = Object.keys(layer.subtabs)[0]; + } for (let id in layer.subtabs) { if (isPlainObject(layer.subtabs[id])) { layer.subtabs[id].active = function() { - return player.subtabs[this.layer]?.mainTabs === this.id; + return player.subtabs[this.layer].mainTabs === this.id; } } } layer.activeSubtab = function() { if (this.subtabs != undefined) { - if (this.subtabs[player.subtabs[layer.id]?.mainTabs] && + if (this.subtabs[player.subtabs[layer.id].mainTabs] && this.subtabs[player.subtabs[layer.id].mainTabs].unlocked !== false) { return this.subtabs[player.subtabs[layer.id].mainTabs]; } @@ -381,7 +415,13 @@ export function addLayer(layer, player = null) { } } if (layer.microtabs) { + if (player.subtabs[layer.id] == undefined) { + player.subtabs[layer.id] = {}; + } for (let family in layer.microtabs) { + if (player.subtabs[layer.id][family] == undefined) { + player.subtabs[layer.id][family] = Object.keys(layer.microtabs[family])[0]; + } for (let id in layer.microtabs[family]) { if (isPlainObject(layer.microtabs[family][id])) { layer.microtabs[family][id].layer = layer.id; @@ -392,9 +432,11 @@ export function addLayer(layer, player = null) { } } } + layer.microtabs[family].layer = layer.id; + layer.microtabs[family].family = family; layer.microtabs[family].activeMicrotab = function() { - if (this[player.subtabs[layer.id][family]] && this[player.subtabs[layer.id][family]].unlocked !== false) { - return this[player.subtabs[layer.id][family]]; + if (this[player.subtabs[this.layer]?.[family]] && this[player.subtabs[this.layer][family]].unlocked !== false) { + return this[player.subtabs[this.layer][family]]; } // Default to first unlocked tab return this[Object.keys(this).find(microtab => microtab !== 'activeMicrotab' && this[microtab].unlocked !== false)]; diff --git a/src/store/proxies.js b/src/store/proxies.js index 4137ae1..15e978b 100644 --- a/src/store/proxies.js +++ b/src/store/proxies.js @@ -143,7 +143,7 @@ function getHandler(prefix) { function getGridHandler(prefix) { return { - get(target, key, receiver) { + get(target, key) { if (key === 'isProxy') { return true; } @@ -159,9 +159,8 @@ function getGridHandler(prefix) { const getterID = `${prefix}${key}`; if (getterID in store.getters) { return store.getters[getterID]; - } else { - return target[key].bind(receiver); } + // Non-cached functions are going to be cell-specific, so don't call them with the grid handler } if (typeof key !== 'symbol' && !isNaN(key)) { target[key] = new Proxy(target, getCellHandler(key));