textadv
Version:
Text Adventures generator from Markdown files
50 lines (49 loc) • 1.19 kB
TypeScript
export declare type Cmd = "goto" | "print" | "set" | "clear" | "zero" | "notzero" | "continue" | "check-room";
export interface Op {
cmd: Cmd;
params: (string | number)[];
}
export interface Code {
on: string;
ops: Op[];
}
export declare enum Type {
project = "project",
location = "location",
object = "object"
}
export interface Node {
type: Type;
id: string;
name: string;
onInput: Code[];
intro: string[];
}
export declare class Project implements Node {
type: Type;
id: string;
name: string;
onInput: never[];
intro: never[];
children: Node[];
initialRoomIndex: number;
meta: any;
static fromJSON(json: any): Project;
addChild(type: Type, id: string): Node;
findChildById(id: string): Node | undefined;
getChildren(): {
[key: string]: Node & {
index: number;
};
};
getChildrenByType(type: Type): {
[key: string]: Node & {
index: number;
};
};
getChild(index: number): Node;
getChildById(id: string): Node & {
index: number;
} | undefined;
}
export declare type Generator = (project: Project) => string;