profectus-docs/assets/api_modules_features_resource.md.0fa45c16.js

2 lines
17 KiB
JavaScript
Raw Normal View History

import{_ as e,c as t,o as r,N as a}from"./chunks/framework.0799945b.js";const b=JSON.parse('{"title":"Module: features/resources/resource","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/features/resource.md","lastUpdated":null}'),o={name:"api/modules/features/resource.md"},s=a('<h1 id="module-features-resources-resource" tabindex="-1">Module: features/resources/resource <a class="header-anchor" href="#module-features-resources-resource" aria-label="Permalink to &quot;Module: features/resources/resource&quot;"></a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to &quot;Interfaces&quot;"></a></h2><h3 id="resource" tabindex="-1">Resource <a class="header-anchor" href="#resource" aria-label="Permalink to &quot;Resource&quot;"></a></h3><p> <strong>Resource</strong>&lt;<code>T</code>&gt;: <code>Object</code></p><p>An object that represents a named and quantifiable resource in the game.</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-label="Permalink to &quot;Type parameters&quot;"></a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;"><a href="./../util/bignum#decimalsource"><code>DecimalSource</code></a></td></tr></tbody></table><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>[RefSymbol]</code></td><td style="text-align:left;"><code>true</code></td><td style="text-align:left;">Type differentiator only. We need this to be in public d.ts but don&#39;t want it to show up in IDE autocomplete, so we use a private Symbol instead.</td></tr><tr><td style="text-align:left;"><code>displayName</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The name of this resource.</td></tr><tr><td style="text-align:left;"><code>precision</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">When displaying the value of this resource, how many significant digits to display.</td></tr><tr><td style="text-align:left;"><code>small?</code></td><td style="text-align:left;"><code>boolean</code></td><td style="text-align:left;">Whether or not to display very small values using scientific notation, or rounding to 0.</td></tr><tr><td style="text-align:left;"><code>value</code></td><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">-</td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/features/resources/resource.ts#L12" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:12</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h2><h3 id="createresource" tabindex="-1">createResource <a class="header-anchor" href="#createresource" aria-label="Permalink to &quot;createResource&quot;"></a></h3><p> <strong>createResource</strong>&lt;<code>T</code>&gt;(<code>defaultValue</code>, <code>displayName?</code>, <code>precision?</code>, <code>small?</code>): <a href="./resource#resource"><code>Resource</code></a>&lt;<code>T</code>&gt; &amp; <a href="./../game/persistence#persistent"><code>Persistent</code></a>&lt;<code>T</code>&gt; &amp; { <code>[NonPersistent]</code>: <a href="./resource#resource"><code>Resource</code></a>&lt;<code>T</code>&gt; }</p><p>Creates a resource.</p><h5 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-label="Permalink to &quot;Type parameters&quot;"></a></h5><table><thead><tr>