</svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><buttontype="button"class="VPNavBarHamburger hamburger"aria-label="mobile navigation"aria-expanded="false"aria-controls="VPNavScreen"data-v-a0fd61f4data-v-e5dd9c1c><spanclass="container"data-v-e5dd9c1c><spanclass="top"data-v-e5dd9c1c></span><spanclass="middle"data-v-e5dd9c1c></span><spanclass="bottom"data-v-e5dd9c1c></span></span></button></div></div></div></div><!----></header><divclass="VPLocalNav fixed reached-top"data-v-5a346dfedata-v-79c8c1df><!----><divclass="VPLocalNavOutlineDropdown"style="--vp-vh:0px;"data-v-79c8c1dfdata-v-1c15a60a><buttondata-v-1c15a60a>Return to top</button><!----></div></div><!----><divclass="VPContent"id="VPContent"data-v-5a346dfedata-v-669faec9><divclass="VPDoc has-aside"data-v-669faec9data-v-6b87e69f><!--[--><!--]--><divclass="container"data-v-6b87e69f><divclass="aside"data-v-6b87e69f><divclass="aside-curtain"data-v-6b87e69f></div><divclass="aside-container"data-v-6b87e69f><divclass="aside-content"data-v-6b87e69f><divclass="VPDocAside"data-v-6b87e69fdata-v-3f215769><!--[--><!--]--><!--[--><!--]--><divclass="VPDocAsideOutline"role="navigation"data-v-3f215769data-v-d330b1bb><divclass="content"data-v-d330b1bb><divclass="outline-marker"data-v-d330b1bb></div><divclass="outline-title"role="heading"aria-level="2"data-v-d330b1bb>On this page</div><navaria-labelledby="doc-outline-aria-label"data-v-d330b1bb><spanclass="visually-hidden"id="doc-outline-aria-label"data-v-d330b1bb> Table of Contents for current page </span><ulclass="root"data-v-d330b1bbdata-v-d0ee3533><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><divclass="spacer"data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><divclass="content"data-v-6b87e69f><divclass="content-container"data-v-6b87e69f><!--[--><!--]--><!----><mainclass="main"data-v-6b87e69f><divstyle="position:relative;"class="vp-doc _public_kronos_docs_main-mod-info"data-v-6b87e69f><div><h1id="mod-js"tabindex="-1">mod.js <aclass="header-anchor"href="#mod-js"aria-label="Permalink to "mod.js""></a></h1><p>Most of the non-layer code and data that you're likely to edit is here in <ahref="/js/mod.js">mod.js</a>. Everything in <ahref="/js/mod.js">mod.js</a> 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><p>name: The name of your mod. (a string)</p></li><li><p>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.</p></li><li><p>author: The name of the author, displayed in the info tab.</p></li><li><p>pointsName: This changes what is displayed instead of "points" for the main currency. (It does not affect it in the code.)</p></li><li><p>discordName, discordLink: If you have a Discord server or other discussion place, you can add a link to it.</p><p>"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.</p></li><li><p>offlineLimit: The maximum amount of offline time that the player can accumulate, in hours. Any extra time is lost. (a number)</p><p>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.</p></li><li><p>initialStartPoints: A Decimal for the amount of points a new player should start with.</p></li></ul></li><li><p>VERSION is used to describe the current version of your mod. It contains:</p><ul><li>num: The mod's version number, displayed at the top right of the tree tab.</li><li>name: The version's name, displayed
<spanclass="line"><spanstyle="color:#F97583;">var</span><spanstyle="color:#E1E4E8;"> doNotCallTheseFunctionsEveryTick </span><spanstyle="color:#F97583;">=</span><spanstyle="color:#E1E4E8;"> [</span><spanstyle="color:#9ECBFF;">"doReset"</span><spanstyle="color:#E1E4E8;">, </span><spanstyle="color:#9ECBFF;">"buy"</span><spanstyle="color:#E1E4E8;">, </span><spanstyle="color:#9ECBFF;">"onPurchase"</span><spanstyle="color:#E1E4E8;">, </span><spanstyle="color:#9ECBFF;">"blowUpEverything"</span><spanstyle="color:#E1E4E8;">]</span></span></code></pre><preclass="shiki github-light vp-code-light"><code><spanclass="line"><spanstyle="color:#6A737D;">// (The ones here are examples, all official functions are already taken care of)</span></span>
<spanclass="line"><spanstyle="color:#D73A49;">var</span><spanstyle="color:#24292E;"> doNotCallTheseFunctionsEveryTick </span><spanstyle="color:#D73A49;">=</span><spanstyle="color:#24292E;"> [</span><spanstyle="color:#032F62;">"doReset"</span><spanstyle="color:#24292E;">, </span><spanstyle="color:#032F62;">"buy"</span><spanstyle="color:#24292E;">, </span><spanstyle="color:#032F62;">"onPurchase"</span><spanstyle="color:#24292E;">, </span><spanstyle="color:#032F62;">"blowUpEverything"</span><spanstyle="color:#24292E;">]</span></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><divclass="language-js vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">js</span><preclass="shiki github-dark vp-code-dark"><code><spanclass="line"><spanstyle="color:#F97583;">function</span><spanstyle="color:#E1E4E8;"></span><spanstyle="color:#B392F0;">addedPlayerData</span><spanstyle="color:#E1E4E8;">() { </span><spanstyle="color:#F97583;">return</span><spanstyle="color:#E1E4E8;"> {</span></span>
<spanclass="line"><spanstyle="color:#24292E;">}}</span></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><p>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).</p></li><li><p>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.</p></li></ul></div></div></main><footerclass="VPDocFooter"data-v-6b87e69fdata-v-ef5dee53><!--[--><!--]--><divclass="edit-info"data-v-ef5dee53><!----><divclass="last-updated"data-v-ef5dee53><pclass="VPLastUpdated"data-v-ef5dee53data-v-7e05ebdb>Last updated: <timedatetime="2023-11-28T02:02:57.000Z"data-v-7e05ebdb></time></p></div></div><!----></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>