isaacscript-common 15.4.4 → 15.4.6

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.
package/dist/index.d.ts CHANGED
@@ -6892,6 +6892,13 @@ export declare function inMirrorRoom(): boolean;
6892
6892
  */
6893
6893
  export declare function inRectangle(position: Vector, topLeft: Vector, bottomRight: Vector): boolean;
6894
6894
 
6895
+ /**
6896
+ * Helper function to check if the current room matches one of the given room types.
6897
+ *
6898
+ * This function is variadic, which means you can pass as many room types as you want to match for.
6899
+ */
6900
+ export declare function inRoomType(...roomTypes: RoomType[]): boolean;
6901
+
6895
6902
  /**
6896
6903
  * Helper function for checking if the current room is a secret exit that leads to a Repentance
6897
6904
  * floor.
@@ -7685,13 +7692,6 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
7685
7692
  */
7686
7693
  export declare function isRoomShapeDoubleCharge(roomShape: RoomShape): boolean;
7687
7694
 
7688
- /**
7689
- * Helper function to check if the current room matches one of the given room types.
7690
- *
7691
- * This function is variadic, which means you can pass as many room types as you want to match for.
7692
- */
7693
- export declare function isRoomType(...roomTypes: RoomType[]): boolean;
7694
-
7695
7695
  /** Returns true for cards that have `CardType.RUNE`. */
7696
7696
  export declare function isRune(cardType: CardType): boolean;
7697
7697
 
@@ -11407,6 +11407,7 @@ declare class PlayerCollectibleDetection extends Feature {
11407
11407
  */
11408
11408
  private checkActiveItemsChanged;
11409
11409
  private entityTakeDmgPlayer;
11410
+ private postItemPickup;
11410
11411
  }
11411
11412
 
11412
11413
  export declare function playerConvertBlackHeartsToSoulHearts(player: EntityPlayer): void;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 15.4.4
3
+ isaacscript-common 15.4.6
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -11199,6 +11199,7 @@ local TearFlagInternal = {
11199
11199
  CARD_DROP_DEATH = getTearFlag(nil, 79),
11200
11200
  RUNE_DROP_DEATH = getTearFlag(nil, 80),
11201
11201
  TELEPORT = getTearFlag(nil, 81),
11202
+ SHORT_RANGE = getTearFlag(nil, 82),
11202
11203
  REROLL_ROCK_WISP = getTearFlag(nil, 115),
11203
11204
  MOM_STOMP_WISP = getTearFlag(nil, 116),
11204
11205
  ENEMY_TO_WISP = getTearFlag(nil, 117),
@@ -25229,9 +25230,9 @@ local __TS__Spread = ____lualib.__TS__Spread
25229
25230
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
25230
25231
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
25231
25232
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
25233
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
25232
25234
  local Set = ____lualib.Set
25233
25235
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
25234
- local __TS__ArraySome = ____lualib.__TS__ArraySome
25235
25236
  local ____exports = {}
25236
25237
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
25237
25238
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -25477,6 +25478,15 @@ function ____exports.inMirrorRoom(self)
25477
25478
  local roomSubType = getRoomSubType(nil)
25478
25479
  return roomType == RoomType.DEFAULT and (roomStageID == StageID.DOWNPOUR or roomStageID == StageID.DROSS) and roomSubType == asNumber(nil, DownpourRoomSubType.MIRROR)
25479
25480
  end
25481
+ function ____exports.inRoomType(self, ...)
25482
+ local roomTypes = {...}
25483
+ local room = game:GetRoom()
25484
+ local thisRoomType = room:GetType()
25485
+ return __TS__ArraySome(
25486
+ roomTypes,
25487
+ function(____, roomType) return roomType == thisRoomType end
25488
+ )
25489
+ end
25480
25490
  function ____exports.inSecretExit(self)
25481
25491
  local roomGridIndex = getRoomGridIndex(nil)
25482
25492
  return roomGridIndex == asNumber(nil, GridRoom.SECRET_EXIT)
@@ -25508,15 +25518,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
25508
25518
  function(____, roomDescriptor) return roomDescriptor.Clear end
25509
25519
  )
25510
25520
  end
