isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
100 lines • 6.16 kB
TypeScript
import { LevelStage, StageType } from "isaac-typescript-definitions";
import { Feature } from "../../private/Feature";
export declare class CustomTrapdoors extends Feature {
/** Indexed by custom trapdoor ID. */
private readonly destinationFuncMap;
/**
* In order to represent a black sprite, we just use the first frame of the boss versus screen
* animation. However, we must lazy load the sprite in order to prevent issues with mods that
* replace the vanilla files. (For some reason, loading the sprites will cause the overwrite to no
* longer apply on the second and subsequent runs.)
*/
private readonly blackSprite;
private readonly customGridEntities;
private readonly disableInputs;
private readonly ponyDetection;
private readonly roomClearFrame;
private readonly runInNFrames;
private readonly runNextRoom;
private readonly stageHistory;
private readonly postRender;
private checkAllPlayersJumpComplete;
private checkPixelationToBlackComplete;
private goToCustomTrapdoorDestination;
private getDestinationFunc;
private checkSecondPixelationHalfWay;
private checkAllPlayersLayingDownComplete;
private drawBlackSprite;
private readonly postGridEntityCustomUpdateTrapdoor;
private checkCustomTrapdoorOpenClose;
private shouldTrapdoorOpen;
private isPlayerCloseAfterBoss;
private checkCustomTrapdoorPlayerTouched;
private playerTouchedCustomTrapdoor;
private startDelayedJump;
private adjustPlayerPositionToTrapdoor;
private readonly postPEffectUpdateReordered;
private checkJumpComplete;
private shouldTrapdoorSpawnOpen;
private logStateChanged;
/**
* 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`.
*
* @param destinationName 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.
* @param destinationFunc 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.
*/
registerCustomTrapdoorDestination(destinationName: string, destinationFunc: (destinationName: string | undefined, destinationStage: LevelStage, destinationStageType: StageType) => void): void;
/**
* 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`.
*
* @param gridIndexOrPosition The location in the room to spawn the trapdoor.
* @param destinationName 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.
* @param destinationStage 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.
* @param destinationStageType 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.
* @param anm2Path 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".
* @param spawnOpen Optional. Whether to spawn the trapdoor in an open state. By default, behavior
* will be used that emulates a vanilla trapdoor.
*/
spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, destinationName?: string, destinationStage?: LevelStage, destinationStageType?: StageType, anm2Path?: string, spawnOpen?: boolean): GridEntity;
}
//# sourceMappingURL=CustomTrapdoors.d.ts.map