Collectibles
Functions
clearCollectibleSprite
▸ clearCollectibleSprite(collectible): void
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:80
collectibleHasCacheFlag
▸ collectibleHasCacheFlag(collectibleOrCollectibleType, cacheFlag): boolean
Helper function to check in the item config if a given collectible has a given cache flag.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
cacheFlag | CacheFlagValue |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:92
collectibleSpriteEquals
▸ collectibleSpriteEquals(sprite1, sprite2): boolean
Helper function to check if two collectible sprites have the same sprite sheet loaded.
Parameters
| Name | Type |
|---|---|
sprite1 | Sprite |
sprite2 | Sprite |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:110
getCollectibleChargeType
▸ getCollectibleChargeType(collectibleOrCollectibleType): ItemConfigChargeType
Helper function to get the charge type that a collectible has. Returns
ItemConfigChargeType.NORMAL if the provided collectible type was not valid.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
ItemConfigChargeType
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:141
getCollectibleDescription
▸ getCollectibleDescription(collectibleOrCollectibleType): string
Helper function to get the in-game description for a collectible. Returns "Unknown" if the provided collectible type was not valid.
This function works for both vanilla and modded collectibles.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
string
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:163
getCollectibleDevilCoinPrice
▸ getCollectibleDevilCoinPrice(collectibleOrCollectibleType): int
Helper function to get the coin cost that a collectible item would be if it were being offered in
a Devil Room deal. Returns 0 if passed CollectibleType.NULL.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
int
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:192
getCollectibleDevilHeartPrice
▸ getCollectibleDevilHeartPrice(collectibleOrCollectibleType, player): PickupPrice
Helper function to get the heart cost that a collectible item would be if it were being offered
in a Devil Room deal. Returns 0 if passed CollectibleType.NULL.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
player | EntityPlayer |
Returns
PickupPrice
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:216
getCollectibleGfxFilename
▸ getCollectibleGfxFilename(collectibleOrCollectibleType): string
Helper function to get the path to a collectible PNG file. Returns the path to the question mark sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
If you intentionally want the path to the question mark sprite, pass -1 as the collectible type.
Note that this does not return the file name, but the full path to the collectible's PNG file.
The function is named "GfxFilename" to correspond to the associated ItemConfigItem.GfxFileName
field.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup | -1 |
Returns
string
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:260
getCollectibleInitCharge
▸ getCollectibleInitCharge(collectibleOrCollectibleType): int
Helper function to get the initial amount of charges that a collectible has. In most cases, when
picking up an active collectible for the first time, it will be fully charged, which corresponds
to an InitCharge value of -1. However, in some cases, this may be different. For example,
Eden's Soul starts without any charges, so it has an InitCharge value of 0.
This function returns 0 if the provided collectible type was not valid. This function returns -1 if the provided collectible type was not an active collectible.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
int
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:289
getCollectibleItemType
▸ getCollectibleItemType(collectibleOrCollectibleType): ItemType
Helper function to get the ItemType of a collectible. Returns ItemType.ITEM_NULL if the
provided collectible type was not valid.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
ItemType
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:309
getCollectibleMaxCharges
▸ getCollectibleMaxCharges(collectibleOrCollectibleType): int
Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the provided collectible type was not valid.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
int
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:329
getCollectibleName
▸ getCollectibleName(collectibleOrCollectibleType): string
Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible type is not valid.
This function works for both vanilla and modded collectibles.
For example, getCollectibleName(CollectibleType.SAD_ONION) would return "Sad Onion".
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
string
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:353
getCollectiblePedestalType
▸ getCollectiblePedestalType(collectible): CollectiblePedestalType
Helper function to get the "pedestal type" of a collectible. For example, it might be sitting on top of a broken Blood Donation Machine, or it might be sitting on top of an opened Spiked Chest.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
CollectiblePedestalType
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:382
getCollectibleQuality
▸ getCollectibleQuality(collectibleOrCollectibleType): Quality
Helper function to get a collectible's quality, which ranges from 0 to 4 (inclusive). For example, Mom's Knife has a quality of 4. Returns 0 if the provided collectible type was not valid.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
Quality
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:401
getCollectibleTags
▸ getCollectibleTags(collectibleOrCollectibleType): BitFlags<ItemConfigTag>
Helper function to get the tags of a collectible (which is the composition of zero or more
ItemConfigTag). Returns 0 if the provided collectible type is not valid.
For example:
const collectibleType = CollectibleType.SAD_ONION;
const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
BitFlags<ItemConfigTag>
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:428
getVanillaCollectibleTypesOfQuality
▸ getVanillaCollectibleTypesOfQuality(quality): readonly CollectibleType[]
Returns an array containing every vanilla collectible type with the given quality.
Note that this function will only return vanilla collectible types. To handle modded collectible
types, use the getCollectibleTypesOfQuality helper function instead.
Parameters
| Name | Type |
|---|---|
quality | Quality |
Returns
readonly CollectibleType[]
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:446
isActiveCollectible
▸ isActiveCollectible(collectibleType): boolean
Returns true if the item type in the item config is equal to ItemType.ACTIVE.
Parameters
| Name | Type |
|---|---|
collectibleType | CollectibleType |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:460
isBlindCollectible
▸ isBlindCollectible(collectible): boolean
Returns true if the collectible has a red question mark sprite.
Note that this function will not work properly in a render callback with the RenderMode set to
RenderMode.WATER_REFLECT. If this is detected, this function will throw a run-time error.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:471
isFamiliarCollectible
▸ isFamiliarCollectible(collectibleType): boolean
Returns true if the item type in the item config is equal to ItemType.FAMILIAR.
Parameters
| Name | Type |
|---|---|
collectibleType | CollectibleType |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:496
isGlitchedCollectible
▸ isGlitchedCollectible(collectible): boolean
Returns whether the given collectible is a "glitched" item. All items are replaced by glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear in secret rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
Under the hood, this checks if the sub-type of the collectible is greater than 4,000,000,000.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:510
isHiddenCollectible
▸ isHiddenCollectible(collectibleOrCollectibleType): boolean
Returns true if the collectible has the "Hidden" attribute in the item config.
Hidden collectibles will not show up in any pools and Eden will not start with them.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:522
isModdedCollectibleType
▸ isModdedCollectibleType(collectibleType): boolean
Parameters
| Name | Type |
|---|---|
collectibleType | CollectibleType |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:534
isPassiveOrFamiliarCollectible
▸ isPassiveOrFamiliarCollectible(collectibleOrCollectibleType): boolean
Returns true if the item type in the item config is equal to ItemType.ITEM_PASSIVE or
ItemType.ITEM_FAMILIAR.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:544
isQuality
▸ isQuality(collectibleOrCollectibleType, quality): boolean
Helper function to check if a collectible type is a particular quality.
Parameters
| Name | Type |
|---|---|
collectibleOrCollectibleType | CollectibleType | EntityPickup |
quality | int |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:557
isSingleUseCollectible
▸ isSingleUseCollectible(collectibleType): boolean
Helper function to determine if a particular collectible will disappear from the player's inventory upon use. Note that this will not work will modded collectibles, as there is no way to dynamically know if a modded collectible will disappear.
Parameters
| Name | Type |
|---|---|
collectibleType | CollectibleType |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:570
isValidCollectibleType
▸ isValidCollectibleType(collectibleType): collectibleType is CollectibleType
Parameters
| Name | Type |
|---|---|
collectibleType | int |
Returns
collectibleType is CollectibleType
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:576
isVanillaCollectibleType
▸ isVanillaCollectibleType(collectibleType): boolean
Parameters
| Name | Type |
|---|---|
collectibleType | CollectibleType |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:584
newCollectibleSprite
▸ newCollectibleSprite(collectibleType): Sprite
Helper function to generate a new sprite based on a collectible. If the provided collectible type is invalid, a sprite with a Curse of the Blind question mark will be returned.
If you intentionally want a question mark sprite, pass -1 as the collectible type.
Parameters
| Name | Type |
|---|---|
collectibleType | CollectibleType | -1 |
Returns
Sprite
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:596
preventCollectibleRotation
▸ preventCollectibleRotation(collectible): void
Helper function to remove the rotation behavior from a collectible. This will happen by default when collectibles are spawned when playing as Tainted Isaac or when having Binge Eater.
Under the hood, this is accomplished by morphing the collectible with the ignoreModifiers
argument set to true.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:624
removeCollectiblePickupDelay
▸ removeCollectiblePickupDelay(collectible): void
Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20 frame delay before they can be picked up by a player.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:646
setCollectibleBlind
▸ setCollectibleBlind(collectible): void
Helper function to set a collectible sprite to a question mark (i.e. how collectibles look when the player has Curse of the Blind).
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:661
setCollectibleEmpty
▸ setCollectibleEmpty(collectible): void
Helper function to remove the collectible from a collectible pedestal and make it appear as if a
player has already taken the item. This is accomplished by changing the sub-type to
CollectibleType.NULL and then setting the sprite to an empty/missing PNG file.
For more information, see the documentation for the "clearSprite" helper function.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:679
setCollectibleGlitched
▸ setCollectibleGlitched(collectible): void
Helper function to change a collectible into a "glitched" item (like the ones that appear when the player has TMTRAINER).
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:695
setCollectiblePedestalType
▸ setCollectiblePedestalType(collectible, collectiblePedestalType): void
Helper function to set the "pedestal type" of a collectible. For example, it might be sitting on top of a broken Blood Donation Machine and you want to change it to be sitting on top of an opened Spiked Chest.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
collectiblePedestalType | CollectiblePedestalType |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:725
setCollectibleSprite
▸ setCollectibleSprite(collectible, pngPath): void
Helper function to change the sprite of a collectible pedestal entity.
For more information about removing the collectible sprite, see the documentation for the "clearSprite" helper function.
Parameters
| Name | Type | Description |
|---|---|---|
collectible | EntityPickup | The collectible whose sprite you want to modify. |
pngPath | undefined | string | Equal to either the spritesheet path to load (e.g. "gfx/items/collectibles/collectibles_001_thesadonion.png") or undefined. If undefined, the sprite will be removed, making it appear like the collectible has already been taken by the player. |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:753
setCollectibleSubType
▸ setCollectibleSubType(collectible, newCollectibleType): void
Helper function to change the collectible on a pedestal. Simply updating the SubType field is
not sufficient because the sprite will not change.
Parameters
| Name | Type |
|---|---|
collectible | EntityPickup |
newCollectibleType | CollectibleType |
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:783
setCollectiblesRerolledForItemTracker
▸ setCollectiblesRerolledForItemTracker(): void
Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that the build has been rerolled.
Returns
void
Defined in
packages/isaacscript-common/src/functions/collectibles.ts:819