Skip to main content

Rooms

Functions

changeRoom

changeRoom(roomGridIndex): void

Helper function for quickly switching to a new room without playing a particular animation. Use this helper function over invoking the Game.ChangeRoom method directly to ensure that you do not forget to set the LeaveDoor field and to prevent crashing on invalid room grid indexes.

Parameters

NameType
roomGridIndexint

Returns

void

Defined in

packages/isaacscript-common/src/functions/rooms.ts:64


getNumRooms

getNumRooms(): int

Helper function to get the number of rooms that are currently on the floor layout. This does not include off-grid rooms, like the Devil Room.

Returns

int

Defined in

packages/isaacscript-common/src/functions/rooms.ts:84


getReadOnlyRooms

getReadOnlyRooms(): ReadonlyArray<Readonly<RoomDescriptor>>

Helper function to get a read-only copy of the room descriptor for every room on the level. This includes off-grid rooms, such as the Devil Room, and extra-dimensional rooms, if they are generated and exist.

Room descriptors without any data are assumed to be non-existent and are not included.

Under the hood, this is performed by iterating over the RoomList from the Level.GetRooms method. This is the best way to see if off-grid rooms have been initialized, since it is possible for mods to insert room data at non-official negative room grid indexes.

Returns

ReadonlyArray<Readonly<RoomDescriptor>>

Defined in

packages/isaacscript-common/src/functions/rooms.ts:100


getRoomDataForTypeVariant

getRoomDataForTypeVariant(roomType, roomVariant, cancelRoomTransition?, useSpecialRoomsForRoomTypeDefault?): Readonly<RoomConfig> | undefined

Helper function to get the room data for a specific room type and variant combination. This is accomplished by using the "goto" console command to load the specified room into the GridRoom.DEBUG slot.

Returns undefined if the provided room type and variant combination were not found. (A warning message will also appear on the console, since the "goto" command will fail.)

Note that the side effect of using the "goto" console command is that it will trigger a room transition after a short delay. By default, this function cancels the incoming room transition by using the Game.StartRoomTransition method to travel to the same room.

Parameters

NameTypeDefault valueDescription
roomTypeRoomTypeundefinedThe type of room to retrieve.
roomVariantintundefinedThe room variant to retrieve. (The room variant is the "ID" of the room in Basement Renovator.)
cancelRoomTransitionbooleantrueOptional. Whether to cancel the room transition by using the Game.StartRoomTransition method to travel to the same room. Default is true. Set this to false if you are getting the data for many rooms at the same time, and then use the teleport helper function when you are finished.
useSpecialRoomsForRoomTypeDefaultbooleanfalseOptional. Whether to use s.default as the prefix for the goto command (instead of d) if the room type is RoomType.DEFAULT (1). False by default.

Returns

Readonly<RoomConfig> | undefined

Defined in

packages/isaacscript-common/src/functions/rooms.ts:143


getRoomItemPoolType

getRoomItemPoolType(): ItemPoolType

Helper function to get the item pool type for the current room. For example, this returns ItemPoolType.ItemPoolType.POOL_ANGEL if you are in an Angel Room.

Returns

ItemPoolType

Defined in

packages/isaacscript-common/src/functions/rooms.ts:170


getRoomTypeName

getRoomTypeName(roomType): string

Helper function to get the proper name of a room type.

For example, RoomType.TREASURE will return "Treasure Room".

Parameters

NameType
roomTypeRoomType

Returns

string

Defined in

packages/isaacscript-common/src/functions/rooms.ts:184


getRooms

getRooms(includeExtraDimensionalRooms?): readonly RoomDescriptor[]

Helper function to get the room descriptor for every room on the level. This includes off-grid rooms, such as the Devil Room.

Room without any data are assumed to be non-existent and are not included.

  • If you want just the rooms inside of the grid, use the getRoomsInsideGrid helper function.
  • If you want just the rooms outside of the grid, use the getRoomsOutsideGrid helper function.

Parameters

