isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
248 lines • 10.8 kB
TypeScript
import type { CardType, CollectibleType, PillEffect, TrinketType } from "isaac-typescript-definitions";
import { Feature } from "../../private/Feature";
/**
* Mods can add extra things to the game (e.g. collectibles, trinkets, and so on). Since mods load
* in alphabetical order, the total number of things can't be properly be known until at least one
* callback fires (which indicates that all mods have been loaded).
*
* This feature gates all such functions behind a callback check. Subsequently, these functions will
* throw a runtime error if they are called in the menu, before any callbacks have occurred. This
* ensures that the proper values are always returned and allows you to get immediate feedback if
* you accidentally access them from the menu.
*/
export declare class ModdedElementDetection extends Feature {
private atLeastOneCallbackFired;
private readonly postPlayerInit;
private errorIfNoCallbacksFired;
/**
* Returns the first modded collectible type, or undefined if there are no modded collectibles.
*
* This function can only be called if at least one callback has been executed. This is because
* not all collectibles will necessarily be present when a mod first loads (due to mod load
* order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getFirstModdedCollectibleType(): CollectibleType | undefined;
/**
* Will change depending on how many modded collectibles there are.
*
* Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
* 666. We subtract one to account for `CollectibleType.NULL`.)
*
* If there are no mods present that add any custom collectibles, this function will return
* `CollectibleType.MOMS_RING` (732).
*
* This function can only be called if at least one callback has been executed. This is because
* not all collectibles will necessarily be present when a mod first loads (due to mod load
* order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getLastCollectibleType(): CollectibleType;
/**
* Returns the total number of collectibles in the item config, including both vanilla and modded
* collectibles. If you just need the number of vanilla collectible types, use the
* `NUM_VANILLA_COLLECTIBLE_TYPES` constant.
*
* This function can only be called if at least one callback has been executed. This is because
* not all collectibles will necessarily be present when a mod first loads (due to mod load
* order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumCollectibleTypes(): int;
/**
* Unlike vanilla collectible types, modded collectible types are always contiguous.
*
* This function can only be called if at least one callback has been executed. This is because
* not all collectibles will necessarily be present when a mod first loads (due to mod load
* order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumModdedCollectibleTypes(): int;
/**
* Returns the first modded trinket type, or undefined if there are no modded trinkets.
*
* This function can only be called if at least one callback has been executed. This is because
* not all trinkets will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getFirstModdedTrinketType(): TrinketType | undefined;
/**
* Will change depending on how many modded trinkets there are.
*
* Equal to `itemConfig.GetTrinkets().Size - 1`. (`Size` includes invalid trinkets, like 47. We
* subtract one to account for `TrinketType.NULL`.)
*
* If there are no mods present that add any custom trinkets, this function will return
* `TrinketType.SIGIL_OF_BAPHOMET` (189).
*
* This function can only be called if at least one callback has been executed. This is because
* not all trinkets will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getLastTrinketType(): TrinketType;
/**
* Returns the total number of trinkets in the item config, including both vanilla and modded
* trinkets. If you just need the number of vanilla trinket types, use the
* `NUM_VANILLA_TRINKET_TYPES` constant.
*
* This function can only be called if at least one callback has been executed. This is because
* not all trinkets will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumTrinketTypes(): int;
/**
* Unlike vanilla trinket types, modded trinket types are always contiguous.
*
* This function can only be called if at least one callback has been executed. This is because
* not all trinkets will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumModdedTrinketTypes(): int;
/**
* Returns the first modded card sub-type, or undefined if there are no modded cards.
*
* This function can only be called if at least one callback has been executed. This is because
* not all cards will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getFirstModdedCardType(): CardType | undefined;
/**
* Will change depending on how many modded cards there are.
*
* Equal to `itemConfig.GetCards().Size - 1`. (`Size` includes invalid cards, but since cards are
* contiguous, there are no invalid cards. We subtract one to account for `CardType.NULL`.)
*
* If there are no mods present that add any custom cards, this function will return
* `CardType.SOUL_OF_JACOB_AND_ESAU` (97).
*
* This function can only be called if at least one callback has been executed. This is because
* not all trinkets will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getLastCardType(): CardType;
/**
* Returns the total number of cards in the item config, including both vanilla and modded cards.
* If you just need the number of vanilla card types, use the `NUM_VANILLA_CARD_TYPES` constant.
*
* This function can only be called if at least one callback has been executed. This is because
* not all cards will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumCardTypes(): int;
/**
* Like vanilla card types, modded card types are always contiguous.
*
* This function can only be called if at least one callback has been executed. This is because
* not all cards will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumModdedCardTypes(): int;
/**
* Returns the first modded pill effect, or undefined if there are no modded pill effects.
*
* This function can only be called if at least one callback has been executed. This is because
* not all pill effects will necessarily be present when a mod first loads (due to mod load
* order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getFirstModdedPillEffect(): PillEffect | undefined;
/**
* Will change depending on how many modded pill effects there are.
*
* Equal to `itemConfig.GetPillEffects().Size - 1`. (`Size` includes invalid pill effects, but
* since pill effects are contiguous, there are no invalid pill effects. We subtract one to
* account for the enum starting at 0 instead of 1.)
*
* If there are no mods present that add any custom pill effects, this function will return
* `PillEffect.EXPERIMENTAL` (49).
*
* This function can only be called if at least one callback has been executed. This is because
* not all pill effects will necessarily be present when a mod first loads (due to mod load
* order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getLastPillEffect(): PillEffect;
/**
* Returns the total number of pill effects in the item config, including both vanilla and modded
* pill effects. If you just need the number of vanilla pill effects, use the
* `NUM_VANILLA_PILL_EFFECTS` constant.
*
* This function can only be called if at least one callback has been executed. This is because
* not all cards will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumPillEffects(): int;
/**
* Like vanilla pill effects, modded pill effects are always contiguous.
*
* This function can only be called if at least one callback has been executed. This is because
* not all cards will necessarily be present when a mod first loads (due to mod load order).
*
* In order to use this function, you must upgrade your mod with
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
*
* @public
*/
getNumModdedPillEffects(): int;
}
//# sourceMappingURL=ModdedElementDetection.d.ts.map