Skip to content

ToolHost beta ​

Interface of @v12-engine/editor

ts
export interface ToolHost

What the editor is to a tool

Members ​

changed ​

ts
changed(settled?: boolean): void;

After the map changed: it has changes to save, and is shown as it is now. settled says an operation just ended or was cancelled: if it left no step in the history, nothing changed (a stroke that did nothing)

changes ​

ts
readonly changes: EditorChanges;

What of the editor changed, said by the tools as they change it (the brush, the facing, the measure)

clipboard ​

ts
readonly clipboard: EditorClipboard;

The game's prefabs: as saved (prefab, prefabFile), put down as an instance (placePrefab), an instance selected

doc ​

ts
readonly doc: MapEditor;

The map's editor, through which a tool changes the map as steps that can be undone

placeThing ​

ts
placeThing(kind: string, at: Vec2): MapThing[];

Puts a thing of a kind of the game's own down at a place, as its kind says a new one is (MapKindDef.create), and again where the map's symmetry says: one step, the new ones selected. None when the kind refuses the place

prefs ​

ts
readonly prefs: EditorPrefs;

What the one who uses the editor set it to: what snapping steps by (grid, angleStep, scaleStep)

recentTiles ​

ts
readonly recentTiles?: Pick<EditorRecentTiles, 'used'>;

The tiles painted with last (EditorRecentTiles): a stroke of paint or fill notes its tile there

registry ​

ts
readonly registry: Registry;

The game's types, which a tool looks units and other things up in

said ​

ts
said<T>(result: EditorResult<T>): EditorResult<T>;

Says why an operation was refused, in the status line, and gives it back (EditorClient.said)

say ​

ts
say(text: string): void;

Tells the user something, in the status line

screen ​

ts
readonly screen: EditorScreen;

What is under a point of the view, and what a tool shows over the map while it works: a box, a brush, a ghost, a draft

selection ​

ts
readonly selection: EditorSelection;

What is selected, and selecting: the sets by kind (ids), a region, light, effect, area, point or path alone, nothing

setTool ​

ts
setTool(tool: EditorTool): void;

Picks a tool in place of the one picked now

sounds ​

ts
readonly sounds?: Pick<EditorSounds, 'defs'>;

How the game's sounds are played (EditorSounds.defs): a sound put down on the map starts at its reach and volume

stage ​

ts
readonly stage: Pick<EditorLiteStage, 'gizmo'>;

The editor's stage: what makes the handles on the selection

styles ​

ts
readonly styles?: Pick<EditorFoliageStyles, 'select' | 'selection' | 'clearSelection' | 'layers' | 'isFoliage'>;

The styles of the layers of grass and bushes, and the cells the Patch tool picks (EditorFoliageStyles); which layers are grass and bushes, for a brush that clears them

tool ​

ts
readonly tool: ToolState;

The tool picked and what it works with: the brush, the facing, the handles, what the picking tools picked…

transformSelection ​

ts
transformSelection(change: {
        facing?: number;
        turn?: number;
        scale?: number;
    }): void;

Turns the selection by turn radians, sets its facing to facing and scales it by scale, each for those given