1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-12-04 22:01:31 +00:00
The-Modding-Tree/docs/main-mod-info.md

63 lines
4.1 KiB
Markdown
Raw Normal View History

2020-10-17 22:02:27 +00:00
# mod.js
2021-05-11 01:24:24 +00:00
Most of the non-layer code and data that you're likely to edit is here in [mod.js](/js/mod.js).
Everything in [mod.js](/js/mod.js) will not be altered by updates, besides the addition of new things.
2020-10-17 22:02:27 +00:00
Here's a breakdown of what's in it:
- modInfo is where most of the basic configuration for the mod is. It contains:
- name: The name of your mod. (a string)
2021-05-11 01:24:24 +00:00
- id: The id for your mod, a unique string that is used to determine savefile location. Be sure to set it when you start making a mod, and don't change it later because it will erase all saves.
2020-10-19 23:52:52 +00:00
- author: The name of the author, displayed in the info tab.
2020-10-17 22:02:27 +00:00
- pointsName: This changes what is displayed instead of "points" for the main currency. (It does not affect it in the code.)
2021-06-11 20:22:56 +00:00
- modFiles: An array of file addresses which will be loaded for this mod. Using smaller files makes it easier to find what you're looking for.
2020-10-17 22:02:27 +00:00
- discordName, discordLink: If you have a Discord server or other discussion place, you can add a link to it.
2020-10-26 20:45:22 +00:00
"discordName" is the text on the link, and "discordLink" is the url of an invite. If you're using a Discord invite, please make sure it's set to never expire.
2020-10-17 22:02:27 +00:00
- offlineLimit: The maximum amount of offline time that the player can accumulate, in hours. Any extra time is lost. (a number)
2020-10-26 20:45:22 +00:00
This is useful because most of these mods are fast-paced enough that too much offline time ruins the balance, such as the time in between updates. That is why I suggest developers disable offline time on their own savefile.
2020-10-17 22:02:27 +00:00
- initialStartPoints: A Decimal for the amount of points a new player should start with.
- VERSION is used to describe the current version of your mod. It contains:
2020-10-26 20:45:22 +00:00
- 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.
2020-10-17 22:02:27 +00:00
2021-05-13 06:51:18 +00:00
- 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)
2020-12-05 19:52:29 +00:00
2021-05-11 01:24:24 +00:00
- 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.
2020-10-17 22:02:27 +00:00
```js
// (The ones here are examples, all official functions are already taken care of)
var doNotCallTheseFunctionsEveryTick = ["doReset", "buy", "onPurchase", "blowUpEverything"]
```
- getStartPoints(): A function to determine the amount of points the player starts with after a reset. (returns a Decimal value)
2020-10-26 20:45:22 +00:00
- canGenPoints(): A function returning a boolean for if points should be generated. Use this if you want an upgrade to unlock generating points.
2020-10-17 22:02:27 +00:00
- getPointGen(): A function that calculates your points per second. Anything that affects your point gain should go into the calculation here.
- addedPlayerData(): A function that returns any non-layer-related data that you want to be added to the save data and "player" object.
```js
function addedPlayerData() { return {
weather: "Yes",
happiness: new Decimal(72),
}}
```
2020-10-26 20:45:22 +00:00
- displayThings: An array of functions used to display extra things at the top of the tree tab. Each function returns a string, which is a line to display (with basic HTML support). If a function returns nothing, nothing is displayed (and it doesn't take up a line).
2020-10-17 22:02:27 +00:00
- isEndgame(): A function to determine if the player has reached the end of the game, at which point the "you win!" screen appears.
Less important things beyond this point!
2021-06-07 04:13:18 +00:00
- backgroundStyle: A CSS object containing the styling for the background of the full game. Can be a function!
2021-05-11 01:24:24 +00:00
- maxTickLength(): Returns the maximum tick length, in milliseconds. Only really useful if you have something that reduces over time, which long ticks mess up (usually a challenge).
- fixOldSave(): Can be used to modify a save file when loading into a new version of the game. Use this to undo inflation, never forcibly hard reset your players.