Room Data
Functions
Section titled “Functions”getRoomAllowedDoors()
Section titled “getRoomAllowedDoors()”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Returns
Section titled “Returns”ReadonlySet<DoorSlot>
getRoomData()
Section titled “getRoomData()”Call Signature
Section titled “Call Signature”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.)
Returns
Section titled “Returns”RoomConfig
Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”RoomConfig | undefined
The room data for the room or undefined if the provided room does not have any data.
getRoomDescriptor()
Section titled “getRoomDescriptor()”getRoomDescriptor(
roomGridIndex?):RoomDescriptor
Defined in: packages/isaacscript-common/src/functions/roomData.ts:65
Helper function to get the descriptor for a room.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”RoomDescriptor
getRoomDescriptorReadOnly()
Section titled “getRoomDescriptorReadOnly()”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.
Returns
Section titled “Returns”Readonly<RoomDescriptor>
getRoomGridIndex()
Section titled “getRoomGridIndex()”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
SafeGridIndexfrom 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 aRoomType.SHAPE_LTLroom.) - If the current room is outside of the grid, it will return the index from the
Level.GetCurrentRoomIndexmethod, sinceSafeGridIndexis bugged for these cases, as demonstrated by entering a Genesis room and enteringl 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
Section titled “Returns”int
getRoomListIndex()
Section titled “getRoomListIndex()”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”int
getRoomName()
Section titled “getRoomName()”Call Signature
Section titled “Call Signature”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.
Returns
Section titled “Returns”string
Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”string | undefined
The room name. Returns undefined if the room data was not found.
getRoomShape()
Section titled “getRoomShape()”Call Signature
Section titled “Call Signature”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.)
Returns
Section titled “Returns”RoomShape
Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”RoomShape | undefined
The room shape. Returns undefined if the room data was not found.
getRoomStageID()
Section titled “getRoomStageID()”Call Signature
Section titled “Call Signature”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.)
Returns
Section titled “Returns”StageID
Call Signature
Section titled “Call Signature”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).
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”StageID | undefined
The room stage ID. Returns undefined if the room data was not found.
getRoomSubType()
Section titled “getRoomSubType()”Call Signature
Section titled “Call Signature”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.)
Returns
Section titled “Returns”int
Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”int | undefined
The room sub-type. Returns undefined if the room data was not found.
getRoomType()
Section titled “getRoomType()”Helper function for getting the type of the room with the given grid index.
roomGridIndex
Optional. Default is the current room index.
Call Signature
Section titled “Call Signature”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.)
Returns
Section titled “Returns”RoomType
Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”RoomType | undefined
The room type. Returns undefined if the room data was not found.
getRoomVariant()
Section titled “getRoomVariant()”Call Signature
Section titled “Call Signature”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.)
Returns
Section titled “Returns”int
Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”int | undefined
The room variant. Returns undefined if the room data was not found.
getRoomVisitedCount()
Section titled “getRoomVisitedCount()”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.
Parameters
Section titled “Parameters”roomGridIndex?
Section titled “roomGridIndex?”int
Optional. Default is the current room index.
Returns
Section titled “Returns”int
setRoomData()
Section titled “setRoomData()”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.
Parameters
Section titled “Parameters”roomGridIndex
Section titled “roomGridIndex”int
roomData
Section titled “roomData”RoomConfig
Returns
Section titled “Returns”void
