isaacscript-common 1.2.262 → 1.2.263

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.
@@ -217,6 +217,13 @@ export declare function isTainted(player: EntityPlayer): boolean;
217
217
  /** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
218
218
  export declare function isTaintedLazarus(player: EntityPlayer): boolean;
219
219
  export declare function isVanillaCharacter(player: EntityPlayer): boolean;
220
+ /**
221
+ * Helper function to check to see if a player has one or more collectibles.
222
+ *
223
+ * This function is variadic, meaning that you can supply as many collectible types as you want to
224
+ * check for. Returns true if the player has any of the supplied collectible types.
225
+ */
226
+ export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes: Array<CollectibleType | int>): boolean;
220
227
  /**
221
228
  * Helper function to remove a collectible costume from a player. Use this helper function to avoid
222
229
  * having to request the collectible from the item config.
@@ -444,6 +444,13 @@ function ____exports.isTaintedLazarus(self, player)
444
444
  local character = player:GetPlayerType()
445
445
  return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
446
446
  end
447
+ function ____exports.playerHasCollectible(self, player, ...)
448
+ local collectibleTypes = {...}
449
+ return __TS__ArraySome(
450
+ collectibleTypes,
451
+ function(____, collectibleType) return player:HasCollectible(collectibleType) end
452
+ )
453
+ end
447
454
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
448
455
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
449
456
  if itemConfigItem == nil then
@@ -482,9 +489,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
482
489
  itemPool:RemoveCollectible(collectibleType)
483
490
  end
484
491
  repeat
485
- local ____switch101 = activeSlot
486
- local ____cond101 = ____switch101 == ActiveSlot.SLOT_PRIMARY
487
- if ____cond101 then
492
+ local ____switch103 = activeSlot
493
+ local ____cond103 = ____switch103 == ActiveSlot.SLOT_PRIMARY
494
+ if ____cond103 then
488
495
  do
489
496
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
490
497
  player:RemoveCollectible(primaryCollectibleType)
@@ -493,8 +500,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
493
500
  break
494
501
  end
495
502
  end
496
- ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_SECONDARY
497
- if ____cond101 then
503
+ ____cond103 = ____cond103 or ____switch103 == ActiveSlot.SLOT_SECONDARY
504
+ if ____cond103 then
498
505
  do
499
506
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
500
507
  player:RemoveCollectible(primaryCollectibleType)
@@ -509,16 +516,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
509
516
  break
510
517
  end
511
518
  end
512
- ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET
513
- if ____cond101 then
519
+ ____cond103 = ____cond103 or ____switch103 == ActiveSlot.SLOT_POCKET
520
+ if ____cond103 then
514
521
  do
515
522
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
516
523
  player:SetActiveCharge(charge, activeSlot)
517
524
  break
518
525
  end
519
526
  end
520
- ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET2
521
- if ____cond101 then
527
+ ____cond103 = ____cond103 or ____switch103 == ActiveSlot.SLOT_POCKET2
528
+ if ____cond103 then
522
529
  do
523
530
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
524
531
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.262",
3
+ "version": "1.2.263",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",