import{_ as i,q as e,p as t,ag as s}from"./chunks/framework.Sr2_9k8k.js";const m=JSON.parse('{"title":"mod.js","description":"","frontmatter":{},"headers":[],"relativePath":"public/gamedevtree/docs/main-mod-info.md","filePath":"public/gamedevtree/docs/main-mod-info.md"}'),a={name:"public/gamedevtree/docs/main-mod-info.md"},n=s(`
All of the code and data that you're likely to edit is here in mod.js! Everything in mod.js will not be altered by updates, besides the addition of new things.
Here's a breakdown of what's in it:
modInfo is where most of the basic configuration for the mod is. It contains:
VERSION is used to describe the current version of your mod. It contains: 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.
doNotCallTheseFunctionsEveryTick is very important. 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.
// (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)
canGenPoints(): A function returning a boolean for if points should be generated. Use this if you want an upgrade to unlock generating points.
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.
function addedPlayerData() { return {
weather: "Yes",
happiness: new Decimal(72),
}}
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).
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!