pages/assets/public_kronos_docs_main-mod-info.md.07830185.js

9 lines
8.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,o as s,c as a,Q as t}from"./chunks/framework.1169fbc9.js";const f=JSON.parse('{"title":"mod.js","description":"","frontmatter":{},"headers":[],"relativePath":"public/kronos/docs/main-mod-info.md","filePath":"public/kronos/docs/main-mod-info.md","lastUpdated":1664930814000}'),n={name:"public/kronos/docs/main-mod-info.md"},o=t(`<h1 id="mod-js" tabindex="-1">mod.js <a class="header-anchor" href="#mod-js" aria-label="Permalink to &quot;mod.js&quot;"></a></h1><p>Most of the non-layer code and data that you&#39;re likely to edit is here in <a href="/js/mod.js">mod.js</a>. Everything in <a href="/js/mod.js">mod.js</a> will not be altered by updates, besides the addition of new things.</p><p>Here&#39;s a breakdown of what&#39;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&#39;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 &quot;points&quot; 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>&quot;discordName&quot; is the text on the link, and &quot;discordLink&quot; is the url of an invite. If you&#39;re using a Discord invite, please make sure it&#39;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&#39;s version number, displayed at the top right of the tree tab.</li><li>name: The version&#39;s name, displayed alongside the number in the info tab.</li></ul></li><li><p>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)</p></li><li><p>doNotCallTheseFunctionsEveryTick is very important, if you are adding non-standard functions. TMT calls every function anywhere in &quot;layers&quot; every tick to store the result, unless specifically told not to. Functions that have are used to do an action need to be identified. &quot;Official&quot; 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 vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#6A737D;">// (The ones here are examples, all official functions are already taken care of)</span></span>
<span class="line"><span style="color:#F97583;">var</span><span style="color:#E1E4E8;"> doNotCallTheseFunctionsEveryTick </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> [</span><span style="color:#9ECBFF;">&quot;doReset&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;buy&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;onPurchase&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#9ECBFF;">&quot;blowUpEverything&quot;</span><span style="color:#E1E4E8;">]</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6A737D;">// (The ones here are examples, all official functions are already taken care of)</span></span>
<span class="line"><span style="color:#D73A49;">var</span><span style="color:#24292E;"> doNotCallTheseFunctionsEveryTick </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> [</span><span style="color:#032F62;">&quot;doReset&quot;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;buy&quot;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;onPurchase&quot;</span><span style="color:#24292E;">, </span><span style="color:#032F62;">&quot;blowUpEverything&quot;</span><span style="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 &quot;player&quot; object.</p></li></ul><div class="language-js vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">function</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">addedPlayerData</span><span style="color:#E1E4E8;">() { </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;"> weather: </span><span style="color:#9ECBFF;">&quot;Yes&quot;</span><span style="color:#E1E4E8;">,</span></span>
<span class="line"><span style="color:#E1E4E8;"> happiness: </span><span style="color:#F97583;">new</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">Decimal</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">72</span><span style="color:#E1E4E8;">),</span></span>
<span class="line"><span style="color:#E1E4E8;">}}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">function</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">addedPlayerData</span><span style="color:#24292E;">() { </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;"> weather: </span><span style="color:#032F62;">&quot;Yes&quot;</span><span style="color:#24292E;">,</span></span>
<span class="line"><span style="color:#24292E;"> happiness: </span><span style="color:#D73A49;">new</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">Decimal</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">72</span><span style="color:#24292E;">),</span></span>
<span class="line"><span style="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&#39;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 &quot;you win!&quot; 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>`,10),l=[o];function i(p,r,c,d,u,h){return s(),a("div",null,l)}const m=e(n,[["render",i]]);export{f as __pageData,m as default};