pages/assets/public_lit_docs_!general-info.md.eec18530.js

2 lines
6.7 KiB
JavaScript
Raw Normal View History

import{_ as e,c as a,o as t,d as o}from"./app.1a35c4a8.js";const p=JSON.parse('{"title":"The-Modding-Tree","description":"","frontmatter":{},"headers":[{"level":2,"title":"Table of Contents","slug":"table-of-contents","link":"#table-of-contents","children":[{"level":3,"title":"General","slug":"general","link":"#general","children":[]},{"level":3,"title":"Common components","slug":"common-components","link":"#common-components","children":[]},{"level":3,"title":"Other components and features","slug":"other-components-and-features","link":"#other-components-and-features","children":[]}]}],"relativePath":"public/lit/docs/!general-info.md","lastUpdated":null}'),n={name:"public/lit/docs/!general-info.md"},r=o('<h1 id="the-modding-tree" tabindex="-1">The-Modding-Tree <a class="header-anchor" href="#the-modding-tree" aria-hidden="true">#</a></h1><p>The main way to add content is through creating layers. You can either add a layer directly in the layers object in <a href="/js/layerSupport.js">layerSupport.js</a>, or declare it in another file and register it by calling <code>addLayer(layername, layerdata)</code>. There is an example layer registration in <a href="/js/layers.js">layers.js</a> showing the recommended method. It is just an example and can be freely deleted. You can also use it as a reference or a base for your own layers.</p><p>The first thing you need to do is fill out the modInfo object at the top of <a href="/js/mod.js">mod.js</a> to set your mod&#39;s name, ID (a string), and other information. A unique modId will prevent your mod&#39;s saves from conflicting with other mods. Note that changing this after people have started playing will reset their saves.</p><p>Most of the time, you won&#39;t need to dive deep into the code to create things, but you still can if you really want to, for example to add new Vue components in <a href="/js/v.js">v.js</a>.</p><p>The Modding Tree uses <a href="https://github.com/Patashu/break_eternity.js" target="_blank" rel="noreferrer">break_eternity.js</a> to store large values. This means that many numbers are <code>Decimal</code> objects, and must be treated differently. For example, you have to use <code>new Decimal(x)</code> to create a <code>Decimal</code> value instead of a plain number, and perform operations on them by calling functions. e.g, instead of <code>x = x + y</code>, use <code>x = x.add(y)</code>. Keep in mind this also applies to comparison operators, which should be replaced with calling the <code>.gt</code>, <code>.gte</code>, <code>.lt</code>, <code>.lte</code>, <code>.eq</code>, and <code>.neq</code> functions. See the <a href="https://github.com/Patashu/break_eternity.js" target="_blank" rel="noreferrer">break_eternity.js</a> docs for more details on working with <code>Decimal</code> values.</p><p>Almost all values can be either a constant value, or a dynamic value. Dynamic values are defined by putting a function that returns what the value should be at any given time.</p><p>All display text can use basic HTML elements (But you can&#39;t use most Vue features there).</p><p>While reading this documentation, the following key will be used when describing features:</p><ul><li>No label: This is required and the game may crash if it isn&#39;t included.</li><li><strong>sometimes required</strong>: This is may be required, depending on other things in the layer.</li><li><strong>optional</strong>: You can leave this out if you don&#39;t intend to use that feature for the layer.</li><li><strong>assigned automagically</strong>: This value will be set automatically and override any value you set.</li><li><strong>deprecated</strong>: This feature is not recommended to be used anymore, and may be removed in future versions of TMT.</li></ul><h2 id="table-of-contents" tabindex="-1">Table of Contents <a class="header-anchor" href="#table-of-contents" aria-hidden="true">#</a></h2><h3 id="general" tabindex="-1">General <a class="header-anchor" href="#general" aria-hidden="true">#</a></h3><ul><li><a href="./getting-started">Getting Started</a>: Getting your own copy of the