isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
44 lines • 2.48 kB
TypeScript
import type { CollectibleType } from "isaac-typescript-definitions";
import { Feature } from "../../private/Feature";
export declare class PlayerCollectibleTracking extends Feature {
private readonly postPlayerCollectibleAdded;
private readonly postPlayerCollectibleRemoved;
/**
* Helper function to get all of the collectible types that the player has gotten so far on this
* run, in order.
*
* In the case of items given on the first frame of the run or the case where the player rerolls
* their build in the middle of the run (e.g. with D4), the order of the collectible types will
* not correspond to the order that the items were actually given to the player. In this case, the
* order will be from the lowest `CollectibleType` to the highest.
*
* Under the hood, this feature works by tracking the number of collectibles that a player has on
* every frame. Thus, in a situation where a collectible was both added and removed to the player
* on the same frame, the amount of total collectibles would stay the same, and the collectible
* types would not be updated. In vanilla, this situation would never happen, but another mod
* might do this for some reason. (With that said, the next time that a collectible is normally
* added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
*
* @param player The player to get the collectible types for.
* @param includeActiveCollectibles Optional. If true, will include all active collectibles.
* Default is true.
* @public
*/
getPlayerCollectibleTypes(player: EntityPlayer, includeActiveCollectibles?: boolean): readonly CollectibleType[];
/**
* Helper function to get the last passive collectible type that the player picked up. In most
* cases, this will be the passive that would be removed if the player used Clicker.
*
* Returns undefined if the player does not have any passive collectibles.
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
*
* @public
*/
getPlayerLastPassiveCollectibleType(player: EntityPlayer): CollectibleType | undefined;
}
//# sourceMappingURL=PlayerCollectibleTracking.d.ts.map