Skip to content
On this page

Module: game/player

Interfaces

Player

Player: Object

The player save data object.

NameTypeDescription
autosavebooleanWhether or not to automatically save every couple of seconds and on tab close.
devSpeednull | numberA multiplier for time passing. Set to 0 when the game is paused.
idstringThe ID of this save.
keepGoingbooleanWhether or not to continue playing after hasWon is true.
layersRecord<string, LayerData<unknown>>A dictionary of layer save data.
modIDstringThe ID of this project, to make sure saves aren't imported into the wrong project.
modVersionstringThe version of the project this save was created by. Used for upgrading saves for new versions.
namestringThe display name of this save.
offlineProdbooleanWhether or not to apply offline time when loading this save.
offlineTimenull | numberHow much offline time has been accumulated and not yet processed.
tabsstring[]The open tabs.
timenumberThe current time this save was last opened at, in ms since the unix epoch.
timePlayednumberHow 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

NameTypeDescription
autosavebooleanWhether or not to automatically save every couple of seconds and on tab close.
devSpeednull | numberA multiplier for time passing. Set to 0 when the game is paused.
idstringThe ID of this save.
keepGoingbooleanWhether or not to continue playing after hasWon is true.
layersRecord<string, LayerData<unknown>>A dictionary of layer save data.
modIDstringThe ID of this project, to make sure saves aren't imported into the wrong project.
modVersionstringThe version of the project this save was created by. Used for upgrading saves for new versions.
namestringThe display name of this save.
offlineProdbooleanWhether or not to apply offline time when loading this save.
offlineTimenull | numberHow much offline time has been accumulated and not yet processed.
tabsstring[]The open tabs.
timenumberThe current time this save was last opened at, in ms since the unix epoch.
timePlayednumberHow 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
NameType
playerPlayer
Returns

string

Defined in

profectus/src/game/player.ts:66