1 line
7.3 KiB
JavaScript
1 line
7.3 KiB
JavaScript
import{_ as e,c as t,o as a,N as l}from"./chunks/framework.0799945b.js";const p=JSON.parse('{"title":"Module: game/player","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/player.md","lastUpdated":null}'),r={name:"api/modules/game/player.md"},d=l('<h1 id="module-game-player" tabindex="-1">Module: game/player <a class="header-anchor" href="#module-game-player" aria-label="Permalink to "Module: game/player""></a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to "Interfaces""></a></h2><ul><li><a href="../../interfaces/game/player.Player">Player</a></li></ul><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-label="Permalink to "Type Aliases""></a></h2><h3 id="layerdata" tabindex="-1">LayerData <a class="header-anchor" href="#layerdata" aria-label="Permalink to "LayerData""></a></h3><p>Ƭ <strong>LayerData</strong><<code>T</code>>: { [P in keyof T]?: T[P] extends (infer U)[] ? Record<string, LayerData<U>> : T[P] extends Record<string, never> ? never : T[P] extends Ref<infer S> ? S : T[P] extends object ? LayerData<T[P]> : T[P] }</p><p>A layer's save data. Automatically unwraps refs.</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></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr></tbody></table><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/70cda5f/src/game/player.ts#L35" target="_blank" rel="noreferrer">profectus/src/game/player.ts:35</a></p><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-label="Permalink to "Variables""></a></h2><h3 id="default" tabindex="-1">default <a class="header-anchor" href="#default" aria-label="Permalink to "default""></a></h3><p>• <strong>default</strong>: <code>Object</code></p><h4 id="type-declaration" tabindex="-1">Type declaration <a class="header-anchor" href="#type-declaration" aria-label="Permalink to "Type declaration""></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>autosave</code></td><td style="text-align:left;"><code>boolean</code></td><td style="text-align:left;">Whether or not to automatically save every couple of seconds and on tab close.</td></tr><tr><td style="text-align:left;"><code>devSpeed</code></td><td style="text-align:left;"><code>null</code> | <code>number</code></td><td style="text-align:left;">A multiplier for time passing. Set to 0 when the game is paused.</td></tr><tr><td style="text-align:left;"><code>id</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The ID of this save.</td></tr><tr><td style="text-align:left;"><code>keepGoing</code></td><td style="text-align:left;"><code>boolean</code></td><td style="text-align:left;">Whether or not to continue playing after <a href="./../data/projEntry#haswon">hasWon</a> is true.</td></tr><tr><td style="text-align:left;"><code>layers</code></td><td style="text-align:left;"><a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <a href="./player#layerdata"><code>LayerData</code></a><<code>unknown</code>>></td><td style="text-align:left;">A dictionary of layer save data.</td></tr><tr><td style="text-align:left;"><code>modID</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The ID of this project, to make sure saves aren't imported into the wrong project.</td></tr><tr><td style="text-align:left;"><code>modVersion</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The version of the project this save was created by. Used for upgrading saves for new versions.</td></tr><tr><td style="text-align:left;"><code>name</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The display name of this save.</td></tr><tr><td style="text-align:left;"><code>offlineProd</code></td><td style="text-align:left;"><code>boolean</code></td><td style="text-align:left;">Whether or not to apply offline time when loading this save.</td></tr><tr><td style="text-align:left;"><code>offlineTime</code></td><td style="text-align:left;"><code>null</code> | <code>number</code></td><td style="text-align:left;">How much offline time has been accumulated and not yet processed.</td></tr><tr><td style="text-align:left;"><code>tabs</code></td><td style="text-align:left;"><code>string</code>[]</td><td style="text-align:left;">The open tabs.</td></tr><tr><td style="text-align:left;"><code>time</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">The current time this save was last opened at, in ms since the unix epoch.</td></tr><tr><td style="text-align:left;"><code>timePlayed</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">How long, in ms, this game has been played.</td></tr></tbody></table><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/70cda5f/src/game/player.ts#L63" target="_blank" rel="noreferrer">profectus/src/game/player.ts:63</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to "Functions""></a></h2><h3 id="stringifysave" tabindex="-1">stringifySave <a class="header-anchor" href="#stringifysave" aria-label="Permalink to "stringifySave""></a></h3><p>▸ <strong>stringifySave</strong>(<code>player</code>): <code>string</code></p><p>Convert a player save data object into a JSON string. Unwraps refs.</p><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></tr></thead><tbody><tr><td style="text-align:left;"><code>player</code></td><td style="text-align:left;"><a href="../../interfaces/game/player.Player"><code>Player</code></a></td></tr></tbody></table><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" 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/70cda5f/src/game/player.ts#L66" target="_blank" rel="noreferrer">profectus/src/game/player.ts:66</a></p>',28),o=[d];function n(s,i,c,f,h,y){return a(),t("div",null,o)}const u=e(r,[["render",n]]);export{p as __pageData,u as default};
|