Skip to content

MissionActionData beta ​

TypeAlias of @v12-engine/engine

ts
export type MissionActionData = 
/** An objective of the map's (`MapObjective`), by id: given (`give`, the default), done or failed (with why) */
{
    objective: {
        id: string;
        do?: 'give' | 'complete' | 'fail';
        to?: PlayerId[];
        reason?: MessageRef;
    };
}
/**
 * A line said (`world.dialog.say`): who speaks (a speaker of the view's), what (a message key, or the words), for how
 * long; the unit that says it (by its name on the map: its face talks in the portrait box) and how (`emotion`)
 */
 | {
    say: {
        speaker: string;
        text: MessageRef;
        seconds?: number;
        to?: PlayerId[];
        unit?: string;
        emotion?: string;
    };
}
/** A cinematic of the view's played (`playCinematic`), to everyone when `to` is left out */
 | {
    cinematic: {
        id: string;
        to?: PlayerId[];
        hold?: boolean;
        skippable?: boolean;
    };
}
/**
 * A prefab of the game's spawned (`world.spawnPrefab`) at a place: a point or a region of the map by name, a named
 * thing of the map, or a point; for a player, or neutral
 */
 | {
    spawn: {
        prefab: string;
        at: string | Vec2;
        owner?: PlayerId;
        facing?: number;
    };
}
/** A word told to a computer player (`world.computers.tell`), with what goes with it */
 | {
    tell: {
        computer: PlayerId;
        word: string;
        data?: unknown;
    };
}
/** What two players are to each other from now on (`world.sides.setRelation`) */
 | {
    relation: {
        a: PlayerId;
        b: PlayerId;
        how: PlayerRelation;
    };
}
/**
 * A timer started: so many seconds on, the rules are told its id as a word (a rule `when: { told: id }` fires), and
 * with `label` it counts down on the players' screens meanwhile (`world.timers.show`). Started again, it starts over
 */
 | {
    timer: {
        id: string;
        seconds: number;
        label?: MessageRef;
        to?: PlayerId[];
    };
}
/** The game is won by the players' team */
 | {
    win: true | {
        to?: PlayerId[];
    };
}
/** The players are out of the game (`defeat`) */
 | {
    lose: true | {
        to?: PlayerId[];
    };
};

What a mission rule does, as plain data: one of a closed set of actions. Each takes who it is for (to) where that matters: every player a person plays when left out (mapObjectivePlayers), as the map's objectives are given