fix: startChapter only overwrites specified defaultVars, no longer clears all variables
This commit is contained in:
@@ -384,9 +384,9 @@ export class Engine {
|
||||
|
||||
private initChapterState(chapter: { defaultVariables?: Record<string, number> }) {
|
||||
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 = []
|
||||
|
||||
Reference in New Issue
Block a user