Skip to main content

Room Data

Functions

getRoomAllowedDoors

getRoomAllowedDoors(roomGridIndex?): ReadonlySet<DoorSlot>

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.

Parameters

NameType
roomGridIndex?int

Returns

ReadonlySet<DoorSlot>

Defined in

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


getRoomData

getRoomData(): RoomConfig

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.)

Returns

RoomConfig

Defined in

packages/isaacscript-common/src/functions/roomData.ts:45

getRoomData(roomGridIndex?): RoomConfig | undefined

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

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

RoomConfig | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:53


getRoomDescriptor

getRoomDescriptor(roomGridIndex?): RoomDescriptor

Helper function to get the descriptor for a room.

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

RoomDescriptor

Defined in

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


getRoomDescriptorReadOnly

getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>

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

Returns

Readonly<RoomDescriptor>

Defined in

packages/isaacscript-common/src/functions/roomData.ts:79


getRoomGridIndex

getRoomGridIndex(): int

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.

Returns

int

Defined in

packages/isaacscript-common/src/functions/roomData.ts:103


getRoomListIndex

getRoomListIndex(roomGridIndex?): int

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.

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

int

Defined in

packages/isaacscript-common/src/functions/roomData.ts:125


getRoomName

getRoomName(): string

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.

Returns

string

Defined in

packages/isaacscript-common/src/functions/roomData.ts:141

getRoomName(roomGridIndex?): string | undefined

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.

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

string | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:151


getRoomShape

getRoomShape(): RoomShape

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.)

Returns

RoomShape

Defined in

packages/isaacscript-common/src/functions/roomData.ts:167

getRoomShape(roomGridIndex?): RoomShape | undefined

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

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

RoomShape | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:175


getRoomStageID

getRoomStageID(): StageID

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.)

Returns

StageID

Defined in

packages/isaacscript-common/src/functions/roomData.ts:194

getRoomStageID(roomGridIndex?): StageID | undefined

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).

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

StageID | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:205


getRoomSubType

getRoomSubType(): int

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.)

Returns

int

Defined in

packages/isaacscript-common/src/functions/roomData.ts:226

getRoomSubType(roomGridIndex?): int | undefined

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.

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

int | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:239


getRoomType

getRoomType(): RoomType

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.)

Returns

RoomType

Defined in

packages/isaacscript-common/src/functions/roomData.ts:255

getRoomType(roomGridIndex?): RoomType | undefined

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

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

RoomType | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:263


getRoomVariant

getRoomVariant(): int

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.)

Returns

int

Defined in

packages/isaacscript-common/src/functions/roomData.ts:288

getRoomVariant(roomGridIndex?): int | undefined

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.

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

int | undefined

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

Defined in

packages/isaacscript-common/src/functions/roomData.ts:299


getRoomVisitedCount

getRoomVisitedCount(roomGridIndex?): int

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.

Parameters

NameTypeDescription
roomGridIndex?intOptional. Default is the current room index.

Returns

int

Defined in

packages/isaacscript-common/src/functions/roomData.ts:314


setRoomData

setRoomData(roomGridIndex, roomData): void

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

Parameters

NameType
roomGridIndexint
roomDataRoomConfig

Returns

void

Defined in

packages/isaacscript-common/src/functions/roomData.ts:323