7 lines
6.5 KiB
JavaScript
7 lines
6.5 KiB
JavaScript
import{_ as e,c as s,o as a,a as n}from"./app.4bcfb575.js";const f=JSON.parse('{"title":"mod.js","description":"","frontmatter":{},"headers":[],"relativePath":"public/gamedevtree/docs/main-mod-info.md","lastUpdated":null}'),t={name:"public/gamedevtree/docs/main-mod-info.md"},o=n(`<h1 id="mod-js" tabindex="-1">mod.js <a class="header-anchor" href="#mod-js" aria-hidden="true">#</a></h1><p>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.</p><p>Here's a breakdown of what's in it:</p><ul><li><p>modInfo is where most of the basic configuration for the mod is. It contains:</p><ul><li>name: The name of your mod. (a string)</li><li>id: The id for your mod, a unique string that is used to determine savefile location. Setting it is important!</li><li>author: The name of the author, displayed in the info tab.</li><li>pointsName: This changes what is displayed instead of "points" for the main currency. (It does not affect it in the code.)</li><li>discordName, discordLink: If you have a Discord server or other discussion place, you can add a link to it. "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.</li><li>changelogLink: You can use this to set a link to a page where your changelog for the game is displayed.</li><li>offlineLimit: The maximum amount of offline time that the player can accumulate, in hours. Any extra time is lost. (a number) 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.</li><li>initialStartPoints: A Decimal for the amount of points a new player should start with.</li></ul></li><li><p>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.</p></li><li><p>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.</p></li></ul><div class="language-js"><button class="copy"></button><span class="lang">js</span><pre><code><span class="line"><span style="color:#676E95;">// (The ones here are examples, all official functions are already taken care of)</span></span>
|
|
<span class="line"><span style="color:#C792EA;">var</span><span style="color:#A6ACCD;"> doNotCallTheseFunctionsEveryTick </span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;"> [</span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">doReset</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">buy</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">onPurchase</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">blowUpEverything</span><span style="color:#89DDFF;">"</span><span style="color:#A6ACCD;">]</span></span>
|
|
<span class="line"></span></code></pre></div><ul><li><p>getStartPoints(): A function to determine the amount of points the player starts with after a reset. (returns a Decimal value)</p></li><li><p>canGenPoints(): A function returning a boolean for if points should be generated. Use this if you want an upgrade to unlock generating points.</p></li><li><p>getPointGen(): A function that calculates your points per second. Anything that affects your point gain should go into the calculation here.</p></li><li><p>addedPlayerData(): A function that returns any non-layer-related data that you want to be added to the save data and "player" object.</p></li></ul><div class="language-js"><button class="copy"></button><span class="lang">js</span><pre><code><span class="line"><span style="color:#C792EA;">function</span><span style="color:#A6ACCD;"> </span><span style="color:#82AAFF;">addedPlayerData</span><span style="color:#89DDFF;">()</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">{</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">return</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">{</span></span>
|
|
<span class="line"><span style="color:#F07178;"> weather</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">"</span><span style="color:#C3E88D;">Yes</span><span style="color:#89DDFF;">"</span><span style="color:#89DDFF;">,</span></span>
|
|
<span class="line"><span style="color:#F07178;"> happiness</span><span style="color:#89DDFF;">:</span><span style="color:#F07178;"> </span><span style="color:#89DDFF;">new</span><span style="color:#F07178;"> </span><span style="color:#82AAFF;">Decimal</span><span style="color:#F07178;">(</span><span style="color:#F78C6C;">72</span><span style="color:#F07178;">)</span><span style="color:#89DDFF;">,</span></span>
|
|
<span class="line"><span style="color:#89DDFF;">}}</span></span>
|
|
<span class="line"></span></code></pre></div><ul><li><p>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).</p></li><li><p>isEndgame(): A function to determine if the player has reached the end of the game, at which point the "you win!" screen appears.</p></li></ul><p>Less important things beyond this point!</p><ul><li>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).</li></ul>`,10),l=[o];function i(p,r,c,u,d,h){return a(),s("div",null,l)}const m=e(t,[["render",i]]);export{f as __pageData,m as default};
|