mwg API
    Preparing search index...

    Function autotileCellParts

    • 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 <= 0 reads as blank; EMPTY is -1).

      The layout is assumed valid (assertAutotileLayout); only the cell and frame are checked here. tile must be an integer the layout claims - an MV id in the layout's slot range, an XP id in index * 48 to index * 48 + 47 - and frame an integer at or above zero, wrapping around the animation cycles (MV) or frame stripes (XP).

      Parameters

      Returns AutotileCellPart[] | null

      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