import { type TerrainField } from "./terrain.js"; import type { WorldBounds } from "./features.js"; export declare const EMPTY_VOXEL = 0; export interface VoxelMaterial { /** Cell value stored in the grid; 0 is reserved for empty. */ id: number; name: string; /** A carve tool's strength must reach this to remove the material — hard rock resists a weak drill. Default 0 (anything digs it). */ strength: number; /** Debris/harvest hint carried through to game code; the engine only tallies removed cells by id. */ drop?: string; } export type VoxelMaterialTable = Readonly>; export interface VoxelVolumeConfig { /** Grid resolution in cells: [nx, ny, nz]. */ dims: readonly [number, number, number]; /** World position of the min corner of cell [0,0,0]. Default [0,0,0]. */ origin?: readonly [number, number, number]; /** World-space edge length of one cubic cell. Default 1. */ scale?: number; /** Material id every cell starts as. Default 1 (a solid volume waiting to be dug). */ fill?: number; /** Strength lookup by material id; carve honours it against a tool strength. */ materials?: VoxelMaterialTable; } export interface CarveOp { /** Sphere centre in world coordinates. */ center: readonly [number, number, number]; /** Sphere radius in world units. */ radius: number; /** Only cells whose material `strength` is ≤ this are removed. Default Infinity (dig anything). */ toolStrength?: number; } export interface DepositOp { center: readonly [number, number, number]; radius: number; /** Material id to fill empty cells with (Engineer platform / Astroneer terrain add). */ material: number; } /** * A runtime-editable dense voxel grid — the carve/deposit op behind destructible dig worlds (Deep * Rock Galactic tunnels, Astroneer terrain). Cells hold a material id (0 = empty); `carve` clears a * sphere of solid cells that a tool is strong enough to break and returns how many it removed (feed * that to a loot roll), `deposit` fills a sphere with a material. World↔cell mapping is `origin`+`scale`. */ export declare class VoxelVolume { readonly nx: number; readonly ny: number; readonly nz: number; readonly scale: number; readonly origin: readonly [number, number, number]; private readonly cells; private readonly materials; private solidCount; constructor(config: VoxelVolumeConfig); get solid(): number; private index; inBounds(ix: number, iy: number, iz: number): boolean; get(ix: number, iy: number, iz: number): number; set(ix: number, iy: number, iz: number, material: number): void; worldToCell(x: number, y: number, z: number): readonly [number, number, number]; solidAtWorld(x: number, y: number, z: number): boolean; private strengthOf; private forEachCellInSphere; /** Clear every solid cell in the sphere the tool can break; returns the number removed. */ carve(op: CarveOp): number; /** Fill every empty cell in the sphere with `material`; returns the number filled. */ deposit(op: DepositOp): number; } export interface CraterOp { /** Crater centre (x, z in world units). */ x: number; z: number; radius: number; /** How deep the bowl cuts at its centre. */ depth: number; } export interface MoundOp { x: number; z: number; radius: number; /** How high the mound rises at its centre. */ height: number; } /** * A `TerrainField` you can write craters and mounds into at runtime — the height-field side of * destructible terrain (Helldivers 2 explosion craters, engineer-deposited berms). Wraps a base field * and layers smooth radial deformations on top, so `sampleHeight` (and therefore ground-snap, * collision, and the shell's terrain mesh) all read the deformed surface. `carve` digs a bowl, * `deposit` raises a mound. */ export declare class CarvableField implements TerrainField { readonly bounds?: WorldBounds; readonly waterLevel?: number; readonly sampleNormal: TerrainField["sampleNormal"]; private readonly base; private readonly edits; private nextEditId; constructor(base: TerrainField); get editCount(): number; sampleHeight(x: number, z: number): number; /** Digs a bowl; the returned id undoes just this crater via `removeEdit` (#284.7). */ carve(op: CraterOp): number; /** Raises a mound; the returned id undoes just this mound via `removeEdit` (#284.7). */ deposit(op: MoundOp): number; /** Removes one edit by the id `carve`/`deposit` returned — capped-history destructibles evict without rebuilding the field. */ removeEdit(editId: number): boolean; clear(): void; } export declare function carvableTerrain(base: TerrainField): CarvableField;