UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

37 lines 2.4 kB
import type { PickupVariant } from "isaac-typescript-definitions"; import { Feature } from "../../private/Feature"; export declare class CustomPickups extends Feature { /** Indexed by entity ID. */ private readonly customPickupFunctionsMap; private readonly prePickupCollision; private readonly postEffectRenderPickupEffect; /** * 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`. * * @param pickupVariantCustom The variant for the corresponding custom pickup. * @param subType The sub-type for the corresponding custom pickup. * @param collectFunc The function to run when the player collects this pickup. * @param collisionFunc Optional. The function to run when a player collides with the pickup. * Default is a function that always returns true, 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. * @public */ registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (this: void, player: EntityPlayer) => void, collisionFunc?: (this: void, player: EntityPlayer) => boolean): void; } //# sourceMappingURL=CustomPickups.d.ts.map