isaacscript-common 20.14.5 → 20.16.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 (29) hide show
  1. package/dist/index.d.ts +15 -6
  2. package/dist/isaacscript-common.lua +19 -12
  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 +2 -0
  8. package/dist/src/functions/collectibles.d.ts.map +1 -1
  9. package/dist/src/functions/collectibles.lua +5 -0
  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/tears.d.ts +8 -4
  16. package/dist/src/functions/tears.d.ts.map +1 -1
  17. package/dist/src/functions/tears.lua +11 -2
  18. package/dist/src/functions/transformations.lua +1 -1
  19. package/package.json +1 -1
  20. package/src/classes/features/other/FlyingDetection.ts +2 -2
  21. package/src/classes/features/other/ModdedElementSets.ts +1 -1
  22. package/src/classes/features/other/extraConsoleCommands/subroutines.ts +1 -1
  23. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  24. package/src/functions/collectibles.ts +9 -0
  25. package/src/functions/debugFunctions.ts +5 -5
  26. package/src/functions/doors.ts +1 -1
  27. package/src/functions/levelGrid.ts +2 -5
  28. package/src/functions/tears.ts +21 -2
  29. package/src/functions/transformations.ts +1 -1
package/dist/index.d.ts CHANGED
@@ -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
 
@@ -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(collectibleType: CollectibleType, quality: int): boolean;
7826
+
7824
7827
  export declare function isQuestCollectible(collectibleType: CollectibleType): boolean;
7825
7828
 
7826
7829
  /**
@@ -8025,8 +8028,14 @@ export declare function isTear(variable: unknown): variable is EntityTear;
8025
8028
  *
8026
8029
  * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
8027
8030
  * this case, it will always appear as if the tear is coming from a player.
8031
+ *
8032
+ * @param tear The tear to inspect.
8033
+ * @param familiarVariant Optional. Specify this to check if the tear came from a specific familiar
8034
+ * variant. Default is undefined, which checks for any familiar.
8035
+ * @param subType Optional. Specify this to check if the tear came from a specific familiar
8036
+ * sub-type. Default is undefined, which checks for any familiar.
8028
8037
  */
8029
- export declare function isTearFromFamiliar(tear: EntityTear): boolean;
8038
+ export declare function isTearFromFamiliar(tear: EntityTear, familiarVariant?: FamiliarVariant, subType?: int): boolean;
8030
8039
 
8031
8040
  /**
8032
8041
  * Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
@@ -15158,11 +15167,11 @@ export declare function texelEquals(sprite1: Sprite, sprite2: Sprite, position:
15158
15167
  export declare function todo(...args: unknown[]): void;
15159
15168
 
15160
15169
  /**
15161
- * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
15170
+ * Helper function to log a stack trace to the "log.txt" file, similar to JavaScript's
15162
15171
  * `console.trace` function.
15163
15172
  *
15164
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
15165
- * enabled.
15173
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
15174
+ * string will be logged.
15166
15175
  */
15167
15176
  export declare function traceback(this: void): void;
15168
15177
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.14.5
3
+ isaacscript-common 20.16.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -20776,7 +20776,7 @@ function ____exports.getRepentanceDoor(self)
20776
20776
  end
20777
20777
  function ____exports.getRoomShapeDoorSlot(self, roomShape, x, y)
20778
20778
  local coordinatesMap = ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES[roomShape]
20779
- for ____, ____value in __TS__Iterator(coordinatesMap:entries()) do
20779
+ for ____, ____value in __TS__Iterator(coordinatesMap) do
20780
20780
  local doorSlot = ____value[1]
20781
20781
  local doorX = ____value[2][1]
20782
20782
  local doorY = ____value[2][2]
@@ -21266,6 +21266,10 @@ function ____exports.isPassiveCollectible(self, collectibleType)
21266
21266
  local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
21267
21267
  return itemType == ItemType.PASSIVE or itemType == ItemType.FAMILIAR
21268
21268
  end
21269
+ function ____exports.isQuality(self, collectibleType, quality)
21270
+ local actualQuality = ____exports.getCollectibleQuality(nil, collectibleType)
21271
+ return quality == actualQuality
21272
+ end
21269
21273
  function ____exports.isSingleUseCollectible(self, collectibleType)
