EditorFoliagePreview beta
Class of @v12-engine/editor
export declare class EditorFoliagePreviewThe previews of a look of grass and bushes in the editor's view (editor.screen.foliage): one at a time, each put back as another starts or stop is called. Nothing of the map changes, nothing is a step of the history, nothing is saved
Members
constructor
constructor(host: FoliagePreviewHost);Constructs a new instance of the EditorFoliagePreview class
area
area(layer: string, value?: number): FoliagePreviewArea | undefined;The cells a preview plays over: the Patch tool's selection where it is on the layer, else the cells of the style (value; any of the layer's when left out) within a few cells of the nearest of them to where the camera looks. None where the layer has no such cell
away
away(layer: string, level: 'mid' | 'far'): void;The layer drawn as the camera would from its mid or far level's distance (FoliageLevels), the camera left where it is: which tufts are thinned out there and which lighter meshes drawn (FoliageView.showAway)
fire
fire(area: FoliagePreviewArea, rules: (value: number) => FoliageStyleDef): boolean;The patch lit at its middle: the fire spreads out over it, each cell burning for as long as its style burns (burns), charred and gone to ash, as play draws it (flames, smoke, embers, the glow, the ash on the ground); a style that does not burn (flammable 0) is left. The ash shows a few seconds, and all is put back. Whether anything of it burns
gust
gust(area: FoliagePreviewArea, strength?: number): void;A gust of wind over the patch, blowing out from its middle: no preview stopped, nothing to put back
now
get now(): {
kind: FoliagePreviewKind;
layer: string;
} | undefined;The preview running now, and on which layer: none while none does
onChange
onChange(listener: () => void): () => void;Told as a preview starts or stops. Gives back what stops it
part
part(layer: string): FoliagePreviewPart | undefined;The part that draws a layer's grass and bushes in the editor's view: the lite client's FoliageView (showState, showAway, flatten, its look drawn); none where it draws none
pointer
pointer(layer: string, rules?: (value: number) => FoliageStyleDef): void;The pointer as a walker while on: the grass under it bent and laid down as one walking would
ruin
ruin(area: FoliagePreviewArea, how: 'cut' | 'crush' | 'scorch' | 'grow', rules?: (value: number) => FoliageStyleDef): void;The patch ruined as the rules ruin it, shown until put back: cut to stubble (cut), crushed flat (crush), or scorched black (scorch); or what is ruined of it (the patch where nothing is) growing back over the time its style grows (grow: FoliageStyleDef.grows), whole once grown
stop
stop(): void;Puts back whatever preview runs: the walkers, the state, the levels as they were
walk
walk(area: FoliagePreviewArea, rules?: (value: number) => FoliageStyleDef): void;A walker crossing the patch and back, a little aside each time, waiting off it between: the grass bent, pushed about, laid down and left to stand again as its look says (FoliageWalked), drawn as in play (the world's walkers). Where the style's rules crush what is walked (trample: 'crush'), the cells it crosses are shown crushed too, as the rules would make them