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
Name | Type |
---|---|
roomGridIndex | int |
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
Name | Type | Default value | Description |
---|---|---|---|
roomType | RoomType | undefined | The type of room to retrieve. |
roomVariant | int | undefined | The room variant to retrieve. (The room variant is the "ID" of the room in Basement Renovator.) |
cancelRoomTransition | boolean | true | Optional. 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. |
useSpecialRoomsForRoomTypeDefault | boolean | false | Optional. 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
Name | Type |
---|---|
roomType | RoomType |
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
Name | Type | Default value | Description |
---|---|---|---|
includeExtraDimensionalRooms | boolean | false | Optional. 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
Name | Type | Default value | Description |
---|---|---|---|
includeExtraDimensionalRooms | boolean | false | Optional. 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
Name | Type |
---|---|
dimension | Dimension |
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
Name | Type |
---|---|
bossID | BossID |
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
Name | Type |
---|---|
minibossID | MinibossID |
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
Name | Type |
---|---|
...roomShapes | readonly 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
Name | Type |
---|---|
...roomTypes | readonly 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
Name | Type |
---|---|
roomData | RoomConfig |
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
Name | Type | Default value | Description |
---|---|---|---|
onlyCheckRoomTypes? | readonly RoomType [] | undefined | Optional. 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. |
includeSecretRoom | boolean | false | Optional. Whether to include the Secret Room. Default is false. |
includeSuperSecretRoom | boolean | false | Optional. Whether to include the Super Secret Room. Default is false. |
includeUltraSecretRoom | boolean | false | Optional. 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
Name | Type |
---|---|
roomData | RoomConfig |
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
Name | Type |
---|---|
roomData | RoomConfig |