When story file on disk updates, browser reloads it and SugarCube sets new state variables. Inventory managers do not know about that and continue to work with old objects, that are detached from the actual game state now.
Either we have to handle that event and reset the managers, or we can provide them not the state objects but their names, so the managers can access their state as SugarCube.State.variables[<NAME>] always.
The things seem to be even worse: detachment happens all the time (after sleeping SugarCube.setup.player.Inventory._state.Day != SugarCube.State.variables.PlayerState.Day).
When story file on disk updates, browser reloads it and SugarCube sets new state variables. Inventory managers do not know about that and continue to work with old objects, that are detached from the actual game state now.
Either we have to handle that event and reset the managers, or we can provide them not the state objects but their names, so the managers can access their state as
SugarCube.State.variables[<NAME>]
always.