Skip to content

EditorEvents beta ​

Interface of @v12-engine/editor

ts
export interface EditorEvents

The events of the editor's bus by name, each with what it comes with: the editor's own, and a game's. A game adds its own by declaration merging, so emit and on know them:

ts
declare module '@v12-engine/editor' {
	interface EditorEvents {
		'td.wave.picked': { wave: number }
	}
}

The editor's own: selection (what is selected, as the things themselves), map.changed (which parts, from the step of the history that changed them), tool (the tool picked), file.opened and file.saved, undo and redo (the step), play.started and play.stopped (the game), play.tick (a few times a second, only while something listens), panel.opened and panel.closed (its id)

Members ​

"file.opened" ​

ts
'file.opened': MapFileEvent;

A map file was opened

"file.saved" ​

ts
'file.saved': MapFileEvent;

A map file was saved

"map.changed" ​

ts
'map.changed': MapChange;

A change was made to the map, with the change's details

"panel.closed" ​

ts
'panel.closed': PanelEvent;

A panel was closed

"panel.opened" ​

ts
'panel.opened': PanelEvent;

A panel was opened

"play.started" ​

ts
'play.started': GameClient;

A test play started, with its game

"play.stopped" ​

ts
'play.stopped': GameClient;

A test play ended, with its game

"play.tick" ​

ts
'play.tick': PlayTick;

A tick of the test play was stepped

"prefab.placed" ​

ts
'prefab.placed': PrefabEvent;

A prefab was placed in the map

"prefab.updated" ​

ts
'prefab.updated': PrefabEvent;

A placed prefab was updated from its file

redo ​

ts
redo: Operation;

An operation was redone, with the operation

selection ​

ts
selection: EditorSelected;

The selection after it changed

tool ​

ts
tool: EditorTool;

The tool the editor now holds

undo ​

ts
undo: Operation;

An operation was undone, with the operation