profectus-docs/assets/api_modules_game_persistence.md.24c8859a.js

2 lines
9.8 KiB
JavaScript
Raw Normal View History

import{_ as e,c as t,o as a,a as s}from"./app.ab34650d.js";const g=JSON.parse('{"title":"Module: game/persistence","description":"","frontmatter":{"editLink":false},"headers":[{"level":2,"title":"Type Aliases","slug":"type-aliases"},{"level":3,"title":"Persistent","slug":"persistent"},{"level":3,"title":"State","slug":"state"},{"level":2,"title":"Variables","slug":"variables"},{"level":3,"title":"DefaultValue","slug":"defaultvalue"},{"level":3,"title":"Deleted","slug":"deleted"},{"level":3,"title":"PersistentState","slug":"persistentstate"},{"level":3,"title":"StackTrace","slug":"stacktrace"},{"level":2,"title":"Functions","slug":"functions"},{"level":3,"title":"deletePersistent","slug":"deletepersistent"},{"level":3,"title":"persistent","slug":"persistent-1"}],"relativePath":"api/modules/game/persistence.md","lastUpdated":null}'),r={name:"api/modules/game/persistence.md"},n=s('<h1 id="module-game-persistence" tabindex="-1">Module: game/persistence <a class="header-anchor" href="#module-game-persistence" aria-hidden="true">#</a></h1><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-hidden="true">#</a></h2><h3 id="persistent" tabindex="-1">Persistent <a class="header-anchor" href="#persistent" aria-hidden="true">#</a></h3><p>\u01AC <strong>Persistent</strong>&lt;<code>T</code>&gt;: <code>Ref</code>&lt;<code>T</code>&gt; &amp; { <code>[DefaultValue]</code>: <code>T</code> ; <code>[Deleted]</code>: <code>boolean</code> ; <code>[PersistentState]</code>: <code>Ref</code>&lt;<code>T</code>&gt; ; <code>[StackTrace]</code>: <code>string</code> }</p><p>A Ref that has been augmented with properties to allow it to be saved and loaded within the player save data object.</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-hidden="true">#</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="./persistence.html#state"><code>State</code></a> = <a href="./persistence.html#state"><code>State</code></a></td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/persistence.ts#L48" target="_blank" rel="noopener noreferrer">profectus/src/game/persistence.ts:48</a></p><hr><h3 id="state" tabindex="-1">State <a class="header-anchor" href="#state" aria-hidden="true">#</a></h3><p>\u01AC <strong>State</strong>: <code>string</code> | <code>number</code> | <code>boolean</code> | <a href="./../util/bignum.html#decimalsource"><code>DecimalSource</code></a> | { <code>[key: string]</code>: <a href="./persistence.html#state"><code>State</code></a>; } | { <code>[key: number]</code>: <a href="./persistence.html#state"><code>State</code></a>; }</p><p>This is a union of things that should be safely stringifiable without needing special processes or knowing what to load them in as.</p><ul><li>Decimals aren&#39;t allowed because we&#39;d need to know to parse them back.</li><li>DecimalSources are allowed because the string is a valid value for them</li></ul><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/persistence.ts#L37" target="_blank" rel="noopener noreferrer">profectus/src/game/persistence.ts:37</a></p><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-hidden="true">#</a></h2><h3 id="defaultvalue" tabindex="-1">DefaultValue <a class="header-anchor" href="#defaultvalue" aria-hidden="true">#</a></h3><p>\u2022 <code>Const</code> <strong>DefaultValue</strong>: typeof <a href="./persistence.html#defaultvalue"><code>DefaultValue</code></a></p><p>A symbol used in <a href="./persistence.html#persistent">Persistent</a> objects.</p><p><stron