JJM152 / Queen

Queen of the Seas Game
GNU General Public License v2.0
12 stars 13 forks source link

Inventory managers detach from the state variables on file reloading #68

Closed ezsh closed 6 years ago

ezsh commented 6 years ago

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.

ezsh commented 6 years ago

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).