Custom Trapdoors
Classes
Section titled “Classes”CustomTrapdoors
Section titled “CustomTrapdoors”Defined in: packages/isaacscript-common/src/classes/features/other/CustomTrapdoors.ts:103
Extends
Section titled “Extends”Feature
Methods
Section titled “Methods”registerCustomTrapdoorDestination()
Section titled “registerCustomTrapdoorDestination()”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.
Parameters
Section titled “Parameters”destinationName
Section titled “destinationName”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.
destinationFunc
Section titled “destinationFunc”(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.
Returns
Section titled “Returns”void
spawnCustomTrapdoor()
Section titled “spawnCustomTrapdoor()”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
undefinedfor thedestinationNameparameter. - If you want to create a custom trapdoor that takes the player to a custom location, you must
have registered the corresponding
destinationNameat the beginning of your mod with theregisterCustomTrapdoorDestinationfunction. (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.
Parameters
Section titled “Parameters”gridIndexOrPosition
Section titled “gridIndexOrPosition”int | Vector
The location in the room to spawn the trapdoor.
destinationName?
Section titled “destinationName?”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.
destinationStage?
Section titled “destinationStage?”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.
destinationStageType?
Section titled “destinationStageType?”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.
anm2Path?
Section titled “anm2Path?”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”.
spawnOpen?
Section titled “spawnOpen?”boolean
Optional. Whether to spawn the trapdoor in an open state. By default, behavior will be used that emulates a vanilla trapdoor.
Returns
Section titled “Returns”GridEntity
