MissionDef beta
Interface of @v12-engine/client/app
export interface MissionDef<D extends object = Record<string, unknown>>A mission of a campaign: its map, who plays it, what is set up on it, and what it carries on to the next (carry). D is the campaign's own data (CampaignDef<D>): what the missions carry and read back
Members
briefing
briefing?: MissionBriefing;What the player is told before it (campaign plan CP4): words, a picture (images/), a voice read out (a sound's name), what it asks; or a cinematic of the game's played as it starts, the world held. Straight into the mission when left out. Retry skips it
carry
carry?: (world: World, context: MissionContext<D>) => Partial<D>;What goes on to the next mission besides the heroes, once this one is won (asked once, as the game is over and before the progress is kept): of the campaign's data (D), the keys it gives over the ones kept, the rest kept as they were. Plain data: the units that come along (carryUnits), research (carryResearch), gold (carryResources), the choices made. The next mission reads it in start (context.progress.data)
debrief
debrief?: MissionDebrief;What the player is told once it is won, with how it went and a rating: straight on when left out
description
description?: string;What it is about, for the campaign's menu
difficulty
difficulty?: string;The difficulty it is played on, by name, whatever the campaign's (CampaignDef.difficulties): a first mission that teaches, always easy. The campaign's when left out
heroesAt
heroesAt?: Vec2;Where heroes carried in come in, when the map places none for them. The player's start when left out
id
id: string;The mission's id, which MissionOutcome, saves and the briefing's mission argument name it by
loading
loading?: LoadingLook & {
picture?: string;
};Its loading screen: a picture by its path in images/ (picture, under its words, as the map's preview is) or a background of its own. The map's words (GameMap.loading) over its picture (preview) when left out
map
map: () => GameMap;The map it is played on: a new copy each time, as a game changes it
name
name: string;The mission's name, shown on the campaign's menu and its loading screen
next
next?: (progress: CampaignProgress<D>, outcome: {
seconds: number;
}) => string | undefined;The mission after it, once it is won, by id: a branch, by what was chosen or carried (progress.data, as it is with what this mission carried) or how it went (outcome.seconds). Nothing for none: the campaign ends there. The next in the list when left out
onStart
onStart?: (world: World, context: MissionContext<D>) => void | Promise<void>;What the mission sets up once the world is made: its objectives, the computer players, the cinematic it opens on. fresh is false for a game loaded from a save, which has all of that already
picture
picture?: string;Its picture on the campaign's menu, by its path in images/
player
player?: (map: GameMap) => PlayerId;Who the player at the screen is. The first player with a start when left out
unlock
unlock?: (progress: CampaignProgress<D>) => boolean;Whether it can be played yet, by how far the campaign is (progress.done, progress.data: what the missions carried). The first, one won, the one the campaign is at, or the one after a mission won when left out