Summary
Custom dealers added by multiple NPC mods reportedly lose all inventory contents after quitting/reloading a save. The same behavior has been observed with three different custom-NPC mods, which points to a shared S1API persistence path rather than one mod's configuration.
This issue is intentionally limited to inventory persistence:
A similar inventory-loss bug was previously tracked in #61 and fixed by #69, so this may be a regression or a newer load-order variant.
Environment
- Schedule I version: not yet supplied; report followed the recent large game update
- S1API version at reproduction: not yet confirmed; retest on 3.1.14 is needed
- MelonLoader version: not yet supplied
- Runtime: not yet supplied (Mono vs IL2CPP)
- Affected mods: three separate custom-NPC mods were reported, but names were not supplied
Steps to reproduce
- Install S1API and a mod that adds a custom dealer NPC.
- Unlock/recruit the dealer if required.
- Put items into the dealer's inventory and save the game.
- Quit to the menu or exit the game.
- Reload the save.
- Inspect the custom dealer's inventory.
Expected behavior
The custom dealer's saved inventory contents, quantities, and slot state are restored.
Actual behavior
The custom dealer's inventory is empty after reload. Other persisted state, including addiction level and unlocked status, remains intact.
Impact
Players lose all stock assigned to custom dealers whenever they reload, breaking the core dealer loop across multiple NPC mods.
Investigation notes
The current custom-NPC loader deserializes Inventory directly in NPCLoader_Load_Prefix. The dealer-specific load prefix also stores the same payload in _pendingInventoryLoads, which is consumed from the NPCInventory.Awake postfix. Please verify the actual lifecycle ordering after the current game update, particularly whether Awake has already completed before the dealer load queues the pending item set, whether a later initialization/default pass clears restored slots, and whether the affected inventory is NPCInventory, dealer overflow inventory, or both.
Relevant code:
S1API/Internal/Patches/NPCPatches.cs: NPCInventory_Awake_Postfix
S1API/Internal/Patches/NPCPatches.cs: NPCLoader_Load_Prefix
S1API/Internal/Patches/NPCPatches.cs: Dealer_Load_Prefix
Acceptance criteria
- Custom dealer inventory survives save -> quit/menu -> reload with the same items, quantities, and slots.
- Restored inventory is not overwritten by startup/default inventory initialization.
- Dealer overflow inventory continues to restore correctly.
- Base-game NPC/dealer inventory behavior is unchanged.
- The fix is validated separately on Mono and IL2CPP.
- Regression coverage exercises the relevant
NPCInventory.Awake / NPC load / dealer load ordering.
Additional evidence requested
To narrow the regression, please add the exact Schedule I, S1API, MelonLoader, and runtime versions; the affected mod names; and a MelonLoader log from one save/reload cycle.
Summary
Custom dealers added by multiple NPC mods reportedly lose all inventory contents after quitting/reloading a save. The same behavior has been observed with three different custom-NPC mods, which points to a shared S1API persistence path rather than one mod's configuration.
This issue is intentionally limited to inventory persistence:
A similar inventory-loss bug was previously tracked in #61 and fixed by #69, so this may be a regression or a newer load-order variant.
Environment
Steps to reproduce
Expected behavior
The custom dealer's saved inventory contents, quantities, and slot state are restored.
Actual behavior
The custom dealer's inventory is empty after reload. Other persisted state, including addiction level and unlocked status, remains intact.
Impact
Players lose all stock assigned to custom dealers whenever they reload, breaking the core dealer loop across multiple NPC mods.
Investigation notes
The current custom-NPC loader deserializes
Inventorydirectly inNPCLoader_Load_Prefix. The dealer-specific load prefix also stores the same payload in_pendingInventoryLoads, which is consumed from theNPCInventory.Awakepostfix. Please verify the actual lifecycle ordering after the current game update, particularly whetherAwakehas already completed before the dealer load queues the pending item set, whether a later initialization/default pass clears restored slots, and whether the affected inventory isNPCInventory, dealer overflow inventory, or both.Relevant code:
S1API/Internal/Patches/NPCPatches.cs:NPCInventory_Awake_PostfixS1API/Internal/Patches/NPCPatches.cs:NPCLoader_Load_PrefixS1API/Internal/Patches/NPCPatches.cs:Dealer_Load_PrefixAcceptance criteria
NPCInventory.Awake/ NPC load / dealer load ordering.Additional evidence requested
To narrow the regression, please add the exact Schedule I, S1API, MelonLoader, and runtime versions; the affected mod names; and a MelonLoader log from one save/reload cycle.