isaacscript-common 20.15.0 → 20.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/index.d.ts +32 -22
  2. package/dist/isaacscript-common.lua +87 -41
  3. package/dist/src/classes/features/other/FlyingDetection.lua +2 -2
  4. package/dist/src/classes/features/other/ModdedElementSets.lua +1 -1
  5. package/dist/src/classes/features/other/extraConsoleCommands/subroutines.lua +1 -1
  6. package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  7. package/dist/src/functions/collectibles.d.ts +25 -17
  8. package/dist/src/functions/collectibles.d.ts.map +1 -1
  9. package/dist/src/functions/collectibles.lua +71 -22
  10. package/dist/src/functions/debugFunctions.d.ts +5 -5
  11. package/dist/src/functions/debugFunctions.lua +5 -5
  12. package/dist/src/functions/doors.lua +1 -1
  13. package/dist/src/functions/levelGrid.d.ts.map +1 -1
  14. package/dist/src/functions/levelGrid.lua +2 -2
  15. package/dist/src/functions/pickupVariants.d.ts.map +1 -1
  16. package/dist/src/functions/pickupVariants.lua +12 -11
  17. package/dist/src/functions/transformations.lua +1 -1
  18. package/package.json +1 -1
  19. package/src/classes/features/other/FlyingDetection.ts +2 -2
  20. package/src/classes/features/other/ModdedElementSets.ts +1 -1
  21. package/src/classes/features/other/extraConsoleCommands/subroutines.ts +1 -1
  22. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  23. package/src/functions/collectibles.ts +156 -22
  24. package/src/functions/debugFunctions.ts +5 -5
  25. package/src/functions/doors.ts +1 -1
  26. package/src/functions/levelGrid.ts +2 -5
  27. package/src/functions/pickupVariants.ts +38 -12
  28. package/src/functions/transformations.ts +1 -1
package/dist/index.d.ts CHANGED
@@ -1318,7 +1318,7 @@ export declare function closeDoorFast(door: GridEntityDoor): void;
1318
1318
  export declare const COLLECTIBLE_INITIAL_WAIT = 20;
1319
1319
 
1320
1320
  /** Helper function to check in the item config if a given collectible has a given cache flag. */
1321
- export declare function collectibleHasCacheFlag(collectibleType: CollectibleType, cacheFlag: CacheFlag): boolean;
1321
+ export declare function collectibleHasCacheFlag(collectibleOrCollectibleType: EntityPickup | CollectibleType, cacheFlag: CacheFlag): boolean;
1322
1322
 
1323
1323
  export declare function collectibleHasTag(collectibleType: CollectibleType, tag: ItemConfigTag): boolean;
1324
1324
 
@@ -4356,7 +4356,7 @@ export declare function getCoinValue(coinSubType: CoinSubType): int;
4356
4356
  * Helper function to get the charge type that a collectible has. Returns
