1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-20 21:06:48 +08:00
parent 1c72066bab
commit 75944b1f1f
102 changed files with 9648 additions and 1540 deletions

View File

@@ -140,6 +140,15 @@ function toText(value: unknown, fallback = '') {
return typeof value === 'string' ? value.trim() : fallback;
}
function toRecordArray(value: unknown) {
return Array.isArray(value)
? value.filter(
(entry): entry is Record<string, unknown> =>
Boolean(entry) && typeof entry === 'object',
)
: [];
}
function toStringArray(value: unknown) {
return Array.isArray(value)
? value
@@ -858,10 +867,22 @@ function normalizeCampScene(
}
return {
id: toText(value.id, fallback.id),
name: toText(value.name, fallback.name),
description: toText(value.description, fallback.description),
visualDescription: toText(value.visualDescription) || undefined,
dangerLevel: toText(value.dangerLevel, fallback.dangerLevel),
imageSrc: toText(value.imageSrc) || undefined,
sceneNpcIds: toStringArray(value.sceneNpcIds),
connections: toRecordArray(value.connections)
.map((connection) => ({
targetLandmarkId: toText(connection.targetLandmarkId),
relativePosition:
toText(connection.relativePosition) || toText(connection.position) || 'forward',
summary: toText(connection.summary) || toText(connection.description),
}))
.filter((connection) => connection.targetLandmarkId),
narrativeResidues: null,
};
}
@@ -950,6 +971,7 @@ function normalizeSceneActBlueprint(
? ['opening']
: ['climax', 'aftermath'],
backgroundImageSrc: toText(value.backgroundImageSrc) || undefined,
backgroundAssetId: toText(value.backgroundAssetId) || undefined,
encounterNpcIds,
primaryNpcId: toText(value.primaryNpcId, encounterNpcIds[0] ?? ''),
linkedThreadIds: toStringArray(value.linkedThreadIds),