跳转到内容

Terrains

此内容尚不支持你的语言。

Defined in: sdk/src/terrain/terrainPlugin.ts:253

Run-time access to the ground: how high it is anywhere, for putting things on it.

new Terrains(): Terrains

Terrains

get loading(): boolean

Defined in: sdk/src/terrain/terrainPlugin.ts:568

Whether any terrain is still reading its images or wearing its ground: its heights are not known yet.

boolean


get pending(): number

Defined in: sdk/src/terrain/terrainPlugin.ts:574

How many pages every terrain still wants made for what is in view.

number

areaBounds(): [number, number, number, number] | null

Defined in: sdk/src/terrain/terrainPlugin.ts:296

The world rectangle the terrains cover, [minX, minZ, maxX, maxZ], or null where it has no end (a terrain of infinite extent) or there is none: what a layer of chunks laid over the ground is held to, so it does not count a radius of empty world.

[number, number, number, number] | null


collisionReadyAt(x, z): boolean

Defined in: sdk/src/terrain/terrainPlugin.ts:436

Whether the ground under (x, z) is built for collision: what a game waits on before it drops something there.

number

number

boolean


deleteModifier(id): void

Defined in: sdk/src/terrain/terrainPlugin.ts:492

Takes a modifier off the ground.

string

void


findPath(from, to, options?): ReachResult

Defined in: sdk/src/terrain/terrainPlugin.ts:431

A way across the ground from one place to another that a walker held to maxSlope can take, or why there is none: what a game checks a spawn, a quest’s goal or a village against. The ground is read where the search goes, modifiers and all, so nothing is baked first; ground still being made is no ground yet (see groundKnownAt).

number

number

number

number

ReachOptions

ReachResult


groundData(): GroundData | null

Defined in: sdk/src/terrain/terrainPlugin.ts:319

The ground as data a worker can rebuild it from, when it can be: one terrain, made, of a field or of noise (the engine’s own noise provider included, whose ground is its parameters), with nothing laid over it. Null otherwise (a game’s provider, a modified ground, several terrains, one still being made), when what is laid out over it must ask here.

GroundData | null


groundEdit(entity): GroundEdit | TiledGroundEdit | null

Defined in: sdk/src/terrain/terrainPlugin.ts:503

A handle to change the ground of the area terrain on entity with brushes (sculpt.ts), or null while it is being made, when it is not an area of its own heights (infinite ground, a provider’s) or when it is not a terrain.

number

GroundEdit | TiledGroundEdit | null


groundKnownAt(x, z): boolean

Defined in: sdk/src/terrain/terrainPlugin.ts:386

Whether the ground at (x, z) is known: false while a terrain that covers it is still being made, or its provider has not answered there yet; true where it is known, and where no terrain is (there is no ground to wait for).

number

number

boolean


heightAt(x, z): number | null

Defined in: sdk/src/terrain/terrainPlugin.ts:261

The world height of the ground at (x, z), or null where no terrain is. The terrain’s own position is taken into account; its rotation and scale are not (a terrain is laid flat at its own size).

number

number

number | null


heightBeneathAt(x, z): number | null

Defined in: sdk/src/terrain/terrainPlugin.ts:352

The world height of the ground at (x, z) as it was made, under every modifier laid over it: what a plot is levelled from.

number

number

number | null


layerNames(): string[]

Defined in: sdk/src/terrain/terrainPlugin.ts:343

The names of the terrain’s layers, in the order paintAt weighs them: the layer files’ names, or grass, dirt, snow and rock without any.

string[]


load(): TerrainLoad

Defined in: sdk/src/terrain/terrainPlugin.ts:457

TerrainLoad


normalAt(x, z): [number, number, number] | null

Defined in: sdk/src/terrain/terrainPlugin.ts:368

Where the ground faces at (x, z) (a unit normal), or null where no terrain is.

number

number

[number, number, number] | null


paintAt(x, z): readonly number[] | null

Defined in: sdk/src/terrain/terrainPlugin.ts:278

The weights of the terrain’s layers at (x, z), as the ground is painted there (four, or as many as it has layers), or null where no terrain is: what a world’s rules read as the fields paint.<layer>.

number

number

readonly number[] | null


raycast(origin, direction, maxDistance): { distance: number; entity: number; normal: { x: number; y: number; z: number; }; point: { x: number; y: number; z: number; }; } | null

Defined in: sdk/src/terrain/terrainPlugin.ts:404

Where a ray meets the ground, anywhere and whether or not anything collides there: exact against the same triangles collision and heightAt use. maxDistance is along the direction. Null where it meets no terrain within it.

number

number

number

number

number

number

number

{ distance: number; entity: number; normal: { x: number; y: number; z: number; }; point: { x: number; y: number; z: number; }; } | null


repaint(): void

Defined in: sdk/src/terrain/terrainPlugin.ts:556

Makes every page again, for a paint that changed what it answers.

void


setModifier(modifier): void

Defined in: sdk/src/terrain/terrainPlugin.ts:484

Lays modifier over the ground (or replaces the one with its id): the drawn ground, its queries and its collision all follow it, and only what it reaches is made again.

TerrainModifier

void


setPager(pager): void

Defined in: sdk/src/terrain/terrainPlugin.ts:551

Hands the making of pages to pager (or back to the terrain, with null). A world that paints the ground has the plan the paint is read from on its workers already, and a page painted there costs the frame nothing; painted here it is tens of milliseconds a page. The pager answers null for a page it cannot make (its plan is no longer the ground’s), and the terrain makes that one itself.

TerrainPager | null

void


setPaint(paint): void

Defined in: sdk/src/terrain/terrainPlugin.ts:537

Gives the ground’s paint to paint (or back to the terrains, with null): at each sample, in world space, it is handed the paint the terrain made and returns the paint to draw. The pages already made are made again.

Repaint | null

void


status(entity): TerrainStatus | null

Defined in: sdk/src/terrain/terrainPlugin.ts:450

Where a terrain’s ground stands. A failed one draws and answers nothing, and says why.

number

TerrainStatus | null