BlockSurface
A block map’s ground: the walkable top of the cell under a point, read
from the map’s chunks as the room streams them, so a setBlockCell is
current at once; with no world, as in the cli, from the file’s rows.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
baseHeight |
readonly |
number |
The cut’s base in metres, 2 m under the lowest top as the map spawned. |
blockMap |
readonly |
Entity | null |
The map’s entity in the world, or null before it stands and in the cli. |
depth |
readonly |
number |
- |
highestTop |
readonly |
number |
The highest top as the map spawned, a blocked cell’s wall over it included. |
kind |
readonly |
Blocks |
- |
map |
readonly |
BlockTerrainMap |
- |
version |
readonly |
number |
Rises whenever a chunk arrives, leaves or changes a cell, so a reader that stood something on the ground stands it again. |
width |
readonly |
number |
Metres across on x and on z, centred on the origin. |
Methods
Section titled “Methods”findRayHit()
Section titled “findRayHit()”findRayHit(
ray,target):Vector3|null
Where ray first meets a top or a face, written into target, or
null where it meets none: it passes over a void cell and leaves the
map.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ray |
Ray |
target |
Vector3 |
Returns
Section titled “Returns”Vector3 | null
findWaterAt()
Section titled “findWaterAt()”findWaterAt(
position):GroundWater|null
A water cell’s own surface over the position, or null where it is dry; a block map has no sea plane.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
Returns
Section titled “Returns”GroundWater | null
isGroundAt()
Section titled “isGroundAt()”isGroundAt(
position):boolean
Whether ground stands at the position: false off the map, on a void cell, and on a page before the cell’s chunk arrived.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
Returns
Section titled “Returns”boolean
isUnderWaterAt()
Section titled “isUnderWaterAt()”isUnderWaterAt(
position):boolean
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
Returns
Section titled “Returns”boolean
readHeightAt()
Section titled “readHeightAt()”readHeightAt(
position):number
The walkable top under the position: a stair’s tread, a blocked
cell’s top. Where no ground stands, the cut’s base, 2 m under the
lowest top: ask isGroundAt first.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
Returns
Section titled “Returns”number
readNormalAt()
Section titled “readNormalAt()”readNormalAt(
position,target):Vector3
Straight up: every top and tread is flat.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
target |
Vector3 |
Returns
Section titled “Returns”Vector3
readPointAt()
Section titled “readPointAt()”readPointAt(
position,target):Vector3
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
target |
Vector3 |
Returns
Section titled “Returns”Vector3
readSlopeAt()
Section titled “readSlopeAt()”readSlopeAt(
position):number
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
position |
GroundPosition |
Returns
Section titled “Returns”number
subscribe()
Section titled “subscribe()”subscribe(
listener): () =>void
Calls listener after each write of the map’s cells on the end
that writes them; the return stops it. None without a world.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
() => void |
Returns
Section titled “Returns”() => void