English
core/quests/sources/common.ts
Generated from the exports of core/quests/sources/common.ts · npm run docs:gen
Shared by the quest sources (lot Q2): texts given by the caller, slugs that the save accepts, the window an incident stays visible after it was solved. Pure: no DOM, no clock of its own, no file.
Standards that cite this file: No standard page cites this file yet.
Exports
Say type
Texts of a source, by key, in every language (the client reads them from content/copy/<lang>/generated.json).
ts
type Say = (key: string, vars?: Record<string, string>) => Text;sayFrom function
A Say over copy tables: {name} is filled with vars; a key missing in a language falls back to English.
ts
function sayFrom(copy: Partial<Record<"en" | "fr", Record<string, string>>>): SaysayOwn function
The text of key.variant when the copy has it, the text of key otherwise.
ts
function sayOwn(say: Say, key: string, variant: string, vars?: Record<string, string>)same const
The same text in every language (a name read on the machine is never translated).
ts
const same = (s: string): Text => …slug function
A part of a uid: lower case, digits and dashes, at most 60 characters (the bounds of server/save.mjs).
ts
function slug(id: string): stringrecentlySolved function
An incident solved less than 24 h ago stays visible (done); a relapse in that time is the same incident.
ts
function recentlySolved(save: Save, id: string, now: number): booleanstillOpen const
An incident still open in the save.
ts
const stillOpen = (save: Save, id: string): boolean => …generatedBranch function
A generated branch: reserved id, one act, no skills; null when it has no quest.
ts
function generatedBranch(id: string, title: Text, act: Text, quests: Branch["quests"]): Branch | null