Skip to content

Class: CSavedGameWrapper

Lightweight view over save-game metadata.

Source

C++ class CSavedGameWrapper

Custom Constructor

CSavedGameWrapper

Remarks

Looks for both current and legacy save extensions under $game_saves$. A missing file asserts; an existing file with an incompatible header returns fallback metadata instead.

Extends

Constructors

Constructor

ts
new CSavedGameWrapper(name: string): CSavedGameWrapper;

Open save-game metadata by save name.

Parameters

ParameterTypeDescription
namestringSave name without extension.

Returns

CSavedGameWrapper

Throws

If the save file does not exist.

Overrides

EngineBinding.constructor

Methods

actor_health()

ts
actor_health(): number;

Get actor health stored in the save.

Returns

number

Actor health.

Remarks

Invalid save headers return 1.


game_time()

ts
game_time(): CTime;

Get in-game time stored in the save.

Returns

CTime

Game time.

Remarks

Invalid save headers return the default ALife time instead of throwing.


level_id()

ts
level_id(): number;

Get active level id stored in the save.

Returns

number

Level id.

Remarks

Returns 255 when level metadata cannot be resolved.


level_name()

ts
level_name(): string;

Get active level name stored in the save.

Returns

string

Level name, or an empty/error value when metadata cannot be resolved.

Remarks

Returns an empty string when level metadata cannot be resolved. Returns the translated error string when the game graph has no matching level id.

Properties

__name

ts
readonly __name: string;

LuaBind instance constructor name.

Inherited from

EngineBinding.__name


__name

ts
readonly static __name: string;

LuaBind class constructor name.

Inherited from

EngineBinding.__name