21270
21274
  return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET:has(collectibleType)
21271
21275
  end
@@ -33794,7 +33798,7 @@ end
33794
33798
  function ModdedElementSets.prototype.getPlayerTrinketsWithCacheFlag(self, player, cacheFlag)
33795
33799
  local trinketsWithCacheFlag = self:getTrinketsWithCacheFlag(cacheFlag)
33796
33800
  local playerTrinkets = __TS__New(Map)
33797
- for ____, trinketType in __TS__Iterator(trinketsWithCacheFlag:values()) do
33801
+ for ____, trinketType in __TS__Iterator(trinketsWithCacheFlag) do
33798
33802
  local trinketMultiplier = player:GetTrinketMultiplier(trinketType)
33799
33803
  if trinketMultiplier > 0 then
33800
33804
  playerTrinkets:set(trinketType, trinketMultiplier)
@@ -35007,7 +35011,7 @@ function ____exports.addTearsStat(self, player, tearsStat)
35007
35011
  local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
35008
35012
  player.MaxFireDelay = newMaxFireDelay
35009
35013
  end
35010
- function ____exports.isTearFromFamiliar(self, tear)
35014
+ function ____exports.isTearFromFamiliar(self, tear, familiarVariant, subType)
35011
35015
  if tear.FrameCount == 0 then
35012
35016
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
35013
35017
  end
@@ -35015,7 +35019,10 @@ function ____exports.isTearFromFamiliar(self, tear)
35015
35019
  return false
35016
35020
  end
35017
35021
  local familiar = tear.SpawnerEntity:ToFamiliar()
35018
- return familiar ~= nil
35022
+ if familiar == nil then
35023
+ return false
35024
+ end
35025
+ return (familiarVariant == nil or familiarVariant == familiar.Variant) and (subType == nil or subType == familiar.SubType)
35019
35026
  end
35020
35027
  function ____exports.isTearFromPlayer(self, tear)
35021
35028
  if tear.FrameCount == 0 then
@@ -36746,7 +36753,7 @@ function clearAndCopyAllElements(self, oldTable, newTable)
36746
36753
  end
36747
36754
  RESETTABLE_SAVE_DATA_KEYS = __TS__New(Set, {SaveDataKey.RUN, SaveDataKey.LEVEL, SaveDataKey.ROOM})
36748
36755
  function ____exports.restoreDefaultsForAllFeaturesAndKeys(self, saveDataMap, saveDataDefaultsMap)
36749
- for ____, saveDataKey in __TS__Iterator(RESETTABLE_SAVE_DATA_KEYS:values()) do
36756
+ for ____, saveDataKey in __TS__Iterator(RESETTABLE_SAVE_DATA_KEYS) do
36750
36757
  ____exports.restoreDefaultsForAllFeaturesKey(nil, saveDataMap, saveDataDefaultsMap, saveDataKey)
36751
36758
  end
36752
36759
  end
@@ -45010,7 +45017,7 @@ function ____exports.getNewRoomCandidatesBesideRoom(self, roomGridIndex)
45010
45017
  end
45011
45018
  local doorSlotToRoomGridIndexes = ____exports.getRoomShapeAdjacentNonExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
45012
45019
  local roomCandidates = {}
45013
- for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
45020
+ for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes) do
45014
45021
  local doorSlot = ____value[1]
45015
45022
  local adjacentRoomGridIndex = ____value[2]
45016
45023
  do
@@ -45065,7 +45072,7 @@ end
45065
45072
  function ____exports.getRoomShapeAdjacentGridIndexes(self, safeRoomGridIndex, roomShape)
45066
45073
  local roomShapeAdjacentGridIndexDeltas = ____exports.getRoomShapeAdjacentGridIndexDeltas(nil, roomShape)
45067
45074
  local adjacentGridIndexes = __TS__New(Map)
45068
- for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas:entries()) do
45075
+ for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas) do
45069
45076
  local doorSlot = ____value[1]
45070
45077
  local delta = ____value[2]
45071
45078
  local roomGridIndex = safeRoomGridIndex + delta