4357
4357
  * `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
4358
4358
  */
4359
- export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
4359
+ export declare function getCollectibleChargeType(collectibleOrCollectibleType: EntityPickup | CollectibleType): ItemConfigChargeType;
4360
4360
 
4361
4361
  /**
4362
4362
  * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
@@ -4364,19 +4364,19 @@ export declare function getCollectibleChargeType(collectibleType: CollectibleTyp
4364
4364
  *
4365
4365
  * This function works for both vanilla and modded collectibles.
4366
4366
  */
4367
- export declare function getCollectibleDescription(collectibleType: CollectibleType): string;
4367
+ export declare function getCollectibleDescription(collectibleOrCollectibleType: EntityPickup | CollectibleType): string;
4368
4368
 
4369
4369
  /**
4370
4370
  * Helper function to get the coin cost that a collectible item would be if it were being offered in
4371
4371
  * a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
4372
4372
  */
4373
- export declare function getCollectibleDevilCoinPrice(collectibleType: CollectibleType): int;
4373
+ export declare function getCollectibleDevilCoinPrice(collectibleOrCollectibleType: EntityPickup | CollectibleType): int;
4374
4374
 
4375
4375
  /**
4376
4376
  * Helper function to get the heart cost that a collectible item would be if it were being offered
4377
4377
  * in a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
4378
4378
  */
4379
- export declare function getCollectibleDevilHeartPrice(collectibleType: CollectibleType, player: EntityPlayer): PickupPrice;
4379
+ export declare function getCollectibleDevilHeartPrice(collectibleOrCollectibleType: EntityPickup | CollectibleType, player: EntityPlayer): PickupPrice;
4380
4380
 
4381
4381
  /**
4382
4382
  * Helper function to get the path to a collectible PNG file. Returns the path to the question mark
@@ -4386,7 +4386,7 @@ export declare function getCollectibleDevilHeartPrice(collectibleType: Collectib
4386
4386
  * The function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
4387
4387
  * field.
4388
4388
  */
4389
- export declare function getCollectibleGfxFilename(collectibleType: CollectibleType): string;
4389
+ export declare function getCollectibleGfxFilename(collectibleOrCollectibleType: EntityPickup | CollectibleType): string;
4390
4390
 
4391
4391
  /**
4392
4392
  * Mods may have to keep track of data relating to a collectible. Finding an index for these kinds
@@ -4444,19 +4444,19 @@ export declare function getCollectibleIndex(collectible: EntityPickup): Collecti
4444
4444
  * Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
4445
4445
  * provided collectible type was not valid.
4446
4446
  */
4447
- export declare function getCollectibleInitCharge(collectibleType: CollectibleType): int;
4447
+ export declare function getCollectibleInitCharge(collectibleOrCollectibleType: EntityPickup | CollectibleType): int;
4448
4448
 
4449
4449
  /**
4450
4450
  * Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
4451
4451
  * provided collectible type was not valid.
4452
4452
  */
4453
- export declare function getCollectibleItemType(collectibleType: CollectibleType): ItemType;
4453
+ export declare function getCollectibleItemType(collectibleOrCollectibleType: EntityPickup | CollectibleType): ItemType;
4454
4454
 
4455
4455
  /**
4456
4456
  * Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the
4457
4457
  * provided collectible type was not valid.
4458
4458
  */
4459
- export declare function getCollectibleMaxCharges(collectibleType: CollectibleType): int;
4459
+ export declare function getCollectibleMaxCharges(collectibleOrCollectibleType: EntityPickup | CollectibleType): int;
4460
4460
 
4461
4461
  /**
4462
4462
  * Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
@@ -4466,7 +4466,7 @@ export declare function getCollectibleMaxCharges(collectibleType: CollectibleTyp
4466
4466
  *
4467
4467
  * This function works for both vanilla and modded collectibles.
4468
4468
  */
4469
- export declare function getCollectibleName(collectibleType: CollectibleType): string;
4469
+ export declare function getCollectibleName(collectibleOrCollectibleType: EntityPickup | CollectibleType): string;
4470
4470
 
4471
4471
  /**
4472
4472
  * Helper function to get the "pedestal type" of a collectible. For example, it might be sitting on
@@ -4478,7 +4478,7 @@ export declare function getCollectiblePedestalType(collectible: EntityPickup): C
4478
4478
  * Helper function to get a collectible's quality. For example, Mom's Knife has a quality of 4.
4479
4479
  * Returns 0 if the provided collectible type was not valid.
4480
4480
  */
4481
- export declare function getCollectibleQuality(collectibleType: CollectibleType): int;
4481
+ export declare function getCollectibleQuality(collectibleOrCollectibleType: EntityPickup | CollectibleType): int;
4482
4482
 
4483
4483
  /**
4484
4484
  * Helper function to get all of the collectible entities in the room.
@@ -4499,7 +4499,7 @@ export declare function getCollectibles(collectibleType?: CollectibleType): Enti
4499
4499
  * const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
4500
4500
  * ```
4501
4501
  */
4502
- export declare function getCollectibleTags(collectibleType: CollectibleType): BitFlags<ItemConfigTag>;
4502
+ export declare function getCollectibleTags(collectibleOrCollectibleType: EntityPickup | CollectibleType): BitFlags<ItemConfigTag>;
4503
4503
 
4504
4504
  /**
4505
4505
  * Gets the entities that have a hitbox that overlaps with any part of the square that the grid
@@ -6497,8 +6497,8 @@ export declare function getTotalPlayerCollectibles(collectibleType: CollectibleT
6497
6497
  /**
6498
6498
  * Helper function to get a stack trace.
6499
6499
  *
6500
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
6501
- * enabled.
6500
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
6501
+ * string will be returned.
6502
6502
  */
6503
6503
  export declare function getTraceback(this: void): string;
6504
6504
 
@@ -7617,7 +7617,7 @@ export declare function isFunction(variable: unknown): variable is Function;
7617
7617
  * glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear
7618
7618
  * in secret rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
7619
7619
  */
