isaacscript-common 23.0.0 → 24.0.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.
@@ -4105,10 +4105,10 @@ declare class GameReorderedCallbacks extends Feature {
4105
4105
  }
4106
4106
 
4107
4107
  /**
4108
- * Helper function to find the active slot that the player has the corresponding collectible type
4109
- * in. Returns undefined if the player does not have the collectible in any active slot.
4108
+ * Helper function to find the active slots that the player has the corresponding collectible type
4109
+ * in. Returns an empty array if the player does not have the collectible in any active slot.
4110
4110
  */
4111
- export declare function getActiveItemSlot(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot | undefined;
4111
+ export declare function getActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
4112
4112
 
4113
4113
  /**
4114
4114
  * Helper function to get the `PocketItemSlot` that the player's pocket active collectible item is
@@ -4411,7 +4411,7 @@ export declare function getCharacters(): PlayerType[];
4411
4411
  *
4412
4412
  * Note that this will return an empty array for Eden and Tainted Eden.
4413
4413
  */
4414
- export declare function getCharacterStartingItems(character: PlayerType): readonly CollectibleType[];
4414
+ export declare function getCharacterStartingCollectibles(character: PlayerType): readonly CollectibleType[];
4415
4415
 
4416
4416
  /**
4417
4417
  * Helper function to get the amount of charges away from the maximum charge that a particular
@@ -6950,6 +6950,16 @@ export declare function hasArmor(entity: Entity): boolean;
6950
6950
  */
6951
6951
  export declare function hasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
6952
6952
 
6953
+ /**
6954
+ * Helper function to check to see if a player has a specific collectible in one or more active
6955
+ * slots.
6956
+ *
6957
+ * This function is variadic, meaning that you can specify as many active slots as you want to check
6958
+ * for. This function will return true if the collectible type is located in any of the active slots
6959
+ * provided.
6960
+ */
6961
+ export declare function hasCollectibleInActiveSlot(player: EntityPlayer, collectibleType: CollectibleType, ...activeSlots: ActiveSlot[]): boolean;
6962
+
6953
6963
  export declare function hasCurse(curse: LevelCurse): boolean;
6954
6964
 
6955
6965
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 23.0.0
3
+ isaacscript-common 24.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -22014,7 +22014,7 @@ function ____exports.getCharacterName(self, character)
22014
22014
  end
22015
22015
  return CHARACTER_NAMES[character]
22016
22016
  end
22017
- function ____exports.getCharacterStartingItems(self, character)
22017
+ function ____exports.getCharacterStartingCollectibles(self, character)
22018
22018
  return CHARACTER_STARTING_COLLECTIBLES[character]
22019
22019
  end
22020
22020
  function ____exports.isFlyingCharacter(self, player)
@@ -22028,9 +22028,9 @@ local ____lualib = require("lualib_bundle")
22028
22028
  local __TS__ArraySome = ____lualib.__TS__ArraySome
22029
22029
  local Set = ____lualib.Set
22030
22030
  local __TS__New = ____lualib.__TS__New
22031
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
22032
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
22033
22031
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
22032
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
22033
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
22034
22034
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
22035
22035
  local ____exports = {}
22036
22036
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
@@ -22140,8 +22140,8 @@ function ____exports.dequeueItem(self, player)
22140
22140
  player.QueuedItem = queue
22141
22141
  return true
22142
22142
  end
22143
- function ____exports.getActiveItemSlot(self, player, collectibleType)
22144
- return __TS__ArrayFind(
22143
+ function ____exports.getActiveItemSlots(self, player, collectibleType)
22144
+ return __TS__ArrayFilter(
22145
22145
  ACTIVE_SLOT_VALUES,
22146
22146
  function(____, activeSlot)
22147
22147
  local activeItem = player:GetActiveItem(activeSlot)
@@ -22326,6 +22326,15 @@ function ____exports.hasCollectible(self, player, ...)
22326
22326
  function(____, collectibleType) return player:HasCollectible(collectibleType) end
22327
22327
  )
22328
22328
  end
22329
+ function ____exports.hasCollectibleInActiveSlot(self, player, collectibleType, ...)
22330
+ local activeSlots = {...}
22331
+ local matchingActiveSlotsSet = __TS__New(Set, activeSlots)
22332
+ local activeItemSlots = ____exports.getActiveItemSlots(nil, player, collectibleType)
22333
+ return __TS__ArraySome(
22334
+ activeItemSlots,
22335
+ function(____, activeSlot) return matchingActiveSlotsSet:has(activeSlot) end
22336
+ )
22337
+ end
22329
22338
  function ____exports.hasForm(self, player, ...)
22330
22339
  local playerForms = {...}
22331
22340
  return __TS__ArraySome(
@@ -22415,7 +22424,7 @@ function ____exports.removeAllActiveItems(self, player)
22415
22424
  do
22416
22425
  local collectibleType = player:GetActiveItem(activeSlot)
22417
22426
  if collectibleType == CollectibleType.NULL then
22418
- goto __continue93
22427
+ goto __continue95
22419
22428
  end
22420
22429
  local stillHasCollectible
22421
22430
  repeat
@@ -22425,7 +22434,7 @@ function ____exports.removeAllActiveItems(self, player)
22425
22434
  end
22426
22435
  until not stillHasCollectible
22427
22436
  end
22428
- ::__continue93::
22437
+ ::__continue95::
22429
22438
  end
22430
22439
  end
22431
22440
  function ____exports.removeAllPlayerTrinkets(self, player)
@@ -22433,7 +22442,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
22433
22442
  do
22434
22443
  local trinketType = player:GetTrinket(trinketSlot)
22435
22444
  if trinketType == TrinketType.NULL then
22436
- goto __continue98
22445
+ goto __continue100
22437
22446
  end
22438
22447
  local hasTrinket
22439
22448
  repeat
@@ -22443,7 +22452,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
22443
22452
  end
22444
22453
  until not hasTrinket
22445
22454
  end
22446
- ::__continue98::
22455
+ ::__continue100::
22447
22456
  end
22448
22457
  end
22449
22458
  function ____exports.removeCollectible(self, player, ...)
@@ -22503,9 +22512,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22503
22512
  itemPool:RemoveCollectible(collectibleType)
22504
22513
  end
22505
22514
  repeat
22506
- local ____switch120 = activeSlot
22507
- local ____cond120 = ____switch120 == ActiveSlot.PRIMARY
22508
- if ____cond120 then
22515
+ local ____switch122 = activeSlot
22516
+ local ____cond122 = ____switch122 == ActiveSlot.PRIMARY
22517
+ if ____cond122 then
22509
22518
  do
22510
22519
  if primaryCollectibleType ~= CollectibleType.NULL then
22511
22520
  player:RemoveCollectible(primaryCollectibleType)
@@ -22514,8 +22523,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22514
22523
  break
22515
22524
  end
22516
22525
  end
22517
- ____cond120 = ____cond120 or ____switch120 == ActiveSlot.SECONDARY
22518
- if ____cond120 then
22526
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.SECONDARY
22527
+ if ____cond122 then
22519
22528
  do
22520
22529
  if primaryCollectibleType ~= CollectibleType.NULL then
22521
22530
  player:RemoveCollectible(primaryCollectibleType)
@@ -22530,16 +22539,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
22530
22539
  break
22531
22540
  end
22532
22541
  end
22533
- ____cond120 = ____cond120 or ____switch120 == ActiveSlot.POCKET
22534
- if ____cond120 then
22542
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET
22543
+ if ____cond122 then
22535
22544
  do
22536
22545
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
22537
22546
  player:SetActiveCharge(charge, activeSlot)
22538
22547
  break
22539
22548
  end
22540
22549
  end
22541
- ____cond120 = ____cond120 or ____switch120 == ActiveSlot.POCKET_SINGLE_USE
22542
- if ____cond120 then
22550
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET_SINGLE_USE
22551
+ if ____cond122 then
22543
22552
  do
22544
22553
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
22545
22554
  break
@@ -52,7 +52,7 @@ export declare function getCharacterName(character: PlayerType): string;
52
52
  *
53
53
  * Note that this will return an empty array for Eden and Tainted Eden.
54
54
  */
55
- export declare function getCharacterStartingItems(character: PlayerType): readonly CollectibleType[];
55
+ export declare function getCharacterStartingCollectibles(character: PlayerType): readonly CollectibleType[];
56
56
  export declare function isFlyingCharacter(player: EntityPlayer): boolean;
57
57
  export declare function isModdedCharacter(character: PlayerType): boolean;
58
58
  export declare function isVanillaCharacter(character: PlayerType): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"characters.d.ts","sourceRoot":"","sources":["../../../src/functions/characters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAsB3E;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAExE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEzE;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,uCAAuC,CACrD,SAAS,EAAE,UAAU,GACpB,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAE5E;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,UAAU,EACrB,iBAAiB,UAAQ,GACxB,KAAK,CAMP;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM,CAU5E;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,CAsBzE;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM,CAM9D;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,UAAU,GACpB,SAAS,eAAe,EAAE,CAE5B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,E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EAAE,UAAU,GAAG,OAAO,CAEhE;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEjE"}
@@ -121,7 +121,7 @@ end
121
121
  -- beginning of a run.
122
122
  --
123
123
  -- Note that this will return an empty array for Eden and Tainted Eden.
124
- function ____exports.getCharacterStartingItems(self, character)
124
+ function ____exports.getCharacterStartingCollectibles(self, character)
125
125
  return CHARACTER_STARTING_COLLECTIBLES[character]
126
126
  end
127
127
  function ____exports.isFlyingCharacter(self, player)
@@ -37,10 +37,10 @@ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
37
37
  */
38
38
  export declare function dequeueItem(player: EntityPlayer): boolean;
39
39
  /**
40
- * Helper function to find the active slot that the player has the corresponding collectible type
41
- * in. Returns undefined if the player does not have the collectible in any active slot.
40
+ * Helper function to find the active slots that the player has the corresponding collectible type
41
+ * in. Returns an empty array if the player does not have the collectible in any active slot.
42
42
  */
43
- export declare function getActiveItemSlot(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot | undefined;
43
+ export declare function getActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
44
44
  /**
45
45
  * Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
46
46
  * `EntityPlayer` object or a tear height stat.
@@ -164,6 +164,15 @@ export declare function getTotalPlayerCollectibles(collectibleType: CollectibleT
164
164
  * check for. Returns true if the player has any of the supplied collectible types.
165
165
  */
166
166
  export declare function hasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
167
+ /**
168
+ * Helper function to check to see if a player has a specific collectible in one or more active
169
+ * slots.
170
+ *
171
+ * This function is variadic, meaning that you can specify as many active slots as you want to check
172
+ * for. This function will return true if the collectible type is located in any of the active slots
173
+ * provided.
174
+ */
175
+ export declare function hasCollectibleInActiveSlot(player: EntityPlayer, collectibleType: CollectibleType, ...activeSlots: ActiveSlot[]): boolean;
167
176
  /**
168
177
  * Helper function to check to see if a player has one or more transformations.
169
178
  *
@@ -1 +1 @@
1
- {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAEf,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAiBtC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAIxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAWzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,GAAG,SAAS,CAKxB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAG5C;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiB/D;AAED;;;GAGG;AAC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AAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
1
+ {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAEf,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAiBtC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAIxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAWzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,EAAE,CAKd;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+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W,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,aAAqB,EAC/B,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
@@ -2,9 +2,9 @@ local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArraySome = ____lualib.__TS__ArraySome
3
3
  local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
6
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
7
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
7
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
8
8
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
9
9
  local ____exports = {}
10
10
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -140,10 +140,10 @@ function ____exports.dequeueItem(self, player)
140
140
  player.QueuedItem = queue
141
141
  return true
142
142
  end
143
- --- Helper function to find the active slot that the player has the corresponding collectible type
144
- -- in. Returns undefined if the player does not have the collectible in any active slot.
145
- function ____exports.getActiveItemSlot(self, player, collectibleType)
146
- return __TS__ArrayFind(
143
+ --- Helper function to find the active slots that the player has the corresponding collectible type
144
+ -- in. Returns an empty array if the player does not have the collectible in any active slot.
145
+ function ____exports.getActiveItemSlots(self, player, collectibleType)
146
+ return __TS__ArrayFilter(
147
147
  ACTIVE_SLOT_VALUES,
148
148
  function(____, activeSlot)
149
149
  local activeItem = player:GetActiveItem(activeSlot)
@@ -397,6 +397,21 @@ function ____exports.hasCollectible(self, player, ...)
397
397
  function(____, collectibleType) return player:HasCollectible(collectibleType) end
398
398
  )
399
399
  end
400
+ --- Helper function to check to see if a player has a specific collectible in one or more active
401
+ -- slots.
402
+ --
403
+ -- This function is variadic, meaning that you can specify as many active slots as you want to check
404
+ -- for. This function will return true if the collectible type is located in any of the active slots
405
+ -- provided.
406
+ function ____exports.hasCollectibleInActiveSlot(self, player, collectibleType, ...)
407
+ local activeSlots = {...}
408
+ local matchingActiveSlotsSet = __TS__New(Set, activeSlots)
409
+ local activeItemSlots = ____exports.getActiveItemSlots(nil, player, collectibleType)
410
+ return __TS__ArraySome(
411
+ activeItemSlots,
412
+ function(____, activeSlot) return matchingActiveSlotsSet:has(activeSlot) end
413
+ )
414
+ end
400
415
  --- Helper function to check to see if a player has one or more transformations.
401
416
  --
402
417
  -- This function is variadic, meaning that you can supply as many transformations as you want to
@@ -520,7 +535,7 @@ function ____exports.removeAllActiveItems(self, player)
520
535
  do
521
536
  local collectibleType = player:GetActiveItem(activeSlot)
522
537
  if collectibleType == CollectibleType.NULL then
523
- goto __continue93
538
+ goto __continue95
524
539
  end
525
540
  local stillHasCollectible
526
541
  repeat
@@ -530,7 +545,7 @@ function ____exports.removeAllActiveItems(self, player)
530
545
  end
531
546
  until not stillHasCollectible
532
547
  end
533
- ::__continue93::
548
+ ::__continue95::
534
549
  end
535
550
  end
536
551
  --- Helper function to remove all of the held trinkets from a player.
@@ -542,7 +557,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
542
557
  do
543
558
  local trinketType = player:GetTrinket(trinketSlot)
544
559
  if trinketType == TrinketType.NULL then
545
- goto __continue98
560
+ goto __continue100
546
561
  end
547
562
  local hasTrinket
548
563
  repeat
@@ -552,7 +567,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
552
567
  end
553
568
  until not hasTrinket
554
569
  end
555
- ::__continue98::
570
+ ::__continue100::
556
571
  end
557
572
  end
558
573
  --- Helper function to remove one or more collectibles to a player.
@@ -643,9 +658,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
643
658
  itemPool:RemoveCollectible(collectibleType)
644
659
  end
645
660
  repeat
646
- local ____switch120 = activeSlot
647
- local ____cond120 = ____switch120 == ActiveSlot.PRIMARY
648
- if ____cond120 then
661
+ local ____switch122 = activeSlot
662
+ local ____cond122 = ____switch122 == ActiveSlot.PRIMARY
663
+ if ____cond122 then
649
664
  do
650
665
  if primaryCollectibleType ~= CollectibleType.NULL then
651
666
  player:RemoveCollectible(primaryCollectibleType)
@@ -654,8 +669,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
654
669
  break
655
670
  end
656
671
  end
657
- ____cond120 = ____cond120 or ____switch120 == ActiveSlot.SECONDARY
658
- if ____cond120 then
672
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.SECONDARY
673
+ if ____cond122 then
659
674
  do
660
675
  if primaryCollectibleType ~= CollectibleType.NULL then
661
676
  player:RemoveCollectible(primaryCollectibleType)
@@ -670,16 +685,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
670
685
  break
671
686
  end
672
687
  end
673
- ____cond120 = ____cond120 or ____switch120 == ActiveSlot.POCKET
674
- if ____cond120 then
688
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET
689
+ if ____cond122 then
675
690
  do
676
691
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
677
692
  player:SetActiveCharge(charge, activeSlot)
678
693
  break
679
694
  end
680
695
  end
681
- ____cond120 = ____cond120 or ____switch120 == ActiveSlot.POCKET_SINGLE_USE
682
- if ____cond120 then
696
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET_SINGLE_USE
697
+ if ____cond122 then
683
698
  do
684
699
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
685
700
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "23.0.0",
3
+ "version": "24.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -141,7 +141,7 @@ export function getCharacterName(character: PlayerType): string {
141
141
  *
142
142
  * Note that this will return an empty array for Eden and Tainted Eden.
143
143
  */
144
- export function getCharacterStartingItems(
144
+ export function getCharacterStartingCollectibles(
145
145
  character: PlayerType,
146
146
  ): readonly CollectibleType[] {
147
147
  return CHARACTER_STARTING_COLLECTIBLES[character];
@@ -129,14 +129,14 @@ export function dequeueItem(player: EntityPlayer): boolean {
129
129
  }
130
130
 
131
131
  /**
132
- * Helper function to find the active slot that the player has the corresponding collectible type
133
- * in. Returns undefined if the player does not have the collectible in any active slot.
132
+ * Helper function to find the active slots that the player has the corresponding collectible type
133
+ * in. Returns an empty array if the player does not have the collectible in any active slot.
134
134
  */
135
- export function getActiveItemSlot(
135
+ export function getActiveItemSlots(
136
136
  player: EntityPlayer,
137
137
  collectibleType: CollectibleType,
138
- ): ActiveSlot | undefined {
139
- return ACTIVE_SLOT_VALUES.find((activeSlot) => {
138
+ ): ActiveSlot[] {
139
+ return ACTIVE_SLOT_VALUES.filter((activeSlot) => {
140
140
  const activeItem = player.GetActiveItem(activeSlot);
141
141
  return activeItem === collectibleType;
142
142
  });
@@ -468,6 +468,26 @@ export function hasCollectible(
468
468
  );
469
469
  }
470
470
 
471
+ /**
472
+ * Helper function to check to see if a player has a specific collectible in one or more active
473
+ * slots.
474
+ *
475
+ * This function is variadic, meaning that you can specify as many active slots as you want to check
476
+ * for. This function will return true if the collectible type is located in any of the active slots
477
+ * provided.
478
+ */
479
+ export function hasCollectibleInActiveSlot(
480
+ player: EntityPlayer,
481
+ collectibleType: CollectibleType,
482
+ ...activeSlots: ActiveSlot[]
483
+ ): boolean {
484
+ const matchingActiveSlotsSet = new Set(activeSlots);
485
+ const activeItemSlots = getActiveItemSlots(player, collectibleType);
486
+ return activeItemSlots.some((activeSlot) =>
487
+ matchingActiveSlotsSet.has(activeSlot),
488
+ );
489
+ }
490
+
471
491
  /**
472
492
  * Helper function to check to see if a player has one or more transformations.
473
493
  *