Skip to content

EditorTools beta ​

Class of @v12-engine/editor

ts
export declare class EditorTools

The tools of a game's own (editor.tools): those it declares (EditorOptions.tools), those an extension brings and those code adds. Each is made with the editor as it is added, and taken apart as it goes; the strip of tools, the keys that pick each and its own keys follow

Members ​

constructor ​

ts
constructor(
    host: ToolHost | undefined, changed?: () => void);

Constructs a new instance of the EditorTools class

add ​

ts
add(def: GameToolDef): () => void;

Adds a tool, or one in the place of the tool of its id. Gives back what takes it away

get ​

ts
get(id: string): GameToolDef | undefined;

The definition of the game's tool with that id, or nothing

has ​

ts
has(id: string): boolean;

Whether the game has a tool of that id

list ​

ts
list(): readonly GameToolDef[];

Every tool of the game's own, in the order they came

onAdded ​

ts
onAdded(listener: (def: GameToolDef) => void): () => void;

Told of each tool added (or in the place of another). Gives back what stops it

onRemoved ​

ts
onRemoved(listener: (def: GameToolDef) => void): () => void;

Told of each tool taken away. Gives back what stops it

remove ​

ts
remove(id: string): void;

Takes a tool away: taken apart, its keys gone; the select tool picked where it was the one picked