7620
- export declare function isGlitchedCollectible(pickup: EntityPickup): boolean;
7620
+ export declare function isGlitchedCollectible(collectible: EntityPickup): boolean;
7621
7621
 
7622
7622
  export declare function isGoldenTrinketType(trinketType: TrinketType): boolean;
7623
7623
 
@@ -7654,7 +7654,7 @@ export declare function isHeart(pickup: EntityPickup): pickup is EntityPickupHea
7654
7654
  *
7655
7655
  * Hidden collectibles will not show up in any pools and Eden will not start with them.
7656
7656
  */
7657
- export declare function isHiddenCollectible(collectibleType: CollectibleType): boolean;
7657
+ export declare function isHiddenCollectible(collectibleOrCollectibleType: EntityPickup | CollectibleType): boolean;
7658
7658
 
7659
7659
  export declare function isHiddenSecretRoomDoor(door: GridEntityDoor): boolean;
7660
7660
 
@@ -7766,7 +7766,7 @@ export declare function isOdd(num: int): boolean;
7766
7766
  * Returns true if the item type in the item config is equal to `ItemType.ITEM_PASSIVE` or
7767
7767
  * `ItemType.ITEM_FAMILIAR`.
7768
7768
  */
7769
- export declare function isPassiveCollectible(collectibleType: CollectibleType): boolean;
7769
+ export declare function isPassiveCollectible(collectibleOrCollectibleType: EntityPickup | CollectibleType): boolean;
7770
7770
 
7771
7771
  /** Helper function to narrow the type of `PickingUpItem`. */
7772
7772
  export declare function isPickingUpItemCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible;
@@ -7821,6 +7821,9 @@ export declare function isPrimitive(variable: unknown): variable is boolean | nu
7821
7821
  /** Helper function to detect if a variable is of type `EntityProjectile`. */
7822
7822
  export declare function isProjectile(variable: unknown): variable is EntityProjectile;
7823
7823
 
7824
+ /** Helper function to check if a collectible type is a particular quality. */
7825
+ export declare function isQuality(collectibleOrCollectibleType: EntityPickup | CollectibleType, quality: int): boolean;
7826
+
7824
7827
  export declare function isQuestCollectible(collectibleType: CollectibleType): boolean;
7825
7828
 
7826
7829
  /**
@@ -7966,8 +7969,8 @@ export declare function isSin(npc: EntityNPC): boolean;
7966
7969
 
7967
7970
  /**
7968
7971
  * Helper function to determine if a particular collectible will disappear from the player's
7969
- * inventory upon use. Note that this will not work will modded items, as there is no way to
7970
- * dynamically know if a modded item will disappear.
7972
+ * inventory upon use. Note that this will not work will modded collectibles, as there is no way to
7973
+ * dynamically know if a modded collectible will disappear.
7971
7974
  */
7972
7975
  export declare function isSingleUseCollectible(collectibleType: CollectibleType): boolean;
7973
7976
 
@@ -14004,6 +14007,13 @@ export declare function setCollectibleEmpty(collectible: EntityPickup): void;
14004
14007
  */
14005
14008
  export declare function setCollectibleGlitched(collectible: EntityPickup): void;
14006
14009
 
14010
+ /**
14011
+ * Helper function to set the "pedestal type" of a collectible. For example, it might be sitting on
14012
+ * top of a broken Blood Donation Machine and you want to change it to be sitting on top of an
14013
+ * opened Spiked Chest.
14014
+ */
14015
+ export declare function setCollectiblePedestalType(collectible: EntityPickup, collectiblePedestalType: CollectiblePedestalType): void;
14016
+
14007
14017
  /**
14008
14018
  * Helper function to change the sprite of a collectible pedestal entity.
14009
14019
  *
@@ -15164,11 +15174,11 @@ export declare function texelEquals(sprite1: Sprite, sprite2: Sprite, position:
15164
15174
  export declare function todo(...args: unknown[]): void;
15165
15175
 
15166
15176
  /**
15167
- * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
15177
+ * Helper function to log a stack trace to the "log.txt" file, similar to JavaScript's
15168
15178
  * `console.trace` function.
15169
15179
  *
15170
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
15171
- * enabled.
15180
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
15181
+ * string will be logged.
15172
15182
  */
15173
15183
  export declare function traceback(this: void): void;
15174
15184
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.15.0
3
+ isaacscript-common 20.17.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -20112,39 +20112,40 @@ return ____exports
20112
20112
  ["src.functions.pickupVariants"] = function(...)
20113
20113
  local ____exports = {}