NameTypeDefault valueDescription
includeExtraDimensionalRoomsbooleanfalseOptional. On some floors (e.g. Downpour 2, Mines 2), extra-dimensional rooms are automatically generated. Default is false.

Returns

readonly RoomDescriptor[]

Defined in

packages/isaacscript-common/src/functions/rooms.ts:201


getRoomsInsideGrid

getRoomsInsideGrid(includeExtraDimensionalRooms?): readonly RoomDescriptor[]

Helper function to get the room descriptor for every room on the level that is on the grid. (For example, Devil Rooms are excluded.)

Room descriptors without any data are assumed to be non-existent and are not included.

Parameters

NameTypeDefault valueDescription
includeExtraDimensionalRoomsbooleanfalseOptional. On some floors (e.g. Downpour 2, Mines 2), extra-dimensional rooms are automatically be generated. Default is false.

Returns

readonly RoomDescriptor[]

Defined in

packages/isaacscript-common/src/functions/rooms.ts:222


getRoomsOfDimension

getRoomsOfDimension(dimension): readonly RoomDescriptor[]

Helper function to get the room descriptor for every room on the level in a specific dimension. This will not include any off-grid rooms, such as the Devil Room.

Room descriptors without any data are assumed to be non-existent and are not included.

Parameters

NameType
dimensionDimension

Returns

readonly RoomDescriptor[]

Defined in

packages/isaacscript-common/src/functions/rooms.ts:253


getRoomsOutsideGrid

getRoomsOutsideGrid(): readonly RoomDescriptor[]

Helper function to get the room descriptor for every room on the level that is outside of the grid (like a Devil Room).

Room descriptors without any data are assumed to be non-existent and are not included.

Returns

readonly RoomDescriptor[]

Defined in

packages/isaacscript-common/src/functions/rooms.ts:278


in2x1Room

in2x1Room(): boolean

Helper function to determine if the current room shape is equal to RoomShape.1x2 or RoomShape.2x1.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:295


inAngelShop

inAngelShop(): boolean

Helper function to check to see if the current room is an angel shop.

Under the hood, this checks the room type being equal to RoomType.ANGEL (15) and the sub-type being equal to AngelRoomSubType.SHOP (1).

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:306


inBeastRoom

inBeastRoom(): boolean

Helper function to check to see if the current room is the Boss Room for The Beast.

This function is useful because the Room.GetBossID method returns 0 for The Beast room.

Under the hood, this checks the room type being equal to RoomType.DUNGEON (16) and the sub-type being equal to DungeonSubType.BEAST_ROOM (4).

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:319


inBigRoom

inBigRoom(): boolean

Helper function to detect if the current room is big. Specifically, this is all 1x2 rooms, 2x2 rooms, and L rooms.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:328


inBossRoomOf

inBossRoomOf(bossID): boolean

Helper function to check if the current room is the Boss Room for a particular boss. This will only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.

Parameters

NameType
bossIDBossID

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:337


inCrawlSpace

inCrawlSpace(): boolean

Helper function for determining whether the current room is a crawl space. Use this function over comparing to RoomType.DUNGEON or GridRoom.DUNGEON_IDX since there is a special case of the player being in a boss fight that takes place in a dungeon.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:347


inCrawlSpaceWithBlackMarketEntrance

inCrawlSpaceWithBlackMarketEntrance(): boolean

Helper function for checking whether the current room is a crawl space with a door corresponding to DoorSlotFlag.RIGHT_0 (1 << 2).

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:356


inDeathCertificateArea

inDeathCertificateArea(): boolean

Helper function to detect if the current room is one of the rooms in the Death Certificate area.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:364


inDevilsCrownTreasureRoom

inDevilsCrownTreasureRoom(): boolean

Helper function to detect if the current room is a Treasure Room created when entering with a Devil's Crown trinket.

Under the hood, this checks for RoomDescriptorFlag.DEVIL_TREASURE.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:375


inDogmaRoom

inDogmaRoom(): boolean

Helper function to check to see if the current room is the Boss Room for Dogma.

