profectus-docs/assets/api_modules_game_player.md.0ff6beaf.js

1 line
11 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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}'),d={name:"api/modules/game/player.md"},o=l('<h1 id="module-game-player" tabindex="-1">Module: game/player <a class="header-anchor" href="#module-game-player" aria-label="Permalink to &quot;Module: game/player&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="player" tabindex="-1">Player <a class="header-anchor" href="#player" aria-label="Permalink to &quot;Player&quot;"></a></h3><p>• <strong>Player</strong>: <code>Object</code></p><p>The player save data object.</p><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>&lt;<code>string</code>, <a href="./player#layerdata"><code>LayerData</code></a>&lt;<code>unknown</code>&gt;&gt;</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&#39;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" 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/5c11524/src/game/player.ts#L5" target="_blank" rel="noreferrer">profectus/src/game/player.ts:5</a></p><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-label="Permalink to &quot;Type Aliases&quot;"></a></h2><h3 id="layerdata" tabindex="-1">LayerData <a class="header-anchor" href="#layerdata" aria-label="Permalink to &quot;LayerData&quot;"></a></h3><p>Ƭ <strong>LayerData</strong>&lt;<code>T</code>&gt;: { [P in keyof T]?: T[P] extends (infer U)[] ? Record&lt;string, LayerData&lt;U&gt;&gt; : T[P] extends Record&lt;string, never&gt; ? never : T[P] extends Ref&lt;infer S&gt; ? S : T[P] extends object ? LayerData&lt;T[P]&gt; : T[P] }</p><p>A layer&#39;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 &quot;Type parameters&quot;"></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-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/5c11524/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 &quot;Variables&quot;"></a></h2><h3 id="default" tabindex="-1">default <a class="header-anchor" href="#default" aria-label="Permalink to &quot;default&quot;"></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 &quot;Type declaration&quot;"></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>&lt;<code>string</code>, <a href="./player#layerdata"><code>LayerData</code></a>&lt;<code>unknown</code>&gt;&gt;</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&#39;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-2" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-2" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/5c11524/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 &quot;Functions&quot;"></a></h2><h3 id="stringifysave" tabindex="-1">stringifySave <a class="header-anchor" href="#stringifysave" aria-label="Permalink to &quot;stringifySave&quot;"></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><h5 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></a></h5><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="./player#player"><code>Player</code></a></td></tr></tbody></table><h5 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><code>string</code></p><h4 id="defined-in-3" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-3" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/5c11524/src/game/player.ts#L66" target="_blank" rel="noreferrer">profectus/src/game/player.ts:66</a></p>',33),r=[o];function n(s,i,c,f,h,y){return a(),t("div",null,r)}const u=e(d,[["render",n]]);export{p as __pageData,u as default};