JSON Room
Functions
getJSONRoomDoorSlotFlags
▸ getJSONRoomDoorSlotFlags(jsonRoom
): BitFlags
<DoorSlotFlag
>
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
Name | Type |
---|---|
jsonRoom | JSONRoom |
Returns
BitFlags
<DoorSlotFlag
>
Defined in
packages/isaacscript-common/src/functions/jsonRoom.ts:24
getJSONRoomOfVariant
▸ getJSONRoomOfVariant(jsonRooms
, variant
): JSONRoom
| undefined
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
Name | Type | Description |
---|---|---|
jsonRooms | readonly JSONRoom [] | The array of rooms to search through. |
variant | int | The room variant to select. (The room variant can be thought of as the ID of the room.) |
Returns
JSONRoom
| undefined
Defined in
packages/isaacscript-common/src/functions/jsonRoom.ts:90
getJSONRoomsOfSubType
▸ getJSONRoomsOfSubType(jsonRooms
, subType
): readonly JSONRoom
[]
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
Name | Type | Description |
---|---|---|
jsonRooms | readonly JSONRoom [] | The array of rooms to search through. |
subType | int | The sub-type to match. |
Returns
readonly JSONRoom
[]
Defined in
packages/isaacscript-common/src/functions/jsonRoom.ts:129
getRandomJSONEntity
▸ getRandomJSONEntity(jsonEntities
, seedOrRNG
, verbose?
): JSONEntity
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
Name | Type | Default value | Description |
---|---|---|---|
jsonEntities | readonly JSONEntity [] | undefined | The array of entities to randomly choose between. |
seedOrRNG | undefined | 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 | boolean | false | Optional. If specified, will write entries to the "log.txt" file that describe what the function is doing. Default is false. |
Returns
Defined in
packages/isaacscript-common/src/functions/jsonRoom.ts:166
getRandomJSONRoom
▸ getRandomJSONRoom(jsonRooms
, seedOrRNG
, verbose?
): JSONRoom
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
Name | Type | Default value | Description |
---|---|---|---|
jsonRooms | readonly JSONRoom [] | undefined | The array of rooms to randomly choose between. |
seedOrRNG | undefined | 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 | boolean | false | Optional. If specified, will write entries to the "log.txt" file that describe what the function is doing. Default is false. |