20114
20114
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
20115
+ local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
20115
20116
  local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
20116
20117
  function ____exports.isHeart(self, pickup)
20117
- return pickup.Variant == PickupVariant.HEART
20118
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.HEART
20118
20119
  end
20119
20120
  function ____exports.isCoin(self, pickup)
20120
- return pickup.Variant == PickupVariant.COIN
20121
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.COIN
20121
20122
  end
20122
20123
  function ____exports.isKey(self, pickup)
20123
- return pickup.Variant == PickupVariant.KEY
20124
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.KEY
20124
20125
  end
20125
20126
  function ____exports.isBombPickup(self, pickup)
20126
- return pickup.Variant == PickupVariant.BOMB
20127
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.BOMB
20127
20128
  end
20128
20129
  function ____exports.isPoopPickup(self, pickup)
20129
- return pickup.Variant == PickupVariant.POOP
20130
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.POOP
20130
20131
  end
20131
20132
  function ____exports.isSack(self, pickup)
20132
- return pickup.Variant == PickupVariant.SACK
20133
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.SACK
20133
20134
  end
20134
20135
  function ____exports.isPill(self, pickup)
20135
- return pickup.Variant == PickupVariant.PILL
20136
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.PILL
20136
20137
  end
20137
20138
  function ____exports.isBattery(self, pickup)
20138
- return pickup.Variant == PickupVariant.LIL_BATTERY
20139
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.LIL_BATTERY
20139
20140
  end
20140
20141
  function ____exports.isCollectible(self, pickup)
20141
- return pickup.Variant == PickupVariant.COLLECTIBLE
20142
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.COLLECTIBLE
20142
20143
  end
20143
20144
  function ____exports.isCardPickup(self, pickup)
20144
- return pickup.Variant == PickupVariant.TAROT_CARD
20145
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.TAROT_CARD
20145
20146
  end
20146
20147
  function ____exports.isTrinket(self, pickup)
20147
- return pickup.Variant == PickupVariant.TRINKET
20148
+ return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.TRINKET
20148
20149
  end
20149
20150
  return ____exports
20150
20151
  end,
@@ -20776,7 +20777,7 @@ function ____exports.getRepentanceDoor(self)
20776
20777
  end
20777
20778
  function ____exports.getRoomShapeDoorSlot(self, roomShape, x, y)
20778
20779
  local coordinatesMap = ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES[roomShape]
20779
- for ____, ____value in __TS__Iterator(coordinatesMap:entries()) do
20780
+ for ____, ____value in __TS__Iterator(coordinatesMap) do
20780
20781
  local doorSlot = ____value[1]
20781
20782
  local doorX = ____value[2][1]
20782
20783
  local doorY = ____value[2][2]
@@ -20985,7 +20986,7 @@ return ____exports
20985
20986
  end,
20986
20987
  ["src.functions.collectibles"] = function(...)
20987
20988
  local ____exports = {}
20988
- local initQuestionMarkSprite
20989
+ local initQuestionMarkSprite, getCollectibleTypeFromArg
20989
20990
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
20990
20991
  local CollectibleSpriteLayer = ____isaac_2Dtypescript_2Ddefinitions.CollectibleSpriteLayer
20991
20992
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
@@ -21025,6 +21026,8 @@ local getRoomListIndex = ____roomData.getRoomListIndex
21025
21026
  local ____sprites = require("src.functions.sprites")
21026
21027
  local clearSprite = ____sprites.clearSprite
21027
21028
  local spriteEquals = ____sprites.spriteEquals
21029
+ local ____types = require("src.functions.types")
21030
+ local isNumber = ____types.isNumber
21028
21031
  local ____utils = require("src.functions.utils")
21029
21032
  local iRange = ____utils.iRange
21030
21033
  function initQuestionMarkSprite(self)
@@ -21035,6 +21038,10 @@ function initQuestionMarkSprite(self)
21035
21038
  return sprite
21036
21039
  end
21037
21040
  function ____exports.clearCollectibleSprite(self, collectible)
21041
+ if not isCollectible(nil, collectible) then
21042
+ local entityID = getEntityID(nil, collectible)
21043
+ error("The \"clearCollectibleSprite\" function was given a non-collectible: " .. entityID)
21044
+ end
21038
21045
  ____exports.setCollectibleSprite(nil, collectible, nil)
21039
21046
  end
21040
21047
  function ____exports.isVanillaCollectibleType(self, collectibleType)
@@ -21079,10 +21086,24 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
21079
21086
  true
