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> }) {
|
private initChapterState(chapter: { defaultVariables?: Record<string, number> }) {
|
||||||
if (chapter.defaultVariables) {
|
if (chapter.defaultVariables) {
|
||||||
this.stateManager.variables = { ...chapter.defaultVariables }
|
for (const [key, val] of Object.entries(chapter.defaultVariables)) {
|
||||||
} else {
|
this.stateManager.variables[key] = val
|
||||||
this.stateManager.init({})
|
}
|
||||||
}
|
}
|
||||||
this.stateManager.flags = new Set()
|
this.stateManager.flags = new Set()
|
||||||
this.stateManager.history = []
|
this.stateManager.history = []
|
||||||
|
|||||||
Reference in New Issue
Block a user