Skip to content

Profectus / game/persistence / Persistent

Type Alias: Persistent<T> ​

Persistent<T>: Ref<T> & object

A Ref that has been augmented with properties to allow it to be saved and loaded within the player save data object.

Type declaration ​

[CheckNaN] ​

[CheckNaN]: boolean

Whether or not to NaN-check this ref. Should only be true on values expected to always be DecimalSources.

[DefaultValue] ​

[DefaultValue]: T

The value the ref should be set to in a fresh save, or when updating an old save to the current version.

[Deleted] ​

[Deleted]: boolean

This is a flag that can be set once the option func is evaluated, to mark that a persistent ref should not be saved to the player save data object.

See ​

deletePersistent for marking a persistent ref as deleted.

[NonPersistent] ​

[NonPersistent]: NonPersistent<T>

A non-persistent ref that just reads and writes ot the persistent ref. Used for passing to other features without duplicating the persistent ref in the constructed save data object.

[PersistentState] ​

[PersistentState]: Ref<T>

A flag that this is a persistent property. Typically a circular reference.

[SaveDataPath] ​

[SaveDataPath]: string[] | undefined

The path this persistent appears in within the save data object. Predominantly used to ensure it's only placed in there one time.

[StackTrace] ​

[StackTrace]: string

The stack trace of where the persistent ref was created. This is used for debugging purposes when a persistent ref is created but not placed in its layer object.

value ​

value: T

Type Parameters ​

• T extends State = State

Defined in ​

profectus/src/game/persistence.ts:72