UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

45 lines 2.24 kB
/** * This is the type that is fed to the `PRE_ITEM_PICKUP` and `POST_ITEM_PICKUP` custom callbacks. * * @module */ import type { TrinketType } from "isaac-typescript-definitions"; import { CollectibleType, ItemType } from "isaac-typescript-definitions"; export type PickingUpItem = PickingUpItemNull | PickingUpItemCollectible | PickingUpItemTrinket; /** Part of `PickingUpItem`. */ export interface PickingUpItemNull { /** Needed so that we can distinguish between picking up a collectible and a trinket. */ itemType: ItemType.NULL; /** Equal to either the collectible type, the trinket type, or 0. */ subType: 0; } /** Part of `PickingUpItem`. */ export interface PickingUpItemCollectible { /** Needed so that we can distinguish between picking up a collectible and a trinket. */ itemType: ItemType.PASSIVE | ItemType.ACTIVE | ItemType.FAMILIAR; /** Equal to either the collectible type, the trinket type, or 0. */ subType: CollectibleType; } /** Part of `PickingUpItem`. */ export interface PickingUpItemTrinket { /** Needed so that we can distinguish between picking up a collectible and a trinket. */ itemType: ItemType.TRINKET; /** Equal to either the collectible type, the trinket type, or 0. */ subType: TrinketType; } export declare function newPickingUpItem(): PickingUpItem; /** Helper function to reset a `PickupUpItem` object to all 0 values. */ export declare function resetPickingUpItem(pickingUpItem: PickingUpItem): void; /** Helper function to narrow the type of `PickingUpItem` to `ItemType.NULL` (0). */ export declare function isPickingUpItemNull(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket; /** * Helper function to narrow the type of `PickingUpItem` to one of the following: * * - `ItemType.PASSIVE` (1) * - `ItemType.ACTIVE` (3) * - `ItemType.FAMILIAR` (4) */ export declare function isPickingUpItemCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible; /** Helper function to narrow the type of `PickingUpItem` to `ItemType.TRINKET` (2). */ export declare function isPickingUpItemTrinket(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket; //# sourceMappingURL=PickingUpItem.d.ts.map