21080
21087
  )
21081
21088
  end
21089
+ function getCollectibleTypeFromArg(self, collectibleOrCollectibleType, functionName)
21090
+ if isNumber(nil, collectibleOrCollectibleType) then
21091
+ local collectibleType = collectibleOrCollectibleType
21092
+ return collectibleType
21093
+ end
21094
+ local collectible = collectibleOrCollectibleType
21095
+ if not isCollectible(nil, collectible) then
21096
+ local entityID = getEntityID(nil, collectible)
21097
+ error((("The \"" .. functionName) .. "\" function was given a non-collectible: ") .. entityID)
21098
+ end
21099
+ return collectible.SubType
21100
+ end
21082
21101
  local COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2"
21102
+ local DEFAULT_COLLECTIBLE_PRICE = 15
21083
21103
  local GLITCHED_ITEM_THRESHOLD = 4000000000
21084
21104
  local questionMarkSprite = initQuestionMarkSprite(nil)
21085
- function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
21105
+ function ____exports.collectibleHasCacheFlag(self, collectibleOrCollectibleType, cacheFlag)
21106
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "collectibleHasCacheFlag")
21086
21107
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21087
21108
  if itemConfigItem == nil then
21088
21109
  return false
@@ -21109,14 +21130,16 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
21109
21130
  yIncrement
21110
21131
  )
21111
21132
  end
21112
- function ____exports.getCollectibleChargeType(self, collectibleType)
21133
+ function ____exports.getCollectibleChargeType(self, collectibleOrCollectibleType)
21134
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleChargeType")
21113
21135
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21114
21136
  if itemConfigItem == nil then
21115
21137
  return ItemConfigChargeType.NORMAL
21116
21138
  end
21117
21139
  return itemConfigItem.ChargeType
21118
21140
  end
21119
- function ____exports.getCollectibleDescription(self, collectibleType)
21141
+ function ____exports.getCollectibleDescription(self, collectibleOrCollectibleType)
21142
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleDescription")
21120
21143
  local collectibleDescription = COLLECTIBLE_DESCRIPTION_MAP:get(collectibleType)
21121
21144
  if collectibleDescription ~= nil then
21122
21145
  return collectibleDescription
@@ -21127,18 +21150,19 @@ function ____exports.getCollectibleDescription(self, collectibleType)
21127
21150
  end
21128
21151
  return DEFAULT_COLLECTIBLE_DESCRIPTION
21129
21152
  end
21130
- function ____exports.getCollectibleDevilCoinPrice(self, collectibleType)
21153
+ function ____exports.getCollectibleDevilCoinPrice(self, collectibleOrCollectibleType)
21154
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleDescription")
21131
21155
  if collectibleType == CollectibleType.NULL then
21132
21156
  return 0
21133
21157
  end
21134
- local defaultCollectiblePrice = 15
21135
21158
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21136
21159
  if itemConfigItem == nil then
21137
- return defaultCollectiblePrice
21160
+ return DEFAULT_COLLECTIBLE_PRICE
21138
21161
  end
21139
- return itemConfigItem.DevilPrice * defaultCollectiblePrice
21162
+ return itemConfigItem.DevilPrice * DEFAULT_COLLECTIBLE_PRICE
21140
21163
  end
21141
- function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player)
21164
+ function ____exports.getCollectibleDevilHeartPrice(self, collectibleOrCollectibleType, player)
21165
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleDevilHeartPrice")
21142
21166
  local maxHearts = player:GetMaxHearts()
21143
21167
  if collectibleType == CollectibleType.NULL then
21144
21168
  return 0
@@ -21154,7 +21178,8 @@ function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player
21154
21178
  local twoHeartPrice = maxHearts == 2 and PickupPrice.ONE_HEART_AND_TWO_SOUL_HEARTS or PickupPrice.TWO_HEARTS
21155
21179
  return itemConfigItem.DevilPrice == 2 and twoHeartPrice or PickupPrice.ONE_HEART
21156
21180
  end
21157
- function ____exports.getCollectibleGfxFilename(self, collectibleType)
21181
+ function ____exports.getCollectibleGfxFilename(self, collectibleOrCollectibleType)
21182
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleGfxFilename")
21158
21183
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21159
21184
  if itemConfigItem == nil then
21160
21185
  return BLIND_ITEM_PNG_PATH
@@ -21178,28 +21203,32 @@ function ____exports.getCollectibleIndex(self, collectible)
21178
21203
  end