@@ -46686,7 +46693,7 @@ function ____exports.warpNextToRoomType(self, roomType)
46686
46693
  return
46687
46694
  end
46688
46695
  local adjacentRoomGridIndexes = getRoomAdjacentGridIndexes(nil, firstGridIndex)
46689
- for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes:entries()) do
46696
+ for ____, ____value in __TS__Iterator(adjacentRoomGridIndexes) do
46690
46697
  local _doorSlot = ____value[1]
46691
46698
  local roomGridIndex = ____value[2]
46692
46699
  local roomData = getRoomData(nil, roomGridIndex)
@@ -48082,13 +48089,13 @@ end
48082
48089
  function FlyingDetection.prototype.hasFlyingTemporaryEffect(self, player)
48083
48090
  local effects = player:GetEffects()
48084
48091
  local flyingCollectibles = self.moddedElementSets:getFlyingCollectibles(false)
48085
- for ____, collectibleType in __TS__Iterator(flyingCollectibles:values()) do
48092
+ for ____, collectibleType in __TS__Iterator(flyingCollectibles) do
48086
48093
  if effects:HasCollectibleEffect(collectibleType) then
48087
48094
  return true
48088
48095
  end
48089
48096
  end
48090
48097
  local flyingTrinkets = self.moddedElementSets:getFlyingTrinkets()
48091
- for ____, trinketType in __TS__Iterator(flyingTrinkets:values()) do
48098
+ for ____, trinketType in __TS__Iterator(flyingTrinkets) do
48092
48099
  if effects:HasTrinketEffect(trinketType) then
48093
48100
  return true
48094
48101
  end
@@ -51210,7 +51217,7 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
51210
51217
  return transformationSet
51211
51218
  end
51212
51219
  function ____exports.hasFlyingTransformation(self, player)
51213
- for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
51220
+ for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING) do
51214
51221
  if player:HasPlayerForm(playerForm) then
51215
51222
  return true
51216
51223
  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