25511
- function ____exports.isRoomType(self, ...)
25512
- local roomTypes = {...}
25513
- local room = game:GetRoom()
25514
- local thisRoomType = room:GetType()
25515
- return __TS__ArraySome(
25516
- roomTypes,
25517
- function(____, roomType) return roomType == thisRoomType end
25518
- )
25519
- end
25520
25521
  function ____exports.roomUpdateSafe(self)
25521
25522
  local room = game:GetRoom()
25522
25523
  local entities = getEntities(nil)
@@ -32110,6 +32111,8 @@ local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
32110
32111
  local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
32111
32112
  local ____cachedClasses = require("src.core.cachedClasses")
32112
32113
  local itemConfig = ____cachedClasses.itemConfig
32114
+ local ____constants = require("src.core.constants")
32115
+ local FIRST_GLITCHED_COLLECTIBLE_TYPE = ____constants.FIRST_GLITCHED_COLLECTIBLE_TYPE
32113
32116
  local ____decorators = require("src.decorators")
32114
32117
  local Exported = ____decorators.Exported
32115
32118
  local ____ISCFeature = require("src.enums.ISCFeature")
@@ -32434,6 +32437,22 @@ function ModdedElementSets.prototype.getPlayerCollectibleMap(self, player)
32434
32437
  collectibleMap:set(collectibleType, numCollectibles)
32435
32438
  end
32436
32439
  end
32440
+ if player:HasCollectible(CollectibleType.TMTRAINER) then
32441
+ local collectibleType = FIRST_GLITCHED_COLLECTIBLE_TYPE
32442
+ local itemConfigItem
32443
+ repeat
32444
+ do
32445
+ itemConfigItem = itemConfig:GetCollectible(collectibleType)
32446
+ if itemConfigItem ~= nil then
32447
+ local hasCollectibles = player:HasCollectible(collectibleType, true)
32448
+ if hasCollectibles then
32449
+ collectibleMap:set(collectibleType, 1)
32450
+ end
32451
+ end
32452
+ collectibleType = collectibleType - 1
32453
+ end
32454
+ until not (itemConfigItem ~= nil)
32455
+ end
32437
32456
  return collectibleMap
32438
32457
  end
32439
32458
  function ModdedElementSets.prototype.getPlayerCollectiblesWithCacheFlag(self, player, cacheFlag)
@@ -32592,10 +32611,13 @@ local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
32592
32611
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
32593
32612
  local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
32594
32613
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
32614
+ local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
32595
32615
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
32596
32616
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
32597
32617
  local ____ISCFeature = require("src.enums.ISCFeature")
32598
32618
  local ISCFeature = ____ISCFeature.ISCFeature
32619
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
32620
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
32599
32621
  local ____array = require("src.functions.array")
32600
32622
  local arrayEquals = ____array.arrayEquals
32601
32623
  local ____enums = require("src.functions.enums")
@@ -32668,8 +32690,17 @@ function PlayerCollectibleDetection.prototype.____constructor(self, postPlayerCo
32668
32690
  end)
32669
32691
  return nil
32670
32692
  end
32693
+ self.postItemPickup = function(____, player, pickingUpItem)
32694
+ if pickingUpItem.itemType == ItemType.TRINKET or pickingUpItem.itemType == ItemType.NULL then
32695
+ return
32696
+ end
32697
+ local newCollectibleCount = player:GetCollectibleCount()
32698
+ mapSetPlayer(nil, self.v.run.playersCollectibleCount, player, newCollectibleCount)
32699
+ self:updateCollectibleMapAndFire(player, 1)
32700
+ end
32671
32701
  self.featuresUsed = {ISCFeature.MODDED_ELEMENT_SETS, ISCFeature.RUN_IN_N_FRAMES}
32672
32702
  self.callbacksUsed = {{ModCallback.POST_USE_ITEM, {self.useItemD4, CollectibleType.D4}}, {ModCallback.POST_PEFFECT_UPDATE, {self.postPEffectUpdate}}, {ModCallback.ENTITY_TAKE_DMG, {self.entityTakeDmgPlayer, EntityType.PLAYER}}}
32703
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_ITEM_PICKUP, {self.postItemPickup}}}
32673
32704
  self.postPlayerCollectibleAdded = postPlayerCollectibleAdded
32674
32705
  self.postPlayerCollectibleRemoved = postPlayerCollectibleRemoved
