1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
import{_ as e,c as t,o as r,N as a}from"./chunks/framework.0799945b.js";const m=JSON.parse('{"title":"Module: features/resources/resource","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/features/resources/resource.md","lastUpdated":null}'),o={name:"api/modules/features/resources/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 "Module: features/resources/resource""></a></h1><h2 id="components" tabindex="-1">Components <a class="header-anchor" href="#components" aria-label="Permalink to "Components""></a></h2><ul><li><a href="./MainDisplayComponent">MainDisplay</a></li><li><a href="./ResourceComponent">Resource</a></li></ul><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to "Interfaces""></a></h2><ul><li><a href="../../../interfaces/features/resources/resource.Resource">Resource</a></li></ul><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to "Functions""></a></h2><h3 id="createresource" tabindex="-1">createResource <a class="header-anchor" href="#createresource" aria-label="Permalink to "createResource""></a></h3><p>▸ <strong>createResource</strong><<code>T</code>>(<code>defaultValue</code>, <code>displayName?</code>, <code>precision?</code>, <code>small?</code>): <a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<code>T</code>> & <a href="./../../game/persistence#persistent"><code>Persistent</code></a><<code>T</code>> & { <code>[NonPersistent]</code>: <a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<code>T</code>> }</p><p>Creates a resource.</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-label="Permalink to "Type parameters""></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;">extends <a href="./../../game/persistence#state"><code>State</code></a></td></tr></tbody></table><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to "Parameters""></a></h4><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>defaultValue</code></td><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">The initial value of the resource</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 human readable 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;">The number of significant digits to display by default</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 or round to 0, by default</td></tr></tbody></table><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to "Returns""></a></h4><p><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<code>T</code>> & <a href="./../../game/persistence#persistent"><code>Persistent</code></a><<code>T</code>> & { <code>[NonPersistent]</code>: <a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<code>T</code>> }</p><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L28" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:28</a></p><p>▸ <strong>createResource</strong><<code>T</code>>(<code>defaultValue</code>, <code>displayName?</code>, <code>precision?</code>, <code>small?</code>): <a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<code>T</code>></p><h4 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-label="Permalink to "Type parameters""></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;">extends <a href="./../../game/persistence#state"><code>State</code></a></td></tr></tbody></table><h4 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to "Parameters""></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>defaultValue</code></td><td style="text-align:left;"><code>Ref</code><<code>T</code>></td></tr><tr><td style="text-align:left;"><code>displayName?</code></td><td style="text-align:left;"><code>string</code></td></tr><tr><td style="text-align:left;"><code>precision?</code></td><td style="text-align:left;"><code>number</code></td></tr><tr><td style="text-align:left;"><code>small?</code></td><td style="text-align:left;"><code>boolean</code></td></tr></tbody></table><h4 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to "Returns""></a></h4><p><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<code>T</code>></p><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L34" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:34</a></p><hr><h3 id="displayresource" tabindex="-1">displayResource <a class="header-anchor" href="#displayresource" aria-label="Permalink to "displayResource""></a></h3><p>▸ <strong>displayResource</strong>(<code>resource</code>, <code>overrideAmount?</code>): <code>string</code></p><p>Utility for displaying a resource with the correct precision.</p><h4 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-label="Permalink to "Parameters""></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>resource</code></td><td style="text-align:left;"><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>></td></tr><tr><td style="text-align:left;"><code>overrideAmount?</code></td><td style="text-align:left;"><a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a></td></tr></tbody></table><h4 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-label="Permalink to "Returns""></a></h4><p><code>string</code></p><h4 id="defined-in-2" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-2" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L153" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:153</a></p><hr><h3 id="trackbest" tabindex="-1">trackBest <a class="header-anchor" href="#trackbest" aria-label="Permalink to "trackBest""></a></h3><p>▸ <strong>trackBest</strong>(<code>resource</code>): <code>Ref</code><<a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a>></p><p>Returns a reference to the highest amount of the resource ever owned, which is updated automatically.</p><h4 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" aria-label="Permalink to "Parameters""></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>resource</code></td><td style="text-align:left;"><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>></td></tr></tbody></table><h4 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-label="Permalink to "Returns""></a></h4><p><code>Ref</code><<a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a>></p><h4 id="defined-in-3" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-3" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L64" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:64</a></p><hr><h3 id="trackoomps" tabindex="-1">trackOOMPS <a class="header-anchor" href="#trackoomps" aria-label="Permalink to "trackOOMPS""></a></h3><p>▸ <strong>trackOOMPS</strong>(<code>resource</code>, <code>pointGain?</code>): <code>Ref</code><<code>string</code>></p><p>Returns a reference to the amount of resource being gained in terms of orders of magnitude per second, calcualted over the last tick. Useful for situations where the gain rate is increasing very rapidly.</p><h4 id="parameters-4" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-4" aria-label="Permalink to "Parameters""></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>resource</code></td><td style="text-align:left;"><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>></td></tr><tr><td style="text-align:left;"><code>pointGain?</code></td><td style="text-align:left;"><code>ComputedRef</code><<a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>></td></tr></tbody></table><h4 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-label="Permalink to "Returns""></a></h4><p><code>Ref</code><<code>string</code>></p><h4 id="defined-in-4" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-4" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L94" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:94</a></p><hr><h3 id="tracktotal" tabindex="-1">trackTotal <a class="header-anchor" href="#tracktotal" aria-label="Permalink to "trackTotal""></a></h3><p>▸ <strong>trackTotal</strong>(<code>resource</code>): <code>Ref</code><<a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a>></p><p>Returns a reference to the total amount of the resource gained, updated automatically. "Refunds" count as gain.</p><h4 id="parameters-5" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-5" aria-label="Permalink to "Parameters""></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>resource</code></td><td style="text-align:left;"><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>></td></tr></tbody></table><h4 id="returns-5" tabindex="-1">Returns <a class="header-anchor" href="#returns-5" aria-label="Permalink to "Returns""></a></h4><p><code>Ref</code><<a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a>></p><h4 id="defined-in-5" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-5" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L78" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:78</a></p><hr><h3 id="unwrapresource" tabindex="-1">unwrapResource <a class="header-anchor" href="#unwrapresource" aria-label="Permalink to "unwrapResource""></a></h3><p>▸ <strong>unwrapResource</strong>(<code>resource</code>): <a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a></p><p>Utility for unwrapping a resource that may or may not be inside a ref.</p><h4 id="parameters-6" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-6" aria-label="Permalink to "Parameters""></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>resource</code></td><td style="text-align:left;"><a href="./../../util/computed#processedcomputable"><code>ProcessedComputable</code></a><<a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a><<a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>>></td></tr></tbody></table><h4 id="returns-6" tabindex="-1">Returns <a class="header-anchor" href="#returns-6" aria-label="Permalink to "Returns""></a></h4><p><a href="../../../interfaces/features/resources/resource.Resource"><code>Resource</code></a></p><h4 id="defined-in-6" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-6" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/resources/resource.ts#L162" target="_blank" rel="noreferrer">profectus/src/features/resources/resource.ts:162</a></p>',76),c=[s];function d(l,i,n,u,h,f){return r(),t("div",null,c)}const b=e(o,[["render",d]]);export{m as __pageData,b as default};
|