From 046bac4abff2e95930a1e23dbc18a3329bcf8973 Mon Sep 17 00:00:00 2001 From: Harley White Date: Sat, 22 May 2021 19:16:27 -0400 Subject: [PATCH] 2.5.10 --- changelog.md | 2 ++ docs/making-a-mod.md | 31 +++++++++++++++++++++++++++++++ js/Demo/demoMod.js | 2 +- js/game.js | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 1ddca4e..9c4f53e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,10 @@ # The Modding Tree changelog: +### v2.5.10 - 5/22/21 - Tooltips can now show over the top overlay again. - Tweaked number formatting (e1000's keep the decimal places on the mantissa.) - Fixed text on two settings buttons not changing. +- Started making a new tutorial. ### v2.5.9.2 - 5/19/21 - Fixed many issues with things not updating. diff --git a/docs/making-a-mod.md b/docs/making-a-mod.md index e8cc089..c17b850 100644 --- a/docs/making-a-mod.md +++ b/docs/making-a-mod.md @@ -32,3 +32,34 @@ Upgrades are one of several Big Features in TMT, and most of them work the same "upgrades" is an object, which contains an object for each upgrade. Each upgrade has an id that corresponds to its position. The upgrade "12" will appear as the second upgrade in the first row. +Given that, let's make our first upgrade! Insert this line in between the brackets after "upgrades": + +```js + 11: { + + }, +``` + +Reload the page, and an upgrade will appear in the layer's tab! It will just be blank though. We need to fill out its features, which works similarly to giving a layer features. Here are the features we'll need: + +```js + name: "Make this whatever you want!", + description: "Double your point gain.", + cost: new Decimal(1), +``` + +Reload the page, and the upgrade will appear, fully formed! But it won't have any effect when you buy it! To impliment a boost, we need to go to the place where it is calculated. In this case, point gain is calculated in getPointGen in mod.js, so let's head over there. + +It's time to explain Decimals. Decimals are a special way of handling numbers over the normal Javascript limit. They are handled in a very different way. To perform any operations, instead of doing x = x + y, you have to do x = x.add(y). x has to be a Decimal, but y can be either a Decimal or Number (regular javascript number). A more detailed description is in [!general-info.md](!general-info.md) + +With that knowledge in hand, what we need to do is check if the player has the upgrade, and then boost point gain if so. We can do that by inserting this line between gain being defined and returned: +```js +if (hasUpgrade('p', 11)) gain = gain.times(2) +``` + +Refresh the page again, and it should work! You are gaining 2 points per second! + + +## Upgraded upgrades + +To be continued... \ No newline at end of file diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index 5179e07..6d0fd0e 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -11,7 +11,7 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.5.9.2", + num: "2.5.10", name: "Dreams Really Do Come True", } diff --git a/js/game.js b/js/game.js index aeb7337..5c19063 100644 --- a/js/game.js +++ b/js/game.js @@ -4,7 +4,7 @@ var gameEnded = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.5.9.2", + tmtNum: "2.5.10", tmtName: "Dreams Really Do Come True" }