isaacscript-common 1.2.217 → 1.2.218

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.
@@ -186,6 +186,13 @@ export declare function isActiveSlotEmpty(player: EntityPlayer, activeSlot: Acti
186
186
  * charges.
187
187
  */
188
188
  export declare function isBethany(player: EntityPlayer): boolean;
189
+ /**
190
+ * Helper function to check if a player is a specific character (i.e. `PlayerType`).
191
+ *
192
+ * This function is variadic, meaning that you can supply as many characters as you want to check
193
+ * for. Returns true if the player is any of the supplied characters.
194
+ */
195
+ export declare function isCharacter(player: EntityPlayer, ...characters: Array<PlayerType | int>): boolean;
189
196
  /**
190
197
  * Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
191
198
  * you want to know if the starting stats were randomized, for example.
@@ -411,6 +411,12 @@ function ____exports.isBethany(self, player)
411
411
  local character = player:GetPlayerType()
412
412
  return character == PlayerType.PLAYER_BETHANY or character == PlayerType.PLAYER_BETHANY_B
413
413
  end
414
+ function ____exports.isCharacter(self, player, ...)
415
+ local characters = {...}
416
+ local characterSet = __TS__New(Set, characters)
417
+ local character = player:GetPlayerType()
418
+ return characterSet:has(character)
419
+ end
414
420
  function ____exports.isEden(self, player)
415
421
  local character = player:GetPlayerType()
416
422
  return character == PlayerType.PLAYER_EDEN or character == PlayerType.PLAYER_EDEN_B
@@ -478,9 +484,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
478
484
  itemPool:RemoveCollectible(collectibleType)
479
485
  end
480
486
  repeat
481
- local ____switch100 = activeSlot
482
- local ____cond100 = ____switch100 == ActiveSlot.SLOT_PRIMARY
483
- if ____cond100 then
487
+ local ____switch101 = activeSlot
488
+ local ____cond101 = ____switch101 == ActiveSlot.SLOT_PRIMARY
489
+ if ____cond101 then
484
490
  do
485
491
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
486
492
  player:RemoveCollectible(primaryCollectibleType)
@@ -489,8 +495,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
489
495
  break
490
496
  end
491
497
  end
492
- ____cond100 = ____cond100 or ____switch100 == ActiveSlot.SLOT_SECONDARY
493
- if ____cond100 then
498
+ ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_SECONDARY
499
+ if ____cond101 then
494
500
  do
495
501
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
496
502
  player:RemoveCollectible(primaryCollectibleType)
@@ -505,16 +511,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
505
511
  break
506
512
  end
507
513
  end
508
- ____cond100 = ____cond100 or ____switch100 == ActiveSlot.SLOT_POCKET
509
- if ____cond100 then
514
+ ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET
515
+ if ____cond101 then
510
516
  do
511
517
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
512
518
  player:SetActiveCharge(charge, activeSlot)
513
519
  break
514
520
  end
515
521
  end
516
- ____cond100 = ____cond100 or ____switch100 == ActiveSlot.SLOT_POCKET2
517
- if ____cond100 then
522
+ ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET2
523
+ if ____cond101 then
518
524
  do
519
525
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
520
526
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.217",
3
+ "version": "1.2.218",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",