21179
21204
  return (((((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.SubType)) .. ",") .. tostring(collectible.InitSeed)
21180
21205
  end
21181
- function ____exports.getCollectibleInitCharge(self, collectibleType)
21206
+ function ____exports.getCollectibleInitCharge(self, collectibleOrCollectibleType)
21207
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleInitCharge")
21182
21208
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21183
21209
  if itemConfigItem == nil then
21184
21210
  return 0
21185
21211
  end
21186
21212
  return itemConfigItem.InitCharge
21187
21213
  end
21188
- function ____exports.getCollectibleItemType(self, collectibleType)
21214
+ function ____exports.getCollectibleItemType(self, collectibleOrCollectibleType)
21215
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleItemType")
21189
21216
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21190
21217
  if itemConfigItem == nil then
21191
21218
  return ItemType.NULL
21192
21219
  end
21193
21220
  return itemConfigItem.Type
21194
21221
  end
21195
- function ____exports.getCollectibleMaxCharges(self, collectibleType)
21222
+ function ____exports.getCollectibleMaxCharges(self, collectibleOrCollectibleType)
21223
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleMaxCharges")
21196
21224
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21197
21225
  if itemConfigItem == nil then
21198
21226
  return 0
21199
21227
  end
21200
21228
  return itemConfigItem.MaxCharges
21201
21229
  end
21202
- function ____exports.getCollectibleName(self, collectibleType)
21230
+ function ____exports.getCollectibleName(self, collectibleOrCollectibleType)
21231
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleName")
21203
21232
  local collectibleName = COLLECTIBLE_TYPE_TO_NAME_MAP:get(collectibleType)
21204
21233
  if collectibleName ~= nil then
21205
21234
  return collectibleName
@@ -21218,14 +21247,16 @@ function ____exports.getCollectiblePedestalType(self, collectible)
21218
21247
  local sprite = collectible:GetSprite()
21219
21248
  return sprite:GetOverlayFrame()
21220
21249
  end
21221
- function ____exports.getCollectibleQuality(self, collectibleType)
21250
+ function ____exports.getCollectibleQuality(self, collectibleOrCollectibleType)
21251
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleQuality")
21222
21252
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21223
21253
  if itemConfigItem == nil then
21224
21254
  return 0
21225
21255
  end
21226
21256
  return itemConfigItem.Quality
21227
21257
  end
21228
- function ____exports.getCollectibleTags(self, collectibleType)
21258
+ function ____exports.getCollectibleTags(self, collectibleOrCollectibleType)
21259
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleTags")
21229
21260
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21230
21261
  return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
21231
21262
  end
@@ -21252,20 +21283,26 @@ function ____exports.isBlindCollectible(self, collectible)
21252
21283
  questionMarkSprite:SetFrame(animation, frame)
21253
21284
  return ____exports.collectibleSpriteEquals(nil, sprite, questionMarkSprite)
21254
21285
  end
21255
- function ____exports.isGlitchedCollectible(self, pickup)
21256
- return pickup.Variant == PickupVariant.COLLECTIBLE and pickup.SubType > GLITCHED_ITEM_THRESHOLD
21286
+ function ____exports.isGlitchedCollectible(self, collectible)
21287
+ return collectible.Variant == PickupVariant.COLLECTIBLE and collectible.SubType > GLITCHED_ITEM_THRESHOLD
21257
21288
  end
21258
- function ____exports.isHiddenCollectible(self, collectibleType)
21289
+ function ____exports.isHiddenCollectible(self, collectibleOrCollectibleType)
21290
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "isHiddenCollectible")
21259
21291
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
21260
21292
  return itemConfigItem ~= nil and itemConfigItem.Hidden
21261
21293
  end
21262
21294
  function ____exports.isModdedCollectibleType(self, collectibleType)
21263
21295
  return not ____exports.isVanillaCollectibleType(nil, collectibleType)
21264
21296
  end
21265
- function ____exports.isPassiveCollectible(self, collectibleType)
21297
+ function ____exports.isPassiveCollectible(self, collectibleOrCollectibleType)
21298
+ local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "isPassiveCollectible")
21266
21299
  local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
21267
21300
  return itemType == ItemType.PASSIVE or itemType == ItemType.FAMILIAR
21268
21301
  end
21302
+ function ____exports.isQuality(self, collectibleOrCollectibleType, quality)
21303
+ local actualQuality = ____exports.getCollectibleQuality(nil, collectibleOrCollectibleType)
21304
+ return quality == actualQuality
21305
+ end
21269
21306
  function ____exports.isSingleUseCollectible(self, collectibleType)
