JSON Room
Functions
Section titled “Functions”getJSONRoomDoorSlotFlags()
Section titled “getJSONRoomDoorSlotFlags()”getJSONRoomDoorSlotFlags(
jsonRoom):BitFlags<DoorSlotFlagValue>
Defined in: packages/isaacscript-common/src/functions/jsonRoom.ts:24
Helper function to calculate what the resulting BitFlags<DoorSlotFlag> value would be for a
given JSON room.
(A JSON room is an XML file converted to JSON so that it can be directly imported into your mod.)
Parameters
Section titled “Parameters”jsonRoom
Section titled “jsonRoom”Returns
Section titled “Returns”BitFlags<DoorSlotFlagValue>
getJSONRoomOfVariant()
Section titled “getJSONRoomOfVariant()”getJSONRoomOfVariant(
jsonRooms,variant):JSONRoom|undefined
Defined in: packages/isaacscript-common/src/functions/jsonRoom.ts:90
Helper function to find a specific room from an array of JSON rooms.
(A JSON room is an XML file converted to JSON so that it can be directly imported into your mod.)
Parameters
Section titled “Parameters”jsonRooms
Section titled “jsonRooms”readonly JSONRoom[]
The array of rooms to search through.
variant
Section titled “variant”int
The room variant to select. (The room variant can be thought of as the ID of the room.)
Returns
Section titled “Returns”JSONRoom | undefined
getJSONRoomsOfSubType()
Section titled “getJSONRoomsOfSubType()”getJSONRoomsOfSubType(
jsonRooms,subType): readonlyJSONRoom[]
Defined in: packages/isaacscript-common/src/functions/jsonRoom.ts:129
Helper function to find all of the JSON rooms that match the sub-type provided.
(A JSON room is an XML file converted to JSON so that it can be directly imported into your mod.)
Parameters
Section titled “Parameters”jsonRooms
Section titled “jsonRooms”readonly JSONRoom[]
The array of rooms to search through.
subType
Section titled “subType”int
The sub-type to match.
Returns
Section titled “Returns”readonly JSONRoom[]
getRandomJSONEntity()
Section titled “getRandomJSONEntity()”getRandomJSONEntity(
jsonEntities,seedOrRNG,verbose?):JSONEntity
Defined in: packages/isaacscript-common/src/functions/jsonRoom.ts:166
Helper function to get a random JSON entity from an array of JSON entities.
(A JSON entity is an entity inside of a JSON room. A JSON room is an XML file converted to JSON so that it can be directly imported into your mod.)
Note that this function does not simply choose a random element in the provided array; it will properly account for each room weight using the algorithm from: https://stackoverflow.com/questions/1761626/weighted-random-numbers
If you want an unseeded entity, you must explicitly pass undefined to the seedOrRNG
parameter.
Parameters
Section titled “Parameters”jsonEntities
Section titled “jsonEntities”readonly JSONEntity[]
The array of entities to randomly choose between.
seedOrRNG
Section titled “seedOrRNG”RNG | Seed | undefined
The Seed or RNG object to use. If an RNG object is provided, the
RNG.Next method will be called. If undefined is provided, it will default to
a random seed.
verbose?
Section titled “verbose?”boolean = false
Optional. If specified, will write entries to the “log.txt” file that describe what the function is doing. Default is false.
Returns
Section titled “Returns”getRandomJSONRoom()
Section titled “getRandomJSONRoom()”getRandomJSONRoom(
jsonRooms,seedOrRNG,verbose?):JSONRoom
Defined in: packages/isaacscript-common/src/functions/jsonRoom.ts:211
Helper function to get a random JSON room from an array of JSON rooms.
(A JSON room is an XML file converted to JSON so that it can be directly imported into your mod.)
Note that this function does not simply choose a random element in the provided array; it will properly account for each room weight using the algorithm from: https://stackoverflow.com/questions/1761626/weighted-random-numbers
If you want an unseeded room, you must explicitly pass undefined to the seedOrRNG parameter.
Parameters
Section titled “Parameters”jsonRooms
Section titled “jsonRooms”readonly JSONRoom[]
The array of rooms to randomly choose between.
seedOrRNG
Section titled “seedOrRNG”RNG | Seed | undefined
The Seed or RNG object to use. If an RNG object is provided, the
RNG.Next method will be called. If undefined is provided, it will default to
a random seed.
verbose?
Section titled “verbose?”boolean = false
Optional. If specified, will write entries to the “log.txt” file that describe what the function is doing. Default is false.
