Skip to content

Room Data

getRoomAllowedDoors(roomGridIndex?): ReadonlySet<DoorSlot>

Defined in: packages/isaacscript-common/src/functions/roomData.ts:16

Helper function to get the set of allowed door slots for the room at the supplied grid index. This corresponds to the doors that are enabled in the STB/XML file for the room.

int

ReadonlySet<DoorSlot>


getRoomData(): RoomConfig

Defined in: packages/isaacscript-common/src/functions/roomData.ts:47

Helper function to get the room data for the current room.

You can optionally provide a room grid index as an argument to get the data for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

RoomConfig

getRoomData(roomGridIndex?): RoomConfig | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:54

Helper function to get the room data for the current or provided room.

int

Optional. Default is the current room index.

RoomConfig | undefined

The room data for the room or undefined if the provided room does not have any data.


getRoomDescriptor(roomGridIndex?): RoomDescriptor

Defined in: packages/isaacscript-common/src/functions/roomData.ts:65

Helper function to get the descriptor for a room.

int

Optional. Default is the current room index.

RoomDescriptor


getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>

Defined in: packages/isaacscript-common/src/functions/roomData.ts:77

Alias for the Level.GetCurrentRoomDesc method. Use this to make it more clear what type of RoomDescriptor object that you are retrieving.

Readonly<RoomDescriptor>


getRoomGridIndex(): int

Defined in: packages/isaacscript-common/src/functions/roomData.ts:101

Helper function to get the grid index of the current room.

  • If the current room is inside of the grid, this function will return the SafeGridIndex from the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room overlaps with, or the top-right 1x1 section of a RoomType.SHAPE_LTL room.)
  • If the current room is outside of the grid, it will return the index from the Level.GetCurrentRoomIndex method, since SafeGridIndex is bugged for these cases, as demonstrated by entering a Genesis room and entering l print(Game():GetLevel():GetCurrentRoomDesc().SafeGridIndex) into the console. (It prints -1 instead of -12.)

Use this function instead of the Level.GetCurrentRoomIndex method directly because the latter will return the specific 1x1 quadrant that the player entered the room at. For most situations, using the safe grid index is more reliable than this.

Data structures that store data per room should use the room’s ListIndex instead of SafeGridIndex, since the former is unique across different dimensions.

int


getRoomListIndex(roomGridIndex?): int

Defined in: packages/isaacscript-common/src/functions/roomData.ts:123

Helper function to get the list grid index of the provided room, which is equal to the index in the RoomList.Get method. In other words, this is equal to the order that the room was created by the floor generation algorithm.

Use this as an index for data structures that store data per room, since it is unique across different dimensions.

int

Optional. Default is the current room index.

int


getRoomName(): string

Defined in: packages/isaacscript-common/src/functions/roomData.ts:139

Helper function to get the name of the current room as it appears in the STB/XML data.

You can optionally provide a room grid index as an argument to get the name for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

If you want to get the room name for a specific room type, use the getRoomTypeName function.

string

getRoomName(roomGridIndex?): string | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:148

Helper function to get the name of the room as it appears in the STB/XML data.

If you want to get the room name for a specific room type, use the getRoomTypeName function.

int

Optional. Default is the current room index.

string | undefined

The room name. Returns undefined if the room data was not found.


getRoomShape(): RoomShape

Defined in: packages/isaacscript-common/src/functions/roomData.ts:163

Helper function to get the shape of the current room as it appears in the STB/XML data.

You can optionally provide a room grid index as an argument to get the shape for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

RoomShape

getRoomShape(roomGridIndex?): RoomShape | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:170

Helper function to get the shape of the room as it appears in the STB/XML data.

int

Optional. Default is the current room index.

RoomShape | undefined

The room shape. Returns undefined if the room data was not found.


getRoomStageID(): StageID

Defined in: packages/isaacscript-common/src/functions/roomData.ts:188

Helper function to get the stage ID for the current room as it appears in the STB/XML data.

The room stage ID will correspond to the first number in the filename of the XML/STB file. For example, a Depths room would have a stage ID of StageID.DEPTHS (7).

You can optionally provide a room grid index as an argument to get the stage ID for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

StageID

getRoomStageID(roomGridIndex?): StageID | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:198

Helper function to get the stage ID for a room as it appears in the STB/XML data.

The room stage ID will correspond to the first number in the filename of the XML/STB file. For example, a Depths room would have a stage ID of StageID.DEPTHS (7).

int

Optional. Default is the current room index.

StageID | undefined

The room stage ID. Returns undefined if the room data was not found.


getRoomSubType(): int

Defined in: packages/isaacscript-common/src/functions/roomData.ts:218

Helper function to get the sub-type for the current room as it appears in the STB/XML data.

The room sub-type will correspond to different things depending on what XML/STB file it draws from. For example, in the “00.special rooms.stb” file, an Angel Room with a sub-type of 0 will correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from The Stairway.

You can optionally provide a room grid index as an argument to get the sub-type for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

int

getRoomSubType(roomGridIndex?): int | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:230

Helper function to get the sub-type for a room as it appears in the STB/XML data.

The room sub-type will correspond to different things depending on what XML/STB file it draws from. For example, in the “00.special rooms.stb” file, an Angel Room with a sub-type of 0 will correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from The Stairway.

int

Optional. Default is the current room index.

int | undefined

The room sub-type. Returns undefined if the room data was not found.


Helper function for getting the type of the room with the given grid index.

roomGridIndex

Optional. Default is the current room index.

getRoomType(): RoomType

Defined in: packages/isaacscript-common/src/functions/roomData.ts:245

Helper function to get the type for the current room as it appears in the STB/XML data.

You can optionally provide a room grid index as an argument to get the type for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

RoomType

getRoomType(roomGridIndex?): RoomType | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:252

Helper function to get the type for a room as it appears in the STB/XML data.

int

Optional. Default is the current room index.

RoomType | undefined

The room type. Returns undefined if the room data was not found.


getRoomVariant(): int

Defined in: packages/isaacscript-common/src/functions/roomData.ts:276

Helper function to get the variant for the current room as it appears in the STB/XML data.

You can think of a room variant as its identifier. For example, to go to Basement room #123, you would use a console command of goto d.123 while on the Basement.

You can optionally provide a room grid index as an argument to get the variant for that room instead.

(The version of the function without any arguments will not return undefined since the current room is guaranteed to have data.)

int

getRoomVariant(roomGridIndex?): int | undefined

Defined in: packages/isaacscript-common/src/functions/roomData.ts:286

Helper function to get the variant for a room as it appears in the STB/XML data.

You can think of a room variant as its identifier. For example, to go to Basement room #123, you would use a console command of goto d.123 while on the Basement.

int

Optional. Default is the current room index.

int | undefined

The room variant. Returns undefined if the room data was not found.


getRoomVisitedCount(roomGridIndex?): int

Defined in: packages/isaacscript-common/src/functions/roomData.ts:300

Note that the room visited count will be inaccurate during the period before the POST_NEW_ROOM callback has fired (i.e. when entities are initializing and performing their first update). This is because the variable is only incremented immediately before the POST_NEW_ROOM callback fires.

int

Optional. Default is the current room index.

int


setRoomData(roomGridIndex, roomData): void

Defined in: packages/isaacscript-common/src/functions/roomData.ts:309

Helper function to set the data for a given room. This will change the room type, contents, and so on.

int

RoomConfig

void