Fix custom dealer inventory restoration after reload - #261
Merged
Conversation
ifBars
approved these changes
Aug 12, 2026
ifBars
left a comment
Owner
There was a problem hiding this comment.
Verified after reproducing two blockers in the original PR and pushing follow-up commit 1679a38:
- Current native NPCInventory no longer exposes the legacy SlotCount member, so custom inventories could remain at zero slots before restoration. The follow-up preserves positive legacy/data/current counts and uses the vanilla five-slot default only for empty custom NPC inventories.
- IL2CPP Delegate.Combine returned Il2CppSystem.Delegate and the CLR cast to Il2CppSystem.Action failed. The follow-up uses the established typed Il2CppInterop Cast path.
Validation:
- MonoMelon build: 0 warnings, 0 errors; focused persistence tests 8/8; full suite 569/569.
- Il2CppMelon build: 0 warnings, 0 errors; focused persistence tests 8/8; full suite 558/558.
- Live disposable-save smoke passed separately on Mono and IL2CPP across save -> Menu -> reload. Primary slot 0 retained banana x7, slot 1 remained empty, slot 2 retained baseball bat x1, overflow slot 1 retained banana x3, and base dealer brad_crosby remained unchanged.
- AssetRipper inspection confirmed NPCInventory is prefab-attached while slots are runtime-created, and all 114 exported NPC inventory data assets use five slots.
- No public API, save identifier, network payload, or base-NPC behavior changes.
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 #259.
Diffuin response
Confidence: Medium
Implemented the approved custom dealer inventory persistence fix and focused regression coverage. Primary inventory now restores once after slot initialization in NPCLoader_Load_Prefix. The obsolete Awake-dependent queue was removed, while dealer overflow and base-game paths remain unchanged. No public API or durable save identifiers changed.
Recommended next steps
Evidence and validation
Evidence inspected
Validation performed
Runtime validation remaining
Diffuin run details
codexgpt-5.6-solhigh(Luna advisor: risk (high); baseline bounded implementation)019ff307-8494-7fd0-9485-60573d93228aAI notice: Generated with AI assistance and not guaranteed accurate. Verify findings and plans against the current source and runtime.
Closes #259
Diffuin job:
7ebc2622-05d0-4ea4-a091-9ce4dd73133aCommit:
a849e27435d552f34c426f8b94e5883eb4147a99