diff --git a/src/components/system/SavesManager.vue b/src/components/system/SavesManager.vue index ffad7ba..e41cefd 100644 --- a/src/components/system/SavesManager.vue +++ b/src/components/system/SavesManager.vue @@ -3,7 +3,7 @@

Saves Manager

-
+
@@ -169,7 +169,7 @@ export default { this.importingFailed = false; } }, - onUpdate(e) { + update(e) { this.saves.splice(e.newIndex, 0, this.saves.splive(e.oldIndex, 1)[0]); const modData = JSON.parse(decodeURIComponent(escape(atob(localStorage.getItem(modInfo.id))))); diff --git a/src/components/tree/TreeNode.vue b/src/components/tree/TreeNode.vue index 3302a2f..b4820ff 100644 --- a/src/components/tree/TreeNode.vue +++ b/src/components/tree/TreeNode.vue @@ -89,8 +89,8 @@ export default { clickTab(e) { if (e.shiftKey) { player[this.id].forceTooltip = !player[this.id].forceTooltip; - } else if (this.layer.onClick != undefined) { - this.layer.onClick(); + } else if (this.layer.click != undefined) { + this.layer.click(); } else if (this.layer.modal) { this.$emit('show-modal', this.id); } else if (this.append) { diff --git a/src/data/layers/aca/a.js b/src/data/layers/aca/a.js index 533649f..d0803b0 100644 --- a/src/data/layers/aca/a.js +++ b/src/data/layers/aca/a.js @@ -56,7 +56,7 @@ export default { getStyle(cell, data) { return {'background-color': '#'+ (data*1234%999999)} }, - onClick() { // Don't forget onHold + click() { // Don't forget onHold this.data++ }, getTitle(cell) { diff --git a/src/data/layers/aca/c.js b/src/data/layers/aca/c.js index c14cceb..48fd26c 100644 --- a/src/data/layers/aca/c.js +++ b/src/data/layers/aca/c.js @@ -222,8 +222,8 @@ export default { }, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends. hotkeys: [ - {key: "c", description: "reset for lollipops or whatever", onPress(){if (layers[this.layer].canReset) resetLayer(this.layer)}}, - {key: "ctrl+c", description: "respec things", onPress(){layers[this.layer].buyables.respec()}, unlocked() {return hasUpgrade('c', '22')}} , + {key: "c", description: "reset for lollipops or whatever", press(){if (layers[this.layer].canReset) resetLayer(this.layer)}}, + {key: "ctrl+c", description: "respec things", press(){layers[this.layer].buyables.respec()}, unlocked() {return hasUpgrade('c', '22')}} , ], increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked diff --git a/src/data/layers/aca/f.js b/src/data/layers/aca/f.js index 99c801d..6e9ad54 100644 --- a/src/data/layers/aca/f.js +++ b/src/data/layers/aca/f.js @@ -84,7 +84,7 @@ export default { break; } }, - onHold(){ + hold(){ console.log("Clickkkkk...") }, style() { diff --git a/src/data/layers/demo-infinity.js b/src/data/layers/demo-infinity.js index ea1b571..d8c958d 100644 --- a/src/data/layers/demo-infinity.js +++ b/src/data/layers/demo-infinity.js @@ -32,7 +32,7 @@ export default { prestigeButtonText(){return "Reset everything for +"+format(layers.i.getResetGain)+" Infinity.
You need "+format(layers.i.requires())+" pointy points to reset."}, row: 1, // Row the layer is in on the tree (0 is the first row) hotkeys: [ - {key: "i", description: "I: Infinity", onPress(){if (layers.i.canReset) resetLayer(this.layer)}}, + {key: "i", description: "I: Infinity", press(){if (layers.i.canReset) resetLayer(this.layer)}}, ], layerShown(){return player[this.layer].unlocked||new Decimal(player.p.buyables[21]).gte(8)}, milestones: { diff --git a/src/data/layers/demo.js b/src/data/layers/demo.js index 75a1eb7..a3d3123 100644 --- a/src/data/layers/demo.js +++ b/src/data/layers/demo.js @@ -47,7 +47,7 @@ export default { }, row: 0, // Row the layer is in on the tree (0 is the first row) hotkeys: [ - {key: "p", description: "P: Reset for prestige points", onPress(){if (layers.p.canReset) resetLayer(this.layer)}}, + {key: "p", description: "P: Reset for prestige points", press(){if (layers.p.canReset) resetLayer(this.layer)}}, ], layerShown(){return true}, upgrades:{ @@ -503,7 +503,7 @@ export default { display() {return "Multiply generator efficiency by "+format(player.p.cmult)+((player.p.cmult.min(100).eq(100)&&!hasUpgrade(this.layer,111))?" (hardcapped)":"")}, unlocked(){return hasUpgrade("p",94)}, - onClick(){player.p.cmult=player.p.cmult.plus(hasUpgrade("p",141)?1:0.01) + click(){player.p.cmult=player.p.cmult.plus(hasUpgrade("p",141)?1:0.01) if (!hasUpgrade(this.layer,111))player.p.cmult=player.p.cmult.min(100) }, canClick(){return player.p.cmult.lt(100)||hasUpgrade(this.layer,111)}, diff --git a/src/data/mod.js b/src/data/mod.js index 8f87448..1d6d662 100644 --- a/src/data/mod.js +++ b/src/data/mod.js @@ -16,7 +16,7 @@ const g = { shown: true, canClick() {return player.points.gte(10)}, tooltip: "Thanos your points", - onClick() { + click() { player.points = player.points.div(2); console.log(this.layer); } @@ -27,7 +27,7 @@ const h = { tooltip() {return "Restore your points to {{ player.c.otherThingy }}"}, row: "side", canClick() {return player.points.lt(player.c.otherThingy)}, - onClick() {player.points = new Decimal(player.c.otherThingy)} + click() {player.points = new Decimal(player.c.otherThingy)} }; const spook = { id: "spook", diff --git a/src/store/layers.js b/src/store/layers.js index b8fd177..4523b7b 100644 --- a/src/store/layers.js +++ b/src/store/layers.js @@ -292,8 +292,8 @@ 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; + if (layer.clickables[id].hold != undefined) { + layer.clickables[id].hold.forceCached = false; } } } @@ -361,11 +361,11 @@ export function addLayer(layer, player = null) { 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].click != undefined) { + layer.grids[id].click.forceCached = false; } - if (layer.grids[id].onHold != undefined) { - layer.grids[id].onHold.forceCached = false; + if (layer.grids[id].hold != undefined) { + layer.grids[id].hold.forceCached = false; } if (layer.grids[id].getTitle != undefined) { layer.grids[id].getTitle.forceCached = false; @@ -446,8 +446,8 @@ export function addLayer(layer, player = null) { if (layer.hotkeys) { for (let id in layer.hotkeys) { if (isPlainObject(layer.hotkeys[id])) { - if (layer.hotkeys[id].onPress) { - layer.hotkeys[id].onPress.forceCached = false; + if (layer.hotkeys[id].press) { + layer.hotkeys[id].press.forceCached = false; } if (layer.hotkeys[id].unlocked == undefined) { layer.hotkeys[id].unlocked = function() { @@ -492,7 +492,7 @@ export function reloadLayer(layer) { addLayer(layer); } -const uncachedProperties = [ 'startData', 'onClick', 'update', 'reset', 'hardReset' ]; +const uncachedProperties = [ 'startData', 'click', 'update', 'reset', 'hardReset' ]; const gridProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables' ]; const featureProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables', 'milestones', 'bars', 'infoboxes', 'grids', 'hotkeys', 'subtabs' ]; diff --git a/src/store/proxies.js b/src/store/proxies.js index 15e978b..1e79d85 100644 --- a/src/store/proxies.js +++ b/src/store/proxies.js @@ -186,11 +186,11 @@ function getCellHandler(id) { } let prop = target[key]; - if (prop != undefined) { - return prop; - } - if (key.slice == undefined) { + if (isFunction(prop) && prop.forceCached === false) { + return () => prop.call(receiver, id, target.getData(id)); + } + if (prop != undefined || key.slice == undefined) { return prop; } diff --git a/src/util/layers.js b/src/util/layers.js index f94fca2..d3e0c1b 100644 --- a/src/util/layers.js +++ b/src/util/layers.js @@ -307,7 +307,7 @@ document.onkeydown = function(e) { if (hotkeys[key]) { e.preventDefault(); if (hotkeys[key].unlocked) { - hotkeys[key].onPress?.(); + hotkeys[key].press?.(); } } }