Skip to main content

Player Collectible Tracking

Hierarchy

  • Feature

    PlayerCollectibleTracking

Methods

getPlayerCollectibleTypes

getPlayerCollectibleTypes(player, includeActiveCollectibles?): readonly CollectibleType[]

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.

Parameters

NameTypeDefault valueDescription
playerEntityPlayerundefinedThe player to get the collectible types for.
includeActiveCollectiblesbooleantrueOptional. If true, will include all active collectibles. Default is true.

Returns

readonly CollectibleType[]

Defined in

packages/isaacscript-common/src/classes/features/other/PlayerCollectibleTracking.ts:92


getPlayerLastPassiveCollectibleType

getPlayerLastPassiveCollectibleType(player): undefined | 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.

Parameters

NameType
playerEntityPlayer

Returns

undefined | CollectibleType

Defined in

packages/isaacscript-common/src/classes/features/other/PlayerCollectibleTracking.ts:123