Repository navigation
Conversation
…Season context Allow saves without ExpeditionContext (standard saves that never joined an expedition) and saves without BaseContext (standalone seasonal expedition saves) to validate and load properly. Add default implementations for SaveRoot context fields and support ActiveContext: 'Season'.
This file contains hidden or 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
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.
Summary
This PR fixes a bug in save-file validation where
nms-saveasserted that bothBaseContextandExpeditionContextmust always be present in the save file JSON.In vanilla No Man's Sky saves:
ActiveContext: "Main") only haveBaseContext;ExpeditionContextis omitted entirely.ActiveContext: "Season") only haveExpeditionContext;BaseContextis omitted entirely.Previously, attempting to load a standard save without
ExpeditionContextresulted in:And attempting to load a standalone expedition save resulted in:
Changes
crates/nms-save/src/validated.rs:context_valueandvalidate_contextso that inactive context objects are optional (Option<&Map<String, Value>>)."Season"to the check foractive_is_expedition.crates/nms-save/src/model.rs:#[serde(default)]tobase_contextandexpedition_contextinSaveRoot.#[serde(default = "default_active_context")]toactive_contextinSaveRoot.crates/nms-save/src/convert.rs:"Season"toactive_player_state()context matcher alongside"Expedition".crates/nms-save/tests/validated_save.rs:test_checked_parser_accepts_saves_with_only_active_context).test_checked_parser_keeps_active_selector_and_required_context_container_rulesso only the active context is asserted as required.Testing
cargo test --workspace): all passed.