This function is useful because the Room.GetBossID method returns 0 for the Dogma room.

Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma Boss Room, as the player is teleported to a different room after watching the TV cutscene.

Under the hood, this checks the stage ID being equal to StageID.HOME (35) and the room type being equal to RoomType.DEFAULT (1) and the variant being equal to 1000 (which is the only Dogma Boss Room that exists in vanilla) and the sub-type being equal to HomeRoomSubType.LIVING_ROOM (3).

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:393


inDoubleTrouble

inDoubleTrouble(): boolean

Helper function to detect if the current room is a Double Trouble Boss Room.

This is performed by checking for the string "Double Trouble" inside of the room name. The vanilla game uses this convention for every Double Trouble Boss Room. Note that this method might fail for mods that add extra Double Trouble rooms but do not follow the convention.

Internally, the game is coded to detect Double Trouble Boss Rooms by checking for the variant range of 3700 through 3850. We intentionally do not use this method since it may not work as well with modded rooms.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:409


inGenesisRoom

inGenesisRoom(): boolean

Helper function to determine if the current room index is equal to GridRoom.GENESIS.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:415


inHomeCloset

inHomeCloset(): boolean

Helper function to check if the current room is either the left Home closet (behind the red door) or the right Home closet (with one random pickup).

Home closets have a unique shape that is different from any other room in the game.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:426


inLRoom

inLRoom(): boolean

Helper function to determine if the current room shape is one of the four L room shapes.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:432


inMegaSatanRoom

inMegaSatanRoom(): boolean

Helper function to determine if the current room index is equal to GridRoom.MEGA_SATAN.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:438


inMineShaft

inMineShaft(): boolean

Helper function to determine if the current room is part of the Repentance "escape sequence" in the Mines/Ashpit.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:447


inMinibossRoomOf

inMinibossRoomOf(minibossID): boolean

Helper function to check if the current room is a miniboss room for a particular miniboss. This will only work for mini-bosses that have dedicated boss rooms in the "00.special rooms.stb" file.

Parameters

NameType
minibossIDMinibossID

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:456


inMirrorRoom

inMirrorRoom(): boolean

Helper function to check if the current room is a "mirror room" in Downpour or Dross. (These rooms are marked with a specific sub-type.)

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:465


inRoomShape

inRoomShape(...roomShapes): boolean

Helper function to check if the current room shape matches one of the given room shapes.

This function is variadic, which means you can pass as many room shapes as you want to match for.

Parameters

