mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-21 16:13:55 +00:00
Added unlocking hotkeys
This commit is contained in:
parent
b003027098
commit
c8bc53ca50
4 changed files with 9 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
|||
- Completely reworked tooltips. Shift-click a node to force its tooltip to stay displayed. (And hopefully finally fixed flickering!)
|
||||
- Added text-input and slider components.
|
||||
- The red layer highlight will not appear before a layer is unlocked.
|
||||
- Added unlocking hotkeys.
|
||||
- Node symbols can use HTML.
|
||||
|
||||
# v2.π.1 - 4/7/21
|
||||
|
|
|
@ -46,7 +46,8 @@ You can make almost any value dynamic by using a function in its place, includin
|
|||
{
|
||||
key: "p", // What the hotkey button is. Use uppercase if it's combined with shift, or "ctrl+x" for holding down ctrl.
|
||||
description: "p: reset your points for prestige points", // The description of the hotkey that is displayed in the game's How To Play tab
|
||||
onPress() { if (player.p.unlocked) doReset("p") }
|
||||
onPress() { if (player.p.unlocked) doReset("p") },
|
||||
unlocked() {return hasMilestone('p', 3)} // Determines if you can use the hotkey, optional
|
||||
}
|
||||
]
|
||||
```
|
||||
|
|
|
@ -212,8 +212,8 @@ addLayer("c", {
|
|||
}, // 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: "C: reset for lollipops or whatever", onPress(){if (canReset(this.layer)) doReset(this.layer)}, unlocked() {return player.points.gte(10)}},
|
||||
{key: "ctrl+c", description: "Ctrl+c: respec things", onPress(){if (player[this.layer].unlocked) respecBuyables(this.layer)}},
|
||||
{key: "c", description: "C: reset for lollipops or whatever", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
|
||||
{key: "ctrl+c", description: "Ctrl+c: respec things", onPress(){respecBuyables(this.layer)}, unlocked() {return hasUpgrade('c', '22')}} ,
|
||||
],
|
||||
increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked
|
||||
|
||||
|
|
|
@ -329,8 +329,10 @@ document.onkeydown = function (e) {
|
|||
if (onFocused) return
|
||||
if (ctrlDown && hotkeys[key]) e.preventDefault()
|
||||
if (hotkeys[key]) {
|
||||
if (player[hotkeys[key].layer].unlocked)
|
||||
hotkeys[key].onPress()
|
||||
let k = hotkeys[key]
|
||||
console.log(tmp[k.layer].hotkeys)
|
||||
if (player[k.layer].unlocked && tmp[k.layer].hotkeys[k.id].unlocked)
|
||||
k.onPress()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue