1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00

Buyables OP

This commit is contained in:
Acamaeda 2020-10-08 20:00:09 -04:00
parent 199485a87a
commit 38e9affa7f
4 changed files with 7 additions and 52 deletions

View file

@ -1,6 +1,9 @@
#The Modding Tree changelog:
##v1.3.5?
- Completely automated convertToDecimal, now you never have to worry about it again.
##v1.3.4: 10/8/20
- Added "midsection" feature to add things to a tab's layout while still keeping the standard layout.
- Fix for being able to buy more buyables than you should.

View file

@ -24,7 +24,7 @@ plain number, and perform operations on them by calling functions. e.g, instead
- [Milestones](milestones.md): How to create milestones for a layer.
- [Challenges](challenges.md): How to create challenges for a layer.
- [Buyables](buyables.md): Create rebuyable upgrades for your layer (with the option to make them respec-able).
Can be used to make Enhancers or Space Buildings.
Can be used to make Enhancers or Space Buildings, but they're flexible enough to do anything.
- [Custom Tab Layouts](custom-tab-layouts.md): An optional way to give your tabs a different layout.
You can even create entirely new components to use.
- [Subtabs and Microtabs](subtabs-and-microtabs.md): Create subtabs for your tabs, as well as "microtab" components that you can put inside the tabs.

View file

@ -1,8 +1,10 @@
# Buyables
Buyables are things that can be bought multiple times with scaling costs. If you set a respec function,
Buyables are usually things that can be bought multiple times with scaling costs. If you set a respec function,
the player can reset the purchases to get their currency back.
However, if you're creative, you can use them for basically anything. "canAfford()" is effectively "canClick()" and "buy()" is effectively "onClick()".
You can use buyableEffect(layer, id) to get the current effects of a buyable.
Buyables should be formatted like this:

View file

@ -148,56 +148,6 @@ function fixData(defaultData, newData) {
}
}
function hecj() {
defaultData = startPlayerBase()
for (datum in defaultData){
if (player[datum] == undefined){
player[datum] = defaultData[datum]
}
}
for (layer in layers) {
defaultData = layers[layer].startData()
if (player[layer].upgrades == undefined)
player[layer].upgrades = []
if (player[layer].milestones == undefined)
player[layer].milestones = []
if (player[layer].challs == undefined)
player[layer].challs = []
for (datum in defaultData){
if (player[layer][datum] == undefined){
player[layer][datum] = defaultData[datum]
}
}
if (player[layer].spentOnBuyables == undefined)
player[layer].spentOnBuyables = new Decimal(0)
if (layers[layer].buyables) {
if (player[layer].buyables == undefined) player[layer].buyables = {}
for (id in layers[layer].buyables){
if (player[layer].buyables[id] == undefined && !isNaN(id))
player[layer].buyables[id] = new Decimal(0)
}
}
if (layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)) {
if (player.subtabs[layer] == undefined) player.subtabs[layer] = {}
if (player.subtabs[layer].mainTabs == undefined) player.subtabs[layer].mainTabs = Object.keys(layers[layer].tabFormat)[0]
}
if (layers[layer].microtabs) {
if (player.subtabs[layer] == undefined) player.subtabs[layer] = {}
for (item in layers[layer].microtabs)
if (player.subtabs[layer][item] == undefined) player.subtabs[layer][item] = Object.keys(layers[layer].microtabs[item])[0]
}
}
}
function load() {
let get = localStorage.getItem(modInfo.id);
if (get===null || get===undefined) player = getStartPlayer()