32675
32706
  self.moddedElementSets = moddedElementSets
@@ -45,5 +45,6 @@ export declare class PlayerCollectibleDetection extends Feature {
45
45
  */
46
46
  private checkActiveItemsChanged;
47
47
  private entityTakeDmgPlayer;
48
+ private postItemPickup;
48
49
  }
49
50
  //# sourceMappingURL=PlayerCollectibleDetection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerCollectibleDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/PlayerCollectibleDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EAKhB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,0BAA2B,SAAQ,OAAO;IACrC,CAAC;;;;;;MAYf;IAEF,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,4BAA4B,CAA+B;IACnE,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,YAAY,CAAe;gBAGjC,0BAA0B,EAAE,0BAA0B,EACtD,4BAA4B,EAAE,4BAA4B,EAC1D,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,YAAY;IAwB5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,2BAA2B;IA0CnC,OAAO,CAAC,SAAS,CAqBf;IAGF,OAAO,CAAC,iBAAiB,CAqBvB;IAEF;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IAmC/B,OAAO,CAAC,mBAAmB,CAgCzB;CACH"}
1
+ {"version":3,"file":"PlayerCollectibleDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/PlayerCollectibleDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EAMhB,MAAM,8BAA8B,CAAC;AAatC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,0BAA2B,SAAQ,OAAO;IACrC,CAAC;;;;;;MAYf;IAEF,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,4BAA4B,CAA+B;IACnE,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,YAAY,CAAe;gBAGjC,0BAA0B,EAAE,0BAA0B,EACtD,4BAA4B,EAAE,4BAA4B,EAC1D,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,YAAY;IA4B5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,2BAA2B;IA0CnC,OAAO,CAAC,SAAS,CAqBf;IAGF,OAAO,CAAC,iBAAiB,CAqBvB;IAEF;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IAmC/B,OAAO,CAAC,mBAAmB,CAgCzB;IAKF,OAAO,CAAC,cAAc,CAmBpB;CACH"}
@@ -16,10 +16,13 @@ local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
16
16
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
17
17
  local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
18
18
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
19
+ local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
19
20
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
20
21
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
21
22
  local ____ISCFeature = require("src.enums.ISCFeature")
22
23
  local ISCFeature = ____ISCFeature.ISCFeature
24
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
25
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
23
26
  local ____array = require("src.functions.array")
24
27
  local arrayEquals = ____array.arrayEquals
25
28
  local ____enums = require("src.functions.enums")
@@ -92,8 +95,17 @@ function PlayerCollectibleDetection.prototype.____constructor(self, postPlayerCo
92
95
  end)
93
96
  return nil
94
97
  end
98
+ self.postItemPickup = function(____, player, pickingUpItem)
99
+ if pickingUpItem.itemType == ItemType.TRINKET or pickingUpItem.itemType == ItemType.NULL then
100
+ return
101
+ end
102
+ local newCollectibleCount = player:GetCollectibleCount()
103
+ mapSetPlayer(nil, self.v.run.playersCollectibleCount, player, newCollectibleCount)
104
+ self:updateCollectibleMapAndFire(player, 1)
105
+ end
95
106
  self.featuresUsed = {ISCFeature.MODDED_ELEMENT_SETS, ISCFeature.RUN_IN_N_FRAMES}
96
107
  self.callbacksUsed = {{ModCallback.POST_USE_ITEM, {self.useItemD4, CollectibleType.D4}}, {ModCallback.POST_PEFFECT_UPDATE, {self.postPEffectUpdate}}, {ModCallback.ENTITY_TAKE_DMG, {self.entityTakeDmgPlayer, EntityType.PLAYER}}}
108
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_ITEM_PICKUP, {self.postItemPickup}}}
97
109
  self.postPlayerCollectibleAdded = postPlayerCollectibleAdded
98
110
  self.postPlayerCollectibleRemoved = postPlayerCollectibleRemoved
99
111
  self.moddedElementSets = moddedElementSets
