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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Terrains():
Terrains
Returns
Section titled “Returns”Terrains
Accessors
Section titled “Accessors”loading
Section titled “loading”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”boolean
pending
Section titled “pending”Get Signature
Section titled “Get Signature”get pending():
number
Defined in: sdk/src/terrain/terrainPlugin.ts:574
How many pages every terrain still wants made for what is in view.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”areaBounds()
Section titled “areaBounds()”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.
Returns
Section titled “Returns”[number, number, number, number] | null
collisionReadyAt()
Section titled “collisionReadyAt()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
deleteModifier()
Section titled “deleteModifier()”deleteModifier(
id):void
Defined in: sdk/src/terrain/terrainPlugin.ts:492
Takes a modifier off the ground.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
findPath()
Section titled “findPath()”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).
Parameters
Section titled “Parameters”number
number
number
number
options?
Section titled “options?”ReachOptions
Returns
Section titled “Returns”ReachResult
groundData()
Section titled “groundData()”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.
Returns
Section titled “Returns”GroundData | null
groundEdit()
Section titled “groundEdit()”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.
Parameters
Section titled “Parameters”entity
Section titled “entity”number
Returns
Section titled “Returns”GroundEdit | TiledGroundEdit | null
groundKnownAt()
Section titled “groundKnownAt()”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).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
heightAt()
Section titled “heightAt()”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).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number | null
heightBeneathAt()
Section titled “heightBeneathAt()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number | null
layerNames()
Section titled “layerNames()”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.
Returns
Section titled “Returns”string[]
load()
Section titled “load()”load():
TerrainLoad
Defined in: sdk/src/terrain/terrainPlugin.ts:457
Returns
Section titled “Returns”TerrainLoad
normalAt()
Section titled “normalAt()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”[number, number, number] | null
paintAt()
Section titled “paintAt()”paintAt(
x,z): readonlynumber[] |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>.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”readonly number[] | null
raycast()
Section titled “raycast()”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.
Parameters
Section titled “Parameters”origin
Section titled “origin”number
number
number
direction
Section titled “direction”number
number
number
maxDistance
Section titled “maxDistance”number
Returns
Section titled “Returns”{ distance: number; entity: number; normal: { x: number; y: number; z: number; }; point: { x: number; y: number; z: number; }; } | null
repaint()
Section titled “repaint()”repaint():
void
Defined in: sdk/src/terrain/terrainPlugin.ts:556
Makes every page again, for a paint that changed what it answers.
Returns
Section titled “Returns”void
setModifier()
Section titled “setModifier()”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.
Parameters
Section titled “Parameters”modifier
Section titled “modifier”Returns
Section titled “Returns”void
setPager()
Section titled “setPager()”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.
Parameters
Section titled “Parameters”TerrainPager | null
Returns
Section titled “Returns”void
setPaint()
Section titled “setPaint()”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.
Parameters
Section titled “Parameters”Repaint | null
Returns
Section titled “Returns”void
status()
Section titled “status()”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.
Parameters
Section titled “Parameters”entity
Section titled “entity”number
Returns
Section titled “Returns”TerrainStatus | null