Skip to content

1681-engine / index / AutotileRule

Interface: AutotileRule ​

Defined in: src/tilemap/autotile.ts:114

How one terrain picks its tiles.

Properties ​

connectsTo? ​

ts
optional connectsTo?: readonly number[];

Defined in: src/tilemap/autotile.ts:129

Other terrain ids this one joins as if they were its own (a road meeting a bridge).


fallback? ​

ts
optional fallback?: number;

Defined in: src/tilemap/autotile.ts:127

The tile when the table has no entry for a mask (default: the entry for the full mask, else empty).


mode? ​

ts
optional mode?: AutotileMode;

Defined in: src/tilemap/autotile.ts:118

Which mask picks the tile (default 'blob').


terrain ​

ts
terrain: number;

Defined in: src/tilemap/autotile.ts:116

The terrain id this rule draws.


tiles ​

ts
tiles: 
  | Readonly<Record<number, number | readonly number[]>>
  | ((mask, x, y) => number);

Defined in: src/tilemap/autotile.ts:125

The tile for a mask: a table by mask (a list picks one of several by the cell's position, the same every time), or a function of the mask (and the cell, for anything fancier). Blob masks are the reduced ones; to lay a 47-tile set out in BLOB47_MASKS order use (m) => first + blob47Index(m). Edge masks run 0…15, so a 16-tile strip in mask order is (m) => first + m.

Released under the MIT License.