@@ -1 +1 @@
1
- {"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AA0BtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC,wBAAwB,CAAyB;IACzD,OAAO,CAAC,sBAAsB,CAA8B;IAE5D,OAAO,CAAC,4BAA4B,CAAyB;IAC7D,OAAO,CAAC,0BAA0B,CAA8B;IAEhE,OAAO,CAAC,2BAA2B,CAAyB;IAC5D,OAAO,CAAC,yBAAyB,CAA8B;IAE/D,OAAO,CAAC,oBAAoB,CAAqB;IACjD,OAAO,CAAC,kBAAkB,CAA0B;IAEpD,OAAO,CAAC,wBAAwB,CAAqB;IACrD,OAAO,CAAC,sBAAsB,CAA0B;IAExD,OAAO,CAAC,uBAAuB,CAAqB;IACpD,OAAO,CAAC,qBAAqB,CAA0B;IAEvD,OAAO,CAAC,wBAAwB,CAG5B;IAEJ,OAAO,CAAC,8BAA8B,CAGlC;IAEJ,OAAO,CAAC,0BAA0B,CAA0C;IAE5E,OAAO,CAAC,yBAAyB,CAA8B;IAC/D,OAAO,CAAC,kCAAkC,CAA8B;IACxE,OAAO,CAAC,qBAAqB,CAA0B;IAEvD,OAAO,CAAC,6BAA6B,CAA8B;IACnE,OAAO,CAAC,8BAA8B,CAA8B;IAEpE,OAAO,CAAC,sBAAsB,CAAyB;IAWvD,OAAO,CAAC,+BAA+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____isaac_2Dtypescript_2Ddefinitions.TrinketType
16
16
  local ____cachedClasses = require("src.core.cachedClasses")
17
17
  local itemConfig = ____cachedClasses.itemConfig
18
+ local ____constants = require("src.core.constants")
19
+ local FIRST_GLITCHED_COLLECTIBLE_TYPE = ____constants.FIRST_GLITCHED_COLLECTIBLE_TYPE
18
20
  local ____decorators = require("src.decorators")
19
21
  local Exported = ____decorators.Exported
20
22
  local ____ISCFeature = require("src.enums.ISCFeature")
@@ -339,6 +341,22 @@ function ModdedElementSets.prototype.getPlayerCollectibleMap(self, player)
339
341
  collectibleMap:set(collectibleType, numCollectibles)
340
342
  end
341
343
  end
344
+ if player:HasCollectible(CollectibleType.TMTRAINER) then
345
+ local collectibleType = FIRST_GLITCHED_COLLECTIBLE_TYPE
346
+ local itemConfigItem
347
+ repeat
348
+ do
349
+ itemConfigItem = itemConfig:GetCollectible(collectibleType)
350
+ if itemConfigItem ~= nil then
351
+ local hasCollectibles = player:HasCollectible(collectibleType, true)
352
+ if hasCollectibles then
353
+ collectibleMap:set(collectibleType, 1)
354
+ end
355
+ end
356
+ collectibleType = collectibleType - 1
357
+ end
358
+ until not (itemConfigItem ~= nil)
359
+ end
342
360
  return collectibleMap
343
361
  end
344
362
  function ModdedElementSets.prototype.getPlayerCollectiblesWithCacheFlag(self, player, cacheFlag)
@@ -151,6 +151,12 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
151
151
  * rooms are marked with a specific sub-type.)
152
152
  */
153
153
  export declare function inMirrorRoom(): boolean;
154
+ /**
155
+ * Helper function to check if the current room matches one of the given room types.
156
+ *
157
+ * This function is variadic, which means you can pass as many room types as you want to match for.
158
+ */
159
+ export declare function inRoomType(...roomTypes: RoomType[]): boolean;
154
160
  /**
155
161
  * Helper function for checking if the current room is a secret exit that leads to a Repentance
156
162
  * floor.
@@ -181,12 +187,6 @@ export declare function inStartingRoom(): boolean;
181
187
  * checked. Undefined by default.
182
188
  */
183
189
  export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
