diff --git a/src/game/maps.js b/src/game/maps.js index f7f59fb..c3fa801 100644 --- a/src/game/maps.js +++ b/src/game/maps.js @@ -27,7 +27,7 @@ function sc(type) { } /** - * @type { + * @type {{ [key: string]: { background: string, sprite: string, @@ -45,7 +45,7 @@ function sc(type) { stopsClouds?: boolean }[] } - } + }} */ export const maps = { uriel: { diff --git a/src/stores/characters.js b/src/stores/characters.js index bed372e..e5fb0dd 100644 --- a/src/stores/characters.js +++ b/src/stores/characters.js @@ -1,5 +1,25 @@ -export const characters = [{ - name: "Uriel", +/** + * Identity function. Coerces string/number literals to literal types. + * @template {string | number} T + * @param {T} v + * @return {T} + */ +function c(v) { + return v; +} + +/** + * Creates a tuple (array) from the given arguments. + * @template {any[]} T + * @param {T} v + * @return {T} + */ +function t(...v) { + return v; +} + +export const characters = t({ + name: c("Uriel"), art: "uriel_idle", title: "the gate guardian", poses: { @@ -8,7 +28,7 @@ export const characters = [{ bat: "uriel_angry" } }, { - name: "Michael", + name: c("Michael"), art: "michael_idle", title: "the high marshal", poses: { @@ -16,7 +36,7 @@ export const characters = [{ happy: "michael_happy" } }, { - name: "Uziel", + name: c("Uziel"), art: "uziel_idle", title: "the chief commissar", poses: { @@ -24,7 +44,7 @@ export const characters = [{ dead: "uziel_angry" } }, { - name: "Gabriel", + name: c("Gabriel"), art: "gabriel_idle", title: "the administrator", poses: { @@ -32,7 +52,7 @@ export const characters = [{ sad: "gabriel_fail" } }, { - name: "Azrael", + name: c("Azrael"), art: "azrael_idle", title: "the great executioner", poses: { @@ -40,10 +60,10 @@ export const characters = [{ angry: "azrael_angry" } }, { - name: "Hadraniel", + name: c("Hadraniel"), title: "the seraphim" }, { - name: "Yahweh", + name: c("Yahweh"), title: "the all-seeing", art: "yahweh_idle", poses: { @@ -52,4 +72,4 @@ export const characters = [{ confuse: "yahweh_confuse", happy: "yahweh_happy" } -}]; \ No newline at end of file +}); \ No newline at end of file diff --git a/src/stores/dialog.js b/src/stores/dialog.js index 41fd6a5..4ce7038 100644 --- a/src/stores/dialog.js +++ b/src/stores/dialog.js @@ -9,16 +9,15 @@ export const chapters = { /** * @type {{ * name: string, - * background: string, - * character: string, - * text: string, - * next?: string, - * pose?: string, - * map?: string, - * chapter?: keyof typeof chapters, - * chapterStart?: keyof typeof chapters, - * buttons: { text: string, next: string }[], - * flags?: string[] + * character: typeof import("./characters").characters[number]["name"], + * text: string, + * next?: string, + * pose?: string, + * map?: "uriel" | "michael" | "uziel", + * chapter?: keyof typeof chapters, + * chapterStart?: keyof typeof chapters, + * buttons: { text: string, next: string }[], + * flags?: ("nosave" | "chapters" | "menu" | "success" | "failure")[] * }[]} */ export const dialog = [{