documentation improvements

This commit is contained in:
Daniel Bulant 2021-08-31 15:48:47 +02:00
parent 388482a22a
commit a58c1dc807
3 changed files with 40 additions and 21 deletions

View file

@ -27,7 +27,7 @@ function sc(type) {
} }
/** /**
* @type { * @type {{
[key: string]: { [key: string]: {
background: string, background: string,
sprite: string, sprite: string,
@ -45,7 +45,7 @@ function sc(type) {
stopsClouds?: boolean stopsClouds?: boolean
}[] }[]
} }
} }}
*/ */
export const maps = { export const maps = {
uriel: { uriel: {

View file

@ -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", art: "uriel_idle",
title: "the gate guardian", title: "the gate guardian",
poses: { poses: {
@ -8,7 +28,7 @@ export const characters = [{
bat: "uriel_angry" bat: "uriel_angry"
} }
}, { }, {
name: "Michael", name: c("Michael"),
art: "michael_idle", art: "michael_idle",
title: "the high marshal", title: "the high marshal",
poses: { poses: {
@ -16,7 +36,7 @@ export const characters = [{
happy: "michael_happy" happy: "michael_happy"
} }
}, { }, {
name: "Uziel", name: c("Uziel"),
art: "uziel_idle", art: "uziel_idle",
title: "the chief commissar", title: "the chief commissar",
poses: { poses: {
@ -24,7 +44,7 @@ export const characters = [{
dead: "uziel_angry" dead: "uziel_angry"
} }
}, { }, {
name: "Gabriel", name: c("Gabriel"),
art: "gabriel_idle", art: "gabriel_idle",
title: "the administrator", title: "the administrator",
poses: { poses: {
@ -32,7 +52,7 @@ export const characters = [{
sad: "gabriel_fail" sad: "gabriel_fail"
} }
}, { }, {
name: "Azrael", name: c("Azrael"),
art: "azrael_idle", art: "azrael_idle",
title: "the great executioner", title: "the great executioner",
poses: { poses: {
@ -40,10 +60,10 @@ export const characters = [{
angry: "azrael_angry" angry: "azrael_angry"
} }
}, { }, {
name: "Hadraniel", name: c("Hadraniel"),
title: "the seraphim" title: "the seraphim"
}, { }, {
name: "Yahweh", name: c("Yahweh"),
title: "the all-seeing", title: "the all-seeing",
art: "yahweh_idle", art: "yahweh_idle",
poses: { poses: {
@ -52,4 +72,4 @@ export const characters = [{
confuse: "yahweh_confuse", confuse: "yahweh_confuse",
happy: "yahweh_happy" happy: "yahweh_happy"
} }
}]; });

View file

@ -9,16 +9,15 @@ export const chapters = {
/** /**
* @type {{ * @type {{
* name: string, * name: string,
* background: string, * character: typeof import("./characters").characters[number]["name"],
* character: string, * text: string,
* text: string, * next?: string,
* next?: string, * pose?: string,
* pose?: string, * map?: "uriel" | "michael" | "uziel",
* map?: string, * chapter?: keyof typeof chapters,
* chapter?: keyof typeof chapters, * chapterStart?: keyof typeof chapters,
* chapterStart?: keyof typeof chapters, * buttons: { text: string, next: string }[],
* buttons: { text: string, next: string }[], * flags?: ("nosave" | "chapters" | "menu" | "success" | "failure")[]
* flags?: string[]
* }[]} * }[]}
*/ */
export const dialog = [{ export const dialog = [{