Fixed buyable exploit

This commit is contained in:
Harley White 2021-05-13 02:51:18 -04:00
parent 04a27147a7
commit 70949f593d
4 changed files with 7 additions and 5 deletions

View file

@ -1,6 +1,7 @@
# The Modding Tree changelog:
- You can now use non-numeric ids for upgrades, buyables, etc.
- Fixed an exploit that let you buy an extra buyable.
# v2.5.5.2 - 5/12/21
- Fixed a major issue with buyables.
@ -373,11 +374,11 @@ which will break old things)
- Added a few minor features, and updated the docs with new information.
### v1.1.1:
### v1.1.1 - 9/30/20
- You can define hotkeys directly from layer config.
## v1.1: Enhanced Edition
## v1.1: Enhanced Edition - 9/30/20
- Added "Buyables", which can function like Space Buildings or Enhancers.
- Custom CSS can now be used on any component! Make the third argument an object with CSS
@ -385,5 +386,5 @@ parameters.
- Lots of minor good things.
## v1.0:
## v1.0 - 9/27/20
- First release.

View file

@ -24,7 +24,7 @@ Here's a breakdown of what's in it:
- num: The mod's version number, displayed at the top right of the tree tab.
- name: The version's name, displayed alongside the number in the info tab.
- changelog is the HTML displayed in the changelog tab.
- changelog is the HTML displayed in the changelog tab. If this gets particularly long, it might be good to put in a separate file (be sure to add the file to index.html)
- doNotCallTheseFunctionsEveryTick is very important, if you are adding non-standard functions. TMT calls every function anywhere in "layers" every tick to store the result, unless specifically told not to. Functions that have are used to do an action need to be identified. "Official" functions (those in the documentation) are all fine, but if you make any new ones, add their names to this array.

View file

@ -555,6 +555,7 @@ function loadVue() {
format,
formatWhole,
formatTime,
formatSmall,
focused,
getThemeName,
layerunlocked,

View file

@ -18,7 +18,7 @@ function canAffordUpgrade(layer, id) {
function canBuyBuyable(layer, id) {
let b = temp[layer].buyables[id]
return (b.unlocked && b.canAfford && player[layer].buyables[id].lt(b.purchaseLimit))
return (b.unlocked && run(b.canAfford, b) && player[layer].buyables[id].lt(b.purchaseLimit))
}
function hasUpgrade(layer, id) {