ESCSaveManager
Extends: RefCounted
Description
Saves and loads savegame and settings files.
Constants
SETTINGS_TEMPLATE
const SETTINGS_TEMPLATE = "settings.tres"
Template for settings filename.
SAVE_NAME_TEMPLATE
const SAVE_NAME_TEMPLATE = "save_%03d.tres"
Template for savegames filenames.
CRASH_SAVE_NAME_TEMPLATE
const CRASH_SAVE_NAME_TEMPLATE = "crash_autosave_%s_%s.tres"
Template for crash savegames filenames.
Members
save_enabled
var save_enabled: bool
If true, saving a game is enabled. Else, saving is disabled.
save_folder
var save_folder: String
Variable containing the saves folder obtained from Project Settings.
crash_savegame_filename
var crash_savegame_filename: String
Filename of the latest crash savegame file.
settings_folder
var settings_folder: String
Variable containing the settings folder obtained from Project Settings.
is_loading_game
var is_loading_game: bool
True if escoria is currently loading a savegame. This is used to avoid RoomManager to execute room’s :setup and :ready events when loading a savegame.
Signals
game_is_loading
signal game_is_loading()
Emitted when the game is starting to load a savegame.
Parameters
None.
game_finished_loading
signal game_finished_loading()
Emitted when the game has finished loading a savegame.
Parameters
None.
Methods
get_saves_list
func get_saves_list() -> Dictionary
Return a list of savegames metadata (id, date, name and game version).
Parameters
None.
Returns
Returns a Dictionary value. (Dictionary)
save_game_exists
func save_game_exists(id: int) -> bool
True whether the savegame identified by id does exist.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
id |
|
Integer suffix of the savegame file. |
yes |
Returns
Returns true whether the savegame identified by id does exist. (bool)
save_game
func save_game(id: int, p_savename: String) -> void
Save the current state of the game in a file suffixed with the id value. This id can help with slots development for the game developer.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
id |
|
Integer suffix of the savegame file. |
yes |
p_savename |
|
Name of the savegame. |
yes |
Returns
Returns nothing.
save_game_crash
func save_game_crash() -> int
Performs an emergency savegame in case of crash.
Parameters
None.
Returns
Returns a int value. (int)
load_game
func load_game(id: int) -> void
Load a savegame file from its id.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
id |
|
Integer suffix of the savegame file. |
yes |
Returns
Returns nothing.