Skip to main content

Player Collectibles

Functions

addCollectible

addCollectible(player, ...collectibleTypes): void

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.

Parameters

NameType
playerEntityPlayer
...collectibleTypesreadonly CollectibleType[]

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:20


addCollectibleCostume

addCollectibleCostume(player, collectibleType): void

Parameters

NameType
playerEntityPlayer
collectibleTypeCollectibleType

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:29


anyPlayerHasCollectible

anyPlayerHasCollectible(collectibleType, ignoreModifiers?): boolean

Helper function to check to see if any player has a particular collectible.

Parameters

NameTypeDescription
collectibleTypeCollectibleTypeThe collectible type to check for.
ignoreModifiers?booleanIf 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.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:49


getActiveItemSlots

getActiveItemSlots(player, collectibleType): readonly ActiveSlot[]

Helper function to find the active slots that the player has the corresponding collectible type in. Returns an empty array if the player does not have the collectible in any active slot.

Parameters

NameType
playerEntityPlayer
collectibleTypeCollectibleType

Returns

readonly ActiveSlot[]

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:64


getAdjustedPrice

getAdjustedPrice(basePrice): int

Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale, the prices for items in the shop would be the same as if Isaac had two Steam Sales.)

Parameters

NameType
basePriceint

Returns

int

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:79


getPlayerCollectibleCount

getPlayerCollectibleCount(player, ...collectibleTypes): int

Helper function to return the total amount of collectibles that a player has that match the collectible type(s) provided.

This function is variadic, meaning that you can specify N collectible types.

Note that this will filter out non-real collectibles like Lilith's Incubus.

Parameters

NameType
playerEntityPlayer
...collectibleTypesreadonly CollectibleType[]

Returns

int

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:94


getPlayersWithCollectible

getPlayersWithCollectible(...collectibleTypes): readonly EntityPlayer[]

Helper function to get only the players that have a certain collectible.

This function is variadic, meaning that you can supply as many collectible types as you want to check for. It only returns the players that have all of the collectibles.

Parameters

NameType
...collectibleTypesreadonly CollectibleType[]

Returns

readonly EntityPlayer[]

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:113


getTotalPlayerCollectibles

getTotalPlayerCollectibles(collectibleType): int

Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad Onion and player 2 has 2 Sad Onions, then this function would return 3.

Note that this will filter out non-real collectibles like Lilith's Incubus.

Parameters

NameType
collectibleTypeCollectibleType

Returns

int

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:131


hasCollectible

hasCollectible(player, ...collectibleTypes): boolean

Helper function to check to see if a player has one or more collectibles.

This function is variadic, meaning that you can supply as many collectible types as you want to check for. Returns true if the player has any of the supplied collectible types.

This function always passes false to the ignoreModifiers argument.

Parameters

NameType
playerEntityPlayer
...collectibleTypesreadonly CollectibleType[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:151


hasCollectibleInActiveSlot

hasCollectibleInActiveSlot(player, collectibleType, ...activeSlots): boolean

Helper function to check to see if a player has a specific collectible in one or more active slots.

This function is variadic, meaning that you can specify as many active slots as you want to check for. This function will return true if the collectible type is located in any of the active slots provided.

Parameters

NameType
playerEntityPlayer
collectibleTypeCollectibleType
...activeSlotsreadonly ActiveSlot[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:168


hasOpenActiveItemSlot

hasOpenActiveItemSlot(player): boolean

Returns whether the player can hold an additional active item, beyond what they are currently carrying. This takes the Schoolbag into account.

If the player is the Tainted Soul, this always returns false, since that character cannot pick up items. (Only Tainted Forgotten can pick up items.)

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:188


isActiveSlotEmpty

isActiveSlotEmpty(player, activeSlot?): boolean

Helper function to check if the active slot of a particular player is empty.

Parameters

NameTypeDefault valueDescription
playerEntityPlayerundefinedThe player to check.
activeSlotActiveSlotActiveSlot.PRIMARYOptional. The active slot to check. Default is ActiveSlot.PRIMARY.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:213


removeAllActiveItems

removeAllActiveItems(player): void

Helper function to remove all of the active items from a player. This includes the Schoolbag item and any pocket actives.

Parameters

NameType
playerEntityPlayer

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:225


removeCollectible

removeCollectible(player, ...collectibleTypes): void

Helper function to remove one or more collectibles to a player.

This function is variadic, meaning that you can supply as many collectible types as you want to remove.

Parameters

NameType
playerEntityPlayer
...collectibleTypesreadonly CollectibleType[]

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:246


removeCollectibleCostume

removeCollectibleCostume(player, collectibleType): void

Helper function to remove a collectible costume from a player. Use this helper function to avoid having to request the collectible from the item config.

Parameters

NameType
playerEntityPlayer
collectibleTypeCollectibleType

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:259


removeCollectibleFromAllPlayers

removeCollectibleFromAllPlayers(...collectibleTypes): void

Helper function to remove one or more collectibles from all players. If any player has more than one copy of the item, then all copies of it will be removed.

This function is variadic, meaning that you can specify as many collectibles as you want to remove.

Parameters

NameType
...collectibleTypesreadonly CollectibleType[]

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:278


setActiveItem

setActiveItem(player, collectibleType, activeSlot?, charge?, keepInPools?): void

Helper function to set an active collectible to a particular slot. This has different behavior than calling the player.AddCollectible method with the activeSlot argument, because this function will not shift existing items into the Schoolbag and it handles ActiveSlot.SLOT_POCKET2.

Note that if an item is set to ActiveSlot.SLOT_POCKET2, it will disappear after being used and will be automatically removed upon entering a new room.

Parameters

NameTypeDefault valueDescription
playerEntityPlayerundefinedThe player to give the item to.
collectibleTypeCollectibleTypeundefinedThe collectible type of the item to give.
activeSlotActiveSlotActiveSlot.PRIMARYOptional. The slot to set. Default is ActiveSlot.PRIMARY.
charge?intundefinedOptional. The argument of charges to set. If not specified, the item will be set with maximum charges.
keepInPoolsbooleanfalseOptional. Whether to remove the item from pools. Default is false.

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:306


useActiveItemTemp

useActiveItemTemp(player, collectibleType): void

Helper function to use an active item without showing an animation, keeping the item, or adding any costumes.

Parameters

NameType
playerEntityPlayer
collectibleTypeCollectibleType

Returns

void

Defined in

packages/isaacscript-common/src/functions/playerCollectibles.ts:379