mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-04-24 10:11:05 +00:00
canAfford and cost can work together
This commit is contained in:
parent
4bc8b7712a
commit
93b0fee963
4 changed files with 13 additions and 7 deletions
js
|
@ -12,9 +12,12 @@ function respecBuyables(layer) {
|
|||
function canAffordUpgrade(layer, id) {
|
||||
let upg = tmp[layer].upgrades[id]
|
||||
if(tmp[layer].deactivated) return false
|
||||
if (tmp[layer].upgrades[id].canAfford !== undefined) return tmp[layer].upgrades[id].canAfford
|
||||
if (tmp[layer].upgrades[id].canAfford === false) return false
|
||||
let cost = tmp[layer].upgrades[id].cost
|
||||
return canAffordPurchase(layer, upg, cost)
|
||||
if (cost !== undefined)
|
||||
return canAffordPurchase(layer, upg, cost)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function canBuyBuyable(layer, id) {
|
||||
|
@ -25,7 +28,6 @@ function canBuyBuyable(layer, id) {
|
|||
|
||||
|
||||
function canAffordPurchase(layer, thing, cost) {
|
||||
|
||||
if (thing.currencyInternalName) {
|
||||
let name = thing.currencyInternalName
|
||||
if (thing.currencyLocation) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue