import type { GameRuntimeSnapshot, RuntimeChunkRow } from "./snapshot.js"; /** Default edge length, in world units, of one persisted world chunk. */ export declare const DEFAULT_CHUNK_SIZE = 64; /** Integer cell coordinates of a chunk on the ground plane. */ export type ChunkCoord = { cx: number; cz: number; }; /** * Chunk key for a cell — the canonical `"cx,cz"` string a `jgWorldChunks` row is stored under. * Games used to invent this mapping each time, which made two systems in one game disagree about * which row a position belongs to. * @capability world-chunk-key map world positions to persisted chunk keys at a declared cell size */ export declare function chunkKeyOf(coord: ChunkCoord): string; /** Chunk coordinates containing a world position at `size` units per cell. */ export declare function chunkCoordAt(position: readonly [number, number, number], size?: number): ChunkCoord; /** Chunk key containing a world position at `size` units per cell. */ export declare function chunkKeyAt(position: readonly [number, number, number], size?: number): string; /** Parse a `chunkKeyOf` string back to coordinates; `null` for anything not in that form. */ export declare function parseChunkKey(key: string): ChunkCoord | null; /** * Every chunk key whose cell intersects a radius around a world position — the key list a viewer's * bounded hydration or client chunk query asks for, instead of loading a whole world. */ export declare function chunkKeysInRadius(center: readonly [number, number, number], radius: number, size?: number): string[]; /** An empty chunk row for `chunkKey` — the starting value for a cell nothing has been placed in yet. */ export declare function createEmptyChunkRow(chunkKey: string): RuntimeChunkRow; /** * Write a chunk into a snapshot and mark it dirty, so the next persist actually stores it. * The engine never writes `dirty.chunks` for a raw `snapshot.chunks[key] = …` assignment, so a command * that mutated the map by hand silently never saved that chunk. * @capability world-chunk-write mutate a snapshot's chunk and have the host persist it */ export declare function setChunk(snapshot: GameRuntimeSnapshot, chunkKey: string, chunk: RuntimeChunkRow): GameRuntimeSnapshot; /** Read-modify-write a chunk (creating it empty when absent), marking it dirty. */ export declare function updateChunk(snapshot: GameRuntimeSnapshot, chunkKey: string, update: (chunk: RuntimeChunkRow) => RuntimeChunkRow): GameRuntimeSnapshot; /** Drop a chunk from a snapshot and mark the key dirty so the host deletes its stored row. */ export declare function deleteChunk(snapshot: GameRuntimeSnapshot, chunkKey: string): GameRuntimeSnapshot; /** Square chunk neighborhood around a world position, including its own chunk. */ export declare function chunkKeysAround(position: readonly [number, number, number], rings?: number, size?: number): string[];