Skip to main content

Deploy JSON Room

Hierarchy

  • Feature

    DeployJSONRoom

Methods

deployJSONRoom

deployJSONRoom(jsonRoom, seedOrRNG, verbose?): void

Helper function to deconstruct a vanilla room and set up a custom room in its place. Specifically, this will clear the current room of all entities and grid entities, and then spawn all of the entries and grid entities in the provided JSON room. For this reason, you must be in the actual room in order to use this function.

A JSON room is simply an XML file converted to JSON. You can create JSON rooms by using the Basement Renovator room editor to create an XML file, and then convert it to JSON using the convert-xml-to-json tool (e.g. npx convert-xml-to-json my-rooms.xml).

This function is meant to be used in the POST_NEW_ROOM callback.

For example:


import customRooms from "./customRooms.json";

export function postNewRoom(): void {
const firstJSONRoom = customRooms.rooms.room[0];
deployJSONRoom(firstJSONRoom);
}

If you want to deploy an unseeded room, you must explicitly pass undefined to the seedOrRNG parameter.

In order to use this function, you must upgrade your mod with ISCFeature.DEPLOY_JSON_ROOM.

Parameters

NameTypeDefault valueDescription
jsonRoomReadonly<JSONRoom>undefinedThe JSON room to deploy.
seedOrRNGundefined | RNG | SeedundefinedThe 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.
verbosebooleanfalseOptional. If specified, will write entries to the "log.txt" file that describe what the function is doing. Default is false.

Returns

void

Defined in

packages/isaacscript-common/src/classes/features/other/DeployJSONRoom.ts:224