Add Lua "Persistent Object" Serialization #5774
Merged
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.
This PR adds support for serializing "persistent objects", i.e. objects that will always be created at runtime. References to these persistent objects are transparently replaced with references to the "live" copy of the persistent object when loading a saved game, unless that persistent object is no longer present (i.e. incompatible saves) in which case the persistent object is "revivified" from the savefile.
This is a difficult concept to explain, but if you're familiar with how commodity types function currently (where saved copies of a commodity type instance are replaced with the commodity type instance that was created at startup) this is an identical concept but with less manual work required.
The primary goal of this system is to migrate equipment items to use this rather than overwriting all equipment item tables every time a save is loaded. As this is primarily accomplished in #5734, this PR only includes the (bugtested) persistent serialization mechanism itself to avoid necessitating a savebump.
TODO:
Serializer:RegisterPersistent()