Skip to content

JSON Room

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

JSONRoom

BitFlags<DoorSlotFlagValue>


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

readonly JSONRoom[]

The array of rooms to search through.

int

The room variant to select. (The room variant can be thought of as the ID of the room.)

JSONRoom | undefined


getJSONRoomsOfSubType(jsonRooms, subType): readonly JSONRoom[]

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

readonly JSONRoom[]

The array of rooms to search through.

int

The sub-type to match.

readonly JSONRoom[]


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.

readonly JSONEntity[]

The array of entities to randomly choose between.

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.

boolean = false

Optional. If specified, will write entries to the “log.txt” file that describe what the function is doing. Default is false.

JSONEntity


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.

readonly JSONRoom[]

The array of rooms to randomly choose between.

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.

boolean = false

Optional. If specified, will write entries to the “log.txt” file that describe what the function is doing. Default is false.

JSONRoom