isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
37 lines (32 loc) • 1.39 kB
text/typescript
import { RoomShape } from "isaac-typescript-definitions";
export const ONE_BY_ONE_CONTENTS_WIDTH = 13;
export const ONE_BY_ONE_CONTENTS_HEIGHT = 7;
const ONE_BY_ONE_VOLUME =
ONE_BY_ONE_CONTENTS_HEIGHT * ONE_BY_ONE_CONTENTS_WIDTH;
export const NARROW_CONTENTS_WIDTH = 5;
export const NARROW_CONTENTS_HEIGHT = 3;
const NARROW_HORIZONTAL_VOLUME =
ONE_BY_ONE_CONTENTS_WIDTH * NARROW_CONTENTS_HEIGHT;
const NARROW_VERTICAL_VOLUME =
NARROW_CONTENTS_WIDTH * ONE_BY_ONE_CONTENTS_HEIGHT;
const ONE_BY_TWO_VOLUME = ONE_BY_ONE_VOLUME * 2;
const L_ROOM_VOLUME = ONE_BY_ONE_VOLUME * 3;
/**
* Volume is the amount of tiles that are inside the room shape.
*
* (This cannot be directly calculated from the bounds since L rooms are a special case.)
*/
export const ROOM_SHAPE_VOLUMES = {
[]: ONE_BY_ONE_VOLUME, // 1
[]: NARROW_HORIZONTAL_VOLUME, // 2
[]: NARROW_VERTICAL_VOLUME, // 3
[]: ONE_BY_TWO_VOLUME, // 4
[]: NARROW_VERTICAL_VOLUME * 2, // 5
[]: ONE_BY_TWO_VOLUME, // 6
[]: NARROW_HORIZONTAL_VOLUME * 2, // 7
[]: ONE_BY_ONE_VOLUME * 4, // 8
[]: L_ROOM_VOLUME, // 9
[]: L_ROOM_VOLUME, // 10
[]: L_ROOM_VOLUME, // 11
[]: L_ROOM_VOLUME, // 12
} as const satisfies Record<RoomShape, int>;