Custom Trapdoors
Hierarchy
-
Feature
↳
CustomTrapdoors
Methods
registerCustomTrapdoorDestination
▸ registerCustomTrapdoorDestination(destinationName
, destinationFunc
): void
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
Name | Type | Description |
---|---|---|
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 | (destinationName : undefined | string , destinationStage : LevelStage , destinationStageType : StageType ) => 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
void
Defined in
packages/isaacscript-common/src/classes/features/other/CustomTrapdoors.ts:682
spawnCustomTrapdoor
▸ spawnCustomTrapdoor(gridIndexOrPosition
, destinationName?
, destinationStage?
, destinationStageType?
, anm2Path?
, spawnOpen?
): GridEntity
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 thedestinationName
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 theregisterCustomTrapdoorDestination
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
.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
gridIndexOrPosition | int | Vector | undefined | The location in the room to spawn the trapdoor. |
destinationName? | string | undefined | 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? | LevelStage | undefined | 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? | StageType | undefined | 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 | 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? | boolean | undefined | Optional. Whether to spawn the trapdoor in an open state. By default, behavior will be used that emulates a vanilla trapdoor. |
Returns
GridEntity
Defined in
packages/isaacscript-common/src/classes/features/other/CustomTrapdoors.ts:738