@@ -170,6 +170,8 @@ export declare function isModdedCollectibleType(collectibleType: CollectibleType
170
170
  * `ItemType.ITEM_FAMILIAR`.
171
171
  */
172
172
  export declare function isPassiveCollectible(collectibleType: CollectibleType): boolean;
173
+ /** Helper function to check if a collectible type is a particular quality. */
174
+ export declare function isQuality(collectibleType: CollectibleType, quality: int): boolean;
173
175
  /**
174
176
  * Helper function to determine if a particular collectible will disappear from the player's
175
177
  * inventory upon use. Note that this will not work will modded items, as there is no way to
@@ -1 +1 @@
1
- {"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EAEvB,eAAe,EAEf,oBAAoB,EACpB,aAAa,EAEb,QAAQ,EACR,WAAW,EAIZ,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAyB7D,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAEtE;AAED,iGAAiG;AACjG,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAsBT;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,GAC/B,oBAAoB,CAOtB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,eAAe,GAC/B,MAAM,CAeR;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,eAAe,EAAE,eAAe,GAC/B,GAAG,CAYL;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,YAAY,GACnB,WAAW,CAyBb;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,eAAe,GAC/B,MAAM,CAOR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,YAAY,GACxB,gBAAgB,CAsBlB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,GAC/B,GAAG,CAOL;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAA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eAAe,EAAE,eAAe,GAAG,MAAM,CAiB7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAC9C,eAAe,EAAE,eAAe,GAC/B,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAS5E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CASnE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAUnE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAuBtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAqBN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,YAAY,EACzB,kBAAkB,EAAE,eAAe,GAClC,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,IAAI,IAAI,CAK5D"}
1
+ {"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EAEvB,eAAe,EAEf,oBAAoB,EACpB,aAAa,EAEb,QAAQ,EACR,WAAW,EAIZ,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAyB7D,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAEtE;AAED,iGAAiG;AACjG,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAA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,WAAW,EAAE,YAAY,GAAG,IAAI,CAuBtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAqBN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,YAAY,EACzB,kBAAkB,EAAE,eAAe,GAClC,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,IAAI,IAAI,CAK5D"}
@@ -408,6 +408,11 @@ function ____exports.isPassiveCollectible(self, collectibleType)
408
408
  local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
409
409
  return itemType == ItemType.PASSIVE or itemType == ItemType.FAMILIAR
410
410
  end
411
+ --- Helper function to check if a collectible type is a particular quality.
412
+ function ____exports.isQuality(self, collectibleType, quality)
413
+ local actualQuality = ____exports.getCollectibleQuality(nil, collectibleType)
414
+ return quality == actualQuality
415
+ end
411
416
  --- Helper function to determine if a particular collectible will disappear from the player's
412
417
  -- inventory upon use. Note that this will not work will modded items, as there is no way to
413
418
  -- dynamically know if a modded item will disappear.
@@ -21,8 +21,8 @@ export declare function getTime(useSocketIfAvailable?: boolean): float;
21
21
  /**
22
22
  * Helper function to get a stack trace.
23
23
  *
24
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
25
- * enabled.
24
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
25
+ * string will be returned.
26
26
  */
27
27
  export declare function getTraceback(this: void): string;
28
28
  /**
@@ -42,11 +42,11 @@ export declare function getTraceback(this: void): string;
42
42
  */
43
43
  export declare function isLuaDebugEnabled(): boolean;
44
44
  /**
45
- * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
45
+ * Helper function to log a stack trace to the "log.txt" file, similar to JavaScript's
46
46
  * `console.trace` function.
47
47
  *
48
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
49
- * enabled.
48
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
49
+ * string will be logged.
50
50
  */
51
51
  export declare function traceback(this: void): void;
52
52
  //# sourceMappingURL=debugFunctions.d.ts.map
@@ -53,8 +53,8 @@ function ____exports.getTime(self, useSocketIfAvailable)
53
53
  end
54
54
  --- Helper function to get a stack trace.
55
55
  --
56
- -- This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
57
- -- enabled.
56
+ -- This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
57
+ -- string will be returned.
58
58
  function ____exports.getTraceback()
59
59
  if SandboxGetTraceback ~= nil then
60
60
  return SandboxGetTraceback()
@@ -64,11 +64,11 @@ function ____exports.getTraceback()
64
64
  end
65
65
  return "stack traceback:\n(the \"--luadebug\" flag is not enabled)"
66
66
  end
67
- --- Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
67
+ --- Helper function to log a stack trace to the "log.txt" file, similar to JavaScript's
68
68
  -- `console.trace` function.
69
69
  --
70
- -- This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
71
- -- enabled.
70
+ -- This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
71
+ -- string will be logged.
72
72
  function ____exports.traceback()
73
73
  local tracebackOutput = ____exports.getTraceback()
74
74
  log(tracebackOutput)
@@ -253,7 +253,7 @@ end
253
253
  --- Helper function to get the corresponding door slot for a given room shape and grid coordinates.
254
254
  function ____exports.getRoomShapeDoorSlot(self, roomShape, x, y)
255
255
  local coordinatesMap = ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES[roomShape]
256
- for ____, ____value in __TS__Iterator(coordinatesMap:entries()) do
256
+ for ____, ____value in __TS__Iterator(coordinatesMap) do
257
257
  local doorSlot = ____value[1]
258
258
  local doorX = ____value[2][1]
259
259
  local doorY = ____value[2][2]
@@ -1 +1 @@
1
- {"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAE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BAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAKtE"}
@@ -104,7 +104,7 @@ function ____exports.getNewRoomCandidatesBesideRoom(self, roomGridIndex)
104
104
  end
105
105
  local doorSlotToRoomGridIndexes = ____exports.getRoomShapeAdjacentNonExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
106
106
  local roomCandidates = {}
107
- for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes:entries()) do
107
+ for ____, ____value in __TS__Iterator(doorSlotToRoomGridIndexes) do
108
108
  local doorSlot = ____value[1]
109
109
  local adjacentRoomGridIndex = ____value[2]
110
110
  do
@@ -182,7 +182,7 @@ end
182
182
  function ____exports.getRoomShapeAdjacentGridIndexes(self, safeRoomGridIndex, roomShape)
