Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

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.

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.

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.

Parameter Type
ray Ray
target Vector3

Vector3 | null


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.

Parameter Type
position GroundPosition

GroundWater | null


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.

Parameter Type
position GroundPosition

boolean


isUnderWaterAt(position): boolean

Parameter Type
position GroundPosition

boolean


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.

Parameter Type
position GroundPosition

number


readNormalAt(position, target): Vector3

Straight up: every top and tread is flat.

Parameter Type
position GroundPosition
target Vector3

Vector3


readPointAt(position, target): Vector3

Parameter Type
position GroundPosition
target Vector3

Vector3


readSlopeAt(position): number

Parameter Type
position GroundPosition

number


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.

Parameter Type
listener () => void

() => void