Module ...
Savefile code T-Engine4 savefiles are direct serialization of in game objects
Basically the engine is told to save your Game instance and then it will recursively save all that it contains: level, map, entities, your own objects, ...
The savefile structure is a zip file that contains one file per object to be saved. Unzip one, it is quite obvious
A simple object (that does not do anything too fancy in its constructor) will save/load without anything to code, it's magic!
For more complex objects, look at the methods save() and loaded() in objects that have them
Functions
_M:check () | Checks for existence |
_M:close () | Finishes up a savefile Always call it once done |
_M:delete () | Delete the savefile, if needed |
_M:init (savefile, coroutine) | Init a savefile |
_M:loadEntity (name) | Loads an entity |
_M:loadGame () | Loads a game |
_M:loadGameSize () | Loads a game |
_M:loadLevel (zone, level) | Loads a level |
_M:loadQuickBirth () | Load the given birth descriptors, used for quick start |
_M:loadWorld () | Loads a world |
_M:loadWorldSize () | Loads a world |
_M:loadZone (zone) | Loads a zone |
_M:nameLoadEntity (name) | Get a savename for an entity |
_M:nameLoadGame () | Get a savename for a game |
_M:nameLoadLevel (zone, level) | Get a savename for a level |
_M:nameLoadWorld () | Get a savename for a world |
_M:nameLoadZone (zone) | Get a savename for a zone |
_M:nameSaveEntity (e) | Get a savename for an entity |
_M:nameSaveGame (game) | Get a savename for a game |
_M:nameSaveLevel (level) | Get a savename for a level |
_M:nameSaveWorld (world) | Get a savename for a world |
_M:nameSaveZone (zone) | Get a savename for a zone |
_M:saveEntity (e, no_dialog) | Save an entity |
_M:saveGame (game, no_dialog) | Save the given game |
_M:saveLevel (level, no_dialog) | Save a level |
_M:saveQuickBirth (descriptor) | Save the given birth descriptors, used for quick start |
_M:saveScreenshot (screenshot) | Saves the screenshot of a game |
_M:saveWorld (world, no_dialog) | Save the given world |
_M:saveZone (zone, no_dialog) | Save a zone |
Functions
- _M:check ()
- Checks for existence
- _M:close ()
- Finishes up a savefile Always call it once done
- _M:delete ()
- Delete the savefile, if needed
- _M:init (savefile, coroutine)
-
Init a savefile
Parameters
- savefile: the name of the savefile, usually the player's name. It will be sanitized so dont bother doing it
- coroutine: if true the saving will yield sometimes to let other code run
- _M:loadEntity (name)
-
Loads an entity
Parameters
- name:
- _M:loadGame ()
- Loads a game
- _M:loadGameSize ()
- Loads a game
- _M:loadLevel (zone, level)
-
Loads a level
Parameters
- zone:
- level:
- _M:loadQuickBirth ()
- Load the given birth descriptors, used for quick start
- _M:loadWorld ()
- Loads a world
- _M:loadWorldSize ()
- Loads a world
- _M:loadZone (zone)
-
Loads a zone
Parameters
- zone:
- _M:nameLoadEntity (name)
-
Get a savename for an entity
Parameters
- name:
- _M:nameLoadGame ()
- Get a savename for a game
- _M:nameLoadLevel (zone, level)
-
Get a savename for a level
Parameters
- zone:
- level:
- _M:nameLoadWorld ()
- Get a savename for a world
- _M:nameLoadZone (zone)
-
Get a savename for a zone
Parameters
- zone:
- _M:nameSaveEntity (e)
-
Get a savename for an entity
Parameters
- e:
- _M:nameSaveGame (game)
-
Get a savename for a game
Parameters
- game:
- _M:nameSaveLevel (level)
-
Get a savename for a level
Parameters
- level:
- _M:nameSaveWorld (world)
-
Get a savename for a world
Parameters
- world:
- _M:nameSaveZone (zone)
-
Get a savename for a zone
Parameters
- zone:
- _M:saveEntity (e, no_dialog)
-
Save an entity
Parameters
- e:
- no_dialog:
- _M:saveGame (game, no_dialog)
-
Save the given game
Parameters
- game:
- no_dialog:
- _M:saveLevel (level, no_dialog)
-
Save a level
Parameters
- level:
- no_dialog:
- _M:saveQuickBirth (descriptor)
-
Save the given birth descriptors, used for quick start
Parameters
- descriptor:
- _M:saveScreenshot (screenshot)
-
Saves the screenshot of a game
Parameters
- screenshot:
- _M:saveWorld (world, no_dialog)
-
Save the given world
Parameters
- world:
- no_dialog:
- _M:saveZone (zone, no_dialog)
-
Save a zone
Parameters
- zone:
- no_dialog: