UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

68 lines 4.4 kB
/** * Helper function to get the name of a class from the Isaac API. This is contained within the * "__type" metatable key. * * For example, a `Vector` class is has a name of "Vector". * * Returns undefined if the object is not of type `userdata` or if the "__type" metatable key does * not exist. * * In some cases, Isaac classes can be a read-only. If this is the case, the "__type" field will be * prepended with "const ". This function will always strip this prefix, if it exists. For example, * the class name returned for "const Vector" will be "Vector". */ export declare function getIsaacAPIClassName(object: unknown): string | undefined; /** Helper function to detect if a variable is of type `EntityBomb`. */ export declare function isBomb(variable: unknown): variable is EntityBomb; /** Helper function to detect if a variable is of type `GridEntityDoor`. */ export declare function isDoor(variable: unknown): variable is GridEntityDoor; /** Helper function to detect if a variable is of type `EntityEffect`. */ export declare function isEffect(variable: unknown): variable is EntityEffect; /** * Helper function to detect if a variable is of type `Entity`. This will return false for child * classes such as `EntityPlayer` or `EntityTear`. */ export declare function isEntity(variable: unknown): variable is Entity; /** Helper function to detect if a variable is of type `EntityFamiliar`. */ export declare function isFamiliar(variable: unknown): variable is EntityFamiliar; /** Helper function to detect if a variable is of type `GridEntity`. */ export declare function isGridEntity(variable: unknown): variable is GridEntity; /** * Helper function to check if something is an instantiated class from the Isaac API. (All classes * from the Isaac API have a type of "userdata" in Lua with a metatable key of "__type" equal to the * name of the class.) */ export declare function isIsaacAPIClass(object: unknown): object is IsaacAPIClass; export declare function isIsaacAPIClassOfType(object: unknown, classType: string): boolean; /** Helper function to detect if a variable is of type `EntityKnife`. */ export declare function isKnife(variable: unknown): variable is EntityKnife; /** Helper function to detect if a variable is of type `EntityLaser`. */ export declare function isLaser(variable: unknown): variable is EntityLaser; /** Helper function to detect if a variable is of type `EntityNPC`. */ export declare function isNPC(variable: unknown): variable is EntityNPC; /** Helper function to detect if a variable is of type `EntityPickup`. */ export declare function isPickup(variable: unknown): variable is EntityPickup; /** Helper function to detect if a variable is of type `GridEntityPit`. */ export declare function isPit(variable: unknown): variable is GridEntityPit; /** Helper function to detect if a variable is of type `EntityPlayer`. */ export declare function isPlayer(variable: unknown): variable is EntityPlayer; /** Helper function to detect if a variable is of type `GridEntityPoop`. */ export declare function isPoop(variable: unknown): variable is GridEntityPoop; /** Helper function to detect if a variable is of type `GridEntityPressurePlate`. */ export declare function isPressurePlate(variable: unknown): variable is GridEntityPressurePlate; /** Helper function to detect if a variable is of type `EntityProjectile`. */ export declare function isProjectile(variable: unknown): variable is EntityProjectile; /** Helper function to detect if a variable is of type `GridEntityRock`. */ export declare function isRock(variable: unknown): variable is GridEntityRock; /** Helper function to detect if a variable is of type `GridEntitySpikes`. */ export declare function isSpikes(variable: unknown): variable is GridEntitySpikes; /** Helper function to detect if a variable is of type `GridEntityTNT`. */ export declare function isTNT(variable: unknown): variable is GridEntityTNT; /** Helper function to detect if a variable is of type `EntityTear`. */ export declare function isTear(variable: unknown): variable is EntityTear; /** * Helper function to check if an instantiated Isaac API class is equal to another one of the same * type. You must provide the list of keys to check for. */ export declare function isaacAPIClassEquals(object1: unknown, object2: unknown, keys: readonly string[]): boolean; //# sourceMappingURL=isaacAPIClass.d.ts.map