21270
21307
  return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET:has(collectibleType)
21271
21308
  end
@@ -21319,6 +21356,15 @@ function ____exports.setCollectibleGlitched(self, collectible)
21319
21356
  player:RemoveCollectible(CollectibleType.TMTRAINER)
21320
21357
  end
21321
21358
  end
21359
+ function ____exports.setCollectiblePedestalType(self, collectible, collectiblePedestalType)
21360
+ if not isCollectible(nil, collectible) then
21361
+ local entityID = getEntityID(nil, collectible)
21362
+ error("The \"setCollectiblePedestalType\" function was given a non-collectible: " .. entityID)
21363
+ end
21364
+ local sprite = collectible:GetSprite()
21365
+ local overlayAnimation = sprite:GetOverlayAnimation()
21366
+ sprite:SetOverlayFrame(overlayAnimation, collectiblePedestalType)
21367
+ end
21322
21368
  function ____exports.setCollectiblesRerolledForItemTracker(self)
21323
21369
  Isaac.DebugString("Added 3 Collectibles")
21324
21370
  end
@@ -33794,7 +33840,7 @@ end
33794
33840
  function ModdedElementSets.prototype.getPlayerTrinketsWithCacheFlag(self, player, cacheFlag)
33795
33841
  local trinketsWithCacheFlag = self:getTrinketsWithCacheFlag(cacheFlag)
33796
33842
  local playerTrinkets = __TS__New(Map)
33797
- for ____, trinketType in __TS__Iterator(trinketsWithCacheFlag:values()) do
33843
+ for ____, trinketType in __TS__Iterator(trinketsWithCacheFlag) do
33798
33844
  local trinketMultiplier = player:GetTrinketMultiplier(trinketType)
33799
33845
  if trinketMultiplier > 0 then
33800
33846
  playerTrinkets:set(trinketType, trinketMultiplier)
@@ -36749,7 +36795,7 @@ function clearAndCopyAllElements(self, oldTable, newTable)
36749
36795
  end
36750
36796
  RESETTABLE_SAVE_DATA_KEYS = __TS__New(Set, {SaveDataKey.RUN, SaveDataKey.LEVEL, SaveDataKey.ROOM})
36751
36797
  function ____exports.restoreDefaultsForAllFeaturesAndKeys(self, saveDataMap, saveDataDefaultsMap)
36752
- for ____, saveDataKey in __TS__Iterator(RESETTABLE_SAVE_DATA_KEYS:values()) do
36798
+ for ____, saveDataKey in __TS__Iterator(RESETTABLE_SAVE_DATA_KEYS) do
36753
36799
  ____exports.restoreDefaultsForAllFeaturesKey(nil, saveDataMap, saveDataDefaultsMap, saveDataKey)
36754
36800
  end
36755
36801
  end
@@ -45013,7 +45059,7 @@ function ____exports.getNewRoomCandidatesBesideRoom(self, roomGridIndex)
45013
45059
  end
45014
45060
  local doorSlotToRoomGridIndexes = ____exports.getRoomShapeAdjacentNonExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
45015
45061
  local roomCandidates = {}
45016
- for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
45062
+ for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes) do
45017
45063
  local doorSlot = ____value[1]
45018
45064
  local adjacentRoomGridIndex = ____value[2]
45019
45065
  do
@@ -45068,7 +45114,7 @@ end
45068
45114
  function ____exports.getRoomShapeAdjacentGridIndexes(self, safeRoomGridIndex, roomShape)
45069
45115
  local roomShapeAdjacentGridIndexDeltas = ____exports.getRoomShapeAdjacentGridIndexDeltas(nil, roomShape)
45070
45116
  local adjacentGridIndexes = __TS__New(Map)
45071
- for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas:entries()) do
45117
+ for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas) do
45072
45118
  local doorSlot = ____value[1]
45073
45119
  local delta = ____value[2]
45074
45120
  local roomGridIndex = safeRoomGridIndex + delta
@@ -46689,7 +46735,7 @@ function ____exports.warpNextToRoomType(self, roomType)
46689
46735
  return
46690
46736
  end
46691
46737
  local adjacentRoomGridIndexes = getRoomAdjacentGridIndexes(nil, firstGridIndex)
46692
- for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes:entries()) do
46738
+ for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes) do
46693
46739
  local _doorSlot = ____value[1]
46694
46740
  local roomGridIndex = ____value[2]
