Module: game/player
Interfaces
Player
• Player: Object
The player save data object.
Name | Type | Description |
---|---|---|
autosave | boolean | Whether or not to automatically save every couple of seconds and on tab close. |
devSpeed | null | number | A multiplier for time passing. Set to 0 when the game is paused. |
id | string | The ID of this save. |
keepGoing | boolean | Whether or not to continue playing after hasWon is true. |
layers | Record <string , LayerData <unknown >> | A dictionary of layer save data. |
modID | string | The ID of this project, to make sure saves aren't imported into the wrong project. |
modVersion | string | The version of the project this save was created by. Used for upgrading saves for new versions. |
name | string | The display name of this save. |
offlineProd | boolean | Whether or not to apply offline time when loading this save. |
offlineTime | null | number | How much offline time has been accumulated and not yet processed. |
tabs | string [] | The open tabs. |
time | number | The current time this save was last opened at, in ms since the unix epoch. |
timePlayed | number | How long, in ms, this game has been played. |
Defined in
profectus/src/game/player.ts:5
Type Aliases
LayerData
Ƭ LayerData<T
>: { [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] }
A layer's save data. Automatically unwraps refs.
Type parameters
Name |
---|
T |
Defined in
profectus/src/game/player.ts:35
Variables
default
• default: Object
Type declaration
Name | Type | Description |
---|---|---|
autosave | boolean | Whether or not to automatically save every couple of seconds and on tab close. |
devSpeed | null | number | A multiplier for time passing. Set to 0 when the game is paused. |
id | string | The ID of this save. |
keepGoing | boolean | Whether or not to continue playing after hasWon is true. |
layers | Record <string , LayerData <unknown >> | A dictionary of layer save data. |
modID | string | The ID of this project, to make sure saves aren't imported into the wrong project. |
modVersion | string | The version of the project this save was created by. Used for upgrading saves for new versions. |
name | string | The display name of this save. |
offlineProd | boolean | Whether or not to apply offline time when loading this save. |
offlineTime | null | number | How much offline time has been accumulated and not yet processed. |
tabs | string [] | The open tabs. |
time | number | The current time this save was last opened at, in ms since the unix epoch. |
timePlayed | number | How long, in ms, this game has been played. |
Defined in
profectus/src/game/player.ts:63
Functions
stringifySave
▸ stringifySave(player
): string
Convert a player save data object into a JSON string. Unwraps refs.
Parameters
Name | Type |
---|---|
player | Player |
Returns
string