← Public packages
@kentcdodds/world-builder
Build a shared 3D voxel world with friends and your AI agents, live.
src/remove-blocks.ts
20 lines · 750 B · TypeScript/**
* Remove blocks (set cells to air) as part of a build, streamed in batches.
*
* @param input - `{ buildId, blocks: [{ x, y, z }], batchSize?, delayMs? }`
* @returns `{ buildId, removed, rejected, batches }`
* @example
* import removeBlocks from 'kody:@kentcdodds/world-builder/remove-blocks'
* await removeBlocks({ buildId, blocks: [{ x: 0, y: 0, z: 0 }] })
*/
import { streamBuildOps } from './lib/agent.ts'
export default async function removeBlocks(input: {
buildId: string
blocks: Array<{ x: number; y: number; z: number }>
batchSize?: number
delayMs?: number
}) {
const out = await streamBuildOps({ ...input, kind: 'del' })
return { buildId: out.buildId, removed: out.removed, rejected: out.rejected, batches: out.batches }
}