Skip to content

EditorFoliageStyles beta ​

Class of @v12-engine/editor

ts
export declare class EditorFoliageStyles

The styles of the layers of grass and bushes in the editor (editor.styles): the selection of cells the Patch tool makes, the layer's styles (the game's values with the map's own), and every change to them, each one step of the map's history: painting the selection, a style of its own for it, renaming, duplicating, merging and deleting. Where a style is kept is said each time (StyleTarget)

Members ​

constructor ​

ts
constructor(host: FoliageStylesHost);

Constructs a new instance of the EditorFoliageStyles class

addStyle ​

ts
addStyle(layer: string, target?: StyleTarget, name?: string): EditorResult<number>;

A new style of the layer's look, painted nowhere yet: one step of the history. Its value, or why there is none

change ​

ts
change(layer: string, value: number, change: DataCellLayerValue, target?: StyleTarget, name?: string): EditorResult;

Sets fields of a style's value (name, colour, rules) where target says, over what is said there: one step

clearSelection ​

ts
clearSelection(): void;

Lets go of the cells picked

duplicate ​

ts
duplicate(layer: string, value: number, target?: StyleTarget): EditorResult<number>;

A copy of a style, painted nowhere yet: one step of the history. Its value, or why there is none

isFoliage ​

ts
isFoliage(layer: string): boolean;

Whether a layer is of grass or bushes: its look draws them (the game's code, its cellLayers.json or the map's), or one of its values says what it is to the rules (foliage)

layer ​

ts
layer(layer: string): CellLayerDef | undefined;

A layer as it is on this map: the game's values (its code and data.json), the map's definitions over them (layCellLayerData). None for a layer the game has not

layers ​

ts
layers(): CellLayerDef[];

Every layer of the game's as it is on this map (layer)

mapData ​

ts
mapData(layer: string): DataCellLayer | undefined;

What the map's definitions say of a layer (GameMap.definitions.cellLayers)

merge ​

ts
merge(layer: string, from: number, into: number, target?: StyleTarget): EditorResult;

Two styles made one: the cells of from painted with into, and from taken away (remove). One step

mostStyle ​

ts
mostStyle(): number | undefined;

The style most of the cells picked have, of those that have any: none where none of them does

nextValue ​

ts
nextValue(layer: string): number | undefined;

The lowest value of a layer no style has, the game's or the map's, and no cell of the map is painted with: none where all 255 are taken

ownStyle ​

ts
ownStyle(target?: StyleTarget, name?: string): EditorResult<number>;

Gives the cells picked a style of their own (Its own settings): a new one (the next free value), made of the style most of them have, painted on those with grass (on all of them where none has any). One step of the history. The new style's value, or why there is none

paintSelection ​

ts
paintSelection(value: number, options?: {
        empty?: boolean;
        grass?: boolean;
        name?: string;
    }): number;

Paints the cells picked: with a style (0 takes the grass away), only those with none (empty: Fill), or only those with grass (grass: a style put on what grows there, Use style; all of them where none has any). One step of the history, which keeps the rectangle of the layer they are in, not the layer. How many cells it changed

recolor ​

ts
recolor(layer: string, value: number, color: Rgb, target?: StyleTarget): EditorResult;

Gives a style another colour, where target says: one step

remove ​

ts
remove(layer: string, value: number, into: number, target?: StyleTarget, name?: string): EditorResult;

Takes a style away: its cells painted with another (into, 0 for none), what is said of it and its look taken out where target says; a style the game has, taken out on this map alone (false) where it is the map's. One step

rename ​

ts
rename(layer: string, value: number, name: string, target?: StyleTarget): EditorResult;

Renames a style, where target says: one step

rows ​

ts
rows(layer: string): StyleRow[];

The styles of a layer: the game's values and the map's own, in order, with how many cells of the map have each

ruleUnder ​

ts
ruleUnder<K extends keyof FoliageStyleDef>(layer: string, value: number, field: K, target: StyleTarget): FoliageStyleDef[K];

What a field of a style's rules is on this map where target says nothing of it: what is under it there (the code and the game's data.json for the map; the code for every map, the map's definitions still over it)

saidRules ​

ts
saidRules(layer: string, value: number, target: StyleTarget): FoliageStyleDef | undefined;

What is said of a style's rules where target says (the map's definitions, or what was written to data.json): none where nothing is

select ​

ts
select(layer: string, cells: Iterable<number>, how?: SelectHow): void;

Picks cells of a layer: in the place of what is picked, added to it, or taken out of it. No step of the history

selection ​

ts
readonly selection: CellSelection;

The cells picked with the Patch tool: never saved, no part of the map

selectPatch ​

ts
selectPatch(layer: string, cell: number, how?: SelectHow, options?: {
        sameValue?: boolean;
    }): number;

Picks the patch of a layer one cell is in (the wand): the cells of the layer that touch it, through sides and corners, of its style alone (sameValue) or of any. Nothing where the cell has none of the layer

selectShape ​

ts
selectShape(layer: string, shape: AreaShape, how?: SelectHow): void;

Picks the cells of a layer in a shape (the cells whose middle is in it)

selectStyle ​

ts
selectStyle(layer: string, value: number, how?: SelectHow): number;

Picks every cell of a layer painted with a style

setRule ​

ts
setRule<K extends keyof FoliageStyleDef>(layer: string, value: number, field: K, to: FoliageStyleDef[K] | undefined, target?: StyleTarget, name?: string): EditorResult;

Sets a field of a style's rules (FoliageStyleDef: whether it hides, how it burns, what slows) where target says, over what is said there; undefined takes the field out, back to what is under it (the code, the game's data). One step of the history, named for what it set

setStyleLook ​

ts
setStyleLook(layer: string, value: number, look: MapBushStyle | false | undefined, target?: StyleTarget, name?: string): EditorResult;

Sets a style's look of its own where target says (undefined takes it out): one step, joined to the last by merge

styleLook ​

ts
styleLook(layer: string, value: number): MapBushStyle | false | undefined;

A style's look of its own (over the layer's), as the code, the game's file and the map lay it: none where it has none

styleRules ​

ts
styleRules(layer: string, value: number): FoliageStyleDef;

What a style is to the rules on this map (FoliageStyleDef): the foliage pack's base of the layer, the game's value (its code and data.json), the map's definitions over them. What a game played here plays it as

version ​

ts
get version(): number;

Moves with every change of the styles or the selection made here