UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

348 lines • 19.9 kB
import type { BombVariant, EffectVariant, FamiliarVariant, KnifeVariant, LaserVariant, PickupVariant, ProjectileVariant, SlotVariant, TearVariant } from "isaac-typescript-definitions"; import { EntityType } from "isaac-typescript-definitions"; /** * Helper function to get all of the bombs in the room. (Specifically, this refers to the * `EntityBomb` class, not bomb pickups.) * * For example: * * ```ts * // Make all of the bombs in the room invisible. * for (const bomb of getBombs()) { * bomb.Visible = false; * } * ``` * * @param bombVariant Optional. If specified, will only get the bombs that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only get the bombs that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getBombs(bombVariant?: BombVariant | -1, subType?: number): readonly EntityBomb[]; /** * Helper function to get all of the effects in the room. * * For example: * * ```ts * // Make all of the effects in the room invisible. * for (const effect of getEffects()) { * effect.Visible = false; * } * ``` * * @param effectVariant Optional. If specified, will only get the effects that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only get the effects that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getEffects(effectVariant?: EffectVariant | -1, subType?: number): readonly EntityEffect[]; /** * Helper function to get all of the familiars in the room. * * For example: * * ```ts * // Make all of the familiars in the room invisible. * for (const familiar of getFamiliars()) { * familiar.Visible = false; * } * ``` * * @param familiarVariant Optional. If specified, will only get the familiars that match the * variant. Default is -1, which matches every variant. * @param subType Optional. If specified, will only get the familiars that match the sub-type. * Default is -1, which matches every sub-type. */ export declare function getFamiliars(familiarVariant?: FamiliarVariant | -1, subType?: number): readonly EntityFamiliar[]; /** * Helper function to get all of the knives in the room. * * For example: * * ```ts * // Make all of the knives in the room invisible. * for (const knife of getKnives()) { * knife.Visible = false; * } * ``` * * @param knifeVariant Optional. If specified, will only get the knives that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only get the knives that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getKnives(knifeVariant?: KnifeVariant | -1, subType?: number): readonly EntityKnife[]; /** * Helper function to get all of the lasers in the room. * * For example: * * ```ts * // Make all of the lasers in the room invisible. * for (const laser of getLasers()) { * laser.Visible = false; * } * ``` * * @param laserVariant Optional. If specified, will only get the lasers that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only get the lasers that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getLasers(laserVariant?: LaserVariant | -1, subType?: number): readonly EntityLaser[]; /** * Helper function to get all of the NPCs in the room. * * @param entityType Optional. If specified, will only get the NPCs that match the type. Default is * -1, which matches every entity type. * @param variant Optional. If specified, will only get the NPCs that match the variant. Default is * -1, which matches every entity type. * @param subType Optional. If specified, will only get the bombs that match the sub-type. Default * is -1, which matches every sub-type. * @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being * returned. Default is false. Will only be taken into account if the * `entityType` is specified. */ export declare function getNPCs(entityType?: EntityType | -1, variant?: number, subType?: number, ignoreFriendly?: boolean): readonly EntityNPC[]; /** * Helper function to get all of the pickups in the room. * * For example: * * ```ts * // Make all of the pickups in the room invisible. * for (const pickup of getPickups()) { * pickup.Visible = false; * } * ``` * * @param pickupVariant Optional. If specified, will only get the pickups that match the variant. * Default is -1, which matches every entity type. * @param subType Optional. If specified, will only get the pickups that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getPickups(pickupVariant?: PickupVariant | -1, subType?: number): readonly EntityPickup[]; /** * Helper function to get all of the projectiles in the room. * * For example: * * ```ts * // Make all of the projectiles in the room invisible. * for (const projectile of getProjectiles()) { * projectile.Visible = false; * } * ``` * * @param projectileVariant Optional. If specified, will only get the projectiles that match the * variant. Default is -1, which matches every entity type. * @param subType Optional. If specified, will only get the projectiles that match the sub-type. * Default is -1, which matches every sub-type. */ export declare function getProjectiles(projectileVariant?: ProjectileVariant | -1, subType?: number): readonly EntityProjectile[]; /** * Helper function to get all of the slots in the room. * * For example: * * ```ts * // Make all of the slots in the room invisible. * for (const slot of getSlots()) { * slot.Visible = false; * } * ``` * * @param slotVariant Optional. If specified, will only get the slots that match the variant. * Default is -1, which matches every entity type. * @param subType Optional. If specified, will only get the slots that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getSlots(slotVariant?: SlotVariant | -1, subType?: number): readonly EntitySlot[]; /** * Helper function to get all of the tears in the room. * * For example: * * ```ts * // Make all of the tears in the room invisible. * for (const tear of getTears()) { * tear.Visible = false; * } * ``` * * @param tearVariant Optional. If specified, will only get the tears that match the variant. * Default is -1, which matches every entity type. * @param subType Optional. If specified, will only get the tears that match the sub-type. Default * is -1, which matches every sub-type. */ export declare function getTears(tearVariant?: TearVariant | -1, subType?: number): readonly EntityTear[]; /** * Helper function to remove all of the bombs in the room. (Specifically, this refers to the * `EntityBomb` class, not bomb pickups.) * * @param bombVariant Optional. If specified, will only remove the bombs that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove the bombs that match the sub-type. * Default is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of bombs. * @returns An array of the bombs that were removed. */ export declare function removeAllBombs(bombVariant?: BombVariant | -1, subType?: number, cap?: int): readonly EntityBomb[]; /** * Helper function to remove all of the effects in the room. * * @param effectVariant Optional. If specified, will only remove the effects that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove the effects that match the sub-type. * Default is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of effects. * @returns An array of the effects that were removed. */ export declare function removeAllEffects(effectVariant?: EffectVariant | -1, subType?: number, cap?: int): readonly EntityEffect[]; /** * Helper function to remove all of the familiars in the room. * * @param familiarVariant Optional. If specified, will only remove the familiars that match the * variant. Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove the familiars that match the sub-type. * Default is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of familiars. * @returns An array of the familiars that were removed. */ export declare function removeAllFamiliars(familiarVariant?: FamiliarVariant | -1, subType?: number, cap?: int): readonly EntityFamiliar[]; /** * Helper function to remove all of the knives in the room. * * @param knifeVariant Optional. If specified, will only remove the knives that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove the knives that match the sub-type. * Default is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of knives. * @returns An array of the knives that were removed. */ export declare function removeAllKnives(knifeVariant?: KnifeVariant | -1, subType?: number, cap?: int): readonly EntityKnife[]; /** * Helper function to remove all of the lasers in the room. * * @param laserVariant Optional. If specified, will only remove the lasers that match the variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove the lasers that match the sub-type. * Default is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of lasers. * @returns An array of the lasers that were removed. */ export declare function removeAllLasers(laserVariant?: LaserVariant | -1, subType?: number, cap?: int): readonly EntityLaser[]; /** * Helper function to remove all of the NPCs in the room. * * @param entityType Optional. If specified, will only remove the NPCs that match the type. Default * is -1, which matches every type. * @param variant Optional. If specified, will only remove the NPCs that match the variant. Default * is -1, which matches every variant. * @param subType Optional. If specified, will only remove the NPCs that match the sub-type. Default * is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of NPCs. * @returns An array of the NPCs that were removed. */ export declare function removeAllNPCs(entityType?: EntityType | -1, variant?: number, subType?: number, cap?: int): readonly EntityNPC[]; /** * Helper function to remove all of the pickups in the room. * * @param pickupVariant Optional. If specified, will only remove pickups that match this variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove pickups that match this sub-type. Default * is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of pickups. * @returns An array of the pickups that were removed. */ export declare function removeAllPickups(pickupVariant?: PickupVariant | -1, subType?: number, cap?: int): readonly EntityPickup[]; /** * Helper function to remove all of the projectiles in the room. * * @param projectileVariant Optional. If specified, will only remove projectiles that match this * variant. Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove projectiles that match this sub-type. * Default is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of projectiles. * @returns An array of the projectiles that were removed. */ export declare function removeAllProjectiles(projectileVariant?: ProjectileVariant | -1, subType?: number, cap?: int): readonly EntityProjectile[]; /** * Helper function to remove all of the slots in the room. * * @param slotVariant Optional. If specified, will only remove slots that match this variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove slots that match this sub-type. Default * is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of slots. * @returns An array of the slots that were removed. */ export declare function removeAllSlots(slotVariant?: SlotVariant | -1, subType?: number, cap?: int): readonly Entity[]; /** * Helper function to remove all of the tears in the room. * * @param tearVariant Optional. If specified, will only remove tears that match this variant. * Default is -1, which matches every variant. * @param subType Optional. If specified, will only remove tears that match this sub-type. Default * is -1, which matches every sub-type. * @param cap Optional. If specified, will only remove the given amount of tears. * @returns An array of the tears that were removed. */ export declare function removeAllTears(tearVariant?: TearVariant | -1, subType?: number, cap?: int): readonly EntityTear[]; /** Helper function to spawn a `EntityType.BOMB` (4). */ export declare function spawnBomb(bombVariant: BombVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityBomb; /** Helper function to spawn a `EntityType.BOMB` (4) with a specific seed. */ export declare function spawnBombWithSeed(bombVariant: BombVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityBomb; /** Helper function to spawn a `EntityType.EFFECT` (1000). */ export declare function spawnEffect(effectVariant: EffectVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityEffect; /** Helper function to spawn a `EntityType.EFFECT` (1000) with a specific seed. */ export declare function spawnEffectWithSeed(effectVariant: EffectVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityEffect; /** * Helper function to spawn a `EntityType.FAMILIAR` (3). * * If you are trying to implement a custom familiar, you probably want to use the * `checkFamiliarFromCollectibles` helper function instead. */ export declare function spawnFamiliar(familiarVariant: FamiliarVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityFamiliar; /** Helper function to spawn a `EntityType.FAMILIAR` (3) with a specific seed. */ export declare function spawnFamiliarWithSeed(familiarVariant: FamiliarVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityFamiliar; /** Helper function to spawn a `EntityType.KNIFE` (8). */ export declare function spawnKnife(knifeVariant: KnifeVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityKnife; /** Helper function to spawn a `EntityType.KNIFE` (8) with a specific seed. */ export declare function spawnKnifeWithSeed(knifeVariant: KnifeVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityKnife; /** Helper function to spawn a `EntityType.LASER` (7). */ export declare function spawnLaser(laserVariant: LaserVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityLaser; /** Helper function to spawn a `EntityType.LASER` (7) with a specific seed. */ export declare function spawnLaserWithSeed(laserVariant: LaserVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityLaser; /** * Helper function to spawn an NPC. * * Note that if you pass a non-NPC `EntityType` to this function, it will cause a run-time error, * since the `Entity.ToNPC` method will return undefined. */ export declare function spawnNPC(entityType: EntityType, variant: int, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityNPC; /** * Helper function to spawn an NPC with a specific seed. * * Note that if you pass a non-NPC `EntityType` to this function, it will cause a run-time error, * since the `Entity.ToNPC` method will return undefined. */ export declare function spawnNPCWithSeed(entityType: EntityType, variant: int, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityNPC; /** Helper function to spawn a `EntityType.PICKUP` (5). */ export declare function spawnPickup(pickupVariant: PickupVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityPickup; /** Helper function to spawn a `EntityType.PICKUP` (5) with a specific seed. */ export declare function spawnPickupWithSeed(pickupVariant: PickupVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityPickup; /** Helper function to spawn a `EntityType.PROJECTILE` (9). */ export declare function spawnProjectile(projectileVariant: ProjectileVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityProjectile; /** Helper function to spawn a `EntityType.PROJECTILE` (9) with a specific seed. */ export declare function spawnProjectileWithSeed(projectileVariant: ProjectileVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityProjectile; /** Helper function to spawn a `EntityType.SLOT` (6). */ export declare function spawnSlot(slotVariant: SlotVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntitySlot; /** Helper function to spawn a `EntityType.SLOT` (6) with a specific seed. */ export declare function spawnSlotWithSeed(slotVariant: SlotVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntitySlot; /** Helper function to spawn a `EntityType.TEAR` (2). */ export declare function spawnTear(tearVariant: TearVariant, subType: int, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity, seedOrRNG?: Seed | RNG): EntityTear; /** Helper function to spawn a `EntityType.EntityType` (2) with a specific seed. */ export declare function spawnTearWithSeed(tearVariant: TearVariant, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity): EntityTear; //# sourceMappingURL=entitiesSpecific.d.ts.map