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

Improved milestone completion + docs

This commit is contained in:
Harley White 2021-06-02 16:45:05 -04:00
parent ef48c4fe48
commit b6bc8beb21
5 changed files with 9 additions and 4 deletions

View file

@ -3,7 +3,9 @@
- Fixed demo.html
- You can now use "this" in tabFormat!
- The prestige/sec display now shows decimals.
- Added onComplete for milestones.
- Fixed certain things skipping negative rows (now they are treated like non-numeric rows, and don't appear in the tree still).
- Things are 0.2% more optimized.
### v2.5.11.1 - 5/27/21
- Fixed issues caused when the tree tab is disabled.

View file

@ -28,8 +28,8 @@ While reading this documentation, the following key will be used when describing
### General
- [Getting Started](tutorial/getting-started.md): A guide to getting your own copy of the code set up with Github Desktop.
- [Making a Mod](tutorial/making-a-mod.md): A guide to using TMT to make a basic mod.
- [Getting Started](tutorials/getting-started.md): A guide to getting your own copy of the code set up with Github Desktop.
- [Making a Mod](tutorials/making-a-mod.md): A guide to using TMT to make a basic mod.
- [Main mod info](main-mod-info.md): How to set up general things for your mod in [mod.js](/js/mod.js).
- [Basic layer breakdown](basic-layer-breakdown.md): Breaking down the components of a layer with minimal features.
- [Layer features](layer-features.md): Explanations of all of the different properties that you can give a layer.

View file

@ -23,6 +23,8 @@ Milestone features:
- done(): A function returning a boolean to determine if the milestone should be awarded.
- onComplete() - **optional**. this function will be called when the milestone is completed.
- toggles: **optional**. Creates toggle buttons that appear on the milestone when it is unlocked. The toggles can toggle a given boolean value in a layer. It is defined as an array of paired items, one pair per toggle. The first is the internal name of the layer the value being toggled is stored in, and the second is the internal name of the variable to toggle. (e.g. [["b", "auto"], ["g", "auto"])
**Tip:** Toggles are not de-set if the milestone becomes locked! In this case, you should also check if the player has the milestone.
@ -35,4 +37,4 @@ Milestone features:
- id: **assigned automagically**. It's the "key" which the milestone was stored under, for convenient access. The milestone in the example's id is 0.
Disaable milestone popups by adding `milestonePopups: false` to the layer.
Disable milestone popups by adding `milestonePopups: false` to the layer.

View file

@ -10,7 +10,7 @@ var activeFunctions = [
"sellOne", "sellAll", "pay", "actualCostFunction", "actualEffectFunction",
"effectDescription", "display", "fullDisplay", "effectDisplay", "rewardDisplay",
"tabFormat", "content",
"onComplete", "onPurchase", "onEnter", "onExit",
"onComplete", "onPurchase", "onEnter", "onExit", "done",
"getUnlocked", "getStyle", "getCanClick", "getTitle", "getDisplay"
]

View file

@ -261,6 +261,7 @@ function updateMilestones(layer) {
for (id in layers[layer].milestones) {
if (!(hasMilestone(layer, id)) && layers[layer].milestones[id].done()) {
player[layer].milestones.push(id)
if (layers[layer].milestones[id].onComplete) layers[layer].milestones[id].onComplete()
if (tmp[layer].milestonePopups || tmp[layer].milestonePopups === undefined) doPopup("milestone", tmp[layer].milestones[id].requirementDescription, "Milestone Gotten!", 3, tmp[layer].color);
player[layer].lastMilestone = id
}