46695
46741
  local roomData = getRoomData(nil, roomGridIndex)
@@ -48085,13 +48131,13 @@ end
48085
48131
  function FlyingDetection.prototype.hasFlyingTemporaryEffect(self, player)
48086
48132
  local effects = player:GetEffects()
48087
48133
  local flyingCollectibles = self.moddedElementSets:getFlyingCollectibles(false)
48088
- for ____, collectibleType in __TS__Iterator(flyingCollectibles:values()) do
48134
+ for ____, collectibleType in __TS__Iterator(flyingCollectibles) do
48089
48135
  if effects:HasCollectibleEffect(collectibleType) then
48090
48136
  return true
48091
48137
  end
48092
48138
  end
48093
48139
  local flyingTrinkets = self.moddedElementSets:getFlyingTrinkets()
48094
- for ____, trinketType in __TS__Iterator(flyingTrinkets:values()) do
48140
+ for ____, trinketType in __TS__Iterator(flyingTrinkets) do
48095
48141
  if effects:HasTrinketEffect(trinketType) then
48096
48142
  return true
48097
48143
  end
@@ -51213,7 +51259,7 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
51213
51259
  return transformationSet
51214
51260
  end
51215
51261
  function ____exports.hasFlyingTransformation(self, player)
51216
- for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
51262
+ for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING) do
51217
51263
  if player:HasPlayerForm(playerForm) then
51218
51264
  return true
51219
51265
  end
@@ -25,13 +25,13 @@ end
25
25
  function FlyingDetection.prototype.hasFlyingTemporaryEffect(self, player)
26
26
  local effects = player:GetEffects()
27
27
  local flyingCollectibles = self.moddedElementSets:getFlyingCollectibles(false)
28
- for ____, collectibleType in __TS__Iterator(flyingCollectibles:values()) do
28
+ for ____, collectibleType in __TS__Iterator(flyingCollectibles) do
29
29
  if effects:HasCollectibleEffect(collectibleType) then
30
30
  return true
31
31
  end
32
32
  end
33
33
  local flyingTrinkets = self.moddedElementSets:getFlyingTrinkets()
34
- for ____, trinketType in __TS__Iterator(flyingTrinkets:values()) do
34
+ for ____, trinketType in __TS__Iterator(flyingTrinkets) do
35
35
  if effects:HasTrinketEffect(trinketType) then
36
36
  return true
37
37
  end
@@ -518,7 +518,7 @@ end
518
518
  function ModdedElementSets.prototype.getPlayerTrinketsWithCacheFlag(self, player, cacheFlag)
519
519
  local trinketsWithCacheFlag = self:getTrinketsWithCacheFlag(cacheFlag)
520
520
  local playerTrinkets = __TS__New(Map)
521
- for ____, trinketType in __TS__Iterator(trinketsWithCacheFlag:values()) do
521
+ for ____, trinketType in __TS__Iterator(trinketsWithCacheFlag) do
522
522
  local trinketMultiplier = player:GetTrinketMultiplier(trinketType)
523
523
  if trinketMultiplier > 0 then
524
524
  playerTrinkets:set(trinketType, trinketMultiplier)
@@ -127,7 +127,7 @@ function ____exports.warpNextToRoomType(self, roomType)
127
127
  return
128
128
  end
129
129
  local adjacentRoomGridIndexes = getRoomAdjacentGridIndexes(nil, firstGridIndex)
130
- for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes:entries()) do
130
+ for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes) do
131
131
  local _doorSlot = ____value[1]
132
132
  local roomGridIndex = ____value[2]
133
133
  local roomData = getRoomData(nil, roomGridIndex)
@@ -62,7 +62,7 @@ function clearAndCopyAllElements(self, oldTable, newTable)
62
62
  end
63
63
  RESETTABLE_SAVE_DATA_KEYS = __TS__New(Set, {SaveDataKey.RUN, SaveDataKey.LEVEL, SaveDataKey.ROOM})
64
64
  function ____exports.restoreDefaultsForAllFeaturesAndKeys(self, saveDataMap, saveDataDefaultsMap)
65
- for ____, saveDataKey in __TS__Iterator(RESETTABLE_SAVE_DATA_KEYS:values()) do
65
+ for ____, saveDataKey in __TS__Iterator(RESETTABLE_SAVE_DATA_KEYS) do
66
66
  ____exports.restoreDefaultsForAllFeaturesKey(nil, saveDataMap, saveDataDefaultsMap, saveDataKey)
67
67
  end
68
68
  end