1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 01:11:46 +00:00

Fix to auto upgrade issues

This commit is contained in:
Acamaeda 2020-11-30 22:36:54 -05:00
parent 0168e11f7f
commit f231eb097b
3 changed files with 9 additions and 8 deletions

View file

@ -15,6 +15,7 @@ addLayer("c", {
beep: false, beep: false,
}}, }},
color: "#4BDC13", color: "#4BDC13",
autoUpgrade: true,
requires: new Decimal(10), // Can be a function that takes requirement increases into account requires: new Decimal(10), // Can be a function that takes requirement increases into account
resource: "lollipops", // Name of prestige currency resource: "lollipops", // Name of prestige currency
baseResource: "candies", // Name of resource prestige is based on baseResource: "candies", // Name of resource prestige is based on

View file

@ -4,7 +4,7 @@ var gameEnded = false;
// Don't change this // Don't change this
const TMT_VERSION = { const TMT_VERSION = {
tmtNum: "2.2.7", tmtNum: "2.2.7.1",
tmtName: "Uprooted" tmtName: "Uprooted"
} }
@ -272,6 +272,12 @@ VERSION.withoutName = "v" + VERSION.num + (VERSION.pre ? " Pre-Release " + VERSI
VERSION.withName = VERSION.withoutName + (VERSION.name ? ": " + VERSION.name : "") 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) { function gameLoop(diff) {
if (isEndgame() || gameEnded) gameEnded = 1 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() { function hardReset() {
if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return
player = null player = null

View file

@ -544,6 +544,7 @@ function buyUpgrade(layer, id) {
} }
function buyUpg(layer, id) { function buyUpg(layer, id) {
if (!tmp[layer].upgrades || !tmp[layer].upgrades[id]) return
let upg = tmp[layer].upgrades[id] let upg = tmp[layer].upgrades[id]
if (!player[layer].unlocked) return if (!player[layer].unlocked) return
if (!tmp[layer].upgrades[id].unlocked) return if (!tmp[layer].upgrades[id].unlocked) return