import { candidateCells, cellsNear, selectDistinctCells } from '@datamoc/mw_games/roguelike';
declare const level: import('@datamoc/mw_games/roguelike').Level;
const FLOOR = new Set([1]);
// scatter 3 decorations anywhere on the floor
const pool = candidateCells(level, { terrain: FLOOR });
const { cells: decorations, trace } = selectDistinctCells(pool, 3);
// then release 2 more items clustered around one of those cells
const nearby = cellsNear(level, decorations[0], 2).filter((c) => pool.includes(c));
const { cells: cluster } = selectDistinctCells(nearby, 2);
Picks
countdistinct cells out ofcandidateswithout replacement, falling back to however many exist when fewer are available rather than throwing or looping forever - a crowded region just gets fewer placements, the same "fail gracefully, place fewer" shapegenerateDungeonGraph's own room placement already uses. Pure: nothing is placed or marked taken until the caller acts oncellsitself (typicallyFeatureLayer.place, or foldingcellsinto the next call's ownoccupiedset).traceis plain, JSON-safe data a game can push straight intoDungeonArtifacts.contentfor a parity check, or persist across save/load the same way any other roll trace does.Composes with
candidateCellsandcellsNearfor the three shapes a regional generator needs: several neighbouring items (cellsNeararound one anchor, intersected with a terrain/occupancy pool, then selected from), scattered decorations across a whole region (candidateCellswith a largewithin, then selected from with a largercount), and a single branch or room reward (candidateCellsscoped to one room,count: 1).