diff --git a/packages/isaac-typescript-definitions-repentogon/src/enums/GameMode.ts b/packages/isaac-typescript-definitions-repentogon/src/enums/GameMode.ts new file mode 100644 index 000000000..548571cf7 --- /dev/null +++ b/packages/isaac-typescript-definitions-repentogon/src/enums/GameMode.ts @@ -0,0 +1,9 @@ +/** + * This enum is for REPENTOGON, an exe-hack which expands the modding API. + * + * @see https://repentogon.com/ + */ +export enum GameMode { + NORMAL = 0, + GREED = 1, +} diff --git a/packages/isaac-typescript-definitions-repentogon/src/enums/ModCallbackRepentogon.ts b/packages/isaac-typescript-definitions-repentogon/src/enums/ModCallbackRepentogon.ts index dd59ccdd7..4d001dfad 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/enums/ModCallbackRepentogon.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/enums/ModCallbackRepentogon.ts @@ -104,6 +104,24 @@ export enum ModCallbackRepentogon { */ PRE_PLAYER_COLLISION = 33, + /** + * A modified version of `ModCallback.POST_PICKUP_SELECTION`. + * + * You cannot filter this callback. + * + * ```ts + * function postPickupSelection( + * pickup: EntityPickup, + * variant: PickupVariant, + * subType: int, + * requestedVariant: PickupVariant, + * requestedSubType: int, + * rng: RNG, + * ): [pickupVariant: PickupVariant, subType: int, continueSelection: boolean] | undefined {} + * ``` + */ + POST_PICKUP_SELECTION = 37, + /** * A modified version of `ModCallback.PRE_PICKUP_COLLISION`. This callback now allows an interface * to be returned to further modify the collision behavior. @@ -2595,6 +2613,51 @@ export enum ModCallbackRepentogon { */ POST_PLAYER_REMOVE_COSTUME = 1284, + /** + * When registering this callback with the `Mod.AddCallback` method: + * - You can provide an optional third argument that will make the callback only fire if it + * matches the `BedSubType` provided. + * + * ```ts + * function preTriggerBedSleepEffect( + * player: EntityPlayer, + * bed: EntityPickup + * ): boolean | undefined {} + * ``` + */ + PRE_TRIGGER_BED_SLEEP_EFFECT = 1285, + + /** + * When registering this callback with the `Mod.AddCallback` method: + * - You can provide an optional third argument that will make the callback only fire if it + * matches the `BedSubType` provided. + * + * ```ts + * function postTriggerBedSleepEffect(player: EntityPlayer, bed: EntityPickup): void {} + * ``` + */ + POST_TRIGGER_BED_SLEEP_EFFECT = 1286, + + /** + * You cannot filter this callback. + * + * ```ts + * function prePlayerPocketItemSwap(player: EntityPlayer): boolean | undefined {} + * ``` + */ + PRE_PLAYER_POCKET_ITEMS_SWAP = 1287, + + /** + * When registering this callback with the `Mod.AddCallback` method: + * - You can provide an optional third argument that will make the callback only fire if it + * matches the `BedSubType` provided. + * + * ```ts + * function preBedSleep(player: EntityPlayer, bed: EntityPickup): boolean | undefined {} + * ``` + */ + PRE_BED_SLEEP = 1288, + /** * When registering this callback with the `Mod.AddCallback` method: * - You can provide an optional third argument that will make the callback only fire if it @@ -3687,4 +3750,40 @@ export enum ModCallbackRepentogon { * ``` */ PRE_ITEM_TEXT_DISPLAY = 1484, + + /** + * When registering this callback with the `Mod.AddCallback` method: + * - You can provide an optional third argument that will make the callback only fire if it + * matches the `EntityType` provided. + * + * ```ts + * function preEntitySetColor( + * entity: Entity, + * color: Color, + * duration: int, + * priority: int, + * fadeOut: boolean, + * share: boolean + * ): Color | boolean | undefined {} + * ``` + */ + PRE_ENTITY_SET_COLOR = 1486, + + /** + * When registering this callback with the `Mod.AddCallback` method: + * - You can provide an optional third argument that will make the callback only fire if it + * matches the `EntityType` provided. + * + * ```ts + * function postEntitySetColor( + * entity: Entity, + * color: Color, + * duration: int, + * priority: int, + * fadeOut: boolean, + * share: boolean + * ): void {} + * ``` + */ + POST_ENTITY_SET_COLOR = 1487, } diff --git a/packages/isaac-typescript-definitions-repentogon/src/enums/flags/GetCollectibleFlag.ts b/packages/isaac-typescript-definitions-repentogon/src/enums/flags/GetCollectibleFlag.ts new file mode 100644 index 000000000..199a21bd9 --- /dev/null +++ b/packages/isaac-typescript-definitions-repentogon/src/enums/flags/GetCollectibleFlag.ts @@ -0,0 +1,39 @@ +/** + * This is represented as an object instead of an enum due to limitations with TypeScript enums. (We + * want this type to be a child of the `BitFlag` type.) + * + * This enum is for REPENTOGON, an exe-hack which expands the modding API. + * + * @see https://repentogon.com/ + * @enum + * @notExported + * @rename GetCollectibleFlag + */ +const GetCollectibleFlagInternal = { + /** Bans active collectibles. */ + BAN_ACTIVE: 1 << 0, + + /** + * Ignores attempts to morph the collectible into Magic Skin or Rosary. Does not prevent morphing + * the collectible into The Bible. + */ + IGNORE_MODIFIERS: 1 << 1, + + BAN_PASSIVE: 1 << 2, + + /** Bans passive collectibles. */ +} as const; + +type GetCollectibleFlagValue = BitFlag & { + readonly __getCollectibleFlagBrand: symbol; +}; +type GetCollectibleFlagType = { + readonly [K in keyof typeof GetCollectibleFlagInternal]: GetCollectibleFlagValue; +}; + +export const GetCollectibleFlag = + GetCollectibleFlagInternal as GetCollectibleFlagType; +export type GetCollectibleFlag = + GetCollectibleFlagType[keyof GetCollectibleFlagType]; + +export const GetCollectibleFlagZero = 0 as BitFlags; diff --git a/packages/isaac-typescript-definitions-repentogon/src/index.ts b/packages/isaac-typescript-definitions-repentogon/src/index.ts index d0953eb37..27af4510c 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/index.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/index.ts @@ -24,9 +24,11 @@ export * from "./enums/flags/ButtonActionFlag"; export * from "./enums/flags/ConceptionFamiliarFlag"; export * from "./enums/flags/DebugFlag"; export * from "./enums/flags/EntityTag"; +export * from "./enums/flags/GetCollectibleFlag"; export * from "./enums/flags/GibFlag"; export * from "./enums/flags/WeaponModifierFlag"; export * from "./enums/FollowerPriority"; +export * from "./enums/GameMode"; export * from "./enums/GenericPromptSelection"; export * from "./enums/GenericPromptSubmittedSelection"; export * from "./enums/GiantbookType"; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Camera.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Camera.d.ts index 4f0367ed7..b4780b1ef 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Camera.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Camera.d.ts @@ -32,4 +32,11 @@ declare interface Camera extends IsaacAPIClass { * This method does not work if `Options.CameraStyle` is not equal to `CameraStyle.ON`. */ SnapToPosition: (position: Vector) => void; + + /** + * Updates the camera. + * + * @param interpolated Optional. Default is false. + */ + Update: (interpolated?: boolean) => void; } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/ItemPool.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/ItemPool.d.ts index 09544a2c3..4f67ec9d7 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/ItemPool.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/ItemPool.d.ts @@ -6,6 +6,7 @@ import type { PillEffect, TrinketType, } from "isaac-typescript-definitions"; +import type { GetCollectibleFlag } from "../../enums/flags/GetCollectibleFlag"; declare global { interface ItemPool extends IsaacAPIClass { @@ -21,7 +22,7 @@ declare global { ignoreLocked: boolean, ) => boolean; - /** Returns the number of Bible collectibles added to the specified `ItemPoolType`. */ + /** Returns the number of Bible collectibles added to provided `itemPool`. */ GetBibleUpgrades: (itemPool: ItemPoolType) => int; /** @@ -60,6 +61,7 @@ declare global { GetCollectiblesFromPool: (poolType: ItemPoolType) => Array<{ decreaseBy: float; initialWeight: float; + isUnlocked: boolean; itemID: CollectibleType; removeOn: float; weight: float; @@ -82,6 +84,27 @@ declare global { */ GetPillColor: (pillEffect: PillEffect) => PillColor; + /** + * Returns a random item pool that is present in the current game mode. The pool selection is + * weighted, meaning item pools with more collectibles have a higher chance of being selected. + * + * @param rng + * @param advancedSearch Optional. If true, the game will return any item pool in the game, + * including those not present in the current game mode. Furthermore, + * setting it to true will allow you to make use of the `filter` argument. + * Default is false. + * @param filter Optional. The list of filtered item pools. Default is an empty array. + * @param isWhitelist Optional. If true, the game will only select item pools from the filter. + * Otherwise, the game will not select item pools from the filter. Default is + * false. + */ + GetRandomPool: ( + rng: RNG, + advancedSearch?: boolean, + filter?: ItemPoolType[], + isWhitelist?: boolean, + ) => ItemPoolType; + /** Returns an array of collectibles removed from all pools. */ GetRemovedCollectibles: () => CollectibleType[]; @@ -94,6 +117,52 @@ declare global { /** Returns whether the specified trinket is available in the trinket pool. */ HasTrinket: (trinket: TrinketType) => boolean; + /** + * Returns the raw result of `ItemPool.GetCollectible` without applying the filtering used in + * `ItemPool.GetCollectible`. Returns undefined if the provided `itemPool` has no collectibles + * remaining. + * + * **Differences with `ItemPool.GetCollectible`** + * + * - The game does not select glitched items, even if a player has TMTRAINER. + * - The game does not randomize the pool if a player has Chaos. + * - The game does not attempt to return a collectible from `ItemPoolType.TREASURE` or + * `CollectibleType.BREAKFAST` if it fails to pick a random collectible. + * - The game does not attempt to morph the collectible into `CollectibleType.BIBLE`, + * `CollectibleType.MAGIC_SKIN`, or `CollectibleType.ROSARY`. + * - The game does not trigger `ModCallbackRepentogon.PRE_GET_COLLECTIBLE` and + * `ModCallbackRepentogon.POST_GET_COLLECTIBLE`. + * + * @param itemPool + * @param decrease Optional. Default is false. + * @param rng Optional. Default is a new RNG object seeded with `Random()`. + * @param flags Optional. Default is `GetCollectibleFlagZero`. + */ + PickCollectible: ( + itemPool: ItemPoolType, + decrease?: boolean, + rng?: RNG, + flags?: GetCollectibleFlag | BitFlags, + ) => + | { + itemID: CollectibleType; + initialWeight: float; + weight: float; + decreaseBy: float; + removeOn: float; + isUnlocked: boolean; + } + | undefined; + + /** + * Makes the provided collectible available again in every item pool. Its `initialWeight` is + * also restored. + */ + ResetCollectible: (collectible: CollectibleType) => void; + + /** Sets the currently selected `ItemPoolType`. */ + SetLastPool: (pool: ItemPoolType) => void; + /** Resets the specified `PillColor` back to its unidentified state. */ UnidentifyPill: (pill: PillColor) => void; } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/LRoomAreaDesc.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LRoomAreaDesc.d.ts new file mode 100644 index 000000000..22c2afc43 --- /dev/null +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LRoomAreaDesc.d.ts @@ -0,0 +1,18 @@ +/** + * This class is for REPENTOGON, an exe-hack which expands the modding API. + * + * @see https://repentogon.com/ + */ +declare interface LRoomAreaDesc { + /** Returns the position of the upper half's bottom right corner. */ + GetHighBottomRight: () => Vector; + + /** Returns the position of the upper half's bottom right corner. */ + GetHighTopLeft: () => Vector; + + /** Returns the position of the bottom half's bottom right corner. */ + GetLowBottomRight: () => Vector; + + /** Returns the position of the lower half's top left corner. */ + GetLowTopLeft: () => Vector; +} diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/LRoomTileDesc.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LRoomTileDesc.d.ts new file mode 100644 index 000000000..a5b06f459 --- /dev/null +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LRoomTileDesc.d.ts @@ -0,0 +1,21 @@ +/** + * This class is for REPENTOGON, an exe-hack which expands the modding API. + * + * @see https://repentogon.com/ + */ +declare interface LRoomTileDesc { + /** Returns the grid coordinates of the upper half's bottom right corner. */ + GetHighBottomRight: () => [int, int]; + + /** Returns the grid coordinates of the upper half's top left corner. */ + GetHighTopLeft: () => [int, int]; + + /** Returns the grid coordinates of the lower half's bottom right corner. */ + GetLowBottomRight: () => [int, int]; + + /** Returns the grid coordinates of the lower half's top left corner. */ + GetLowTopLeft: () => [int, int]; + + /** Returns the grid coordinates of a random tile. */ + GetRandomTile: (seed: Seed) => [int, int]; +} diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Level.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Level.d.ts index 0b055b75b..f083528e5 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Level.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Level.d.ts @@ -2,28 +2,114 @@ import type { Dimension, DoorSlot, LevelStage, + RoomShape, StageType, } from "isaac-typescript-definitions"; import type { SpecialQuest } from "../../enums/SpecialQuest"; declare global { interface Level extends IsaacAPIClass { + /** + * Returns whether the provided room config can be successfully placed at the provided grid + * index using `Level.TryPlaceRoom`. + * + * @param roomConfigToPlace + * @param gridIndex + * @param dimension Optional. Default is `Dimension.CURRENT`. + * @param allowMultipleDoors Optional. If true, the room can be placed if it has more than one + * door. Default is true. + * @param allowSpecialNeighbors Optional. If true, the game will allow the room to connect with + * special rooms. Default is false. + * @param allowNoNeighbors Optional. If true, the room can be placed anywhere on the map without + * having any neighbors. Default is false. + */ + CanPlaceRoom: ( + roomConfigToPlace: RoomConfig, + gridIndex: int, + dimension?: Dimension, + allowMultipleDoors?: boolean, + allowSpecialNeighbors?: boolean, + allowNoNeighbors?: boolean, + ) => boolean; + + /** + * Returns whether the provided room config can be successfully placed as a neighbor of an + * existing room at the provided door slot using `Level.TryPlaceRoomAtDoor`. + * + * @param roomConfigToPlace + * @param neighborRoomDescriptor + * @param doorSlot + * @param allowMultipleDoors Optional. If true, the room can be placed if it has more than one + * door. Default is true. + * @param allowSpecialNeighbors Optional. If true, the game will allow the room to connect with + * special rooms. Default is false. + */ + CanPlaceRoomAtDoor: ( + roomConfigToPlace: RoomConfig, + neighborRoomDescriptor: RoomDescriptor, + doorSlot: DoorSlot, + allowMultipleDoors?: boolean, + allowSpecialNeighbors?: boolean, + ) => boolean; + /** Returns whether the Red Door outline can spawn at the specified `DoorSlot`. */ CanSpawnDoorOutline: (roomIndex: int, doorSlot: DoorSlot) => boolean; + /** + * Returns an array of grid indices that are valid locations to place the provided room using + * `Level.TryPlaceRoom`. + * + * @param roomConfigToPlace + * @param dimension Optional. Default is `Dimension.CURRENT`. + * @param allowMultipleDoors Optional. If true, the room can be placed if it has more than one + * door. Default is true. + * @param allowSpecialNeighbors Optional. If true, the game will allow the room to connect with + * special rooms. Default is false. + */ + FindValidRoomPlacementLocations: ( + roomConfigToPlace: RoomConfig, + dimension?: Dimension, + allowMultipleDoors?: boolean, + allowSpecialNeighbors?: boolean, + ) => int[]; + /** Returns the current dimension the player is in. */ GetDimension: () => Dimension; + /** + * Returns the level's forced special quest. This can be set through + * `Level.SetForceSpecialQuest`. + */ + GetForceSpecialQuest: () => SpecialQuest; + + /** Returns the number of Greed Mode waves cleared without a player taking Red Heart damage. */ + GetGreedWavesClearedWithoutRedHeartDamage: () => int; + /** * Returns the pickups that will be transferred to the next floor by the Myosotis trinket * effect. */ GetMyosotisPickups: () => EntitiesSaveStateVector; - /** Returns whether the special quest is forced. */ - GetForceSpecialQuest: () => SpecialQuest; - - GetGreedWavesClearedWithoutRedHeartDamage: () => int; + /** + * Returns a map that maps `DoorSlot` to `RoomDescriptor` for all of the neighbors that a room + * of the provided room shape would have if placed at the provided grid index. + * + * This method does not give any information on if a room would actually fit there, or if the + * neighbors would allow the connection. + * + * If you want to get the neighbors of an existing room, use + * `RoomDescriptor.GetNeighboringRooms` instead. + * + * @param gridIndex + * @param roomShape + * @param dimension Optional. Default is `Dimension.CURRENT`. + */ + GetNeighboringRooms: ( + gridIndex: int, + roomShape: RoomShape, + dimension?: Dimension, + ) => LuaMap; /** Returns whether the floor has the mineshaft room used for the second Knife Piece puzzle. */ HasAbandonedMineshaft: () => boolean; @@ -46,6 +132,10 @@ declare global { /** * Attempts to place a room. * + * This method does not check if a room placement would be considered valid, nor does it create + * the doors necessary to connect the new room to its neighbors. If you wish to properly add new + * rooms to the floor after level generation, use `Level.TryPlaceRoom` instead. + * * Returns whether room placement was successful. */ PlaceRoom: ( @@ -54,10 +144,67 @@ declare global { seed: Seed, ) => boolean; - SetGreedWavesClearedWithoutRedHeartDamage: (waves: int) => void; + /** + * Sets the level's forced special quest on the floor. For this method to work properly, it + * should be called in `ModCallbackRepentogon.PRE_LEVEL_INIT`. + */ SetForceSpecialQuest: (quest: SpecialQuest) => void; + /** Sets how many Greed Mode waves were cleared without taking Red Heart damage. */ + SetGreedWavesClearedWithoutRedHeartDamage: (waves: int) => void; + /** Sets the display name of the level. */ SetName: (name: string) => void; + + /** + * Tries to place a room corresponding to the provided room config at the provided grid index. + * Returns a `RoomDescriptor` if room placement was successful. Returns undefined if room + * placement was unsuccessful. + * + * @param roomConfigToPlace + * @param gridIndex + * @param dimension Optional. Default is `Dimension.CURRENT`. + * @param seed Optional. Setting the seed to zero will have the game generate a seed based on + * the room's location, shape, and the level's seed. Default is 0. + * @param allowMultipleDoors Optional. If true, the room can be placed if it has more than one + * door. Default is true. + * @param allowSpecialNeighbors Optional. If true, the game will allow the room to connect with + * special rooms. Default is false. + * @param allowNoNeighbors Optional. If true, the room can be placed anywhere on the map without + * having any neighbors. Default is false. + */ + TryPlaceRoom: ( + roomConfigToPlace: RoomConfig, + gridIndex: int, + dimension?: Dimension, + seed?: Seed, + allowMultipleDoors?: boolean, + allowSpecialNeighbors?: boolean, + allowNoNeighbors?: boolean, + ) => RoomDescriptor | undefined; + + /** + * Tries to place a room corresponding to the provided room config at the provided door slot at + * in existing room. Returns a `RoomDescriptor` if room placement was successful. Returns + * undefined if room placement was unsuccessful. + * + * @param roomConfigToPlace + * @param neighborRoomDescriptor + * @param doorSlot + * @param seed Optional. Setting the seed to zero will have the game generate a seed based on + * the room's location, shape, and the level's seed. Default is 0. + * @param allowMultipleDoors Optional. If true, the room can be placed if it has more than one + * door. Default is true. + * @param allowSpecialNeighbors Optional. If true, the game will allow the room to connect with + * special rooms. Default is false. + */ + TryPlaceRoomAtDoor: ( + roomConfigToPlace: RoomConfig, + neighborRoomDescriptor: RoomDescriptor, + doorSlot: DoorSlot, + seed?: Seed, + allowMultipleDoors?: boolean, + allowSpecialNeighbors?: boolean, + ) => RoomDescriptor | undefined; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootList.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootList.d.ts index 8a0370f1a..a848d89fe 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootList.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootList.d.ts @@ -7,9 +7,42 @@ declare global { * @see https://repentogon.com/ */ interface LootList extends IsaacAPIClass { + /** Returns an array of entries in the `LootList`. */ GetEntries: () => LootListEntry[]; /** + * Adds a new entry into the `LootList`. + * + * While usually reserved for chests and sacks that give pickups like hearts and bombs, every + * `EntityPickup` has a `LootList` that lets you add your entities to it. + * + * Calling this method does nothing if the `LootList` is readonly; it should only be called in + * `ModCallbackRepentogon.PRE_PICKUP_GET_LOOT_LIST`. + * + * **Example** + * + * This snippet replaces the contents of every chest in the game with Delirium, for better or + * for worse: + * + * ```ts + * const mod = RegisterMod("Delirium Unboxing", 1); + * + * function getLootList(pickup: EntityPickup) { + * if (pickup.Variant === PickupVariant.CHEST) { + * const newLootList = LootList(); + * newLootList.PushEntry(EntityType.DELIRIUM, 0, 0); + * return newLootList; + * } + * + * return undefined; + * } + * + * mod.AddCallbackRepentogon( + * ModCallbackRepentogon.PRE_PICKUP_GET_LOOT_LIST, + * getLootList, + * ); + * ``` + * * @param entityType * @param variant * @param subType diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootListEntry.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootListEntry.d.ts index d14681173..7be446a71 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootListEntry.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/LootListEntry.d.ts @@ -7,10 +7,19 @@ declare global { * @see https://repentogon.com/ */ interface LootListEntry extends IsaacAPIClass { + /** Returns the entry's RNG. Returns undefined if it has no RNG object. */ GetRNG: () => RNG | undefined; + + /** Returns the entry's seed. */ GetSeed: () => Seed; + + /** Returns the entry's sub-type. */ GetSubType: () => int; + + /** Returns the entry's `EntityType`. */ GetType: () => EntityType; + + /** Returns the entry's variant. */ GetVariant: () => int; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/MultiShotParams.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/MultiShotParams.d.ts index a771828b9..0d9a9b3a0 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/MultiShotParams.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/MultiShotParams.d.ts @@ -13,7 +13,7 @@ declare global { */ GetMultiEyeAngle: () => number; - /** the number of active eyes that shoots simultaneously (e.g. 2 for The Wiz). */ + /** Returns the number of active eyes that shoots simultaneously (e.g. 2 for The Wiz). */ GetNumEyesActive: () => int; /** @@ -25,8 +25,11 @@ declare global { /** Returns the number of tears fired in random directions, similar to the Eye Sore effect. */ GetNumRandomDirTears: () => int; + /** Returns the amount of tears the player can simultaneously fire. */ + GetNumTears: () => int; + /** Returns the spread angle of the specified `WeaponType`. */ - GetSpreadAngle: (weaponType: WeaponType) => void; + GetSpreadAngle: (weaponType: WeaponType) => number; /** Returns whether the cross-eyed effect is active, similar to The Wiz. */ IsCrossEyed: () => boolean; @@ -58,6 +61,9 @@ declare global { /** Sets the number of lanes tears are spread into per eye. */ SetNumLanesPerEye: (lanes: int) => void; + /** Sets the number of tears fired in random directions, similar to the Eye Sore effect. */ + SetNumRandomDirTears: (tears: int) => void; + /** Sets the maximum number of tears the player can fire simultaneously. */ SetNumTears: (tears: int) => void; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/NightmareScene.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/NightmareScene.d.ts index 2686c185c..08dce70fb 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/NightmareScene.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/NightmareScene.d.ts @@ -14,6 +14,7 @@ declare namespace NightmareScene { /** Returns the sprite used by the thought bubble above the player portrait. */ function GetBubbleSprite(): Sprite; + /** Returns the sprite used to display the extra player's portrait. */ function GetPlayerExtraPortraitSprite(): Sprite; function GetProgressBarMap(): int[]; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/PersistentGameData.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/PersistentGameData.d.ts index d66641011..554fa1b38 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/PersistentGameData.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/PersistentGameData.d.ts @@ -1,4 +1,5 @@ import type { + BossID, Challenge, CollectibleType, EntityType, @@ -16,6 +17,16 @@ declare global { * @see https://repentogon.com/ */ interface PersistentGameData { + /** + * Adds a kill to the bestiary entry. + * + * @param variant Optional. Default is 0. + */ + AddBestiaryKill: (entityType: EntityType, variant?: int) => void; + + /** Marks the boss as killed and unlocks its relevant achievements if conditions are met. */ + AddBossKilled: (bossID: BossID) => void; + /** Returns the number of times a specific entity has been killed, according to the bestiary. */ GetBestiaryDeathCount: (entityType: EntityType, variant: int) => int; @@ -36,6 +47,9 @@ declare global { /** Increases the value of a specified persistent event counter by the provided amount. */ IncreaseEventCounter: (event: EventCounter, count: int) => void; + /** Returns whether the boss has been killed. This is used for tracking numerous unlocks. */ + IsBossKilled: (bossID: BossID) => boolean; + /** Returns whether the provided `Challenge` has been completed. */ IsChallengeComplete: (challenge: Challenge) => boolean; @@ -46,7 +60,8 @@ declare global { * Tries to unlock the provided `Achievement`. Returns whether the achievement was unlocked * successfully. * - * @param hideNotification Optional. Default is false. + * @param hideNotification Optional. If true, the achievement paper will not appear. This is + * only used by modded achievements. Default is false. */ TryUnlock: (unlock: Achievement, hideNotification?: boolean) => boolean; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/PlayerManager.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/PlayerManager.d.ts index 1485ff54f..b47eb79dd 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/PlayerManager.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/PlayerManager.d.ts @@ -1,5 +1,7 @@ import type { + BabySubType, CollectibleType, + ControllerIndex, PlayerType, TrinketType, } from "isaac-typescript-definitions"; @@ -59,6 +61,15 @@ declare global { ignoreModifiers?: boolean, ): boolean; + /** + * Returns the first player whose type matches the provided `playerType` that picked up + * Birthright. Returns undefined if no players of the provided `playerType` has picked up + * Birthright. + */ + function FirstBirthrightOwner( + playerType: PlayerType, + ): EntityPlayer | undefined; + /** * Returns the first player who picked up the provided `CollectibleType` for the first time in * the current run. Returns undefined if the collectible has not been picked up yet. @@ -93,6 +104,7 @@ declare global { lazarusSharedGlobalTag?: boolean, ): EntityPlayer | undefined; + /** @param index Optional. Default is 0. */ function GetEsauJrState(index?: int): EntityPlayer; /** @@ -118,13 +130,21 @@ declare global { /** * Safely removes extra player entities such as Strawman. * - * It is not recommended to pass the main player entity to this method. + * This method is extremely dangerous to use as passing the main player entity to this will + * cause the game to crash. Ensure that this method is only used to remove co-players spawned by + * `SpawnCoPlayer2`. */ function RemoveCoPlayer(player: EntityPlayer): void; /** Spawns a second player of the provided `PlayerType`. */ function SpawnCoPlayer2(playerType: PlayerType): EntityPlayer; + /** Spawns a co-op baby tied to the provided controller index. */ + function SpawnSelectedBaby( + babySubType: BabySubType, + controllerIndex: ControllerIndex, + ): void; + /** Triggers the room clear event. */ function TriggerRoomClear(): void; } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/PocketItem.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/PocketItem.d.ts index 679569474..5222ac3a9 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/PocketItem.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/PocketItem.d.ts @@ -1,4 +1,8 @@ -import type { PocketItemSlot } from "isaac-typescript-definitions"; +import type { + ActiveSlot, + CardType, + PillColor, +} from "isaac-typescript-definitions"; import type { PocketItemType } from "../../enums/PocketItemType"; declare global { @@ -8,10 +12,37 @@ declare global { * @see https://repentogon.com/ */ interface PocketItem { - /** Returns the slot of the pocket item. */ - GetSlot: () => PocketItemSlot; + /** + * Returns an identifying value for the pocket item: + * + * - Returns `CardType` if the pocket item is a card. + * - Returns `PillColor` if the pocket item is a pill. + * - Returns an `ActiveSlot` offset by +1 if the pocket item is an active item. + * - Returns 0 if the pocket slot is empty. + * + * **Example** + * + * This snippet obtains the `CollectibleType` of the pocket item in a given pocket slot: + * + * ```ts + * const player = Isaac.GetPlayer(); + * const pocketItem = player.GetPocketItem(PillCardSlot.PRIMARY); + * + * if (pocketItem.GetType() === PocketItemType.ACTIVE_ITEM) { + * const activeSlot = (pocketItem.GetSlot() - 1) as ActiveSlot; + * const activeItemID = player.GetActiveItem(activeSlot); + * print(activeItemID); + * } + * ``` + */ + GetSlot: () => CardType | PillColor | ActiveSlot | 0; - /** Returns the pocket item's `PocketItemType`. */ + /** + * Returns the pocket item's `PocketItemType`. + * + * Do not use this method if the slot is currently empty as the game sometimes does not clear + * the value. + */ GetType: () => PocketItemType; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/RNG.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/RNG.d.ts index 9d39217ff..5930ebb04 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/RNG.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/RNG.d.ts @@ -1,4 +1,7 @@ declare interface RNG extends IsaacAPIClass { + /** Returns the RNG object's shift index. */ + GetShiftIdx: () => int; + /** * Returns a random float between 0 and 1. It is inclusive on the lower end and exclusive on the * higher end. @@ -17,6 +20,22 @@ declare interface RNG extends IsaacAPIClass { */ PhantomInt: (max: int) => int; + /** + * Returns the next seed of the RNG object as if it has been "iterated". + * + * This does not change the RNG object's seed. If you wish to get the next seed and also change + * it, use `RNG.Next` instead. + */ + PhantomNext: () => int; + + /** + * Returns the previous seed of the RNG object. + * + * This does not change the RNG object's seed. If you wish to get the previous seed and also + * change it, use `RNG.Previous` instead. + */ + PhantomPrevious: () => int; + /** * Returns a random vector with a length of 1. * @@ -25,6 +44,9 @@ declare interface RNG extends IsaacAPIClass { */ PhantomVector: () => Vector; + /** "Iterates" the RNG object's seed backwards and returns the new seed. */ + Previous: () => int; + /** * Returns a random vector with a length of 1. * @@ -32,5 +54,5 @@ declare interface RNG extends IsaacAPIClass { * number. Since this mutates the RNG object, you should use this method with care. If this * behavior is not desired, use the `RNG.PhantomVector` method instead. */ - RandomFloat: () => float; + RandomVector: () => Vector; } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Room.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Room.d.ts index 69d1f394c..fba78228d 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Room.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Room.d.ts @@ -3,62 +3,34 @@ import type { EntityType, GridEntityType, ItemPoolType, + Music, PickupVariant, } from "isaac-typescript-definitions"; import type { StbRailVariant } from "../../enums/StbRailVariant"; declare global { interface Room extends IsaacAPIClass { - /** - * Repentogon's modified `Room.SpawnGridEntity` method. - * - * This method has been renamed to include "Ex" so it can not conflict with the vanilla type - * definitions. However, when the project compiles the method's name will change to what it's - * supposed to be. - * - * @param gridIndex - * @param gridEntityType - * @param variant Optional. Default is 0. - * @param seed Optional. - * @param varData Optional. Default is 0. - * @param descriptor - * @customName SpawnGridEntity - */ - SpawnGridEntityEx: (( - gridIndex: int, - gridEntityType: GridEntityType, - variant?: int, - seed?: Seed, - varData?: int, - ) => void) & - ((gridIndex: int, descriptor: GridEntityDesc) => void); - - /** - * Repentogon's modified `Room.TrySpawnSpecialQuestDoor` method. - * - * This method has been renamed to include "Ex" so it can not conflict with the vanilla type - * definitions. However, when the project compiles the method's name will change to what it's - * supposed to be. - * - * @param ignoreStageType Optional. Whether the Mirror & Mineshaft door can spawn outside of - * stages outside of the alt-floor. Default is false. - * @customName TrySpawnSpecialQuestDoor - */ - TrySpawnSpecialQuestDoorEx: (ignoreStageType?: boolean) => boolean; - /** Returns whether the grid entity with the specified GridIndex can be picked up. */ CanPickupGridEntity: (gridIndex: int) => boolean; - CanSpawnObstacleAtPosition: (gridIndex: int, force: boolean) => void; + /** Returns whether an obstacle can be spawned at the provided grid index. */ + CanSpawnObstacleAtPosition: (gridIndex: int, force: boolean) => boolean; /** * Creates a lightning strike effect as seen in Downpour. * - * @param seed Optional. The seed determines the intensity and sound pitch. + * @param seed Optional. The seed determines the intensity and sound pitch. The game calculates + * the intensity and pitch using the following formulas: `1.3 + RNG.RandomFloat() * + * 0.6` and `0.9 + RNG.RandomFloat() * 0.2` respectively. Default is a randomized + * seed. */ DoLightningStrike: (seed?: Seed) => void; - // `GetBackdrop` is currently unimplemented as the `Image` class is not complete. + /** Returns the room's `Backdrop` object. */ + GetBackdrop: () => Backdrop; + + /** Returns the room's boss victory jingle. */ + GetBossVictoryJingle: () => Music; /** Returns a `Camera` object. */ GetCamera: () => Camera; @@ -80,7 +52,8 @@ declare global { * Returns the grid index from the specified row and column. Returns -1 if no grid index exists * at that point. */ - GetGridIndexByTile: (row: int, column: int) => int; + GetGridIndexByTile: ((row: int, column: int) => int) & + ((tile: [int, int]) => int); /** * Returns the room's current item pool. @@ -91,20 +64,32 @@ declare global { GetItemPool: (seed?: Seed, raw?: boolean) => void; /** Returns the intensity of the lightning effect. */ - GetLightningIntensity: () => number; + GetLightningIntensity: () => float; + + /** Returns a descriptor of the corners of an L-room shape in world coordinates. */ + GetLRoomAreaDesc: () => LRoomAreaDesc; + + /** Returns a descriptor of the corners of an L-room shape in grid coordinates. */ + GetLRoomTileDesc: () => LRoomTileDesc; /** * Returns the approximate number of areas in a room that spawn a rain effect in a tight radius. */ GetNumRainSpawners: () => int; + /** + * Returns the `StbRailVariant` at the provided grid index. Returns undefined if there is no + * rail. + */ GetRail: (gridIndex: int) => StbRailVariant | undefined; + /** Returns the room's `RailManager` object. */ GetRailManager: () => RailManager; /** Returns the rain intensity in the room. */ GetRainIntensity: () => float; + /** Returns the room clear delay. */ GetRoomClearDelay: () => int; /** Returns the price of the item in the current room. */ @@ -125,6 +110,7 @@ declare global { /** Returns the color of the water in the current room. */ GetWaterColor: () => KColor; + /** Returns the water's color multiplier. */ GetWaterColorMultiplier: () => KColor; /** Returns whether boss spawns in this room will be champions. */ @@ -167,7 +153,12 @@ declare global { /** Sets the greed wave timer. */ SetGreedWaveTimer: (time: int) => void; - /** Sets the room's item pool. */ + /** + * Sets the room's item pool. This takes priority over the game's regular pool selection code. + * Passing `ItemPoolType.NULL` will have the game handle item pool selection. + * + * This is reset upon leaving the room. + */ SetItemPool: (poolType: ItemPoolType) => void; /** Sets the intensity of the lava in the room. */ @@ -176,9 +167,22 @@ declare global { /** Sets the intensity of the lightning effect in the room. */ SetLightningIntensity: (intensity: float) => void; + /** + * Sets how many frames the room is paused for. When the room is paused, the AI and animations + * of all NPCs and effects stop updating. + * + * NPCs and effects that are spawned while the room is still paused will still update until the + * method is called again. + */ SetPauseTimer: (duration: int) => void; + + /** Adds a rail at the provided grid index. */ SetRail: (gridIndex: int, railVariant: StbRailVariant) => void; + + /** Sets the room's rain intensity. This is used by the rain effect spawners in Downpour. */ SetRainIntensity: (intensity: number) => void; + + /** Sets the room's clear delay. */ SetRoomClearDelay: (delay: int) => void; /** @@ -189,6 +193,9 @@ declare global { /** Sets the color of the water in the room. */ SetWaterColor: (color: KColor) => void; + /** Sets the water's color multiplier. */ + SetWaterColorMultiplier: (color: KColor) => void; + /** * Sets the strength of the water current in the room. The water current particles and sounds * are automatically handled by the game. @@ -197,8 +204,46 @@ declare global { */ SetWaterCurrent: (current: Vector) => void; + /** + * Repentogon's modified `Room.SpawnGridEntity` method. + * + * This method has been renamed to include "Ex" so it can not conflict with the vanilla type + * definitions. However, when the project compiles the method's name will change to what it's + * supposed to be. + * + * @param gridIndex + * @param gridEntityType + * @param variant Optional. Default is 0. + * @param seed Optional. Default is a random seed. + * @param varData Optional. Default is 0. + * @param descriptor + * @customName SpawnGridEntity + */ + SpawnGridEntityEx: (( + gridIndex: int, + gridEntityType: GridEntityType, + variant?: int, + seed?: Seed, + varData?: int, + ) => void) & + ((gridIndex: int, descriptor: GridEntityDesc) => void); + + /** Returns a discounted price of a shop item. */ TryGetShopDiscount: (shopItem: int, price: int) => int; + /** + * Repentogon's modified `Room.TrySpawnSpecialQuestDoor` method. + * + * This method has been renamed to include "Ex" so it can not conflict with the vanilla type + * definitions. However, when the project compiles the method's name will change to what it's + * supposed to be. + * + * @param ignoreStageType Optional. Whether the Mirror & Mineshaft door can spawn outside of + * stages outside of the alt-floor. Default is false. + * @customName TrySpawnSpecialQuestDoor + */ + TrySpawnSpecialQuestDoorEx: (ignoreStageType?: boolean) => boolean; + /** * Updates the room's color correction with the copy of `FXParams.ColorModifier`. * diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Weapon.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Weapon.d.ts index a8e68487c..e4e9e2282 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/Weapon.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/Weapon.d.ts @@ -12,26 +12,68 @@ declare global { * @see https://repentogon.com/ */ interface Weapon extends IsaacAPIClass { + /** Stops the weapon's current collectible animation. */ ClearItemAnim: (collectible: CollectibleType) => void; + + /** Returns the weapon's current charge. */ GetCharge: () => int; + + /** Returns the weapon's current direction. */ GetDirection: () => Vector; + + /** Returns the weapon's current fire delay. */ GetFireDelay: () => int; + + /** Returns the weapon's max fire delay. */ GetMaxFireDelay: () => int; + + /** Returns the weapon's modifiers. */ GetModifiers: () => BitFlags; + + /** + * Returns how many times the weapon has fired its attack. This is reset upon leaving the run. + */ GetNumFired: () => int; + + /** Returns the owner of the weapon. Returns undefined if the weapon has no owners. */ GetOwner: () => Entity | undefined; + + /** Returns the weapon's `WeaponType`. */ GetWeaponType: () => WeaponType; + + /** Returns whether the weapon is aligned to its axis. */ IsAxisAligned: () => boolean; + + /** Returns whether the weapon's collectible animation is finished. */ IsItemAnimFinished: (collectible: CollectibleType) => boolean; + + /** Plays the weapon's collectible animation. */ PlayItemAnim: ( collectible: CollectibleType, aimDirection: Direction, position: Vector, charge: int, ) => void; + + /** + * Sets the weapon's charge. If the provided `charge` is higher than the charge capacity, the + * weapon will discharge its attack. + */ SetCharge: (charge: int) => void; - SetFireDelay: (delay: int) => void; - SetHeadLockTime: (time: int) => void; - SetModifiers: (modifiers: BitFlags) => void; + + /** + * Sets the weapon's fire delay for the provided duration in frames. + * + * The fire delay is not used by all weapons in the game, such as Mom's Knife. + */ + SetFireDelay: (duration: int) => void; + + /** Locks the player's head direction for the provided duration in frames. */ + SetHeadLockTime: (duration: int) => void; + + /** Sets the weapon's modifiers. */ + SetModifiers: ( + modifiers: WeaponModifierFlag | BitFlags, + ) => void; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityFamiliar.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityFamiliar.d.ts index 3e0e37ab1..b4c4310a1 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityFamiliar.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityFamiliar.d.ts @@ -27,6 +27,7 @@ declare global { */ GetItemConfig: () => ItemConfigItem | undefined; + /** Returns the familiar's move delay. */ GetMoveDelayNum: () => int; /** @@ -56,11 +57,19 @@ declare global { /** Returns whether the familiar is charmed. */ IsCharmed: () => boolean; + /** Returns whether the familiar is one of Lil Delirium's morphs. */ + IsLilDelirium: () => boolean; + /** Removes the familiar from the player. */ RemoveFromPlayer: () => void; + /** Sets whether the familiar is one of Lil Delirium's forms. */ + SetLilDelirium: (isLilDelirium: boolean) => void; + + /** Sets the familiar's move delay. */ SetMoveDelayNum: (delay: int) => void; + /** Triggers the familiar's room clear events. */ TriggerRoomClear: () => void; /** @@ -74,6 +83,7 @@ declare global { direction: Direction, ) => Vector | undefined; + /** Updates the familiar's dirt color. */ UpdateDirtColor: () => void; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityPlayer.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityPlayer.d.ts index 555c8e4c5..79fc46592 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityPlayer.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/entity/EntityPlayer.d.ts @@ -344,6 +344,9 @@ declare global { offset?: Vector, ) => EntityEffect; + /** Returns how many frames the player has been holding the drop trinket button. */ + GetActionHoldDrop: () => int; + /** * Returns an `ActiveItemDesc` corresponding to the provided `activeSlot`. * @@ -1081,6 +1084,9 @@ declare global { itemPool?: ItemPoolType, ) => void; + /** Sets how many frames the player has been holding the drop trinket button. */ + SetActionHoldDrop: (frames: int) => void; + /** Sets the `VarData` of the collectible at the provided active slot. */ SetActiveVarData: (varData: int, slot: ActiveSlot) => void; @@ -1355,11 +1361,13 @@ declare global { * If the player is The Forgotten/The Soul, the two will swap forms. Otherwise, this method does * nothing. * + * Returns whether the swap was successful. + * * @param force Optional. If true, the two will swap even if the sub-player doesn't have any * health or while a room/stage transition is active. Default is false. * @param noEffects Optional. If true, the dust and fade effect will not play. Default is false. */ - SwapForgottenForm: (force?: boolean, noEffects?: boolean) => void; + SwapForgottenForm: (force?: boolean, noEffects?: boolean) => boolean; SyncConsumableCounts: (player: EntityPlayer, collectibleFlags: int) => void; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/level-generator/LevelGeneratorEntry.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/level-generator/LevelGeneratorEntry.d.ts index 2a426eac3..40b25713d 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/level-generator/LevelGeneratorEntry.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/level-generator/LevelGeneratorEntry.d.ts @@ -9,7 +9,7 @@ declare global { interface LevelGeneratorEntry extends IsaacAPIClass { SetAllowedDoors: ( room: LevelGeneratorRoom, - doors: BitFlags, + doors: DoorSlotFlag | BitFlags, ) => void; SetColIdx: (room: LevelGeneratorRoom, columnIndex: int) => void; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/MenuManager.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/MenuManager.d.ts index 0751450b8..23bbb8e3c 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/MenuManager.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/MenuManager.d.ts @@ -24,6 +24,7 @@ declare global { /** Returns the current color modifier of the menu. */ function GetCurrentColorModifier(): ColorModifier; + /** Returns a bitmask of the allowed inputs on the main menu. */ function GetInputMask(): BitFlags; /** Returns the sprite used for the select widget. */ @@ -51,7 +52,10 @@ declare global { rate?: number, ): void; - function SetInputMask(mask: BitFlags): void; + /** Sets the allowed inputs on the main menu. */ + function SetInputMask( + mask: ButtonActionFlag | BitFlags, + ): void; /** Sets the position of the main menu camera. */ function SetViewPosition(position: Vector): void; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/StatsMenu.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/StatsMenu.d.ts index 9c37d9ef4..bf093db81 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/StatsMenu.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/menus/StatsMenu.d.ts @@ -24,9 +24,15 @@ declare namespace StatsMenu { function GetSecretsMiniSprite8(): Sprite; function GetSecretsMiniSprite9(): Sprite; + /** Returns the selected element. */ + function GetSelectedElement(): int; + /** Returns the sprites used by the stats menu. */ function GetStatsMenuSprite(): Sprite; /** Returns whether the secrets menu is active. */ function IsSecretsMenuVisible(): boolean; + + /** Sets the menu's selected element. */ + function SetSelectedMenu(): boolean; } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/rendering/Point.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/rendering/Point.d.ts index 4f38f8983..0ea849322 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/rendering/Point.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/rendering/Point.d.ts @@ -8,14 +8,18 @@ * `spritesheetCoordinate` of 0 and 64 will render the spritesheet * starting from `y = 0` to `y = 64`, while an additional third point * of 0 will draw it in reverse from `y = 64` to `y = 0`. - * @param widthMultiplier A multiplier for how wide the beam should be. This is interpolated between - * points. + * @param widthMultiplier Optional. A multiplier for how wide the beam should be. This is + * interpolated between points. Default is 1. + * @param color Optional. Default is `ColorDefault`. + * @param isWorldSpace Optional. Default is false. */ declare function Point( this: void, position: Vector, spritesheetCoordinate: number, - widthMultiplier: number, + widthMultiplier?: number, + color?: Color, + isWorldSpace?: boolean, ): Point; /** @@ -24,6 +28,15 @@ declare function Point( * @see https://repentogon.com/ */ declare interface Point extends IsaacAPIClass { + /** Returns the point's color. */ + GetColor: () => Color; + + /** + * Returns whether the game automatically converts the point's position from world space to screen + * space when rendering. + */ + GetIsWorldSpace: () => boolean; + /** Returns the vertical position of the point. */ GetSpritesheetCoordinate: () => number; @@ -33,6 +46,15 @@ declare interface Point extends IsaacAPIClass { /** Returns the position of the point. */ GetPosition: () => Vector; + /** Sets the point's color. */ + SetColor: (color: Color) => void; + + /** + * Sets whether the game automatically converts the point's position from world space to screen + * space when rendering. + */ + SetIsWorldSpace: (isWorldSpace: boolean) => void; + /** Sets the vertical position of the point. */ SetSpritesheetCoordinate: (height: number) => void; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/EntitiesSaveStateVector.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/EntitiesSaveStateVector.d.ts index fa2f1c601..14e48eaf7 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/EntitiesSaveStateVector.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/EntitiesSaveStateVector.d.ts @@ -7,6 +7,8 @@ declare global { * @see https://repentogon.com/ */ interface EntitiesSaveStateVector extends IsaacAPIClass { + Clear: () => void; + Get: (index: int) => EntitiesSaveState | undefined; /** @@ -19,5 +21,7 @@ declare global { variant?: int, subType?: int, ) => EntitiesSaveState | undefined; + + len: LuaLengthMethod; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfig.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfig.d.ts index 881352ab1..182630abe 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfig.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfig.d.ts @@ -2,7 +2,11 @@ import type { StageID } from "isaac-typescript-definitions"; declare global { interface RoomConfig extends IsaacAPIClass { - GetStage: (stbType: StageID.BLUE_WOMB) => void; Mode: int; } + + /** @noSelf */ + namespace RoomConfig { + function GetStage(stbType: StageID): RoomConfigStage; + } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigHolder.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigHolder.d.ts index b3391f728..416030a44 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigHolder.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigHolder.d.ts @@ -3,6 +3,7 @@ import type { RoomType, StageID, } from "isaac-typescript-definitions"; +import type { GameMode } from "../../../enums/GameMode"; declare global { /** @@ -26,7 +27,7 @@ declare global { * @param maxDifficulty Optional. Default is 10. * @param requiredDoors Optional. Default is 0. * @param subType Optional. Default is -1. - * @param mode Optional. Default is -1. + * @param mode Optional. Default is the current game mode. */ function GetRandomRoom( seed: Seed, @@ -40,7 +41,7 @@ declare global { maxDifficulty?: int, requiredDoors?: int, subType?: int, - mode?: int, + mode?: GameMode, ): RoomConfig | undefined; /** diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigSet.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigSet.d.ts new file mode 100644 index 000000000..ac949ae41 --- /dev/null +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigSet.d.ts @@ -0,0 +1,16 @@ +/** + * This class is for REPENTOGON, an exe-hack which expands the modding API. + * + * @see https://repentogon.com/ + */ +declare interface RoomConfigSet extends IsaacAPIClass { + /** + * Returns a `RoomConfig` at the provided index. Returns undefined if no `RoomConfig` was found. + */ + Get: (index: int) => RoomConfig | undefined; + + /** The number of rooms in the list. */ + readonly Size: int; + + len: LuaLengthMethod; +} diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigStage.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigStage.d.ts index dafe431f5..c62a696e4 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigStage.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomConfigStage.d.ts @@ -1,4 +1,5 @@ import type { BackdropType, Music } from "isaac-typescript-definitions"; +import type { GameMode } from "../../../enums/GameMode"; declare global { /** @@ -7,17 +8,45 @@ declare global { * @see https://repentogon.com/ */ interface RoomConfigStage extends IsaacAPIClass { + /** Returns the `BackdropType` used in default rooms. */ GetBackdrop: () => BackdropType; + + /** Returns the sprite path for the boss spot used in the boss intro. */ GetBossSpot: () => string; + + /** Returns the stage's name. */ GetDisplayName: () => string; + + /** Returns the music that is played in default rooms. */ GetMusic: () => Music; + + /** + * Returns the sprite path for the player spot used in the boss intro and nightmare transition. + */ GetPlayerSpot: () => string; + + /** Returns a `RoomConfigSet`, which contains every `RoomConfig` in the stage. */ + GetRoomSet: (gameMode: GameMode) => RoomConfigSet; + + /** Returns the suffix used by the stage for stage-unique sprites. */ GetSuffix: () => string; + + /** Sets the backdrop used in default rooms. */ SetBackdrop: (backdrop: BackdropType) => void; - SetBossSpot: (bossSpot: string) => void; + + /** Sets the sprite path for the boss spot used in the boss intro. */ + SetBossSpot: (spritePath: string) => void; + + /** Sets the stage's display name. */ SetDisplayName: (name: string) => void; + + /** Sets the music used in default rooms. */ SetMusic: (music: Music) => void; + + /** Sets the sprite path for the player spot used in the boss intro and nightmare transition. */ SetPlayerSpot: (playerSpot: string) => void; + + /** Sets the suffix used by the stage for stage-unique sprites. */ SetSuffix: (suffix: string) => void; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomDescriptor.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomDescriptor.d.ts index 711cd494a..c4aa768a8 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomDescriptor.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/room-config/RoomDescriptor.d.ts @@ -1,14 +1,38 @@ -import type { DoorSlotFlag } from "isaac-typescript-definitions"; +import type { + Dimension, + DoorSlot, + DoorSlotFlag, +} from "isaac-typescript-definitions"; declare global { interface RoomDescriptor extends IsaacAPIClass { AddRestrictedGridIndex: (gridIndex: int) => void; + + /** Returns the dimension that the room is in. */ + GetDimension: () => Dimension; + GetEntitiesSaveState: () => EntitiesSaveStateVector; GetGridEntitiesSaveState: () => GridEntitiesSaveStateVector; + + /** + * Returns a map that maps the door slots to a `RoomDescriptor` for all of the room's current + * neighbors. + */ + GetNeighboringRooms: () => LuaMap; + GetRestrictedGridIndexes: () => int[]; InitSeeds: (rng: RNG) => void; - AllowedDoors: BitFlags; - Doors: BitFlags; + /** Bitflags corresponding to which door slots are currently enabled. */ + readonly AllowedDoors: BitFlags; + + /** + * Which level grid index each `DoorSlot` connects to. Returns -1 if the room's shape doesn't + * allow a door in that slot. + * + * This typically provides a valid index even if there is no door present and if the room itself + * doesn't allow a door in that slot. + */ + readonly Doors: LuaTable; } } diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/AnimationFrame.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/AnimationFrame.d.ts index 89f864163..5785fcad1 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/AnimationFrame.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/AnimationFrame.d.ts @@ -25,6 +25,9 @@ declare interface AnimationFrame extends IsaacAPIClass { /** Returns the frame's scale. */ GetScale: () => Readonly; + /** Returns the starting frame. */ + GetStartFrame: () => number; + /** Returns the frame's width. */ GetWidth: () => number; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/LayerState.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/LayerState.d.ts index de8bcc842..59b8b1ed1 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/LayerState.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/LayerState.d.ts @@ -8,10 +8,10 @@ declare global { */ interface LayerState extends IsaacAPIClass { /** Clears the custom shader. */ - ClearCustomShader: () => void; + ClearCustomChampionShader: () => void; /** Clears the custom shader. */ - ClearCustomChampionShader: () => void; + ClearCustomShader: () => void; /** Returns the layer's `BlendMode`. */ GetBlendMode: () => BlendMode; @@ -56,10 +56,10 @@ declare global { GetWrapTMode: () => int; /** Returns whether the shader from the specified path is active. */ - HasCustomShader: (path: string) => boolean; + HasCustomChampionShader: (path: string) => boolean; /** Returns whether the shader from the specified path is active. */ - HasCustomChampionShader: (path: string) => boolean; + HasCustomShader: (path: string) => boolean; /** Returns whether the layer is visible. */ IsVisible: () => boolean; @@ -71,20 +71,29 @@ declare global { SetCropOffset: (cropOffset: Vector) => void; /** - * Overrides the default color offset shader the sprite uses. + * Overrides the `coloroffset_champion` shader the sprite uses with a custom one. This shader is + * only used if the entity is a champion. + * + * The custom shader must take the same inputs as the `coloroffset_champion` shader the game + * uses. * * @param shaderPath A path to the folder containing the shaders. The path starts on the * resources folder and expects to find both a `.vs` and `.fs` file. */ - SetCustomShader: (shaderPath: string) => void; + SetCustomChampionShader: (shaderPath: string) => void; /** - * Overrides the champion color offset shader the sprite uses. + * Overrides the `coloroffset` shader the sprite uses with a custom one. + * + * The game will not use the shader if the entity is a champion or if the Gold/Dogma shader is + * active. + * + * The custom shader must take the exact same inputs as the `coloroffset` shader the game uses. * * @param shaderPath A path to the folder containing the shaders. The path starts on the * resources folder and expects to find both a `.vs` and `.fs` file. */ - SetCustomChampionShader: (shaderPath: string) => void; + SetCustomShader: (shaderPath: string) => void; /** Sets whether the layer is flipped on the X axis. */ SetFlipX: (flipped: boolean) => void; @@ -96,7 +105,9 @@ declare global { SetPos: (position: Vector) => void; /** Sets the layer's animation render flags. */ - SetRenderFlags: (flags: BitFlags) => void; + SetRenderFlags: ( + flags: AnimationRenderFlag | BitFlags, + ) => void; /** Sets the layer's rotation. */ SetRotation: (rotation: number) => void; diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/Sprite.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/Sprite.d.ts index eb020848a..8e145f7d8 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/Sprite.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/classes/sprite/Sprite.d.ts @@ -10,10 +10,10 @@ declare global { interface Sprite extends IsaacAPIClass { /** Clears the custom shader. */ - ClearCustomShader: () => void; + ClearCustomChampionShader: () => void; /** Clears the custom shader. */ - ClearCustomChampionShader: () => void; + ClearCustomShader: () => void; /** * If the animation is currently stopped, it will start playing again from the current frame. @@ -34,21 +34,27 @@ declare global { */ ContinueOverlay: () => void; + /** Returns an array of all `LayerState` in the sprite. */ + GetAllLayers: () => LayerState[]; + /** * Returns an array of `AnimationData` representing all of the animations in the sprite's .anm2 * file. */ GetAllAnimationData: () => AnimationData[]; - /** Returns an array of all `LayerState` in the sprite. */ - GetAllLayers: () => LayerState[]; - /** Returns the current animation data. */ GetCurrentAnimationData: () => AnimationData; /** Returns the layer data from the specified layer id. Returns undefined if none were found. */ GetLayer: (layerIdOrName: string | int) => LayerState | undefined; + /** + * Returns the `AnimationFrame` currently being displayed on the provided layer ID of the + * current animation. Returns undefined if the layer ID is invalid. + */ + GetLayerFrameData: (layerId: int) => AnimationFrame | undefined; + /** * Returns the null frame from the specified layer name. Returns undefined if the null frame * does not exist. @@ -61,6 +67,12 @@ declare global { */ GetOverlayAnimationData: () => AnimationData | undefined; + /** + * Returns the `AnimationFrame` currently being displayed on the provided layer ID of the + * current overlay animation. Returns undefined if the layer ID is invalid. + */ + GetOverlayLayerFrameData: (layerId: int) => AnimationFrame | undefined; + /** * Returns the null frame from the specified layer name of the current overlay animation. * Returns undefined if the null frame does not exist. @@ -71,10 +83,10 @@ declare global { GetRenderFlags: () => BitFlags; /** Returns whether the shader from the specified path is active. */ - HasCustomShader: (path: string) => boolean; + HasCustomChampionShader: (path: string) => boolean; /** Returns whether the shader from the specified path is active. */ - HasCustomChampionShader: (path: string) => boolean; + HasCustomShader: (path: string) => boolean; /** * Returns true if the specified event in the overlay animation is currently being triggered. @@ -103,20 +115,29 @@ declare global { ) => void; /** - * Overrides the default color offset shader the sprite uses. + * Overrides the `coloroffset_champion` shader the sprite uses with a custom one. This shader is + * only used if the entity is a champion. + * + * The custom shader must take the same inputs as the `coloroffset_champion` shader the game + * uses. * * @param shaderPath A path to the folder containing the shaders. The path starts on the * resources folder and expects to find both a `.vs` and `.fs` file. */ - SetCustomShader: (shaderPath: string) => void; + SetCustomChampionShader: (shaderPath: string) => void; /** - * Overrides the champion color offset shader the sprite uses. + * Overrides the `coloroffset` shader the sprite uses with a custom one. + * + * The game will not use the shader if the entity is a champion or if the Gold/Dogma shader is + * active. + * + * The custom shader must take the exact same inputs as the `coloroffset` shader the game uses. * * @param shaderPath A path to the folder containing the shaders. The path starts on the * resources folder and expects to find both a `.vs` and `.fs` file. */ - SetCustomChampionShader: (shaderPath: string) => void; + SetCustomShader: (shaderPath: string) => void; /** * Repentogon's modified `Sprite.SetOverlayFrame` method. @@ -132,6 +153,9 @@ declare global { */ SetOverlayFrameEx: (frameNumber: int) => void; + /** Sets the overlay layer's frame. */ + SetOverlayLayerFrame: (layer: int, frame: int) => void; + /** Sets the animation's render flags. */ SetRenderFlags: ( flags: AnimationRenderFlag | BitFlags, diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/index.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/index.d.ts index b3364d3e6..88ecfe33c 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/index.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/index.d.ts @@ -70,6 +70,7 @@ /// /// /// +/// /// /// /// @@ -101,6 +102,8 @@ /// /// /// +/// +/// /// /// /// diff --git a/packages/isaac-typescript-definitions-repentogon/src/types/unofficial/AddCallbackParametersRepentogon.d.ts b/packages/isaac-typescript-definitions-repentogon/src/types/unofficial/AddCallbackParametersRepentogon.d.ts index 05b43a24d..00e1805f3 100644 --- a/packages/isaac-typescript-definitions-repentogon/src/types/unofficial/AddCallbackParametersRepentogon.d.ts +++ b/packages/isaac-typescript-definitions-repentogon/src/types/unofficial/AddCallbackParametersRepentogon.d.ts @@ -1,6 +1,7 @@ import type { ActiveSlot, BackdropType, + BedSubType, BombVariant, BossID, ButtonAction, @@ -120,6 +121,24 @@ declare global { playerVariant?: PlayerVariant, ]; + // 37 + [ModCallbackRepentogon.POST_PICKUP_SELECTION]: [ + callback: ( + pickup: EntityPickup, + variant: PickupVariant, + subType: int, + requestedVariant: PickupVariant, + requestedSubType: int, + rng: RNG, + ) => + | [ + pickupVariant: PickupVariant, + subType: int, + continueSelection: boolean, + ] + | undefined, + ]; + // 38 [ModCallbackRepentogon.PRE_PICKUP_COLLISION]: [ callback: ( @@ -1646,6 +1665,32 @@ declare global { callback: (itemConfig: ItemConfigItem, player: EntityPlayer) => void, ]; + // 1285 + [ModCallbackRepentogon.PRE_TRIGGER_BED_SLEEP_EFFECT]: [ + callback: ( + player: EntityPlayer, + bed: EntityPickup, + ) => boolean | undefined, + bedSubType?: BedSubType, + ]; + + // 1286 + [ModCallbackRepentogon.POST_TRIGGER_BED_SLEEP_EFFECT]: [ + callback: (itemConfig: ItemConfigItem, player: EntityPlayer) => void, + bedSubType?: BedSubType, + ]; + + // 1287 + [ModCallbackRepentogon.PRE_PLAYER_POCKET_ITEMS_SWAP]: [ + callback: (player: EntityPlayer) => boolean | undefined, + ]; + + // 1288 + [ModCallbackRepentogon.PRE_BED_SLEEP]: [ + callback: (player: EntityPlayer, bed: BedSubType) => boolean | undefined, + bedSubType?: BedSubType, + ]; + // 1300 [ModCallbackRepentogon.POST_GLOWING_HOURGLASS_SAVE]: [ callback: (slot: int) => void, @@ -2283,5 +2328,31 @@ declare global { isCurseDisplay: boolean, ) => boolean | undefined, ]; + + // 1486 + [ModCallbackRepentogon.PRE_ENTITY_SET_COLOR]: [ + callback: ( + entity: Entity, + color: Color, + duration: int, + priority: int, + fadeOut: boolean, + share: boolean, + ) => Color | boolean | undefined, + entityType?: EntityType, + ]; + + // 1486 + [ModCallbackRepentogon.POST_ENTITY_SET_COLOR]: [ + callback: ( + entity: Entity, + color: Color, + duration: int, + priority: int, + fadeOut: boolean, + share: boolean, + ) => void, + entityType?: EntityType, + ]; } } diff --git a/packages/isaacscript-spell/dictionaries/isaac/isaac.txt b/packages/isaacscript-spell/dictionaries/isaac/isaac.txt index 37ca7383f..722edae5d 100644 --- a/packages/isaacscript-spell/dictionaries/isaac/isaac.txt +++ b/packages/isaacscript-spell/dictionaries/isaac/isaac.txt @@ -22,6 +22,7 @@ collisionradius # REPENTOGON API collisionradiusxmulti # REPENTOGON API collisionradiusymulti # REPENTOGON API colorblood # REPENTOGON API +coloroffset # Game shader combobox # ImGui element completionparent # REPENTOGON API contentfolder # metadata.vdf