183
183
  local roomShapeAdjacentGridIndexDeltas = ____exports.getRoomShapeAdjacentGridIndexDeltas(nil, roomShape)
184
184
  local adjacentGridIndexes = __TS__New(Map)
185
- for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas:entries()) do
185
+ for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexDeltas) do
186
186
  local doorSlot = ____value[1]
187
187
  local delta = ____value[2]
188
188
  local roomGridIndex = safeRoomGridIndex + delta
@@ -1,6 +1,4 @@
1
- /// <reference types="isaac-typescript-definitions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /// <reference types="isaac-typescript-definitions" />
1
+ import { FamiliarVariant } from "isaac-typescript-definitions";
4
2
  /**
5
3
  * - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and
6
4
  * adds it to the player.
@@ -46,8 +44,14 @@ export declare function getTearsStat(fireDelay: float): float;
46
44
  *
47
45
  * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
48
46
  * this case, it will always appear as if the tear is coming from a player.
47
+ *
48
+ * @param tear The tear to inspect.
49
+ * @param familiarVariant Optional. Specify this to check if the tear came from a specific familiar
50
+ * variant. Default is undefined, which checks for any familiar.
51
+ * @param subType Optional. Specify this to check if the tear came from a specific familiar
52
+ * sub-type. Default is undefined, which checks for any familiar.
49
53
  */
