UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

1,113 lines • 112 kB
/** * - The Isaac API offers a lot of callbacks, but a lot of times there isn't one for the specific * thing that you are looking to do. So, `isaacscript-common` adds a bunch of new callbacks that * you can use. * - The extra callbacks are efficient such that no code is executed until there is one or more * subscriptions. * - You must upgrade your mod with the `upgradeMod` helper function before using a custom callback. */ export declare enum ModCallbackCustom { /** * The exact same thing as the vanilla `ENTITY_TAKE_DMG` callback, except this callback allows you * to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * - You can provide an optional fifth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function entityTakeDmgFilter( * entity: Entity, * amount: float, * damageFlags: BitFlags<DamageFlag>, * source: EntityRef, * countdownFrames: int, * ): boolean | undefined {} * ``` */ ENTITY_TAKE_DMG_FILTER = 0, /** * The exact same thing as the vanilla `ENTITY_TAKE_DMG` callback, except this callback * automatically filters for `EntityType.ENTITY_PLAYER` and casts the `Entity` object to a * `EntityPlayer`. * * - You can provide an optional third argument that will make the callback only fire if it * matches the `PlayerVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the `PlayerType` provided. * * ```ts * function entityTakeDmgPlayer( * player: EntityPlayer, * amount: float, * damageFlags: BitFlags<DamageFlag>, * source: EntityRef, * countdownFrames: int, * ): boolean | undefined {} * ``` */ ENTITY_TAKE_DMG_PLAYER = 1, /** * The exact same thing as the vanilla `INPUT_ACTION` callback, except this callback allows you to * specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `InputHook` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the `ButtonAction` provided. * * ```ts * function inputActionFilter( * entity: Entity | undefined, * inputHook: InputHook, * buttonAction: ButtonAction, * ): boolean | undefined {} * ``` */ INPUT_ACTION_FILTER = 2, /** * The exact same thing as the vanilla `INPUT_ACTION` callback, except this callback automatically * filters for `EntityType.ENTITY_PLAYER` and casts the `Entity` object to a `EntityPlayer`. It * also allows you to specify extra arguments for additional filtration. * * - You can provide an optional third argument that will make the callback only fire if it * matches the `PlayerVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the `PlayerType` provided. * - You can provide an optional fifth argument that will make the callback only fire if it * matches the `InputHook` provided. * - You can provide an optional sixth argument that will make the callback only fire if it * matches the `ButtonAction` provided. * * ```ts * function inputActionPlayer( * player: EntityPlayer, * inputHook: InputHook, * buttonAction: ButtonAction, * ): boolean | undefined {} * ``` */ INPUT_ACTION_PLAYER = 3, /** * Fires from the `POST_UPDATE` callback when a Challenge Room or Boss Rush is started. * Specifically, this happens on the first frame that `Room.IsAmbushDone` is true. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `AmbushType` provided. * * ```ts * function postAmbushFinished(ambushType: AmbushType): void {} * ``` */ POST_AMBUSH_FINISHED = 4, /** * Fires from the `POST_UPDATE` callback when a Challenge Room or Boss Rush is completed. * Specifically, this happens on the first frame that `Room.IsAmbushActive` is true. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `AmbushType` provided. * * ```ts * function postAmbushStarted(ambushType: AmbushType): void {} * ``` */ POST_AMBUSH_STARTED = 5, /** * Fires on the `POST_BOMB_UPDATE` callback that it explodes. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `BombVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postBombDetonated(bomb: EntityBomb): void {} * ``` */ POST_BOMB_EXPLODED = 6, /** * The exact same thing as the vanilla `POST_BOMB_INIT` callback, except this callback allows you * to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `BombVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postBombInitFilter(bomb: EntityBomb): void {} * ``` */ POST_BOMB_INIT_FILTER = 7, /** * Fires on the first `POST_BOMB_UPDATE` frame for each bomb. * * This callback is useful because many attributes cannot be set or retrieved properly in the * normal `POST_BOMB_INIT` callback. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `BombVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postBombInitLate(bomb: EntityBomb): void {} * ``` */ POST_BOMB_INIT_LATE = 8, /** * The exact same thing as the vanilla `POST_BOMB_RENDER` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `BombVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postBombRenderFilter(bomb: EntityBomb, renderOffset: Vector): void {} * ``` */ POST_BOMB_RENDER_FILTER = 9, /** * The exact same thing as the vanilla `POST_BOMB_UPDATE` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `BombVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postBombUpdateFilter(bomb: EntityBomb): void {} * ``` */ POST_BOMB_UPDATE_FILTER = 10, /** * Fires from the `POST_RENDER` callback when one of Forgotten's bone clubs is swung or thrown. * * ```ts * function postBoneSwing(boneClub: EntityKnife): void {} * ``` */ POST_BONE_SWING = 11, /** * Fires from the `POST_PICKUP_UPDATE` callback when a collectible goes from a non-zero sub-type * to `CollectibleType.NULL` (i.e. an "empty" pedestal). * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if the * pedestal changed from the `CollectibleType` provided. * * ```ts * function postCollectibleEmpty( * collectible: EntityPickupCollectible, * oldCollectibleType: CollectibleType, * ): void {} * ``` */ POST_COLLECTIBLE_EMPTY = 12, /** * Fires from the `POST_PLAYER_RENDER` callback on the first frame that the "TeleportUp" animation * begins playing after a player triggers a Cursed Eye teleport or a Cursed Skull teleport. (Both * of these have the same effect in causing Isaac to be teleported to a random room.) * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `PlayerVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the `PlayerType` provided. * * ```ts * function postCursedTeleport(player: EntityPlayer): void {} * ``` */ POST_CURSED_TELEPORT = 13, /** * Fires from the `POST_PLAYER_UPDATE` callback after the player has finished the death animation, * has teleported to the previous room, and is ready to play the animation for the modded revival * item. The `revivalType` will match the value returned from the `PRE_CUSTOM_REVIVE` callback. * * In this callback, you must play an animation with something along the lines of * `player.AnimateCollectible(CollectibleTypeCustom.COLLECTIBLE_MY_REVIVAL_ITEM);`, otherwise the * animation for a 1-Up will play. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if the * revival type matches the one provided. * * ```ts * function postCustomRevive(player: EntityPlayer, revivalType: int): void {} * ``` */ POST_CUSTOM_REVIVE = 14, /** * Fires from the `EFFECT_POST_UPDATE` callback after a player has entered the range of a Dice * Room floor. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `DiceFloorSubType` provided. * * ```ts * function postDiceRoomActivated( * player: EntityPlayer, * diceFloorSubType: DiceFloorSubType, * ): void {} * ``` */ POST_DICE_ROOM_ACTIVATED = 15, /** * Fires from the `POST_RENDER` callback on every frame that a door exists. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postDoorRender(door: GridEntityDoor): void {} * ``` */ POST_DOOR_RENDER = 16, /** * Fires from the `POST_UPDATE` callback on every frame that a door exists. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postDoorUpdate(door: GridEntityDoor): void {} * ``` */ POST_DOOR_UPDATE = 17, /** * The exact same thing as the vanilla `POST_EFFECT_INIT` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EffectVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEffectInitFilter(effect: EntityEffect): void {} * ``` */ POST_EFFECT_INIT_FILTER = 18, /** * Fires on the first `POST_EFFECT_UPDATE` frame for each effect. * * This callback is useful because many attributes cannot be set or retrieved properly in the * normal `POST_EFFECT_INIT` callback. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EffectVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEffectInitLate(effect: EntityEffect): void {} * ``` */ POST_EFFECT_INIT_LATE = 19, /** * The exact same thing as the vanilla `POST_EFFECT_RENDER` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EffectVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEffectRenderFilter(effect: EntityEffect, renderOffset: Vector): void {} * ``` */ POST_EFFECT_RENDER_FILTER = 20, /** * Fires from the `POST_EFFECT_UPDATE` callback when an effect's state has changed from what it * was on the previous frame. (In this context, "state" refers to the `EntityEffect.State` field.) * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EffectVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEffectStateChanged( * effect: EntityEffect, * previousState: int, * currentState: int, * ): void {} * ``` */ POST_EFFECT_STATE_CHANGED = 21, /** * The exact same thing as the vanilla `POST_EFFECT_UPDATE` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EffectVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEffectUpdateFilter(effect: EntityEffect): void {} * ``` */ POST_EFFECT_UPDATE_FILTER = 22, /** * The exact same thing as the vanilla `POST_ENTITY_KILL` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * - You can provide an optional fifth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEntityKillFilter(entity: Entity): void {} * ``` */ POST_ENTITY_KILL_FILTER = 23, /** * The exact same thing as the vanilla `POST_ENTITY_REMOVE` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `EntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * - You can provide an optional fifth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postEntityRemoveFilter(entity: Entity): void {} * ``` */ POST_ENTITY_REMOVE_FILTER = 24, /** * Fires one `POST_UPDATE` frame after the player has used the Esau Jr. item. (The player is not * updated to the new character until a game frame has passed.) * * ```ts * function postEsauJr(player: EntityPlayer): void {} * ``` */ POST_ESAU_JR = 25, /** * The exact same thing as the vanilla `POST_FAMILIAR_INIT` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `FamiliarVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postFamiliarInitFilter(familiar: EntityFamiliar): void {} * ``` */ POST_FAMILIAR_INIT_FILTER = 26, /** * Fires on the first `FAMILIAR_UPDATE` frame for each familiar. * * This callback is useful because many attributes cannot be set or retrieved properly in the * normal `POST_TEAR_INIT` callback. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `FamiliarVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postFamiliarInitLate(familiar: EntityFamiliar): void {} * ``` */ POST_FAMILIAR_INIT_LATE = 27, /** * The exact same thing as the vanilla `POST_FAMILIAR_RENDER` callback, except this callback * allows you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `FamiliarVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postFamiliarRenderFilter(familiar: EntityFamiliar, renderOffset: Vector): void {} * ``` */ POST_FAMILIAR_RENDER_FILTER = 28, /** * Fires from the `POST_FAMILIAR_UPDATE` callback when a familiar's state has changed from what it * was on the previous frame. (In this context, "state" refers to the `EntityFamiliar.State` * field.) * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `FamiliarVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postFamiliarStateChanged( * familiar: EntityFamiliar, * previousState: int, * currentState: int, * ): void {} * ``` */ POST_FAMILIAR_STATE_CHANGED = 29, /** * The exact same thing as the vanilla `POST_FAMILIAR_UPDATE` callback, except this callback * allows you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `FamiliarVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postFamiliarUpdateFilter(familiar: EntityFamiliar): void {} * ``` */ POST_FAMILIAR_UPDATE_FILTER = 30, /** * Fires one `POST_UPDATE` frame after the player has first used the Esau Jr. item. (The player is * not updated to the new character until a game frame has passed.) * * This callback is useful because there is no way to get access to the Esau Jr. character entity * before the player has actually used the Esau Jr. item. * * ```ts * function postFirstEsauJr(player: EntityPlayer): void {} * ``` */ POST_FIRST_ESAU_JR = 31, /** * Fires after the player has used the Flip item for the first time. Unlike the vanilla `USE_ITEM` * callback, this callback will return the player object for the new Lazarus (not the one who used * the Flip item). * * This callback is useful because there is no way to get access to the "flipped" character entity * before the player has actually used the Flip item. * * ```ts * function postFirstFlip(newLazarus: EntityPlayer, oldLazarus: EntityPlayer): void {} * ``` */ POST_FIRST_FLIP = 32, /** * Fires after the player has used the Flip item. Unlike the vanilla `USE_ITEM` callback, this * callback will return the player object for the new Lazarus (not the one who used the Flip * item). * * This callback is useful because there is no way to get access to the "flipped" character entity * before the player has actually used the Flip item. * * ```ts * function postFlip(newLazarus: EntityPlayer, oldLazarus: EntityPlayer): void {} * ``` */ POST_FLIP = 33, /** * The exact same thing as the vanilla `POST_GAME_END` callback, except this callback allows you * to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `isGameOver` value provided. * * ```ts * function postGameEndFilter(isGameOver: boolean): void {} * ``` */ POST_GAME_END_FILTER = 34, /** * Similar to the vanilla callback of the same name, but fires in the correct order with respect * to the `POST_NEW_LEVEL` and the `POST_NEW_ROOM` callbacks: * * `POST_GAME_STARTED_REORDERED` --> `POST_NEW_LEVEL_REORDERED` --> `POST_NEW_ROOM_REORDERED` * * - You must provide a third argument: * - Pass true if you want the callback to only fire if the run is continued. * - Pass false if you want the callback to only fire when the run is not continued. * - Pass undefined if you want the callback to fire in both situations. * * (The third argument for this callback is mandatory in order to prevent users from shooting * themselves in the foot with respect to logic unexpectedly being executed on continued runs.) * * ```ts * function postGameStartedReordered(isContinued: boolean): void {} * ``` */ POST_GAME_STARTED_REORDERED = 35, /** * Similar to the `POST_GAME_STARTED_REORDERED` callback, but fires after all of the subscribed * callbacks have finished firing. Thus, you can use this callback to do perform things after a * new run has started (or continued), but you can be sure that all new-run-related initialization * has been completed. * * - You must provide a third argument: * - Pass true if you want the callback to only fire if the run is continued. * - Pass false if you want the callback to only fire when the run is not continued. * - Pass undefined if you want the callback to fire in both situations. * * (The third argument for this callback is mandatory in order to prevent users from shooting * themselves in the foot with respect to logic unexpectedly being executed on continued runs.) * * ```ts * function postGameStartedReorderedLast(isContinued: boolean): void {} * ``` */ POST_GAME_STARTED_REORDERED_LAST = 36, /** * Fires from the `POST_UPDATE` callback when the Greed Mode wave increases. * * ```ts * function postGreedModeWave(oldWave: int, newWave: int): void {} * ``` */ POST_GREED_MODE_WAVE = 37, /** * Fires from the `POST_UPDATE` callback when a grid entity changes to a state that corresponds to * the broken state for the respective grid entity type. (For example, this will fire for a * `GridEntityType.ROCK` (2) when its state changes to `RockState.BROKEN` (2).) * * For grid entities created with `spawnCustomGridEntity`, use the * `POST_GRID_ENTITY_CUSTOM_BROKEN` callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postGridEntityBroken(gridEntity: GridEntity): void {} * ``` */ POST_GRID_ENTITY_BROKEN = 38, /** * Fires from the `POST_UPDATE` callback when a new entity collides with a grid entity. (After * this, the callback will not continue to fire. It will only fire again once the entity moves out * of range and then moves back into range.) * * For grid entities created with `spawnCustomGridEntity`, use the * `POST_GRID_ENTITY_CUSTOM_COLLISION` callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided (for the grid entity). * - You can provide an optional fifth argument that will make the callback only fire if the * colliding entity matches the `EntityType` provided. * - You can provide an optional sixth argument that will make the callback only fire if the * colliding entity matches the variant provided. * - You can provide an optional seventh argument that will make the callback only fire if the * colliding entity matches the sub-type provided. * * ```ts * function postGridEntityCollision( * gridEntity: GridEntity, * entity: Entity, * ): void {} * ``` */ POST_GRID_ENTITY_COLLISION = 39, /** * The same as the `POST_GRID_ENTITY_BROKEN` callback, but only fires for grid entities created * with the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * * ```ts * function postGridEntityCustomBroken( * gridEntity: GridEntity, * gridEntityTypeCustom: GridEntityType, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_BROKEN = 40, /** * The same as the `POST_GRID_ENTITY_COLLISION` callback, but only fires for grid entities created * with the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * - You can provide an optional fourth argument that will make the callback only fire if the * colliding entity matches the `EntityType` provided. * - You can provide an optional fifth argument that will make the callback only fire if the * colliding entity matches the variant provided. * - You can provide an optional sixth argument that will make the callback only fire if the * colliding entity matches the sub-type provided. * * ```ts * function postGridEntityCustomCollision( * gridEntity: GridEntity, * gridEntityTypeCustom: GridEntityType, * entity: Entity, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_COLLISION = 41, /** * The same as the `POST_GRID_ENTITY_INIT` callback, but only fires for grid entities created with * the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * * ```ts * function postGridEntityCustomInit( * gridEntity: GridEntity, * gridEntityTypeCustom: GridEntityType, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_INIT = 42, /** * The same as the `POST_GRID_ENTITY_REMOVE` callback, but only fires for grid entities created * with the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * * ```ts * function postGridEntityCustomRemove( * gridIndex: int, * gridEntityTypeCustom: GridEntityType, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_REMOVE = 43, /** * The same as the `POST_GRID_ENTITY_RENDER` callback, but only fires for grid entities created * with the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * * ```ts * function postGridEntityCustomRender( * gridEntity: GridEntity, * gridEntityTypeCustom: GridEntityType, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_RENDER = 44, /** * The same as the `POST_GRID_ENTITY_STATE_CHANGED` callback, but only fires for grid entities * created with the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * * ```ts * function postGridEntityCustomStateChanged( * gridEntity: GridEntity, * gridEntityTypeCustom: GridEntityType, * oldState: int, * newState: int, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_STATE_CHANGED = 45, /** * The same as the `POST_GRID_ENTITY_UPDATE` callback, but only fires for grid entities created * with the `spawnCustomGridEntity` helper function. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the custom `GridEntityType` provided. (Custom grid entities do not have variants, so * there is no need for an optional argument to filter by variant.) * * ```ts * function postGridEntityCustomUpdate( * gridEntity: GridEntity, * gridEntityTypeCustom: GridEntityType, * ): void {} * ``` */ POST_GRID_ENTITY_CUSTOM_UPDATE = 46, /** * Fires when a new grid entity is initialized. Specifically, this is either: * * - in the `POST_NEW_ROOM_REORDERED` callback (firing every time a room is entered, even if the * entity was previously there on a previous room entry) * - in the `POST_UPDATE` callback (if the entity appeared mid-way through the room, like when the * trapdoor appears after defeating It Lives) * * For grid entities created with `spawnCustomGridEntity`, use the `POST_GRID_ENTITY_CUSTOM_INIT` * callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postGridEntityInit(gridEntity: GridEntity): void {} * ``` */ POST_GRID_ENTITY_INIT = 47, /** * Fires from the `POST_UPDATE` callback when a new grid entity is removed. Specifically, this on * the frame after it no longer exists (where it did exist a frame ago). * * (Leaving a room with a grid entity does not count as "removing" it.) * * This will fire when a Polty/Kineti picks up a grid entity. * * For grid entities created with `spawnCustomGridEntity`, use the * `POST_GRID_ENTITY_CUSTOM_REMOVE` callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postGridEntityRemove( * gridIndex: int, * gridEntityType: GridEntityType, * ): void {} * ``` */ POST_GRID_ENTITY_REMOVE = 48, /** * Fires from the `POST_RENDER` callback on every frame that a grid entity exists. * * For grid entities created with `spawnCustomGridEntity`, use the * `POST_GRID_ENTITY_CUSTOM_RENDER` callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postGridEntityRender(gridEntity: GridEntity): void {} * ``` */ POST_GRID_ENTITY_RENDER = 49, /** * Fires from the `POST_UPDATE` callback when a grid entity changes its state. (In this context, * "state" refers to the `GridEntity.State` field.) * * For grid entities created with `spawnCustomGridEntity`, use the * `POST_GRID_ENTITY_CUSTOM_STATE_CHANGED` callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postGridEntityStateChanged( * gridEntity: GridEntity, * oldState: int, * newState: int, * ): void {} * ``` */ POST_GRID_ENTITY_STATE_CHANGED = 50, /** * Fires from the `POST_UPDATE` callback on every frame that a grid entity exists. * * For grid entities created with `spawnCustomGridEntity`, use the * `POST_GRID_ENTITY_CUSTOM_UPDATE` callback instead. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `GridEntityType` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the variant provided. * * ```ts * function postGridEntityUpdate(gridEntity: GridEntity): void {} * ``` */ POST_GRID_ENTITY_UPDATE = 51, /** * Fires from the `POST_PEFFECT_UPDATE_REORDERED` callback when the player loses a Holy Mantle * temporary collectible effect. * * This callback is useful because you might want to have code that happens when the player is hit * from an enemy. Normally, you would accomplish this via the `ENTITY_TAKE_DMG` callback, but that * callback never fires if the player has a Holy Mantle shield. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `PlayerVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the `PlayerType` provided. * * ```ts * function postPlayerInitReordered( * player: EntityPlayer, * oldNumHolyMantles: int, * newNumHolyMantles: int, * ): void {} * ``` */ POST_HOLY_MANTLE_REMOVED = 52, /** * Fires from `POST_PEFFECT_UPDATE_REORDERED` callback when the player loses charge on their * active collectible item, implying that the item was just used. * * This callback is useful because the `USE_ITEM` callback does not fire when The Candle, Red * Candle, and Bob's Rotten Brain are discharged. * * Note that this callback will not fire if the active item is both discharged and swapped for * another item / discharged on the same frame, like in the case of Alabaster Box. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `CollectibleType` provided. * * ```ts * function postItemDischarge( * player: EntityPlayer, * collectibleType: CollectibleType, * activeSlot: ActiveSlot, * ): void {} * ``` */ POST_ITEM_DISCHARGE = 53, /** * Fires from the `POST_PEFFECT_UPDATE_REORDERED` callback when an item is no longer queued (i.e. * when the animation of the player holding the item above their head is finished and the item is * actually added to the player's inventory). * * Note that this callback will only fire once per Forgotten/Soul pair. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `ItemType` provided. * - You can provide an optional fourth argument that will make the callback only fire if the * sub-type matches the `CollectibleType` or the `TrinketType` provided. * * ```ts * function postItemPickup( * player: EntityPlayer, * pickingUpItem: PickingUpItem, * ): void {} * ``` */ POST_ITEM_PICKUP = 54, /** * Fires on the first `POST_RENDER` frame after a key on the keyboard has been pressed or * released. (In other words, the callback only fires when the "pressed" status is different than * what it was on the previous frame.) * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `Keyboard` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the pressed state provided. (`true` for pressed, `false` for released.) * * ```ts * function postKeyboardChanged(keyboard: Keyboard, pressed: boolean): void {} * ``` */ POST_KEYBOARD_CHANGED = 55, /** * The exact same thing as the vanilla `POST_KNIFE_INIT` callback, except this callback allows you * to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `KnifeVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postKnifeInitFilter(knife: EntityKnife): void {} * ``` */ POST_KNIFE_INIT_FILTER = 56, /** * Fires on the first `POST_KNIFE_UPDATE` frame for each knife. * * This callback is useful because many attributes cannot be set or retrieved properly in the * normal `POST_KNIFE_INIT` callback. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `KnifeVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postKnifeInitLate(knife: EntityKnife): void {} * ``` */ POST_KNIFE_INIT_LATE = 57, /** * The exact same thing as the vanilla `POST_KNIFE_RENDER` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `KnifeVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postKnifeRenderFilter(knife: EntityKnife, renderOffset: Vector): void {} * ``` */ POST_KNIFE_RENDER_FILTER = 58, /** * The exact same thing as the vanilla `POST_KNIFE_UPDATE` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `KnifeVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postKnifeUpdateFilter(knife: EntityKnife): void {} * ``` */ POST_KNIFE_UPDATE_FILTER = 59, /** * The exact same thing as the vanilla `POST_LASER_INIT` callback, except this callback allows you * to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `LaserVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postLaserInitFilter(laser: EntityLaser): void {} * ``` */ POST_LASER_INIT_FILTER = 60, /** * Fires on the first `POST_LASER_UPDATE` frame for each laser. * * This callback is useful because many attributes cannot be set or retrieved properly in the * normal `POST_LASER_INIT` callback. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `LaserVariant` provided. * - You can provide an optional forth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postLaserInitLate(laser: EntityLaser): void {} * ``` */ POST_LASER_INIT_LATE = 61, /** * The exact same thing as the vanilla `POST_LASER_RENDER` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `LaserVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postLaserRenderFilter(laser: EntityLaser, renderOffset: Vector): void {} * ``` */ POST_LASER_RENDER_FILTER = 62, /** * The exact same thing as the vanilla `POST_LASER_UPDATE` callback, except this callback allows * you to specify extra arguments for additional filtration. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `LaserVariant` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the sub-type provided. * * ```ts * function postLaserUpdateFilter(laser: EntityLaser): void {} * ``` */ POST_LASER_UPDATE_FILTER = 63, /** * The same as the vanilla callback of the same name, but fires in the correct order with respect * to the `POST_GAME_STARTED` and the `POST_NEW_ROOM` callbacks: * * `POST_GAME_STARTED_REORDERED` --> `POST_NEW_LEVEL_REORDERED` --> `POST_NEW_ROOM_REORDERED` * * Additionally, this callback will pass the `LevelStage` as the first callback argument and the * `StageType` as the second callback argument. * * Note that similar to the vanilla `POST_NEW_LEVEL` callback, this callback will not fire when a * player resumes a saved run. (In that case, only the `POST_GAME_STARTED_REORDERED` and the * `POST_NEW_ROOM_REORDERED` callbacks will fire, in that order). * * If some specific cases, mods can change the current level during run initialization (on the 0th * frame). However, due to how the callback reordering works, the custom * `POST_NEW_LEVEL_REORDERED` callback will never fire on the 0th frame. To get around this, call * the `forceNewLevelCallback()` function before changing levels to temporarily force the callback * to fire. * * When registering the callback with the `ModUpgraded.AddCallbackCustom` method: * - You can provide an optional third argument that will make the callback only fire if it * matches the `LevelStage` provided. * - You can provide an optional fourth argument that will make the callback only fire if it * matches the `StageType` provided. * * ```ts * function postNewLevelReordered(stage: LevelStage, stageType: StageType): void {} * ``` */ POST_NEW