Skip to content

Custom Trapdoors

Defined in: packages/isaacscript-common/src/classes/features/other/CustomTrapdoors.ts:103

  • Feature

registerCustomTrapdoorDestination(destinationName, destinationFunc): void

Defined in: packages/isaacscript-common/src/classes/features/other/CustomTrapdoors.ts:697

Helper function to specify where your custom trapdoor should take the player. Call this once at the beginning of your mod for each kind of custom trapdoor that you want to have. The provided destinationFunc will be executed when the player jumps into the trapdoor and the pixelation effect fades to black.

Registration is needed so that custom trapdoors can be serializable when the player saves and quits.

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

string

The name that identifies the type of custom trapdoor. It should correspond to a local CustomTrapdoorType enum in your mod. It can be any unique value and can safely overlap with values chosen by other mods.

(destinationName, destinationStage, destinationStageType) => void

A function that takes the player to the destination that you want. Inside this function, use the setStage or setCustomStage helper functions, or do something completely custom.

void

spawnCustomTrapdoor(gridIndexOrPosition, destinationName?, destinationStage?, destinationStageType?, anm2Path?, spawnOpen?): GridEntity

Defined in: packages/isaacscript-common/src/classes/features/other/CustomTrapdoors.ts:753

Helper function to spawn a trapdoor grid entity that will take a player to a vanilla stage or custom location.

  • If you want to create a custom trapdoor that goes to a vanilla stage, pass undefined for the destinationName parameter.
  • If you want to create a custom trapdoor that takes the player to a custom location, you must have registered the corresponding destinationName at the beginning of your mod with the registerCustomTrapdoorDestination function. (This is necessary so that custom trapdoors can be serializable when the player saves and quits.)

Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually respawned every time the player re-enters the room.

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

int | Vector

The location in the room to spawn the trapdoor.

string

Optional. A string representing the name of the of destination that the custom trapdoor will take the player to. Default is undefined, which will take the player to a vanilla stage.

LevelStage

Optional. The first argument that will be passed to the destinationFunc corresponding to this custom trapdoor. This is essentially metadata for the custom trapdoor. Leave this undefined if your corresponding custom trapdoor function does not care what the destination stage should be. Default is the “normal” next vanilla stage.

StageType

Optional. The second argument that will be passed to the destinationFunc corresponding to this custom trapdoor. This is essentially metadata for the custom trapdoor. Leave this undefined if your corresponding custom trapdoor function does not care what the destination stage type should be. Default is the “normal” next vanilla stage type.

string = "gfx/grid/door_11_trapdoor.anm2"

Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2 of “gfx/grid/door_11_trapdoor.anm2” will be used. The specified anm2 file must have animations called “Opened”, “Closed”, and “Open Animation”.

boolean

Optional. Whether to spawn the trapdoor in an open state. By default, behavior will be used that emulates a vanilla trapdoor.

GridEntity