50
- export declare function isTearFromFamiliar(tear: EntityTear): boolean;
54
+ export declare function isTearFromFamiliar(tear: EntityTear, familiarVariant?: FamiliarVariant, subType?: int): boolean;
51
55
  /**
52
56
  * Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
53
57
  * is determined by looking at the parent.
@@ -1 +1 @@
1
- {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
1
+ {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,eAAe,EACjC,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAuBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
@@ -46,7 +46,13 @@ end
46
46
  --
47
47
  -- Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
48
48
  -- this case, it will always appear as if the tear is coming from a player.
49
- function ____exports.isTearFromFamiliar(self, tear)
49
+ --
50
+ -- @param tear The tear to inspect.
51
+ -- @param familiarVariant Optional. Specify this to check if the tear came from a specific familiar
52
+ -- variant. Default is undefined, which checks for any familiar.
53
+ -- @param subType Optional. Specify this to check if the tear came from a specific familiar
54
+ -- sub-type. Default is undefined, which checks for any familiar.
55
+ function ____exports.isTearFromFamiliar(self, tear, familiarVariant, subType)
50
56
  if tear.FrameCount == 0 then
51
57
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
52
58
  end
@@ -54,7 +60,10 @@ function ____exports.isTearFromFamiliar(self, tear)
54
60
  return false
55
61
  end
56
62
  local familiar = tear.SpawnerEntity:ToFamiliar()
57
- return familiar ~= nil
63
+ if familiar == nil then
64
+ return false
65
+ end
66
+ return (familiarVariant == nil or familiarVariant == familiar.Variant) and (subType == nil or subType == familiar.SubType)
58
67
  end
59
68
  --- Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
60
69
  -- is determined by looking at the parent.
@@ -72,7 +72,7 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
72
72
  return transformationSet
73
73
  end
74
74
  function ____exports.hasFlyingTransformation(self, player)
75
- for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
75
+ for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING) do
76
76
  if player:HasPlayerForm(playerForm) then
77
77
  return true
78
78
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.14.5",
3
+ "version": "20.16.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -36,14 +36,14 @@ export class FlyingDetection extends Feature {
36
36
  // - Pinking Shears gives a Transcendence temporary effect.
37
37
  const flyingCollectibles =
38
38
  this.moddedElementSets.getFlyingCollectibles(false);
39
- for (const collectibleType of flyingCollectibles.values()) {
39
+ for (const collectibleType of flyingCollectibles) {
40
40
  if (effects.HasCollectibleEffect(collectibleType)) {
41
41
  return true;
42
42
  }
43
43
  }
44
44
 
45
45
  const flyingTrinkets = this.moddedElementSets.getFlyingTrinkets();
46
- for (const trinketType of flyingTrinkets.values()) {
46
+ for (const trinketType of flyingTrinkets) {
47
47
  if (effects.HasTrinketEffect(trinketType)) {
48
48
  return true;
49
49
  }
@@ -990,7 +990,7 @@ export class ModdedElementSets extends Feature {
990
990
  const trinketsWithCacheFlag = this.getTrinketsWithCacheFlag(cacheFlag);
991
991
 
992
992
  const playerTrinkets = new Map<TrinketType, int>();
993
- for (const trinketType of trinketsWithCacheFlag.values()) {
993
+ for (const trinketType of trinketsWithCacheFlag) {
994
994
  const trinketMultiplier = player.GetTrinketMultiplier(trinketType);
995
995
  if (trinketMultiplier > 0) {
996
996
  playerTrinkets.set(trinketType, trinketMultiplier);
@@ -148,7 +148,7 @@ export function warpNextToRoomType(roomType: RoomType): void {
148
148
 
149
149
  const adjacentRoomGridIndexes = getRoomAdjacentGridIndexes(firstGridIndex);
150
150
 
151
- for (const [_doorSlot, roomGridIndex] of adjacentRoomGridIndexes.entries()) {
151
+ for (const [_doorSlot, roomGridIndex] of adjacentRoomGridIndexes) {
152
152
  const roomData = getRoomData(roomGridIndex);
153
153
  if (roomData !== undefined && roomData.Type === RoomType.DEFAULT) {
154
154
  changeRoom(roomGridIndex);
@@ -19,7 +19,7 @@ export function restoreDefaultsForAllFeaturesAndKeys(
19
19
  saveDataMap: LuaMap<string, SaveData>,
20
20
  saveDataDefaultsMap: LuaMap<string, SaveData>,
21
21
  ): void {
22
- for (const saveDataKey of RESETTABLE_SAVE_DATA_KEYS.values()) {
22
+ for (const saveDataKey of RESETTABLE_SAVE_DATA_KEYS) {
23
23
  restoreDefaultsForAllFeaturesKey(
24
24
  saveDataMap,
25
25
  saveDataDefaultsMap,
@@ -493,6 +493,15 @@ export function isPassiveCollectible(
493
493
  return itemType === ItemType.PASSIVE || itemType === ItemType.FAMILIAR;
494
494
  }
495
495
 
496
+ /** Helper function to check if a collectible type is a particular quality. */
497
+ export function isQuality(
498
+ collectibleType: CollectibleType,
499
+ quality: int,
500
+ ): boolean {
501
+ const actualQuality = getCollectibleQuality(collectibleType);
502
+ return quality === actualQuality;
503
+ }
504
+
496
505
  /**
497
506
  * Helper function to determine if a particular collectible will disappear from the player's
498
507
  * inventory upon use. Note that this will not work will modded items, as there is no way to
@@ -42,8 +42,8 @@ export function getTime(useSocketIfAvailable = true): float {
42
42
  /**
43
43
  * Helper function to get a stack trace.
44
44
  *
45
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
46
- * enabled.
45
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
46
+ * string will be returned.
47
47
  */
