Skip to content

Mission ​

Interface of @v12-engine/engine

ts
export interface Mission

What a mission registers its parts with (Game.mission): each part's id is made of the game's, the mission's and its own ('raze' in the mission homecoming of my-game is my-game.homecoming.raze), and the parts go into the game's rules, so that a save finds them by those ids. Its onStart runs where the world's map is one it plays, or as it is started

Members ​

after ​

ts
after<K extends HookName>(hook: K, run: HookHandler<K>, options?: HandlerOptions): Mission;

A handler of a hook that runs after the engine's own (priority 1), its id under the mission's

after ​

ts
after<T>(hook: HookKey<T>, run: (world: World, event: T) => void, options?: HandlerOptions): Mission;

A handler of a game's own hook (HookKey) that runs after the rest, its id under the mission's

area ​

ts
area(def: AreaDef): AreaDef;

A part of the map the mission watches (AreaDef), its id made of the mission's, listed in the rules

before ​

ts
before<K extends HookName>(hook: K, run: HookHandler<K>, options?: HandlerOptions): Mission;

A handler of a hook that runs before the engine's own (priority -1), its id under the mission's

before ​

ts
before<T>(hook: HookKey<T>, run: (world: World, event: T) => void, options?: HandlerOptions): Mission;

A handler of a game's own hook (HookKey) that runs before the rest, its id under the mission's

component ​

ts
component<T, S = T>(def: {
        id: string;
    } & ComponentOptions<T, S>): Component<T, S>;

State the mission keeps (defineComponent), its id made of the mission's, listed in the rules

id ​

ts
readonly id: string;

Its id, the game's and its own: my-game.homecoming

idOf ​

ts
idOf(name: string): string;

The id of a part of it, by its own name: my-game.homecoming.raze for 'raze'

objective ​

ts
objective(def: ObjectiveDef): ObjectiveDef;

An objective of the mission (defineObjective), its id made of the mission's

on ​

ts
on<T>(event: EventKey<T>, run: (world: World, payload: T) => void, options?: HandlerOptions): Mission;

How the mission reacts to an event: a listener of the rules (defineListener), its id under the mission's

onStart ​

ts
onStart(run: GameStart): Mission;

What the mission does as a world of it starts: its objectives given, its sequences started (fresh says whether to)

plays ​

ts
plays(...maps: string[]): Mission;

The maps it is played on, by their name (GameMap.name) or their name in Game.maps: a world made from one starts it

sequence ​

ts
sequence<D = undefined>(def: {
        id: string;
        steps: (Step<D> | readonly Step<D>[])[];
    }): SequenceDef<D>;

A sequence of steps of the mission (defineSequence), its id made of the mission's, listed in the rules

start ​

ts
start(world: World, context?: GameStartContext): void | Promise<void>;

Starts it on a world: its onStart in the order given. What a campaign's scene calls, knowing whether the world is new

timer ​

ts
timer<T = undefined>(def: {
        id: string;
        run: (world: World, data: T, timer: TimerInfo) => void;
    }): TimerDef<T>;

A timer of the mission (defineTimer), its id made of the mission's, listed in the rules