This commit is contained in:
thepaperpilot 2021-07-02 08:16:29 -05:00
parent 3772f65919
commit 3671a072a1
7 changed files with 19 additions and 11 deletions

View file

@ -44,7 +44,7 @@
</div>
<br>
<div>Time Played: {{ timePlayed }}</div>
<div v-if="hotkeys.length > 0">
<div v-if="hotkeys">
<br>
<h4>Hotkeys</h4>
<div v-for="key in hotkeys" :key="key.key">
@ -75,8 +75,12 @@ export default {
return formatTime(this.$store.state.timePlayed);
},
hotkeys() {
// TODO check layer is unlocked and hotkey is unlocked
return hotkeys.filter(hotkey => hotkey || true);
return Object.keys(hotkeys).reduce((acc, curr) => {
if (hotkeys[curr].unlocked !== false) {
acc[curr] = hotkeys[curr];
}
return acc;
}, {});
}
}
};

View file

@ -40,7 +40,7 @@ export default {
if (this.nodes != undefined) {
return this.nodes;
}
return Object.keys(layers).reduce((acc, curr) => {
const rows = Object.keys(layers).reduce((acc, curr) => {
if (!(layers[curr].displayRow in acc)) {
acc[layers[curr].displayRow] = [];
}
@ -51,6 +51,10 @@ export default {
}
return acc;
}, []);
return Object.keys(rows).reduce((acc, curr) => {
acc[curr] = rows[curr].filter(layer => layer);
return acc;
}, []);
}
},
methods: {

View file

@ -56,8 +56,8 @@ export default {
},
masterButtonDisplay() {return (getClickableState(this.layer, 11) == "Borkened...") ? "Fix the clickable!" : "Does nothing"}, // Text on Respec button, optional
11: {
titleDisplay: "Clicky clicky!", // Optional, displayed at the top in a larger font
descriptionDisplay() { // Everything else displayed in the buyable button after the title
title: "Clicky clicky!", // Optional, displayed at the top in a larger font
display() { // Everything else displayed in the buyable button after the title
let data = getClickableState(this.layer, this.id)
return "Current state:<br>" + data
},

View file

@ -6,7 +6,7 @@ import { resetLayer } from '../../util/layers';
export default {
id: "i",
position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
position: 2, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
startData() { return {
unlocked: false,
points: new Decimal(0),
@ -31,7 +31,6 @@ export default {
canReset(){return player.p.buyables[21].gte(layers.i.requires)},
prestigeButtonDisplay(){return "Reset everything for +"+format(layers.i.resetGain)+" Infinity.<br>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)
displayRow: 3,
hotkeys: [
{key: "i", description: "I: Infinity", press(){if (layers.i.canReset) resetLayer(this.layer)}},
],

View file

@ -6,7 +6,7 @@ import { resetLayer } from '../../util/layers';
export default {
id: "p",
position: 0,
position: 2,
startData() { return {
unlocked: true,
points: new Decimal(0),
@ -46,7 +46,6 @@ export default {
return new Decimal(1)
},
row: 0, // Row the layer is in on the tree (0 is the first row)
displayRow: 2,
hotkeys: [
{key: "p", description: "P: Reset for prestige points", press(){if (layers.p.canReset) resetLayer(this.layer)}},
],

View file

@ -28,6 +28,7 @@ const h = {
branches: ["g", () => ({ target: 'flatBoi', featureType: 'bar', endOffset: { x: -50 + 100 * layers.c.bars.flatBoi.progress.toNumber() } })],
tooltip() {return "Restore your points to {{ player.c.otherThingy }}"},
row: "side",
position: 3,
canClick() {return player.points.lt(player.c.otherThingy)},
click() {player.points = new Decimal(player.c.otherThingy)}
};

View file

@ -72,6 +72,7 @@ export function resetLayerData(layer, keep = []) {
}
export function resetRow(row, ignore) {
console.log(row, ignore);
Object.values(layers).filter(layer => layer.row === row && layer.layer !== ignore).forEach(layer => layer.hardReset());
}
@ -277,7 +278,7 @@ export const defaultLayerProperties = {
player.points = new Decimal(0);
for (let row = this.row; row >= 0; row--) {
for (let row = this.row - 1; row >= 0; row--) {
resetRow(row, this.layer);
}
resetRow('side', this.layer);