48
48
  export function getTraceback(this: void): string {
49
49
  if (SandboxGetTraceback !== undefined) {
@@ -82,11 +82,11 @@ export function isLuaDebugEnabled(): boolean {
82
82
  }
83
83
 
84
84
  /**
85
- * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
85
+ * Helper function to log a stack trace to the "log.txt" file, similar to JavaScript's
86
86
  * `console.trace` function.
87
87
  *
88
- * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
89
- * enabled.
88
+ * This will only work if the `--luadebug` launch option is enabled. If it isn't, then a error
89
+ * string will be logged.
90
90
  */
91
91
  export function traceback(this: void): void {
92
92
  const tracebackOutput = getTraceback();
@@ -249,7 +249,7 @@ export function getRoomShapeDoorSlot(
249
249
  y: int,
250
250
  ): DoorSlot | undefined {
251
251
  const coordinatesMap = ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES[roomShape];
252
- for (const [doorSlot, [doorX, doorY]] of coordinatesMap.entries()) {
252
+ for (const [doorSlot, [doorX, doorY]] of coordinatesMap) {
253
253
  if (x === doorX && y === doorY) {
254
254
  return doorSlot;
255
255
  }
@@ -170,10 +170,7 @@ export function getNewRoomCandidatesBesideRoom(
170
170
 
171
171
  const roomCandidates: Array<[DoorSlot, int]> = [];
172
172
 
173
- for (const [
174
- doorSlot,
175
- adjacentRoomGridIndex,
176
- ] of doorSlotToRoomGridIndexes.entries()) {
173
+ for (const [doorSlot, adjacentRoomGridIndex] of doorSlotToRoomGridIndexes) {
177
174
  // The "getRoomShapeAdjacentNonExistingGridIndexes" returns grid indexes for every possible
178
175
  // door, but the real room we are examining will only have a subset of these doors. Thus, we
179
176
  // have to exclude adjacent grid indexes where it would not be possible to place a door.
@@ -341,7 +338,7 @@ export function getRoomShapeAdjacentGridIndexes(
341
338
  getRoomShapeAdjacentGridIndexDeltas(roomShape);
342
339
 
343
340
  const adjacentGridIndexes = new Map<DoorSlot, int>();
344
- for (const [doorSlot, delta] of roomShapeAdjacentGridIndexDeltas.entries()) {
341
+ for (const [doorSlot, delta] of roomShapeAdjacentGridIndexDeltas) {
345
342
  const roomGridIndex = safeRoomGridIndex + delta;
346
343
  if (isRoomInsideGrid(roomGridIndex)) {
347
344
  adjacentGridIndexes.set(doorSlot, roomGridIndex);
@@ -1,3 +1,5 @@
1
+ import { FamiliarVariant } from "isaac-typescript-definitions";
2
+
1
3
  /**
2
4
  * - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and
3
5
  * adds it to the player.
@@ -55,8 +57,18 @@ export function getTearsStat(fireDelay: float): float {
55
57
  *
56
58
  * Note that this function does not work properly when the tear is from a Lead Pencil barrage. In
57
59
  * this case, it will always appear as if the tear is coming from a player.
60
+ *
61
+ * @param tear The tear to inspect.
62
+ * @param familiarVariant Optional. Specify this to check if the tear came from a specific familiar
63
+ * variant. Default is undefined, which checks for any familiar.
64
+ * @param subType Optional. Specify this to check if the tear came from a specific familiar
65
+ * sub-type. Default is undefined, which checks for any familiar.
58
66
  */
59
- export function isTearFromFamiliar(tear: EntityTear): boolean {
67
+ export function isTearFromFamiliar(
68
+ tear: EntityTear,
69
+ familiarVariant?: FamiliarVariant,
70
+ subType?: int,
71
+ ): boolean {
60
72
  if (tear.FrameCount === 0) {
61
73
  error(
62
74
  'Failed to check if the given tear was from a player since the tear\'s frame count was equal to 0. (The "isTearFromFamiliar" function must only be used in the "POST_TEAR_INIT_VERY_LATE" callback or on frame 1 and onwards.)',
@@ -71,7 +83,14 @@ export function isTearFromFamiliar(tear: EntityTear): boolean {
71
83
  // We cannot use `tear.SpawnerType` to determine this, since it is baked in to be equal to
72
84
  // `EntityType.PLAYER` regardless of whether the tear is from a player or familiar.
73
85
  const familiar = tear.SpawnerEntity.ToFamiliar();
74
- return familiar !== undefined;
86
+ if (familiar === undefined) {
87
+ return false;
88
+ }
89
+
90
+ return (
91
+ (familiarVariant === undefined || familiarVariant === familiar.Variant) &&
92
+ (subType === undefined || subType === familiar.SubType)
93
+ );
75
94
  }
76
95
 
77
96
  /**
@@ -87,7 +87,7 @@ export function getTransformationsForCollectibleType(
87
87
  }
88
88
 
89
89
  export function hasFlyingTransformation(player: EntityPlayer): boolean {
90
- for (const playerForm of TRANSFORMATIONS_THAT_GRANT_FLYING.values()) {
90
+ for (const playerForm of TRANSFORMATIONS_THAT_GRANT_FLYING) {
91
91
  if (player.HasPlayerForm(playerForm)) {
92
92
  return true;
93
93
  }