/** * placement.ts — passability-aware tile placement. * * Where mapGenerator's isWalkableGround classifies tiles by autotile *range* * (good enough for generated maps), this module uses the project tileset's * REAL passage flags (Tilesets[id].flags, one entry per tileId). That makes * event placement correct on ANY map — hand-authored, plugin-modified, or * custom tileset — by asking the same question the engine asks: "can the player * stand on this tile?". * * MV flag semantics (per tileId in Tilesets.flags): * bits 0x0f → the four cardinal passage bits; all four set (0x0f) = fully * impassable (wall / roof / closed door). * bit 0x10 → "☆" star/overhead: the tile is drawn above the player and does * NOT affect passage — so it is skipped, and the tile beneath it * decides standability (a lantern over a floor is still walkable). * * A coordinate is "void" when no tile layer has a tile there: there is nothing * to stand on, so it is never standable. */ export interface PlaceableMap { width: number; height: number; data: number[]; } /** * Can the player stand on (x, y)? Mirrors the engine's top-down layer scan: * the topmost non-star tile decides passage; star tiles are transparent to * passage; an all-empty column (void) is not standable. */ export declare function isStandable(map: PlaceableMap, flags: number[], x: number, y: number): boolean; export interface NearestResult { x: number; y: number; relocated: boolean; } /** * Snap (x, y) to a standable tile inside the map's main playable region. If the * coordinate is already in that region it's returned untouched (relocated: * false); otherwise the nearest region tile is chosen (relocated: true). A * standable-but-isolated coordinate still relocates, because the player can't * actually get there. */ export declare function nearestStandable(map: PlaceableMap, flags: number[], x: number, y: number): NearestResult; /** * Pick a safe spawn/start point for a map: a tile that is standable AND reachable * (a member of the main playable region — never void, a wall, or a walled-in * pocket the player can't leave). Biased toward the bottom-centre of that region, * the natural "player walks in from the south" entrance, which reads correctly * for towns, exteriors and dungeons alike. Falls back to the map centre only if * the map has no standable tiles at all (a degenerate/broken map). */ export declare function chooseSpawn(map: PlaceableMap, flags: number[]): { x: number; y: number; }; export interface WalkableSummary { usableRegionTiles: number; bounds: { minX: number; minY: number; maxX: number; maxY: number; }; suggestedPoints: { x: number; y: number; }[]; } /** * Describe the map's main playable region: its tile count, bounding box, and a * handful of spread-out standable points (useful as default spawn/event spots). */ export declare function walkableSummary(map: PlaceableMap, flags: number[]): WalkableSummary;