isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
46 lines • 2.17 kB
TypeScript
import type { JSONRoom } from "../../../interfaces/JSONRoomsFile";
import { Feature } from "../../private/Feature";
export declare class DeployJSONRoom extends Feature {
private readonly preventGridEntityRespawn;
private spawnAllEntities;
private spawnNormalEntityForJSONRoom;
/**
* 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:
*
* ```ts
*
* 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`.
*
* @param jsonRoom The JSON room to deploy.
* @param seedOrRNG 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.
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
* what the function is doing. Default is false.
* @public
*/
deployJSONRoom(jsonRoom: Readonly<JSONRoom>, seedOrRNG: Seed | RNG | undefined, verbose?: boolean): void;
}
//# sourceMappingURL=DeployJSONRoom.d.ts.map