Mission
Interface of @v12-engine/engine
export interface MissionWhat 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
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
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
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
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
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
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
readonly id: string;Its id, the game's and its own: my-game.homecoming
idOf
idOf(name: string): string;The id of a part of it, by its own name: my-game.homecoming.raze for 'raze'
objective
objective(def: ObjectiveDef): ObjectiveDef;An objective of the mission (defineObjective), its id made of the mission's
on
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
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
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
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
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
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