Skip to content

EditorClipboard beta ​

Class of @v12-engine/editor

ts
export declare class EditorClipboard

Copying and pasting, here and between maps, and the game's prefabs.

A part of the editor, as it gives it (editor.clipboard)

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the EditorClipboard class.

Members ​

applyPrefabInstance ​

ts
applyPrefabInstance(id: number): Promise<EditorResult<PrefabFile>>;

The instance as it stands written back as the prefab: every other instance of it is behind then

copySelection ​

ts
copySelection(cut?: boolean): void;

Copies what is selected, to put it down again here or on another map; cut takes it away too

copyValues ​

ts
copyValues(): EditorResult<CopiedValues>;

Copies what the things selected have alike (selectedValues), as JSON on the clipboard (Ctrl+Shift+C): to set on other things with pasteValues. Refused with nothing selected, or things of several kinds

deletePrefab ​

ts
deletePrefab(name: string): Promise<EditorResult>;

A prefab's file taken away (its instances stay, and say they have no file). Nothing when there is none

duplicatePrefab ​

ts
duplicatePrefab(name: string, as: string): Promise<EditorResult<PrefabFile>>;

A copy of the prefab under another name, at version 1

duplicateSelection ​

ts
duplicateSelection(): EditorResult<Pasted>;

Copies of everything selected, of every kind, to the side and selected in the originals' place: one step

editPrefab ​

ts
editPrefab(name: string): EditorResult;

The prefab opened on a stage of its own: a small flat map with the prefab's parts on it, in the place of the map, which is kept and comes back with leavePrefab. Save writes the prefab (a version on, the prefab's own ids of its parts kept, so that instances follow part by part)

leavePrefab ​

ts
leavePrefab(): void;

Back from the prefab's stage to the map that was open, as it was

loadPrefabs ​

ts
loadPrefabs(): Promise<void>;

Reads the game's prefabs again

makeVariant ​

ts
makeVariant(of: string, as: string): Promise<EditorResult<PrefabFile>>;

A variant of a prefab under a name of its own, at version 1: its source's parts, nothing set apart yet. Edited on its stage (or an instance of it applied), what is changed of the source is written as its overrides; the source changed, the variant follows it

paste ​

ts
paste(): Promise<EditorResult<Pasted>>;

Puts down what was copied where the pointer is, or in the middle of the view, selected

pasteValues ​

ts
pasteValues(text?: string): Promise<EditorResult<number>>;

Sets values copied (copyValues, or text: the clipboard's when left out, a plain object of fields too) on everything selected, as one step (Ctrl+Shift+V): on things of the kind they came from every one, on others the fields they have. What was mixed was not copied, and is left as it is

placePrefab ​

ts
placePrefab(name: string, at: Vec2, pose?: {
        turn?: number;
        scale?: number;
        without?: Partial<Record<string, number[]>>;
    }): EditorResult<PrefabInstance>;

A prefab put down with its middle at a point, turned and sized as said, as an instance that stays linked to the prefab (PrefabInstance): moved as one, brought up to the prefab's new versions (updatePrefabInstance), its changes written back (applyPrefabInstance), let go (unpackPrefabInstance). Its parts are selected after

prefab ​

ts
prefab(name: string): MapClip | undefined;

A prefab of the game's by its name, as it was saved

prefabFile ​

ts
prefabFile(name: string): PrefabFile | undefined;

A prefab's file by its name, as the editor has it

prefabInstanceSelected ​

ts
prefabInstanceSelected(): PrefabInstance | undefined;

The one instance whose parts are what is selected, all of them and nothing else, if the selection is that

renamePrefab ​

ts
renamePrefab(from: string, to: string, tags?: string[]): Promise<EditorResult>;

The prefab under another name: its file moved, its instances on this map told, its tags kept

revertPrefabInstance ​

ts
revertPrefabInstance(id: number): EditorResult;

The instance made anew from its prefab where it stands: the designer's changes dropped

savePrefab ​

ts
savePrefab(name: string, options?: {
        ground?: boolean;
    }): Promise<EditorResult<PrefabFile>>;

Saves what is selected as a prefab of the game's, under a name, to put down again on any of its maps; with the ground under it when asked

savePrefabStage ​

ts
savePrefabStage(): Promise<EditorResult<PrefabFile>>;

The prefab's stage written back as the prefab: everything on the stage, under the prefab's ids where they were its parts

selectedValues ​

ts
selectedValues(): CopiedValues | undefined;

What the things selected have alike (CopiedValues): every field one of them has and the others have the same, not where they stand or what they are. Things of one kind; nothing with nothing selected or several kinds

selectPrefabInstance ​

ts
selectPrefabInstance(id: number): void;

An instance's parts selected, of every kind, and nothing else

selectPrefabInstances ​

ts
selectPrefabInstances(name: string): void;

Every instance of a prefab selected

unpackPrefabInstance ​

ts
unpackPrefabInstance(id: number): EditorResult;

The instance forgotten: its parts stay as plain things

updatePrefabInstance ​

ts
updatePrefabInstance(id: number): EditorResult;

The instance brought to its prefab's version, the designer's changes kept