NameType
...roomShapesreadonly RoomShape[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:475


inRoomType

inRoomType(...roomTypes): boolean

Helper function to check if the current room matches one of the given room types.

This function is variadic, which means you can pass as many room types as you want to match for.

Parameters

NameType
...roomTypesreadonly RoomType[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:485


inSecretExit

inSecretExit(): boolean

Helper function for checking if the current room is a secret exit that leads to a Repentance floor.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:494


inSecretShop

inSecretShop(): boolean

Helper function for checking if the current room is a secret shop (from the Member Card collectible).

Secret shops are simply copies of normal shops, but with the backdrop of a secret room. In other words, they will have the same room type, room variant, and room sub-type of a normal shop. Thus, the only way to detect them is by using the grid index.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:507


inStartingRoom

inStartingRoom(): boolean

Helper function to determine whether the current room is the starting room of a floor. It only returns true for the starting room of the primary dimension (meaning that being in the starting room of the mirror world does not count).

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:517


is2x1Room

is2x1Room(roomData): boolean

Helper function to determine if the provided room is equal to RoomShape.1x2 or RoomShape.2x1.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:528


isAllRoomsClear

isAllRoomsClear(onlyCheckRoomTypes?, includeSecretRoom?, includeSuperSecretRoom?, includeUltraSecretRoom?): boolean

Helper function to loop through every room on the floor and see if it has been cleared.

This function will only check rooms inside the grid and inside the current dimension.

Parameters

NameTypeDefault valueDescription
onlyCheckRoomTypes?readonly RoomType[]undefinedOptional. A whitelist of room types. If specified, room types not in the array will be ignored. If not specified, then all rooms will be checked. Undefined by default.
includeSecretRoombooleanfalseOptional. Whether to include the Secret Room. Default is false.
includeSuperSecretRoombooleanfalseOptional. Whether to include the Super Secret Room. Default is false.
includeUltraSecretRoombooleanfalseOptional. Whether to include the Ultra Secret Room. Default is false.

Returns

boolean

Allow Empty Variadic

Defined in

packages/isaacscript-common/src/functions/rooms.ts:547


isAngelShop

isAngelShop(roomData): boolean

Helper function to check to see if the current room is an angel shop.

Under the hood, this checks the room type being equal to RoomType.ANGEL (15) and the sub-type being equal to AngelRoomSubType.SHOP (1).

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:600


isBeastRoom

isBeastRoom(roomData): boolean

Helper function to check to see if the provided room is the Boss Room for The Beast.

This function is useful because the Room.GetBossID method returns 0 for The Beast room.

Under the hood, this checks the room type being equal to RoomType.DUNGEON (16) and the sub-type being equal to DungeonSubType.BEAST_ROOM (4).

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:615


isBigRoom

isBigRoom(roomData): boolean

Helper function to detect if the provided room is big. Specifically, this is all 1x2 rooms, 2x2 rooms, and L rooms.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:626


isBossRoomOf

isBossRoomOf(roomData, bossID): boolean

Helper function to check if the provided room is the Boss Room for a particular boss. This will only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.

Parameters

NameType
roomDataRoomConfig
bossIDBossID

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:634


isCrawlSpace

isCrawlSpace(roomData): boolean

Helper function for determining whether the provided room is a crawl space. Use this function over comparing to RoomType.DUNGEON or GridRoom.DUNGEON_IDX since there is a special case of the player being in a boss fight that takes place in a dungeon.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:647


isCrawlSpaceWithBlackMarketEntrance

isCrawlSpaceWithBlackMarketEntrance(roomData): boolean

Helper function for checking whether the provided room is a crawl space with a door corresponding to DoorSlotFlag.RIGHT_0 (1 << 2).

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:658


isDeathCertificateArea

isDeathCertificateArea(roomData): boolean

Helper function to detect if the provided room is one of the rooms in the Death Certificate area.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:669


isDevilsCrownTreasureRoom

isDevilsCrownTreasureRoom(roomDescriptor): boolean

Helper function to detect if the provided room is a Treasure Room created when entering with a Devil's Crown trinket.

Under the hood, this checks for RoomDescriptorFlag.DEVIL_TREASURE.

Parameters

NameType
roomDescriptorRoomDescriptor

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:683


isDogmaRoom

isDogmaRoom(roomData): boolean

Helper function to check to see if the provided room is the Boss Room for Dogma.

This function is useful because the Room.GetBossID method returns 0 for the Dogma room.

Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma Boss Room, as the player is teleported to a different room after watching the TV cutscene.

Under the hood, this checks the stage ID being equal to StageID.HOME (35) and the room type being equal to RoomType.DEFAULT (1) and the variant being equal to 1000 (which is the only Dogma Boss Room that exists in vanilla) and the sub-type being equal to HomeRoomSubType.LIVING_ROOM (3).

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:702


isDoubleTrouble

isDoubleTrouble(roomData): boolean

Helper function to detect if the provided room is a Double Trouble Boss Room.

This is performed by checking for the string "Double Trouble" inside of the room name. The vanilla game uses this convention for every Double Trouble Boss Room. Note that this method might fail for mods that add extra Double Trouble rooms but do not follow the convention.

Internally, the game is coded to detect Double Trouble Boss Rooms by checking for the variant range of 3700 through 3850. We intentionally do not use this method since it may not work as well with modded rooms.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:722


isGenesisRoom

isGenesisRoom(roomGridIndex): boolean

Helper function to determine if the index of the provided room is equal to GridRoom.GENESIS.

Parameters

NameType
roomGridIndexint

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:731


isHomeCloset

isHomeCloset(roomData): boolean

Helper function to check if the provided room is either the left Home closet (behind the red door) or the right Home closet (with one random pickup).

Home closets have a unique shape that is different from any other room in the game.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:741


isLRoom

isLRoom(roomData): boolean

Helper function to determine if the provided room is one of the four L room shapes.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:750


isMegaSatanRoom

isMegaSatanRoom(roomGridIndex): boolean

Helper function to determine if the index of the provided room is equal to GridRoom.MEGA_SATAN.

Parameters

NameType
roomGridIndexint

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:757


isMineShaft

isMineShaft(roomData): boolean

Helper function to determine if the provided room is part of the Repentance "escape sequence" in the Mines/Ashpit.

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:765


isMinibossRoomOf

isMinibossRoomOf(roomData, minibossID): boolean

Helper function to check if the provided room is a miniboss room for a particular miniboss. This will only work for mini-bosses that have dedicated boss rooms in the "00.special rooms.stb" file.

Parameters

NameType
roomDataRoomConfig
minibossIDMinibossID

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:778


isMirrorRoom

isMirrorRoom(roomData): boolean

Helper function to check if the provided room is a "mirror room" in Downpour or Dross. (These rooms are marked with a specific sub-type.)

Parameters

NameType
roomDataRoomConfig

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:793


isRoomShape

isRoomShape(roomData, ...roomShapes): boolean

Helper function to check if the provided room matches one of the given room shapes.

This function is variadic, which means you can pass as many room shapes as you want to match for.

Parameters

NameType
roomDataRoomConfig
...roomShapesreadonly RoomShape[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:807


isRoomType

isRoomType(roomData, ...roomTypes): boolean

Helper function to check if the provided room matches one of the given room types.

This function is variadic, which means you can pass as many room types as you want to match for.

Parameters

NameType
roomDataRoomConfig
...roomTypesreadonly RoomType[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:819


isSecretExit

isSecretExit(roomGridIndex): boolean

Helper function for checking if the provided room is a secret exit that leads to a Repentance floor.

Parameters

NameType
roomGridIndexint

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:830


isSecretRoomType

isSecretRoomType(roomType): boolean

Helper function to detect if a room type is a Secret Room, a Super Secret Room, or an Ultra Secret Room.

Parameters

NameType
roomTypeRoomType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:838


isSecretShop

isSecretShop(roomGridIndex): boolean

Helper function for checking if the provided room is a secret shop (from the Member Card collectible).

Secret shops are simply copies of normal shops, but with the backdrop of a secret room. In other words, they will have the same room type, room variant, and room sub-type of a normal shop. Thus, the only way to detect them is by using the grid index.

Parameters

NameType
roomGridIndexint

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/rooms.ts:850


roomUpdateSafe

roomUpdateSafe(): void

If the Room.Update method is called in a POST_NEW_ROOM callback, then some entities will slide around (such as the player). Since those entity velocities are already at zero, setting them to zero will have no effect. Thus, a generic solution is to record all of the entity positions/velocities before updating the room, and then restore those positions/velocities.

Returns

void

Defined in

packages/isaacscript-common/src/functions/rooms.ts:860


setBackdrop

setBackdrop(backdropType): void

Helper function to set the backdrop (i.e. background) of the current room.

Parameters

NameType
backdropTypeBackdropType

Returns

void

Defined in

packages/isaacscript-common/src/functions/rooms.ts:874


setRoomCleared

setRoomCleared(): void

Helper function to convert an uncleared room to a cleared room in the POST_NEW_ROOM callback. This is useful because if enemies are removed in this callback, a room drop will be awarded and the doors will start closed and then open.

Returns

void

Defined in

packages/isaacscript-common/src/functions/rooms.ts:884


setRoomUncleared

setRoomUncleared(): void

Helper function to emulate what happens when you bomb an Angel Statue or push a Reward Plate that spawns an NPC.

Returns

void

Defined in

packages/isaacscript-common/src/functions/rooms.ts:920