diff --git a/engine/core/Engine.ts b/engine/core/Engine.ts index 8554f1f..f127d42 100644 --- a/engine/core/Engine.ts +++ b/engine/core/Engine.ts @@ -384,9 +384,9 @@ export class Engine { private initChapterState(chapter: { defaultVariables?: Record }) { if (chapter.defaultVariables) { - this.stateManager.variables = { ...chapter.defaultVariables } - } else { - this.stateManager.init({}) + for (const [key, val] of Object.entries(chapter.defaultVariables)) { + this.stateManager.variables[key] = val + } } this.stateManager.flags = new Set() this.stateManager.history = []