Home Reference Source
import {Savegame} from 'shapez.io/js/savegame/savegame.js'
public class | source

Savegame

Extends:

ReadWriteProxy → Savegame

Static Method Summary

Static Public Methods
public static
public static

getReaderClass(): typeof BaseSavegameInterface

Constructor Summary

Public Constructor
public

constructor(app: import("../application").Application, param0: object)

Member Summary

Public Members
public

currentData: import("./savegame_typedefs").SavegameData

public
public

Method Summary

Public Methods
public

getCurrentDump(): import("./savegame_typedefs").SerializedGame

Returns the current game dump

public
public

getDefaultData(): import("./savegame_typedefs").SavegameData

Returns the savegames default data

public

Returns a reader to access the data

public

Returns a reader to access external data

public

Returns the real last update of the savegame, not the one of the metadata which could also be the servers one

public

getStatistics(): import("./savegame_typedefs").SavegameStats

Returns the statistics of the savegame

public

Returns if this game has a serialized game dump

public

Returns if this game can be saved on disc

public

migrate(data: import("./savegame_typedefs").SavegameData): *

Migrates the savegames data

public

Updates the savegames metadata

public

setLastUpdate(time: *)

Updates the last update field so we can send the savegame to the server, WITHOUT Saving!

public

updateData(root: import("../game/root").GameRoot): boolean

public

verify(data: import("./savegame_typedefs").SavegameData): *

Verifies the savegames data

public
public

Writes the savegame as well as its metadata

Inherited Summary

From class ReadWriteProxy
public static
public static
public
public
public

Store a debounced handler to prevent double writes

public
public

deleteAsync(): Promise<void>

Deletes the file

public

Actually writes the data asychronously

public
public
public
public
public
public

readAsync(): *

public
public
public

writeAsync(): Promise<void>

Writes the data asychronously, fails if verify() fails.

Static Public Methods

public static getCurrentVersion(): any source

Override:

ReadWriteProxy#getCurrentVersion

Return:

any

public static getReaderClass(): typeof BaseSavegameInterface source

Return:

typeof BaseSavegameInterface

Public Constructors

public constructor(app: import("../application").Application, param0: object) source

Override:

ReadWriteProxy#constructor

Params:

NameTypeAttributeDescription
app import("../application").Application
param0 object
param0.internalId string
param0.metaDataRef import("./savegame_typedefs").SavegameMetadata

Handle to the meta data

Public Members

public currentData: import("./savegame_typedefs").SavegameData source

Override:

ReadWriteProxy#currentData

public internalId: * source

public metaDataRef: * source

Public Methods

public getCurrentDump(): import("./savegame_typedefs").SerializedGame source

Returns the current game dump

Return:

import("./savegame_typedefs").SerializedGame

public getCurrentVersion(): number source

Override:

ReadWriteProxy#getCurrentVersion

Return:

number

public getDefaultData(): import("./savegame_typedefs").SavegameData source

Returns the savegames default data

Override:

ReadWriteProxy#getDefaultData

Return:

import("./savegame_typedefs").SavegameData

public getDumpReader(): BaseSavegameInterface source

Returns a reader to access the data

public getDumpReaderForExternalData(data: *): BaseSavegameInterface source

Returns a reader to access external data

Params:

NameTypeAttributeDescription
data *

public getRealLastUpdate(): * source

Returns the real last update of the savegame, not the one of the metadata which could also be the servers one

Return:

*

public getStatistics(): import("./savegame_typedefs").SavegameStats source

Returns the statistics of the savegame

Return:

import("./savegame_typedefs").SavegameStats

public hasGameDump(): * source

Returns if this game has a serialized game dump

Return:

*

public isSaveable(): boolean source

Returns if this game can be saved on disc

Return:

boolean

public migrate(data: import("./savegame_typedefs").SavegameData): * source

Migrates the savegames data

Override:

ReadWriteProxy#migrate

Params:

NameTypeAttributeDescription
data import("./savegame_typedefs").SavegameData

Return:

*

public saveMetadata(): * source

Updates the savegames metadata

Return:

*

public setLastUpdate(time: *) source

Updates the last update field so we can send the savegame to the server, WITHOUT Saving!

Params:

NameTypeAttributeDescription
time *

public updateData(root: import("../game/root").GameRoot): boolean source

Params:

NameTypeAttributeDescription
root import("../game/root").GameRoot

Return:

boolean

public verify(data: import("./savegame_typedefs").SavegameData): * source

Verifies the savegames data

Override:

ReadWriteProxy#verify

Params:

NameTypeAttributeDescription
data import("./savegame_typedefs").SavegameData

Return:

*

public writeAsync(): Promise<any> source

Writes the data asychronously, fails if verify() fails. Debounces the operation by up to 50ms

Override:

ReadWriteProxy#writeAsync

Return:

Promise<any>

See:

public writeSavegameAndMetadata(): * source

Writes the savegame as well as its metadata

Return:

*