-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a base JsonFile
implementation for extension, as well as a SaveDataCache
extension of JsonFile
for working with per-mod-per-saveslot cached data
#233
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…aHandler` that can be used to automatically read/write to from a json file that is per-mod-per-save.
…t to `false`. Improved comments.
Builds b2479a6SubnauticaStableExperimentalBelow ZeroStableExperimental |
…er than deep storage, and reverted the change to createFileIfNotExist.
…taCache, and changed the way it handles updating the player position to utilise the OnStartedSaving etc. events of SaveDataCache, inherited from JsonFile.
Builds a3634f5SubnauticaStableExperimentalBelow ZeroStableExperimental |
…since for this mod they will work just fine as variables within the `Patch` method.
MrPurple6411
approved these changes
Jul 10, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks useful, Builds on all branches, Example mod loads and saved player position on save, Doesnt seem to break my 136 mod loadout. I think it works 👍🏻
Merged
…sIncludedConverters` of `JsonFile`, and subsequently removing the override from `SaveDataCache` that adds these converters.
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes made in this pull request
JsonFile
abstract implementation ofIJsonFile
, to alow easy extension in a similar manner to howConfigFile
operates.SaveDataCache
abstract extension ofJsonFile
, which is intended to be used as a per-mod-per-saveslot data cache. Multiple can be used per mod. It automatically generates the file path based on the game's SaveLoadManager.GetTemporaryStoragePath() and the SaveDataCache's defining QMod, i.e.:Subnautica\TempSave\tmp964151\SMLHelperExampleMod\player_position.json
.This data will be moved into/out of deep storage as per normal, whenever the game is saved and loaded.
SaveDataHandler
, which allows an API consumer to easily register aSaveDataCache
to be automatically loaded and saved when appropriate.SaveDataHandler
auto-loading theSaveDataCache
files, adds public methods to theInGameMenuHandler
:RegisterOnLoadEvent
,UnregisterOnLoadEvent
andRegisterOneTimeUseOnLoadEvent
as companions to the methods already provided, which trigger when the game loads into the "Main" scene.ExampleMod
to show a basic usage ofSaveDataCache
.Examples
JsonFile
SaveDataCache
JsonFile
implementations, similar toConfigFile
, have publicOnStartedLoading
/OnFinishedLoading
&OnStartedSaving
/OnFinishedSaving
events, and sinceSaveDataCache
extendsJsonFile
, you can easily hook up to these events if you need to react to the save/loads and do a bunch of processing, for example spawning in items in the correct locations.Like with
ConfigFile
, it is entirely possible to useSaveDataCache
without using theSaveDataHandler
, but you will be responsible for handling when to save and load the data yourself.If no
FileNameAttribute
is provided, the default filename is the QMod's id.Builds a3634f5
Subnautica
Stable
SMLHelper
Example Mod
Experimental
SMLHelper
Example Mod
Below Zero
Stable
SMLHelper Zero
Example Mod
Experimental
SMLHelper Zero
Example Mod