ProperSave
Saves your progress at the start of the stage so you can load later
Last updated | 2 months ago |
Total downloads | 1438394 |
Total rating | 163 |
Categories | Mods Tweaks Client-side |
Dependency string | KingEnderBrine-ProperSave-2.11.2 |
Dependants | 495 other packages depend on this package |
This mod requires the following mods to function
bbepis-BepInExPack
Unified BepInEx all-in-one modding pack - plugin framework, detour library
Preferred version: 5.4.1905README
Description
Saves your progress at the start of each stage. You can leave run as soon as the stage started. Only 1 save file for each profile for a singleplayer. If you die, the save will be deleted.
Multiplayer support
Only the host must have this mod for it to work.
A Load
button will be active if you are host and was found suitable save file (if save file has the same set of players as in the current lobby).
Game modes support
Each game mode (Classic
, Eclipse
, Simulacrum
) has it's own save files, so that you can switch between game modes and not losing your progress.
Config options
UseCloudStorage
- Store files in Steam/EpicGames cloud. Enabling this feature would not preserve current saves and disabling it wouldn't clear the cloud.CloudStorageSubDirectory
- Sub directory name for cloud storage. Changing it allows to use different save files for different mod profiles.SavesDirectory
- Directory where save files will be stored. "ProperSave" directory will be created in the directory you have specified. If the directory doesn't exist the default one will be used.
For mod developers
Saving
To save data you need to subscribe to ProperSave.SaveFile.OnGatherSaveData
. It will be called every time the game is saved (this happens on RoR2.Stage.onStageStartGlobal
) to gather info from mods that needs to be saved. You can add any value with any key, but remember that other mods can do the same thing, so keep keys unique (maybe add a mod name in front or something).
I would suggest adding only one object per mod because the type of the object is also stored to be able to deserialize objects, and it can take a lot of space in comparison with stored value.
An object that you add in the dictionary will be serialized to JSON. Here is some info about serialization:
- Only public properties/fields will be serialized.
- You can add
[DataMember()]
attribute fromSystem.Runtime.Serialization
to specify custom name for property/field in json file. - You can add
[IgnoreDataMember]
attribute fromSystem.Runtime.Serialization
to specify that this public property/field should be ignored on serialization.
Loading
Once save file is loaded you can get data you've previously saved and apply it anytime you want. Here are some things that will help you with that:
ProperSave.Loading.IsLoading
- you can use this to check if theProperSave
is loading.ProperSave.Loading.FirstRunStage
- you can use this to check if run is starting. Is set totrue
onRoR2.Run.Start
, is set tofalse
onRoR2.Stage.onStageStartGlobal
ProperSave.Loading.OnLoadingStarted
- event, fired whenIsLoading
set to true (this happens after save file is loaded into memory, before run started).ProperSave.Loading.OnLoadingEnded
- event, fired whenIsLoading
set to false (this happens afterRoR2.TeamManager.Start
because this is the last step of loading process).ProperSave.Loading.CurrentSave
- current save file, you can access it afterOnLoadingStarted
. Will be overwritten every time game is saved.CurrentSave.GetModdedData<Type>("")
- use this method to get data that you've saved.ProperSave.Data
- under this namespace you can find classes used to save some of vanilla data.
Known issues
I tried to save all necessary data so that when you load the game would continue as it should have been without saving.
- Minions would respawn at different positions each time you load the same save file. It's not big of an issue, and there is nothing I can do about it.
- I've not tested this mod much with achievements unlocking, but for most, if not all cases, it should be working as intended.