mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-23 17:01:47 +00:00
Fix to auto upgrade issues
This commit is contained in:
parent
0168e11f7f
commit
f231eb097b
3 changed files with 9 additions and 8 deletions
|
@ -15,6 +15,7 @@ addLayer("c", {
|
|||
beep: false,
|
||||
}},
|
||||
color: "#4BDC13",
|
||||
autoUpgrade: true,
|
||||
requires: new Decimal(10), // Can be a function that takes requirement increases into account
|
||||
resource: "lollipops", // Name of prestige currency
|
||||
baseResource: "candies", // Name of resource prestige is based on
|
||||
|
|
15
js/game.js
15
js/game.js
|
@ -4,7 +4,7 @@ var gameEnded = false;
|
|||
|
||||
// Don't change this
|
||||
const TMT_VERSION = {
|
||||
tmtNum: "2.2.7",
|
||||
tmtNum: "2.2.7.1",
|
||||
tmtName: "Uprooted"
|
||||
}
|
||||
|
||||
|
@ -272,6 +272,12 @@ VERSION.withoutName = "v" + VERSION.num + (VERSION.pre ? " Pre-Release " + VERSI
|
|||
VERSION.withName = VERSION.withoutName + (VERSION.name ? ": " + VERSION.name : "")
|
||||
|
||||
|
||||
function autobuyUpgrades(layer){
|
||||
if (!tmp[layer].upgrades) return
|
||||
for (id in tmp[layer].upgrades)
|
||||
if (isPlainObject(tmp[layers].upgrades[id]) && (layers[layer].upgrades[id].canAfford === undefined || layers[layer].upgrades[id].canAfford() === true))
|
||||
buyUpg(layer, id)
|
||||
}
|
||||
|
||||
function gameLoop(diff) {
|
||||
if (isEndgame() || gameEnded) gameEnded = 1
|
||||
|
@ -332,13 +338,6 @@ function gameLoop(diff) {
|
|||
|
||||
}
|
||||
|
||||
function autobuyUpgrades(layer){
|
||||
if (!tmp[layer].upgrades) return
|
||||
for (id in tmp[layer].upgrades)
|
||||
if (layers[layer].canAfford === undefined || layers[layer].canAfford() === true)
|
||||
buyUpg(layer, id)
|
||||
}
|
||||
|
||||
function hardReset() {
|
||||
if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return
|
||||
player = null
|
||||
|
|
|
@ -544,6 +544,7 @@ function buyUpgrade(layer, id) {
|
|||
}
|
||||
|
||||
function buyUpg(layer, id) {
|
||||
if (!tmp[layer].upgrades || !tmp[layer].upgrades[id]) return
|
||||
let upg = tmp[layer].upgrades[id]
|
||||
if (!player[layer].unlocked) return
|
||||
if (!tmp[layer].upgrades[id].unlocked) return
|
||||
|
|
Loading…
Reference in a new issue