184
- /**
185
- * Helper function to check if the current room matches one of the given room types.
186
- *
187
- * This function is variadic, which means you can pass as many room types as you want to match for.
188
- */
189
- export declare function isRoomType(...roomTypes: RoomType[]): boolean;
190
190
  /**
191
191
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
192
192
  * slide around (such as the player). Since those entity velocities are already at zero, setting
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,SAAS,EAMT,YAAY,EAEZ,UAAU,EAGV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAkCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAenD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAChB,oBAAoB,UAAO,GAC1B,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAUlC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAOlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAqBlB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAA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rC;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
@@ -8,9 +8,9 @@ local __TS__Spread = ____lualib.__TS__Spread
8
8
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
9
9
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
10
10
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
11
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
11
12
  local Set = ____lualib.Set
12
13
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
13
- local __TS__ArraySome = ____lualib.__TS__ArraySome
14
14
  local ____exports = {}
15
15
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
16
16
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -347,6 +347,18 @@ function ____exports.inMirrorRoom(self)
347
347
  local roomSubType = getRoomSubType(nil)
348
348
  return roomType == RoomType.DEFAULT and (roomStageID == StageID.DOWNPOUR or roomStageID == StageID.DROSS) and roomSubType == asNumber(nil, DownpourRoomSubType.MIRROR)
349
349
  end
350
+ --- Helper function to check if the current room matches one of the given room types.
351
+ --
352
+ -- This function is variadic, which means you can pass as many room types as you want to match for.
353
+ function ____exports.inRoomType(self, ...)
354
+ local roomTypes = {...}
355
+ local room = game:GetRoom()
356
+ local thisRoomType = room:GetType()
357
+ return __TS__ArraySome(
358
+ roomTypes,
359
+ function(____, roomType) return roomType == thisRoomType end
360
+ )
361
+ end
350
362
  --- Helper function for checking if the current room is a secret exit that leads to a Repentance
351
363
  -- floor.
352
364
  function ____exports.inSecretExit(self)
@@ -396,18 +408,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
396
408
  function(____, roomDescriptor) return roomDescriptor.Clear end
397
409
  )
398
410
  end
399
- --- Helper function to check if the current room matches one of the given room types.
400
- --
401
- -- This function is variadic, which means you can pass as many room types as you want to match for.
402
- function ____exports.isRoomType(self, ...)
403
- local roomTypes = {...}
404
- local room = game:GetRoom()
405
- local thisRoomType = room:GetType()
406
- return __TS__ArraySome(
407
- roomTypes,
408
- function(____, roomType) return roomType == thisRoomType end
409
- )
410
- end
411
411
  --- If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
412
412
  -- slide around (such as the player). Since those entity velocities are already at zero, setting
413
413
  -- them to zero will have no effect. Thus, a generic solution is to record all of the entity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "15.4.4",
3
+ "version": "15.4.6",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^9.3.0"
25
+ "isaac-typescript-definitions": "^9.4.1"
26
26
  }
27
27
  }
@@ -3,10 +3,12 @@ import {
3
3
  CollectibleType,
4
4
  DamageFlag,
5
5
  EntityType,
6
+ ItemType,
6
7
  ModCallback,
7
8
  PlayerType,
8
9
  } from "isaac-typescript-definitions";
9
10
  import { ISCFeature } from "../../../enums/ISCFeature";
11
+ import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
10
12
  import { arrayEquals } from "../../../functions/array";
11
13
  import { getEnumValues } from "../../../functions/enums";
12
14
  import { hasFlag } from "../../../functions/flag";
@@ -16,6 +18,7 @@ import {
16
18
  } from "../../../functions/playerDataStructures";
17
19
  import { getPlayerFromPtr } from "../../../functions/players";
18
20
  import { repeat } from "../../../functions/utils";
21
+ import { PickingUpItem } from "../../../types/PickingUpItem";
19
22
  import { PlayerIndex } from "../../../types/PlayerIndex";
20
23
  import { PostPlayerCollectibleAdded } from "../../callbacks/PostPlayerCollectibleAdded";
21
24
  import { PostPlayerCollectibleRemoved } from "../../callbacks/PostPlayerCollectibleRemoved";
@@ -66,6 +69,10 @@ export class PlayerCollectibleDetection extends Feature {
66
69
  ], // 11
67
70
  ];
68
71
 
72
+ this.customCallbacksUsed = [
73
+ [ModCallbackCustom.POST_ITEM_PICKUP, [this.postItemPickup]],
74
+ ];
75
+
69
76
  this.postPlayerCollectibleAdded = postPlayerCollectibleAdded;
70
77
  this.postPlayerCollectibleRemoved = postPlayerCollectibleRemoved;
71
78
  this.moddedElementSets = moddedElementSets;
@@ -250,4 +257,28 @@ export class PlayerCollectibleDetection extends Feature {
250
257
 
251
258
  return undefined;
252
259
  };
260
+
261
+ // ModCallbackCustom.POST_ITEM_PICKUP
262
+ // We need to handle TMTRAINER collectibles, since they do not cause the player's collectible
263
+ // count to change.
264
+ private postItemPickup = (
265
+ player: EntityPlayer,
266
+ pickingUpItem: PickingUpItem,
267
+ ) => {
268
+ if (
269
+ pickingUpItem.itemType === ItemType.TRINKET ||
270
+ pickingUpItem.itemType === ItemType.NULL
271
+ ) {
272
+ return;
273
+ }
274
+
275
+ const newCollectibleCount = player.GetCollectibleCount();
276
+ mapSetPlayer(
277
+ this.v.run.playersCollectibleCount,
278
+ player,
279
+ newCollectibleCount,
280
+ );
281
+
282
+ this.updateCollectibleMapAndFire(player, 1);
283
+ };
253
284
  }
@@ -6,6 +6,7 @@ import {
6
6
  TrinketType,
7
7
  } from "isaac-typescript-definitions";
8
8
  import { itemConfig } from "../../../core/cachedClasses";
9
+ import { FIRST_GLITCHED_COLLECTIBLE_TYPE } from "../../../core/constants";
9
10
  import { Exported } from "../../../decorators";
10
11
  import { ISCFeature } from "../../../enums/ISCFeature";
11
12
  import {
@@ -603,6 +604,27 @@ export class ModdedElementSets extends Feature {
603
604
  }
604
605
  }
605
606
 
607
+ // If the player has TMTRAINER, they might also have glitched items.
608
+ if (player.HasCollectible(CollectibleType.TMTRAINER)) {
609
+ let collectibleType = FIRST_GLITCHED_COLLECTIBLE_TYPE;
610
+ let itemConfigItem: Readonly<ItemConfigItem> | undefined;
611
+ do {
612
+ itemConfigItem = itemConfig.GetCollectible(collectibleType);
613
+
614
+ if (itemConfigItem !== undefined) {
615
+ // The `EntityPlayer.GetCollectibleNum` method is bugged with TMTrainer items and will
616
+ // always return 0. To work around this, we simply assume that if the player has the
617
+ // collectible, then they have one copy of the item.
618
+ const hasCollectibles = player.HasCollectible(collectibleType, true);
619
+ if (hasCollectibles) {
620
+ collectibleMap.set(collectibleType, 1);
621
+ }
622
+ }
623
+
624
+ collectibleType--; // eslint-disable-line isaacscript/strict-enums
625
+ } while (itemConfigItem !== undefined);
626
+ }
627
+
606
628
  return collectibleMap;
607
629
  }
608
630
 
@@ -463,6 +463,17 @@ export function inMirrorRoom(): boolean {
463
463
  );
464
464
  }
465
465
 
466
+ /**
467
+ * Helper function to check if the current room matches one of the given room types.
468
+ *
469
+ * This function is variadic, which means you can pass as many room types as you want to match for.
470
+ */
471
+ export function inRoomType(...roomTypes: RoomType[]): boolean {
472
+ const room = game.GetRoom();
473
+ const thisRoomType = room.GetType();
474
+ return roomTypes.some((roomType) => roomType === thisRoomType);
475
+ }
476
+
466
477
  /**
467
478
  * Helper function for checking if the current room is a secret exit that leads to a Repentance
468
479
  * floor.
@@ -527,17 +538,6 @@ export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
527
538
  return matchingRooms.every((roomDescriptor) => roomDescriptor.Clear);
528
539
  }
529
540
 
530
- /**
531
- * Helper function to check if the current room matches one of the given room types.
532
- *
533
- * This function is variadic, which means you can pass as many room types as you want to match for.
534
- */
535
- export function isRoomType(...roomTypes: RoomType[]): boolean {
536
- const room = game.GetRoom();
537
- const thisRoomType = room.GetType();
538
- return roomTypes.some((roomType) => roomType === thisRoomType);
539
- }
540
-
541
541
  /**
542
542
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
543
543
  * slide around (such as the player). Since those entity velocities are already at zero, setting