fix: persist custom NPC deals and relationships - #262
Merged
Conversation
5 tasks
ifBars
approved these changes
Aug 12, 2026
ifBars
left a comment
Owner
There was a problem hiding this comment.
Verified and approved after completing the persistence path on the PR branch.
The original head established deterministic custom-NPC GUIDs and prepared NPCs before QuestsLoader, but live testing exposed two remaining loader-order defects:
- NPCsLoader's legacy path constructed a second custom NPC after QuestsLoader had prepared one, allowing prefab defaults to win during later save serialization.
- IL2CPP contract restoration reached Customer.AssignContract before the inactive custom customer's deal-attendance cache was initialized.
Commit 693c5d6 reuses the exact prepared NPC instance and initializes customer runtime state before contract restoration.
Validation:
- Mono: build succeeded with 0 warnings/errors; 575/575 tests passed.
- IL2CPP: build succeeded with 0 warnings/errors; 564/564 tests passed.
- Live Mono and IL2CPP: strict three-load smoke passed for a custom customer and custom dealer. Non-default relationship values and unlock state persisted, an accepted contract restored to the same deterministic customer GUID, Customer.CurrentContract was assigned, and an explicit zero relationship persisted through another save/reload.
- AssetRipper/native inspection confirmed vanilla NPC prefabs use stable baked GUIDs while the custom BaseEmployee template has no baked GUID, matching the runtime registration approach.
- Refreshed hosted IL2CPP build, coverage, and both documentation checks passed.
Existing saves containing contracts written with the pre-fix random custom-NPC GUID cannot be migrated because ContractData stores only CustomerGUID, not the custom NPC identity ID. Newly saved and future custom-NPC contracts persist correctly.
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.
Requested by @ifBars in #260.
Diffuin response
Confidence: Medium
The worktree is ready for a PR: new custom NPC deals use stable native GUIDs, and saved relationship values survive the deferred spawn lifecycle. Existing contracts created with the old random GUID cannot be repaired from their save payload, so this PR should not close #260 until that migration limit is accepted or addressed.
Recommended next steps
Evidence and validation
Evidence inspected
Validation performed
Runtime validation remaining
Diffuin run details
codexgpt-5.6-terrahigh(Luna advisor: complexity (high); baseline bounded implementation)019ff4fe-5fce-7531-8248-15655413371dAI notice: Generated with AI assistance and not guaranteed accurate. Verify findings and plans against the current source and runtime.
Diffuin job:
d1a3bdda-fd74-4273-aa32-1f1ccbfb1ac9Commit:
23cf7a4099a66e8b8a5ce2db1a01014297bdb5be