import {
autotileCellParts,
RPGM_FLOOR_AUTOTILE_TABLE,
} from '@datamoc/mwg/two-d/render';
const parts = autotileCellParts(
{ format: 'rpgm-mv', slot: 0, table: RPGM_FLOOR_AUTOTILE_TABLE, cycles: [] },
2048, 0,
);
console.log(parts?.length); // 4 - one piece per quadrant
console.log(parts?.[0].sourceWidth); // 24 - MV quadrant halves
console.log(autotileCellParts(
{ format: 'rpgm-xp', index: 2, frames: 1, single: false },
97, 0,
)?.[0].sourceWidth); // 16 - XP quadrant halves
Resolves one autotile cell to its drawn pieces: four quadrant halves for a template cell, one whole-tile piece for an XP single-tile strip, or null for a blank cell (
tile <= 0reads as blank;EMPTYis -1).The layout is assumed valid (
assertAutotileLayout); only the cell and frame are checked here.tilemust be an integer the layout claims - an MV id in the layout's slot range, an XP id inindex * 48toindex * 48 + 47- andframean integer at or above zero, wrapping around the animation cycles (MV) or frame stripes (XP).