feat(save): persist story flags and node progress in v1
This commit is contained in:
@@ -29,6 +29,9 @@ export const gameStateSchema = z.object({
|
||||
activeActionId: z.string().nullable(),
|
||||
actionElapsedMs: z.number().nonnegative(),
|
||||
actionQueue: z.array(z.string()).default([]),
|
||||
storyFlags: z.record(z.string(), z.boolean()).default({}),
|
||||
currentStoryNodeId: z.string().default(''),
|
||||
seenStoryNodeIds: z.array(z.string()).default([]),
|
||||
});
|
||||
|
||||
export const saveSchema = z.object({
|
||||
@@ -49,6 +52,9 @@ export function createSave(state: GameState, now: number): SaveData {
|
||||
activeActionId: state.activeActionId,
|
||||
actionElapsedMs: state.actionElapsedMs,
|
||||
actionQueue: [...state.actionQueue],
|
||||
storyFlags: { ...state.storyFlags },
|
||||
currentStoryNodeId: state.currentStoryNodeId,
|
||||
seenStoryNodeIds: [...state.seenStoryNodeIds],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user