Custom Pickups
Classes
Section titled “Classes”CustomPickups
Section titled “CustomPickups”Defined in: packages/isaacscript-common/src/classes/features/other/CustomPickups.ts:40
Extends
Section titled “Extends”Feature
Methods
Section titled “Methods”registerCustomPickup()
Section titled “registerCustomPickup()”registerCustomPickup(
pickupVariantCustom,subType,collectFunc,collisionFunc?):void
Defined in: packages/isaacscript-common/src/classes/features/other/CustomPickups.ts:147
Helper function to register a custom pickup with the IsaacScript standard library. Use this feature for custom pickups that are intended to be picked up by the player, like bombs and keys.
When IsaacScript detects that a player should be collecting the custom pickup, then the pickup
will be immediately removed, and an effect showing the pickup’s respective Collect animation
will be spawned. (This emulates how a normal vanilla pickup would work.) After that, the
provided collectFunc will be fired. In this function, you will probably want to play a sound
corresponding to what kind of pickup it is (e.g. SoundEffect.KEY_PICKUP_GAUNTLET), as well as
do things like adding something to the player’s inventory.
Note that when you specify your custom pickup in the “entities2.xml” file, it should have a type of “5” and be associated with an anm2 file that has a “Collect” animation.
In order to use this function, you must upgrade your mod with ISCFeature.CUSTOM_PICKUPS.
Parameters
Section titled “Parameters”pickupVariantCustom
Section titled “pickupVariantCustom”PickupVariant
The variant for the corresponding custom pickup.
subType
Section titled “subType”int
The sub-type for the corresponding custom pickup.
collectFunc
Section titled “collectFunc”(this, pickup, player) => void
The function to run when the player collects this pickup.
collisionFunc?
Section titled “collisionFunc?”(this, pickup, player) => boolean | undefined
Optional. The function to run when a player collides with the pickup.
Default is a function that always returns undefined, meaning that the
player will always immediately collect the pickup when they collide with
it. Specify this function if your pickup should only be able to be
collected under certain conditions. Return value acts similar to
ModCallback.PRE_PICKUP_COLLISION.
Returns
Section titled “Returns”void
