UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

1,030 lines • 122 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModCallbackCustom = void 0; /** * - 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. */ var ModCallbackCustom; (function (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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["ENTITY_TAKE_DMG_FILTER"] = 0] = "ENTITY_TAKE_DMG_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["ENTITY_TAKE_DMG_PLAYER"] = 1] = "ENTITY_TAKE_DMG_PLAYER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["INPUT_ACTION_FILTER"] = 2] = "INPUT_ACTION_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["INPUT_ACTION_PLAYER"] = 3] = "INPUT_ACTION_PLAYER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_AMBUSH_FINISHED"] = 4] = "POST_AMBUSH_FINISHED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_AMBUSH_STARTED"] = 5] = "POST_AMBUSH_STARTED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_BOMB_EXPLODED"] = 6] = "POST_BOMB_EXPLODED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_BOMB_INIT_FILTER"] = 7] = "POST_BOMB_INIT_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_BOMB_INIT_LATE"] = 8] = "POST_BOMB_INIT_LATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_BOMB_RENDER_FILTER"] = 9] = "POST_BOMB_RENDER_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_BOMB_UPDATE_FILTER"] = 10] = "POST_BOMB_UPDATE_FILTER"; /** * Fires from the `POST_RENDER` callback when one of Forgotten's bone clubs is swung or thrown. * * ```ts * function postBoneSwing(boneClub: EntityKnife): void {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_BONE_SWING"] = 11] = "POST_BONE_SWING"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_COLLECTIBLE_EMPTY"] = 12] = "POST_COLLECTIBLE_EMPTY"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_CURSED_TELEPORT"] = 13] = "POST_CURSED_TELEPORT"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_CUSTOM_REVIVE"] = 14] = "POST_CUSTOM_REVIVE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_DICE_ROOM_ACTIVATED"] = 15] = "POST_DICE_ROOM_ACTIVATED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_DOOR_RENDER"] = 16] = "POST_DOOR_RENDER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_DOOR_UPDATE"] = 17] = "POST_DOOR_UPDATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_EFFECT_INIT_FILTER"] = 18] = "POST_EFFECT_INIT_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_EFFECT_INIT_LATE"] = 19] = "POST_EFFECT_INIT_LATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_EFFECT_RENDER_FILTER"] = 20] = "POST_EFFECT_RENDER_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_EFFECT_STATE_CHANGED"] = 21] = "POST_EFFECT_STATE_CHANGED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_EFFECT_UPDATE_FILTER"] = 22] = "POST_EFFECT_UPDATE_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_ENTITY_KILL_FILTER"] = 23] = "POST_ENTITY_KILL_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_ENTITY_REMOVE_FILTER"] = 24] = "POST_ENTITY_REMOVE_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_ESAU_JR"] = 25] = "POST_ESAU_JR"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FAMILIAR_INIT_FILTER"] = 26] = "POST_FAMILIAR_INIT_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FAMILIAR_INIT_LATE"] = 27] = "POST_FAMILIAR_INIT_LATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FAMILIAR_RENDER_FILTER"] = 28] = "POST_FAMILIAR_RENDER_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FAMILIAR_STATE_CHANGED"] = 29] = "POST_FAMILIAR_STATE_CHANGED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FAMILIAR_UPDATE_FILTER"] = 30] = "POST_FAMILIAR_UPDATE_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FIRST_ESAU_JR"] = 31] = "POST_FIRST_ESAU_JR"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FIRST_FLIP"] = 32] = "POST_FIRST_FLIP"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_FLIP"] = 33] = "POST_FLIP"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GAME_END_FILTER"] = 34] = "POST_GAME_END_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GAME_STARTED_REORDERED"] = 35] = "POST_GAME_STARTED_REORDERED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GAME_STARTED_REORDERED_LAST"] = 36] = "POST_GAME_STARTED_REORDERED_LAST"; /** * Fires from the `POST_UPDATE` callback when the Greed Mode wave increases. * * ```ts * function postGreedModeWave(oldWave: int, newWave: int): void {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GREED_MODE_WAVE"] = 37] = "POST_GREED_MODE_WAVE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_BROKEN"] = 38] = "POST_GRID_ENTITY_BROKEN"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_COLLISION"] = 39] = "POST_GRID_ENTITY_COLLISION"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_BROKEN"] = 40] = "POST_GRID_ENTITY_CUSTOM_BROKEN"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_COLLISION"] = 41] = "POST_GRID_ENTITY_CUSTOM_COLLISION"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_INIT"] = 42] = "POST_GRID_ENTITY_CUSTOM_INIT"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_REMOVE"] = 43] = "POST_GRID_ENTITY_CUSTOM_REMOVE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_RENDER"] = 44] = "POST_GRID_ENTITY_CUSTOM_RENDER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_STATE_CHANGED"] = 45] = "POST_GRID_ENTITY_CUSTOM_STATE_CHANGED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_CUSTOM_UPDATE"] = 46] = "POST_GRID_ENTITY_CUSTOM_UPDATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_INIT"] = 47] = "POST_GRID_ENTITY_INIT"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_REMOVE"] = 48] = "POST_GRID_ENTITY_REMOVE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_RENDER"] = 49] = "POST_GRID_ENTITY_RENDER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_STATE_CHANGED"] = 50] = "POST_GRID_ENTITY_STATE_CHANGED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_GRID_ENTITY_UPDATE"] = 51] = "POST_GRID_ENTITY_UPDATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_HOLY_MANTLE_REMOVED"] = 52] = "POST_HOLY_MANTLE_REMOVED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_ITEM_DISCHARGE"] = 53] = "POST_ITEM_DISCHARGE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_ITEM_PICKUP"] = 54] = "POST_ITEM_PICKUP"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_KEYBOARD_CHANGED"] = 55] = "POST_KEYBOARD_CHANGED"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_KNIFE_INIT_FILTER"] = 56] = "POST_KNIFE_INIT_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_KNIFE_INIT_LATE"] = 57] = "POST_KNIFE_INIT_LATE"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_KNIFE_RENDER_FILTER"] = 58] = "POST_KNIFE_RENDER_FILTER"; /** * 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 {} * ``` */ ModCallbackCustom[ModCallbackCustom["POST_KNIFE_UPDATE_FILTER"] = 59] = "POST_KNIFE_UPDATE_FILTER"; /** * 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.AddCallbackCusto