feat: P25 conditional routing, nextScene supports Choice[] with conditions
This commit is contained in:
@@ -41,8 +41,16 @@ function collectReachable(startId: string, chapterId: string): Set<string> {
|
||||
queue.push(c.targetScene)
|
||||
}
|
||||
}
|
||||
if (scene.nextScene && !visited.has(scene.nextScene) && !isOtherChapterStart(scene.nextScene, chapterId))
|
||||
queue.push(scene.nextScene)
|
||||
if (scene.nextScene) {
|
||||
if (Array.isArray(scene.nextScene)) {
|
||||
for (const r of scene.nextScene) {
|
||||
if (!visited.has(r.targetScene) && !isOtherChapterStart(r.targetScene, chapterId))
|
||||
queue.push(r.targetScene)
|
||||
}
|
||||
} else if (!visited.has(scene.nextScene) && !isOtherChapterStart(scene.nextScene, chapterId)) {
|
||||
queue.push(scene.nextScene)
|
||||
}
|
||||
}
|
||||
if (scene.qte) {
|
||||
if (scene.qte.successScene && !visited.has(scene.qte.successScene) && !isOtherChapterStart(scene.qte.successScene, chapterId))
|
||||
queue.push(scene.qte.successScene)
|
||||
@@ -157,7 +165,13 @@ function buildPlayerTree(sceneId: string, chapterId: string, depth: number, path
|
||||
if (scene.choices) {
|
||||
for (const c of scene.choices) pushChild(c.targetScene)
|
||||
}
|
||||
pushChild(scene.nextScene)
|
||||
if (scene.nextScene) {
|
||||
if (Array.isArray(scene.nextScene)) {
|
||||
for (const r of scene.nextScene) pushChild(r.targetScene)
|
||||
} else {
|
||||
pushChild(scene.nextScene)
|
||||
}
|
||||
}
|
||||
if (scene.qte) {
|
||||
pushChild(scene.qte.successScene)
|
||||
pushChild(scene.qte.failScene)
|
||||
|
||||
Reference in New Issue
Block a user