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

loadMap

loadMap(name): Promise<Readonly<{ blockSet: string; cells: string[]; diorama?: { backdrop?: string; camera?: { fov?: number; maxZoom?: number; minZoom?: number; pitch?: number; }; hour?: number; interior?: boolean; weather?: string; }; heights: string[]; legend: Record<string, string | { block: string; facing?: North | East | South | West; waterLevel?: number; }>; props: Readonly<Record<string, Readonly<{ end?: readonly […, …, …] | readonly […, …]; fields?: Record<…, …>; kind: string; position: readonly […, …, …] | readonly […, …]; scale?: number | readonly […, …, …]; seed?: number; size?: […, …]; static?: boolean; yaw: number; }> | Readonly<{ collider?: false; color: string; idleMotion?: Readonly<…> | Readonly<…>; kind: PropShape; position: readonly […, …, …] | readonly […, …]; scale: number | readonly […, …, …]; size: readonly [number, number, number]; static?: boolean; yaw: number; }> | Readonly<{ kind: ScatterKind; position: readonly […, …, …] | readonly […, …]; scale: number; static?: boolean; yaw: number; }> | Readonly<{ collider?: false; idleMotion?: Readonly<…> | Readonly<…>; model: string; position: readonly […, …, …] | readonly […, …]; scale: number | readonly […, …, …]; static?: boolean; yaw: number; }> | Readonly<{ kind: "player-start"; position: readonly […, …, …] | readonly […, …]; yaw: number; }>>>; revision?: number; sea?: number; seed: number; views: Readonly<Record<string, Readonly<{ eye: readonly [number, number, number]; fov: number; ortho?: number; target: readonly [number, number, number]; }>>>; }> | HeightfieldMap>

Loads the registered map of name, once: every call answers the same promise until the name registers again. A map a lazy glob registered imports its file then, and a <Landscape> that mounts it waits for this under the loading screen, so a game calls it only to read a map outside a Landscape, such as in a test, or to start one’s load early. Rejects with a MapLoadError for a file that does not load, and with an error naming the registered maps for a name nobody registered.

Parameter Type
name string

Promise<Readonly<{ blockSet: string; cells: string[]; diorama?: { backdrop?: string; camera?: { fov?: number; maxZoom?: number; minZoom?: number; pitch?: number; }; hour?: number; interior?: boolean; weather?: string; }; heights: string[]; legend: Record<string, string | { block: string; facing?: North | East | South | West; waterLevel?: number; }>; props: Readonly<Record<string, Readonly<{ end?: readonly […, …, …] | readonly […, …]; fields?: Record<…, …>; kind: string; position: readonly […, …, …] | readonly […, …]; scale?: number | readonly […, …, …]; seed?: number; size?: […, …]; static?: boolean; yaw: number; }> | Readonly<{ collider?: false; color: string; idleMotion?: Readonly<…> | Readonly<…>; kind: PropShape; position: readonly […, …, …] | readonly […, …]; scale: number | readonly […, …, …]; size: readonly [number, number, number]; static?: boolean; yaw: number; }> | Readonly<{ kind: ScatterKind; position: readonly […, …, …] | readonly […, …]; scale: number; static?: boolean; yaw: number; }> | Readonly<{ collider?: false; idleMotion?: Readonly<…> | Readonly<…>; model: string; position: readonly […, …, …] | readonly […, …]; scale: number | readonly […, …, …]; static?: boolean; yaw: number; }> | Readonly<{ kind: "player-start"; position: readonly […, …, …] | readonly […, …]; yaw: number; }>>>; revision?: number; sea?: number; seed: number; views: Readonly<Record<string, Readonly<{ eye: readonly [number, number, number]; fov: number; ortho?: number; target: readonly [number, number, number]; }>>>; }> | HeightfieldMap>