UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

1,190 lines (1,139 loc) • 881 kB
import { ActiveSlot } from 'isaac-typescript-definitions'; import type { BackdropType } from 'isaac-typescript-definitions'; import type { BatterySubType } from 'isaac-typescript-definitions'; import type { BombSubType } from 'isaac-typescript-definitions'; import type { BombVariant } from 'isaac-typescript-definitions'; import { BossID } from 'isaac-typescript-definitions'; import { ButtonAction } from 'isaac-typescript-definitions'; import { CacheFlag } from 'isaac-typescript-definitions'; import { CallbackPriority } from 'isaac-typescript-definitions'; import { CardType } from 'isaac-typescript-definitions'; import { Challenge } from 'isaac-typescript-definitions'; import type { CoinSubType } from 'isaac-typescript-definitions'; import type { CollectiblePedestalType } from 'isaac-typescript-definitions'; import { CollectibleType } from 'isaac-typescript-definitions'; import { Controller } from 'isaac-typescript-definitions'; import { ControllerIndex } from 'isaac-typescript-definitions'; import { CopyableIsaacAPIClassType } from 'isaac-typescript-definitions'; import { CrawlSpaceVariant } from 'isaac-typescript-definitions'; import { DamageFlag } from 'isaac-typescript-definitions'; import type { DiceFloorSubType } from 'isaac-typescript-definitions'; import { Dimension } from 'isaac-typescript-definitions'; import { Direction } from 'isaac-typescript-definitions'; import { DisplayFlag } from 'isaac-typescript-definitions'; import { DoorSlot } from 'isaac-typescript-definitions'; import type { DoorSlotFlag } from 'isaac-typescript-definitions'; import { DoorVariant } from 'isaac-typescript-definitions'; import type { EffectVariant } from 'isaac-typescript-definitions'; import { EntityFlag } from 'isaac-typescript-definitions'; import { EntityType } from 'isaac-typescript-definitions'; import type { FamiliarVariant } from 'isaac-typescript-definitions'; import { GridCollisionClass } from 'isaac-typescript-definitions'; import { GridEntityType } from 'isaac-typescript-definitions'; import type { GridEntityXMLType } from 'isaac-typescript-definitions'; import type { HeartSubType } from 'isaac-typescript-definitions'; import type { InputHook } from 'isaac-typescript-definitions'; import { ItemConfigCardType } from 'isaac-typescript-definitions'; import { ItemConfigChargeType } from 'isaac-typescript-definitions'; import type { ItemConfigPillEffectClass } from 'isaac-typescript-definitions'; import type { ItemConfigPillEffectType } from 'isaac-typescript-definitions'; import { ItemConfigTag } from 'isaac-typescript-definitions'; import { ItemPoolType } from 'isaac-typescript-definitions'; import { ItemType } from 'isaac-typescript-definitions'; import { Keyboard } from 'isaac-typescript-definitions'; import type { KeySubType } from 'isaac-typescript-definitions'; import type { KnifeVariant } from 'isaac-typescript-definitions'; import type { LaserVariant } from 'isaac-typescript-definitions'; import type { LevelCurse } from 'isaac-typescript-definitions'; import { LevelStage } from 'isaac-typescript-definitions'; import type { MinibossID } from 'isaac-typescript-definitions'; import { ModCallback } from 'isaac-typescript-definitions'; import type { Music } from 'isaac-typescript-definitions'; import type { NPCState } from 'isaac-typescript-definitions'; import type { NullItemID } from 'isaac-typescript-definitions'; import { PickupPrice } from 'isaac-typescript-definitions'; import { PickupVariant } from 'isaac-typescript-definitions'; import { PillColor } from 'isaac-typescript-definitions'; import { PillEffect } from 'isaac-typescript-definitions'; import { PitVariant } from 'isaac-typescript-definitions'; import { PlayerForm } from 'isaac-typescript-definitions'; import { PlayerType } from 'isaac-typescript-definitions'; import type { PlayerVariant } from 'isaac-typescript-definitions'; import type { PocketItemSlot } from 'isaac-typescript-definitions'; import { PoopGridEntityVariant } from 'isaac-typescript-definitions'; import { PressurePlateVariant } from 'isaac-typescript-definitions'; import { ProjectileFlag } from 'isaac-typescript-definitions'; import { ProjectilesMode } from 'isaac-typescript-definitions'; import type { ProjectileVariant } from 'isaac-typescript-definitions'; import { RockVariant } from 'isaac-typescript-definitions'; import { RoomShape } from 'isaac-typescript-definitions'; import { RoomTransitionAnim } from 'isaac-typescript-definitions'; import { RoomType } from 'isaac-typescript-definitions'; import type { SackSubType } from 'isaac-typescript-definitions'; import { SeedEffect } from 'isaac-typescript-definitions'; import { SlotVariant } from 'isaac-typescript-definitions'; import { StageID } from 'isaac-typescript-definitions'; import { StageType } from 'isaac-typescript-definitions'; import { TearFlag } from 'isaac-typescript-definitions'; import type { TearVariant } from 'isaac-typescript-definitions'; import type { TrapdoorVariant } from 'isaac-typescript-definitions'; import { TrinketType } from 'isaac-typescript-definitions'; import { UseFlag } from 'isaac-typescript-definitions'; /** * Helper type to add two other types. * * From: https://gist.github.com/ryandabler/8b4ff4f36aed47bc09acc03174638468 */ export declare type Add<A extends number, B extends number> = Length<[ ...BuildTuple<A>, ...BuildTuple<B> ]>; declare interface AddCallbackParametersCustom { [ModCallbackCustom.ENTITY_TAKE_DMG_FILTER]: [ callback: (entity: Entity, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined, entityType?: EntityType, variant?: number, subType?: number ]; [ModCallbackCustom.ENTITY_TAKE_DMG_PLAYER]: [ callback: (player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.INPUT_ACTION_FILTER]: [ callback: (entity: Entity | undefined, inputHook: InputHook, buttonAction: ButtonAction) => boolean | float | undefined, inputHook?: InputHook, buttonAction?: ButtonAction ]; [ModCallbackCustom.INPUT_ACTION_PLAYER]: [ callback: (player: EntityPlayer, inputHook: InputHook, buttonAction: ButtonAction) => boolean | float | undefined, playerVariant?: PlayerVariant, character?: PlayerType, inputHook?: InputHook, buttonAction?: ButtonAction ]; [ModCallbackCustom.POST_AMBUSH_FINISHED]: [ callback: (ambushType: AmbushType) => void, ambushType?: AmbushType ]; [ModCallbackCustom.POST_AMBUSH_STARTED]: [ callback: (ambushType: AmbushType) => void, ambushType?: AmbushType ]; [ModCallbackCustom.POST_BOMB_EXPLODED]: [ callback: (bomb: EntityBomb) => void, bombVariant?: BombVariant, subType?: int ]; [ModCallbackCustom.POST_BOMB_INIT_FILTER]: [ callback: (bomb: EntityBomb) => void, bombVariant?: BombVariant, subType?: int ]; [ModCallbackCustom.POST_BOMB_INIT_LATE]: [ callback: (bomb: EntityBomb) => void, bombVariant?: BombVariant, subType?: int ]; [ModCallbackCustom.POST_BOMB_RENDER_FILTER]: [ callback: (bomb: EntityBomb, renderOffset: Vector) => void, bombVariant?: BombVariant, subType?: int ]; [ModCallbackCustom.POST_BOMB_UPDATE_FILTER]: [ callback: (bomb: EntityBomb) => void, bombVariant?: BombVariant, subType?: int ]; [ModCallbackCustom.POST_BONE_SWING]: [callback: (knife: EntityKnife) => void]; [ModCallbackCustom.POST_COLLECTIBLE_EMPTY]: [ callback: (collectible: EntityPickupCollectible, oldCollectibleType: CollectibleType) => void, collectibleType?: CollectibleType ]; [ModCallbackCustom.POST_CURSED_TELEPORT]: [ callback: (player: EntityPlayer) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_CUSTOM_REVIVE]: [ callback: (player: EntityPlayer, revivalType: int) => void, revivalType?: int ]; [ModCallbackCustom.POST_DICE_ROOM_ACTIVATED]: [ callback: (player: EntityPlayer, diceFloorSubType: DiceFloorSubType) => void, diceFloorSubType?: DiceFloorSubType ]; [ModCallbackCustom.POST_DOOR_RENDER]: [ callback: (door: GridEntityDoor) => void, doorVariant?: DoorVariant ]; [ModCallbackCustom.POST_DOOR_UPDATE]: [ callback: (door: GridEntityDoor) => void, doorVariant?: DoorVariant ]; [ModCallbackCustom.POST_EFFECT_INIT_FILTER]: [ callback: (effect: EntityEffect) => void, effectVariant?: EffectVariant, subType?: int ]; [ModCallbackCustom.POST_EFFECT_INIT_LATE]: [ callback: (effect: EntityEffect) => void, effectVariant?: EffectVariant, subType?: int ]; [ModCallbackCustom.POST_EFFECT_RENDER_FILTER]: [ callback: (effect: EntityEffect, renderOffset: Vector) => void, effectVariant?: EffectVariant, subType?: int ]; [ModCallbackCustom.POST_EFFECT_STATE_CHANGED]: [ callback: (effect: EntityEffect, previousState: int, currentState: int) => void, effectVariant?: EffectVariant, subType?: int ]; [ModCallbackCustom.POST_EFFECT_UPDATE_FILTER]: [ callback: (effect: EntityEffect) => void, effectVariant?: EffectVariant, subType?: int ]; [ModCallbackCustom.POST_ENTITY_KILL_FILTER]: [ callback: (entity: Entity) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_ENTITY_REMOVE_FILTER]: [ callback: (entity: Entity) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_ESAU_JR]: [callback: (player: EntityPlayer) => void]; [ModCallbackCustom.POST_FAMILIAR_INIT_FILTER]: [ callback: (familiar: EntityFamiliar) => void, familiarVariant?: FamiliarVariant, subType?: int ]; [ModCallbackCustom.POST_FAMILIAR_INIT_LATE]: [ callback: (familiar: EntityFamiliar) => void, familiarVariant?: FamiliarVariant, subType?: int ]; [ModCallbackCustom.POST_FAMILIAR_RENDER_FILTER]: [ callback: (familiar: EntityFamiliar, renderOffset: Vector) => void, familiarVariant?: FamiliarVariant, subType?: int ]; [ModCallbackCustom.POST_FAMILIAR_STATE_CHANGED]: [ callback: (familiar: EntityFamiliar, previousState: int, currentState: int) => void, familiarVariant?: FamiliarVariant, subType?: int ]; [ModCallbackCustom.POST_FAMILIAR_UPDATE_FILTER]: [ callback: (familiar: EntityFamiliar) => void, familiarVariant?: FamiliarVariant, subType?: int ]; [ModCallbackCustom.POST_FIRST_ESAU_JR]: [ callback: (player: EntityPlayer) => void ]; [ModCallbackCustom.POST_FIRST_FLIP]: [ callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void ]; [ModCallbackCustom.POST_FLIP]: [ callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void ]; [ModCallbackCustom.POST_GAME_END_FILTER]: [ callback: (isGameOver: boolean) => void, isGameOver?: boolean ]; [ModCallbackCustom.POST_GAME_STARTED_REORDERED]: [ callback: (isContinued: boolean) => void, isContinued: boolean | undefined ]; [ModCallbackCustom.POST_GAME_STARTED_REORDERED_LAST]: [ callback: (isContinued: boolean) => void, isContinued: boolean | undefined ]; [ModCallbackCustom.POST_GREED_MODE_WAVE]: [ callback: (oldWave: int, newWave: int) => void ]; [ModCallbackCustom.POST_GRID_ENTITY_BROKEN]: [ callback: (gridEntity: GridEntity) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_COLLISION]: [ callback: (gridEntity: GridEntity, entity: Entity) => void, gridEntityType?: GridEntityType, gridEntityVariant?: int, entityType?: EntityType, entityVariant?: int, entitySubType?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_BROKEN]: [ callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType) => void, gridEntityTypeCustom?: GridEntityType ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_COLLISION]: [ callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType, entity: Entity) => void, gridEntityTypeCustom?: GridEntityType, entityType?: EntityType, entityVariant?: int, entitySubType?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_INIT]: [ callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType) => void, gridEntityTypeCustom?: GridEntityType ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_REMOVE]: [ callback: (gridIndex: int, gridEntityTypeCustom: GridEntityType) => void, gridEntityTypeCustom?: GridEntityType ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_RENDER]: [ callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType) => void, gridEntityTypeCustom?: GridEntityType ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_STATE_CHANGED]: [ callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType, oldState: int, newState: int) => void, gridEntityTypeCustom?: GridEntityType ]; [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE]: [ callback: (gridEntity: GridEntity, gridEntityTypeCustom: GridEntityType) => void, gridEntityTypeCustom?: GridEntityType ]; [ModCallbackCustom.POST_GRID_ENTITY_INIT]: [ callback: (gridEntity: GridEntity) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_REMOVE]: [ callback: (gridIndex: int, gridEntityType: GridEntityType, variant: int) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_RENDER]: [ callback: (gridEntity: GridEntity) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_STATE_CHANGED]: [ callback: (gridEntity: GridEntity, oldState: int, newState: int) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_GRID_ENTITY_UPDATE]: [ callback: (gridEntity: GridEntity) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_HOLY_MANTLE_REMOVED]: [ callback: (player: EntityPlayer, oldNumHolyMantles: int, newNumHolyMantles: int) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_ITEM_DISCHARGE]: [ callback: (player: EntityPlayer, collectibleType: CollectibleType, activeSlot: ActiveSlot) => void, collectibleType?: CollectibleType ]; [ModCallbackCustom.POST_ITEM_PICKUP]: [callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => void] | [ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemCollectible) => void, itemType: ItemType.PASSIVE | ItemType.ACTIVE | ItemType.FAMILIAR, collectibleType?: CollectibleType ] | [ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemTrinket) => void, itemType: ItemType.TRINKET, trinketType?: TrinketType ]; [ModCallbackCustom.POST_KEYBOARD_CHANGED]: [ callback: (keyboard: Keyboard, pressed: boolean) => void, keyboard?: Keyboard, pressed?: boolean ]; [ModCallbackCustom.POST_KNIFE_INIT_FILTER]: [ callback: (knife: EntityKnife) => void, knifeVariant?: KnifeVariant, subType?: int ]; [ModCallbackCustom.POST_KNIFE_INIT_LATE]: [ callback: (knife: EntityKnife) => void, knifeVariant?: KnifeVariant, subType?: int ]; [ModCallbackCustom.POST_KNIFE_RENDER_FILTER]: [ callback: (knife: EntityKnife, renderOffset: Vector) => void, knifeVariant?: KnifeVariant, subType?: int ]; [ModCallbackCustom.POST_KNIFE_UPDATE_FILTER]: [ callback: (knife: EntityKnife) => void, knifeVariant?: KnifeVariant, subType?: int ]; [ModCallbackCustom.POST_LASER_INIT_FILTER]: [ callback: (laser: EntityLaser) => void, laserVariant?: LaserVariant, subType?: int ]; [ModCallbackCustom.POST_LASER_INIT_LATE]: [ callback: (laser: EntityLaser) => void, laserVariant?: LaserVariant, subType?: int ]; [ModCallbackCustom.POST_LASER_RENDER_FILTER]: [ callback: (laser: EntityLaser, renderOffset: Vector) => void, laserVariant?: LaserVariant, subType?: int ]; [ModCallbackCustom.POST_LASER_UPDATE_FILTER]: [ callback: (laser: EntityLaser) => void, laserVariant?: LaserVariant, subType?: int ]; [ModCallbackCustom.POST_NEW_LEVEL_REORDERED]: [ callback: (stage: LevelStage, stageType: StageType) => void, stage?: LevelStage, stageType?: StageType ]; [ModCallbackCustom.POST_NEW_ROOM_EARLY]: [ callback: (roomType: RoomType) => void, roomType?: RoomType ]; [ModCallbackCustom.POST_NEW_ROOM_REORDERED]: [ callback: (roomType: RoomType) => void, roomType?: RoomType ]; [ModCallbackCustom.POST_NPC_DEATH_FILTER]: [ callback: (npc: EntityNPC) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_NPC_INIT_FILTER]: [ callback: (npc: EntityNPC) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_NPC_INIT_LATE]: [ callback: (npc: EntityNPC) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_NPC_RENDER_FILTER]: [ callback: (npc: EntityNPC, renderOffset: Vector) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_NPC_STATE_CHANGED]: [ callback: (npc: EntityNPC, previousState: int, currentState: int) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_NPC_UPDATE_FILTER]: [ callback: (npc: EntityNPC) => void, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED]: [ callback: (player: EntityPlayer) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PICKUP_CHANGED]: [ callback: (pickup: EntityPickup, oldVariant: PickupVariant, oldSubType: int, newVariant: PickupVariant, newSubType: int) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_COLLECT]: [ callback: (pickup: EntityPickup, player: EntityPlayer) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_INIT_FILTER]: [ callback: (pickup: EntityPickup) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_INIT_FIRST]: [ callback: (pickup: EntityPickup) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_INIT_LATE]: [ callback: (pickup: EntityPickup) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_RENDER_FILTER]: [ callback: (pickup: EntityPickup, renderOffset: Vector) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_SELECTION_FILTER]: [ callback: (pickup: EntityPickup, variant: PickupVariant, subType: int) => [pickupVariant: PickupVariant, subType: int] | undefined, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_STATE_CHANGED]: [ callback: (pickup: EntityPickup, previousState: int, currentState: int) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PICKUP_UPDATE_FILTER]: [ callback: (pickup: EntityPickup) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_PIT_RENDER]: [ callback: (pit: GridEntityPit) => void, pitVariant?: PitVariant ]; [ModCallbackCustom.POST_PIT_UPDATE]: [ callback: (pit: GridEntityPit) => void, pitVariant?: PitVariant ]; [ModCallbackCustom.POST_PLAYER_CHANGE_HEALTH]: [ callback: (player: EntityPlayer, healthType: HealthType, difference: int, oldValue: int, newValue: int) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PLAYER_CHANGE_STAT]: [ callback: <T extends PlayerStat>(player: EntityPlayer, playerStat: PlayerStat, difference: int, oldValue: PlayerStats[T], newValue: PlayerStats[T]) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PLAYER_CHANGE_TYPE]: [ callback: (player: EntityPlayer, oldCharacter: PlayerType, newCharacter: PlayerType) => void, playerVariant?: PlayerVariant ]; [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED]: [ callback: (player: EntityPlayer, collectibleType: CollectibleType) => void, collectibleType?: CollectibleType ]; [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED]: [ callback: (player: EntityPlayer, collectibleType: CollectibleType) => void, collectibleType?: CollectibleType ]; [ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE]: [ callback: (player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PLAYER_INIT_FIRST]: [ callback: (player: EntityPlayer) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PLAYER_INIT_LATE]: [ callback: (player: EntityPlayer) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PLAYER_RENDER_REORDERED]: [ callback: (player: EntityPlayer, renderOffset: Vector) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_PLAYER_UPDATE_REORDERED]: [ callback: (player: EntityPlayer) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_POOP_RENDER]: [ callback: (poop: GridEntityPoop) => void, poopVariant?: PoopGridEntityVariant ]; [ModCallbackCustom.POST_POOP_UPDATE]: [ callback: (poop: GridEntityPoop) => void, poopVariant?: PoopGridEntityVariant ]; [ModCallbackCustom.POST_PRESSURE_PLATE_RENDER]: [ callback: (pressurePlate: GridEntityPressurePlate) => void, pressurePlateVariant?: PressurePlateVariant ]; [ModCallbackCustom.POST_PRESSURE_PLATE_UPDATE]: [ callback: (pressurePlate: GridEntityPressurePlate) => void, pressurePlateVariant?: PressurePlateVariant ]; [ModCallbackCustom.POST_PROJECTILE_INIT_FILTER]: [ callback: (projectile: EntityProjectile) => void, projectileVariant?: ProjectileVariant, subType?: int ]; [ModCallbackCustom.POST_PROJECTILE_INIT_LATE]: [ callback: (projectile: EntityProjectile) => void, projectileVariant?: ProjectileVariant, subType?: int ]; [ModCallbackCustom.POST_PROJECTILE_KILL]: [ callback: (projectile: EntityProjectile) => void, projectileVariant?: ProjectileVariant, subType?: number ]; [ModCallbackCustom.POST_PROJECTILE_UPDATE_FILTER]: [ callback: (projectile: EntityProjectile) => void, projectileVariant?: ProjectileVariant, subType?: int ]; [ModCallbackCustom.POST_PROJECTILE_RENDER_FILTER]: [ callback: (projectile: EntityProjectile, renderOffset: Vector) => void, projectileVariant?: ProjectileVariant, subType?: int ]; [ModCallbackCustom.POST_PURCHASE]: [ callback: (player: EntityPlayer, pickup: EntityPickup) => void, pickupVariant?: PickupVariant, subType?: int ]; [ModCallbackCustom.POST_ROCK_RENDER]: [ callback: (rock: GridEntityRock) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_ROCK_UPDATE]: [ callback: (rock: GridEntityRock) => void, gridEntityType?: GridEntityType, variant?: int ]; [ModCallbackCustom.POST_ROOM_CLEAR_CHANGED]: [ callback: (roomClear: boolean) => void, roomClear?: boolean ]; [ModCallbackCustom.POST_SACRIFICE]: [ callback: (player: EntityPlayer, numSacrifices: int) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.POST_SLOT_ANIMATION_CHANGED]: [ callback: (slot: EntitySlot, previousAnimation: string, currentAnimation: string) => void, slotVariant?: SlotVariant, subType?: int ]; [ModCallbackCustom.POST_SLOT_COLLISION]: [ callback: (slot: EntitySlot, player: EntityPlayer) => void, slotVariant?: SlotVariant, subType?: int ]; [ModCallbackCustom.POST_SLOT_DESTROYED]: [ callback: (slot: EntitySlot, slotDestructionType: SlotDestructionType) => void, slotVariant?: SlotVariant, subType?: int ]; [ModCallbackCustom.POST_SLOT_INIT]: [ callback: (slot: EntitySlot) => void, slotVariant?: SlotVariant, subType?: int ]; [ModCallbackCustom.POST_SLOT_RENDER]: [ callback: (slot: EntitySlot) => void, slotVariant?: SlotVariant, subType?: int ]; [ModCallbackCustom.POST_SLOT_UPDATE]: [ callback: (slot: EntitySlot) => void, slotVariant?: SlotVariant, subType?: int ]; [ModCallbackCustom.POST_SPIKES_RENDER]: [ callback: (spikes: GridEntitySpikes) => void, variant?: int ]; [ModCallbackCustom.POST_SPIKES_UPDATE]: [ callback: (spikes: GridEntitySpikes) => void, variant?: int ]; [ModCallbackCustom.POST_TEAR_INIT_FILTER]: [ callback: (tear: EntityTear) => void, tearVariant?: TearVariant, subType?: int ]; [ModCallbackCustom.POST_TEAR_INIT_LATE]: [ callback: (tear: EntityTear) => void, tearVariant?: TearVariant, subType?: int ]; [ModCallbackCustom.POST_TEAR_INIT_VERY_LATE]: [ callback: (tear: EntityTear) => void, tearVariant?: TearVariant, subType?: int ]; [ModCallbackCustom.POST_TEAR_KILL]: [ callback: (tear: EntityTear) => void, tearVariant?: TearVariant, subType?: int ]; [ModCallbackCustom.POST_TEAR_RENDER_FILTER]: [ callback: (tear: EntityTear, renderOffset: Vector) => void, tearVariant?: TearVariant, subType?: int ]; [ModCallbackCustom.POST_TEAR_UPDATE_FILTER]: [ callback: (tear: EntityTear) => void, tearVariant?: TearVariant, subType?: int ]; [ModCallbackCustom.POST_TNT_RENDER]: [ callback: (tnt: GridEntityTNT) => void, variant?: int ]; [ModCallbackCustom.POST_TNT_UPDATE]: [ callback: (tnt: GridEntityTNT) => void, variant?: int ]; [ModCallbackCustom.POST_TRANSFORMATION]: [ callback: (player: EntityPlayer, playerForm: PlayerForm, hasForm: boolean) => void, playerForm?: PlayerForm ]; [ModCallbackCustom.POST_TRINKET_BREAK]: [ callback: (player: EntityPlayer, trinketType: TrinketType) => void, trinketType?: TrinketType ]; [ModCallbackCustom.POST_USE_PILL_FILTER]: [ callback: (pillEffect: PillEffect, pillColor: PillColor, player: EntityPlayer, useFlags: BitFlags<UseFlag>) => void, pillEffect?: PillEffect, pillColor?: PillColor ]; [ModCallbackCustom.PRE_BERSERK_DEATH]: [ callback: (player: EntityPlayer) => void, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.PRE_BOMB_COLLISION_FILTER]: [ callback: (bomb: EntityBomb, collider: Entity, low: boolean) => boolean | undefined, bombVariant?: BombVariant, subtype?: int ]; [ModCallbackCustom.PRE_CUSTOM_REVIVE]: [ callback: (player: EntityPlayer) => int | undefined, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.PRE_ENTITY_SPAWN_FILTER]: [ callback: (entityType: EntityType, variant: int, subType: int, position: Vector, velocity: Vector, spawner: Entity | undefined, initSeed: Seed) => [entityType: EntityType, variant: int, subType: int, initSeed: Seed] | undefined, entityType?: EntityType, variant?: int, subtype?: int ]; [ModCallbackCustom.PRE_FAMILIAR_COLLISION_FILTER]: [ callback: (familiar: EntityFamiliar, collider: Entity, low: boolean) => boolean | undefined, familiarVariant?: FamiliarVariant, subtype?: int ]; [ModCallbackCustom.PRE_GET_PEDESTAL]: [ callback: (player: EntityPlayer, collectible: EntityPickupCollectible) => boolean | undefined, playerVariant?: PlayerVariant, character?: PlayerType ]; [ModCallbackCustom.PRE_ITEM_PICKUP]: [ callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => boolean | undefined ] | [ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemCollectible) => boolean | undefined, itemType: ItemType.PASSIVE | ItemType.ACTIVE | ItemType.FAMILIAR, collectibleType?: CollectibleType ] | [ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemTrinket) => boolean | undefined, itemType: ItemType.TRINKET, trinketType?: TrinketType ]; [ModCallbackCustom.PRE_KNIFE_COLLISION_FILTER]: [ callback: (knife: EntityKnife, collider: Entity, low: boolean) => boolean | undefined, knifeVariant?: KnifeVariant, subtype?: int ]; [ModCallbackCustom.PRE_NEW_LEVEL]: [callback: (player: EntityPlayer) => void]; [ModCallbackCustom.PRE_NPC_COLLISION_FILTER]: [ callback: (npc: EntityNPC, collider: Entity, low: boolean) => undefined | boolean, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.PRE_NPC_UPDATE_FILTER]: [ callback: (npc: EntityNPC) => undefined | boolean, entityType?: EntityType, variant?: int, subType?: int ]; [ModCallbackCustom.PRE_PROJECTILE_COLLISION_FILTER]: [ callback: (projectile: EntityProjectile, collider: Entity, low: boolean) => boolean | undefined, projectileVariant?: ProjectileVariant, subtype?: int ]; [ModCallbackCustom.PRE_ROOM_ENTITY_SPAWN_FILTER]: [ callback: (entityTypeOrGridEntityXMLType: EntityType | GridEntityXMLType, variant: int, subType: int, gridIndex: int, initSeed: Seed) => [type: EntityType | GridEntityXMLType, variant: int, subType: int] | undefined, entityTypeOrGridEntityXMLType?: EntityType | GridEntityXMLType, variant?: int, subType?: int ]; [ModCallbackCustom.PRE_TEAR_COLLISION_FILTER]: [ callback: (tear: EntityTear, collider: Entity, low: boolean) => boolean | undefined, tearVariant?: TearVariant, subtype?: int ]; } /** * Helper function to add a charge to the player's active item. Will flash the HUD and play the * appropriate sound effect, depending on whether the charge is partially full or completely full. * * If the player's active item is already fully charged, then this function will return 0 and not * flash the HUD or play a sound effect. * * This function will take the following things into account: * - The Battery * - AAA Battery * * @param player The player to grant the charges to. * @param activeSlot Optional. The slot to grant the charges to. Default is `ActiveSlot.PRIMARY`. * @param numCharges Optional. The amount of charges to grant. Default is 1. * @param playSoundEffect Optional. Whether to play a charge-related sound effect. Default is true. * @returns The amount of charges that were actually granted. For example, if the active item was * only one away from a full charge, but the `numCharges` provided to this function was 2, * then this function would return 1. */ export declare function addCharge(player: EntityPlayer, activeSlot?: ActiveSlot, numCharges?: number, playSoundEffect?: boolean): int; /** * Helper function to add one or more collectibles to a player. * * This function is variadic, meaning that you can supply as many collectible types as you want to * add. */ export declare function addCollectible(player: EntityPlayer, ...collectibleTypes: readonly CollectibleType[]): void; export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void; /** * Helper function to add a bit flag to an existing set of bit flags. * * This is a variadic function, so pass as many flags as you want to add. * * Example 1: * * ```ts * // Give the player spectral tears * const player = Isaac.GetPlayer(); * player.TearFlags = addFlag(player.TearFlags, TearFlags.TEAR_SPECTRAL); * ``` * * Example 2: * * ```ts * // Give the player spectral and homing tears * const player = Isaac.GetPlayer(); * player.TearFlags = addFlag(player.TearFlags, TearFlags.TEAR_SPECTRAL, TearFlags.TEAR_HOMING); * ``` * * @param flags The existing set of bit flags. * @param flagsToAdd One or more bit flags to add, each as a separate argument. * @returns The combined bit flags. */ export declare function addFlag<T extends BitFlag | BitFlag128>(flags: T | BitFlags<T>, ...flagsToAdd: readonly T[]): BitFlags<T>; export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void; /** * Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function * from the `EVALUATE_CACHE` callback. * * Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat * to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by). * * This function supports the following cache flags: * - CacheFlag.DAMAGE (1 << 0) * - CacheFlag.FIRE_DELAY (1 << 1) * - CacheFlag.SHOT_SPEED (1 << 2) * - CacheFlag.RANGE (1 << 3) * - CacheFlag.SPEED (1 << 4) * - CacheFlag.LUCK (1 << 10) */ export declare function addPlayerStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void; /** * Helper function to add a charge to a player's active item(s), emulating what happens when a room * is cleared. * * This function will take the following things into account: * - 2x2 rooms and L rooms granting a double charge * - The Battery * - AAA Battery * - Not charging active items with `chargetype="special"` * * @param player The player to grant the charges to. * @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1 * room for the purposes of calculating how much charge to grant. Default * is true. * @param playSoundEffect Optional. Whether to play a charge-related sound effect. Default is true. */ export declare function addRoomClearCharge(player: EntityPlayer, bigRoomDoubleCharge?: boolean, playSoundEffect?: boolean): void; /** * Helper function to add a charge to every player's active item, emulating what happens when a room * is cleared. * * This function will take the following things into account: * - L rooms and 2x2 rooms granting a double charge * - The Battery * - AAA Battery * * @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1 * room for the purposes of calculating how much charge to grant. Default * is true. */ export declare function addRoomClearCharges(bigRoomDoubleCharge?: boolean): void; /** * Helper function to add a charge to one of a player's active items, emulating what happens when a * room is cleared. * * This function will take the following things into account: * - L rooms and 2x2 rooms granting a double charge * - The Battery * - AAA Battery * - Not charging active items with `chargetype="special"` * * @param player The player to grant the charges to. * @param activeSlot Optional. The active item slot to grant the charges to. Default is * `ActiveSlot.PRIMARY`. * @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1 * room for the purposes of calculating how much charge to grant. Default * is true. * @param playSoundEffect Optional. Whether to play a charge-related sound effect. Default is true. */ export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot?: ActiveSlot, bigRoomDoubleCharge?: boolean, playSoundEffect?: boolean): void; /** * Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether * it is visible and so on). * * This function automatically accounts for if MinimapAPI is being used. * * @param roomGridIndex Set to undefined to use the current room index. * @param displayFlag The `DisplayFlag` to set. (See the `DisplayFlag` enum.) * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to * make the changes immediately visible. Default is true. */ export declare function addRoomDisplayFlag(roomGridIndex: int | undefined, displayFlag: DisplayFlag, updateVisibility?: boolean): void; /** * Helper function to add all of the values in one set to another set. The first set passed will be * modified in place. * * This function is variadic, meaning that you can specify N sets to add to the first set. */ export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: ReadonlyArray<ReadonlySet<T>>): void; /** * - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and * adds it to the player. * - This function should only be used inside the `EVALUATE_CACHE` callback. * - In this context, the "tears stat" represents what is shown on the in-game stat UI. * * For example: * * ```ts * function evaluateCacheTears(player: EntityPlayer) { * const numFoo = player.GetNumCollectible(CollectibleTypeCustom.FOO); * const tearsStat = numFoo * FOO_TEARS_STAT; * addTearsStat(player, tearsStat); * } * ``` */ export declare function addTearsStat(player: EntityPlayer, tearsStat: float): void; export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void; /** * The combination of the following flags: * - `DisplayFlag.VISIBLE` (1 << 0) * - `DisplayFlag.SHADOW` (1 << 1) * - `DisplayFlag.SHOW_ICON` (1 << 2) */ export declare const ALL_DISPLAY_FLAGS: BitFlags<number & { readonly __bitFlagBrand: symbol; } & { readonly __displayFlagBrand: symbol; }>; /** Helper type to create a new tuple containing all but the first element of another tuple. */ export declare type AllButFirst<T extends unknown[]> = T extends [ unknown, ...infer Tail ] ? Tail : unknown[]; /** Helper type to create a new tuple containing all but the last element of another tuple. */ export declare type AllButLast<T extends unknown[]> = T extends [...infer Head, unknown] ? Head : unknown[]; /** This is used by the `POST_AMBUSH_STARTED` and `POST_AMBUSH_FINISHED` custom callbacks. */ export declare enum AmbushType { CHALLENGE_ROOM = 0, BOSS_RUSH = 1 } /** * Helper function to convert the degrees of an angle to the `Direction` enum. * * Note that this function considers 0 degrees to be pointing to the right, which is unusual because * 0 normally corresponds to up. (This corresponds to how the `Vector.GetAngleDegrees` method * works.) */ export declare function angleToDirection(angleDegrees: int): Direction; /** Helper type to represent any class. (This is the same type as any class constructor.) */ export declare type AnyClass = new () => object; /** Alias for the `anySeedEffectEnabled` function. */ export declare function anyEasterEggEnabled(exceptions?: readonly SeedEffect[]): boolean; /** * A type union that matches `Entity`, `EntityBomb`, `EntityEffect`, and so on. * * This is useful for building generic functions that should accept any kind of entity. */ export declare type AnyEntity = Entity | EntityBomb | EntityEffect | EntityFamiliar | EntityKnife | EntityLaser | EntityNPC | EntityPickup | EntityPlayer | EntityProjectile | EntityTear; export declare function anyEntityCloserThan(entities: readonly Entity[], position: Vector, distance: int): boolean; /** * Helper type to represent any function. This is safer than using the built-in `Function` type, as * it does not completely turn off all type safety. */ export declare type AnyFunction = (...args: readonly unknown[]) => unknown; /** * A type union that matches `GridEntity`, `GridEntityDoor`, `GridEntityPit`, and so on. * * This is useful for building generic functions that should accept any kind of grid entity. */ export declare type AnyGridEntity = GridEntity | GridEntityDoor | GridEntityPit | GridEntityPoop | GridEntityPressurePlate | GridEntityRock | GridEntitySpikes | GridEntityTNT; /** * Iterates over all players and checks if any player is close enough to the specified position. * * Note that this function does not consider players with a non-undefined parent, since they are not * real players (e.g. the Strawman Keeper). */ export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean; /** * Helper function to check to see if any player has a particular collectible. * * @param collectibleType The collectible type to check for. * @param ignoreModifiers If set to true, only counts collectibles the player actually owns and * ignores effects granted by items like Zodiac, 3 Dollar Bill and Lemegeton. * Default is false. */ export declare function anyPlayerHasCollectible(collectibleType: CollectibleType, ignoreModifiers?: boolean): boolean; /** Helper function to check to see if any player has a temporary collectible effect. */ export declare function anyPlayerHasCollectibleEffect(collectibleType: CollectibleType): boolean; /** Helper function to check to see if any player has a temporary null effect. */ export declare function anyPlayerHasNullEffect(nullItemID: NullItemID): boolean; /** * Helper function to check to see if any player has a particular trinket. * * @param trinketType The trinket type to check for. * @param ignoreModifiers If set to true, only counts trinkets the player actually holds and ignores * effects granted by other items. Default is false. */ export declare function anyPlayerHasTrinket(trinketType: TrinketType, ignoreModifiers?: boolean): boolean; /** Helper function to check to see if any player has a temporary trinket effect. */ export declare function anyPlayerHasTrinketEffect(trinketType: TrinketType): boolean; /** * Helper function to check to see if any player is holding up an item (from e.g. an active item * activation, a poop from IBS, etc.). */ export declare function anyPlayerHoldingItem(): boolean; /** * Helper function to determine if the given character is present. * * This function is variadic, meaning that you can supply as many characters as you want to check * for. Returns true if any of the characters supplied are present. */ export declare function anyPlayerIs(...matchingCharacters: readonly PlayerType[]): boolean; /** * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run. * * @param exceptions Optional. An array of seed effects to ignore. */ export declare function anySeedEffectEnabled(exceptions?: readonly SeedEffect[]): boolean; declare type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>; declare type Arr_2<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr_2<N, [...T, unknown]>; /** * Helper function for determining if two arrays contain the exact same elements. Note that this * only performs a shallow comparison. */ export declare function arrayEquals<T>(array1: readonly T[], array2: readonly T[]): boolean; /** * Builds a new array based on the original array without the specified element(s). Returns the new * array. If the specified element(s) are not found in the array, it will simply return a shallow * copy of the array. * * If there is more than one matching element in the array, this function will remove all of them. * * This function is variadic, meaning that you can specify N arguments to remove N elements. */ export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[]; /** * Removes all of the specified element(s) from the array. If the specified element(s) are not found * in the array, this function will do nothing. * * This function is variadic, meaning that you can specify N arguments to remove N elements. * * If there is more than one matching element in the array, this function will remove every matching * element. If you want to only remove the first matching element, use the `arrayRemoveInPlace` * function instead. * * @returns True if one or more elements were removed, false otherwise. */ export declare function arrayRemoveAllInPlace<T>(array: T[], ...elementsToRemove: readonly T[]): boolean; /** * Shallow copies and removes the elements at the specified indexes from the array. Returns the * copied array. If the specified indexes are not found in the array, it will simply return a * shallow copy of the array. * * This function is variadic, meaning that you can specify N arguments to remove N elements. */ export declare function arrayRemoveIndex<T>(originalArray: readonly T[], ...indexesToRemove: readonly int[]): T[]; /** * Removes the elements at the specified indexes from the array. If the specified indexes are not * found in the array, this function will do nothing. * * This function is variadic, meaning that you can specify N arguments to remove N elements. * * @returns The removed elements. This will be an empty array if no elements were removed. */ export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: readonly int[]): T[]; /** * Removes the specified element(s) from the array. If the specified element(s) are not found in the * array, this function will do nothing. * * This function is variadic, meaning that you can specify N arguments to remove N elements. * * If there is more than one matching element in the array, this function will only remove the first * matching element. If you want to remove all of the elements, use the `arrayRemoveAllInPlace` * function instead. * * @returns The removed elements. This will be an empty array if no elements were removed. */ export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: readonly T[]): T[]; /** Helper function to convert a set of flags to a single `BitFlags` object. */ export declare function arrayToBitFlags<T extends BitFlag | BitFlag128>(array: readonly T[]): BitFlags<T>; export declare function arrayToString(array: readonly unknown[]): string; /** * Helper function to safely cast an `int` to a `CardType`. (This is better than using the `as` * TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. ) * * This is useful to satisfy the "complete/strict-enums" ESLint rule. */ export declare function asCardType(num: int): CardType; /** * Helper function to safely cast an `int` to a `CollectibleType`. (This is better than using the * `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. ) * * This is useful to satisfy the "complete/strict-enums" ESLint rule. */ export declare function asCollectibleType(num: int): CollectibleType; /** * Helper function to safely cast an enum to an `int`. (This is better than using the `as` * TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. ) * * This is useful to satisfy the "complete/strict-enums" ESLint rule. */ export declare function asFloat(num: number): float; /** * Helper function to safely cast an enum to an `int`. (This is better than using the `as` * TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. ) * * This is useful to satisfy the "complete/strict-enums" ESLint rule. */ export declare function asInt(num: number): int; /** * Helper function to safely cast an `int` to a `LevelStage`. (This is better than using the `as` * TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. ) * * This is useful to satisfy the "complete/strict-enums" ESLint rule. */ export declare function asLevelStage(num: int): LevelStage; /** * Helper function to safely cast an `int` to a `NPCState`. (This is better than using the `as` * TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. ) * * This is useful to satisf