UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

56 lines 3.02 kB
import type { ActiveSlot } from "isaac-typescript-definitions"; import { CollectibleType } from "isaac-typescript-definitions"; import type { PlayerIndex } from "../../../types/PlayerIndex"; import { DefaultMap } from "../../DefaultMap"; import type { PostPlayerCollectibleAdded } from "../../callbacks/PostPlayerCollectibleAdded"; import type { PostPlayerCollectibleRemoved } from "../../callbacks/PostPlayerCollectibleRemoved"; import { Feature } from "../../private/Feature"; import type { ModdedElementSets } from "../other/ModdedElementSets"; import type { RunInNFrames } from "../other/RunInNFrames"; export declare class PlayerCollectibleDetection extends Feature { v: { run: { playersCollectibleCount: DefaultMap<PlayerIndex, int, []>; playersCollectibleMap: DefaultMap<PlayerIndex, Map<CollectibleType, int>, []>; playersActiveItemMap: DefaultMap<PlayerIndex, Map<ActiveSlot, CollectibleType>, []>; }; }; private readonly postPlayerCollectibleAdded; private readonly postPlayerCollectibleRemoved; private readonly moddedElementSets; private readonly runInNFrames; constructor(postPlayerCollectibleAdded: PostPlayerCollectibleAdded, postPlayerCollectibleRemoved: PostPlayerCollectibleRemoved, moddedElementSets: ModdedElementSets, runInNFrames: RunInNFrames); /** * This is called when the collectible count changes and in situations where the entire build is * rerolled. * * Since getting a new player collectible map is expensive, we want to only run this function when * necessary, and not on e.g. every frame. Unfortunately, this has the side effect of missing out * on collectible changes from mods that add and remove a collectible on the same frame. * * @param player The player to update. * @param numCollectiblesChanged Pass undefined for situations where the entire build was * rerolled. */ private updateCollectibleMapAndFire; private readonly postUseItemD4; /** We need to handle the case of Tainted Eden taking damage. */ private readonly entityTakeDmgPlayer; /** * We need to handle TMTRAINER collectibles, since they do not cause the player's collectible * count to change. */ private readonly postItemPickup; private readonly postPEffectUpdateReordered; /** * Checking for collectible count will work to detect when a player swaps their active item for * another active item. This is because the collectible count will decrement by 1 when the item is * swapped onto the pedestal and the hold animation begins, and increment by 1 when the item is * dequeued and the hold animation ends. * * However, we also want to explicitly check for the case where a mod swaps in a custom active * collectible on the same frame, since doing so is cheap. */ private checkActiveItemsChanged; } //# sourceMappingURL=PlayerCollectibleDetection.d.ts.map