isaacscript-common 1.2.132 → 1.2.133

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.
@@ -11,7 +11,7 @@ export declare function anyEntityCloserThan(entities: Entity[], position: Vector
11
11
  * @param subType Default is -1.
12
12
  * @param ignoreFriendly Default is false.
13
13
  */
14
- export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): number;
14
+ export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): int;
15
15
  /**
16
16
  * Given an array of entities, this helper function returns the closest one to a provided reference
17
17
  * entity.
@@ -47,7 +47,7 @@ export declare function getAllPlayers(): EntityPlayer[];
47
47
  *
48
48
  * The formula for calculating it is: 32 - 2.5 * player.TearHeight
49
49
  */
50
- export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): number;
50
+ export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): float;
51
51
  /**
52
52
  * Returns the number of black hearts that the player has, excluding any soul hearts. For example,
53
53
  * if the player has one full black heart, one full soul heart, and one half black heart, this
@@ -63,7 +63,7 @@ export declare function getBlackHearts(player: EntityPlayer): int;
63
63
  */
64
64
  export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
65
65
  /** Helper function to get an array containing the characters of all of the current players. */
66
- export declare function getCharacters(): number[];
66
+ export declare function getCharacters(): PlayerType[];
67
67
  export declare function getClosestPlayer(position: Vector): EntityPlayer;
68
68
  /**
69
69
  * Most characters have a 56 frame death animation (i.e. the "Death" animation).
@@ -194,7 +194,13 @@ export declare function getPlayers(performCharacterExclusions?: boolean): Entity
194
194
  * for. Returns true if any of the characters supplied are present.
195
195
  */
196
196
  export declare function getPlayersOfType(...characters: Array<PlayerType | int>): EntityPlayer[];
197
- export declare function getPlayersWithCollectible(collectibleType: CollectibleType | int): EntityPlayer[];
197
+ /**
198
+ * Helper function to get only the players that have a certain collectible.
199
+ *
200
+ * This function is variadic, meaning that you can supply as many collectible types as you want to
201
+ * check for. It only returns the players that have all of the collectibles.
202
+ */
203
+ export declare function getPlayersWithCollectible(...collectibleTypes: Array<CollectibleType | int>): EntityPlayer[];
198
204
  /**
199
205
  * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
200
206
  * if the player has one full black heart, one full soul heart, and one half black heart, this
@@ -220,7 +226,7 @@ export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPl
220
226
  * This function does not validate whether or not the provided player is Tainted Magdalene; that
221
227
  * should be accomplished before invoking this function.
222
228
  */
223
- export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): number;
229
+ export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): int;
224
230
  /**
225
231
  * Helper function to return the active charge and the battery charge combined. This is useful
226
232
  * because you are not able to set the battery charge directly.
@@ -9,6 +9,7 @@ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
9
9
  local Map = ____lualib.Map
10
10
  local __TS__Iterator = ____lualib.__TS__Iterator
11
11
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
12
+ local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
12
13
  local ____exports = {}
13
14
  local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
14
15
  local ____cachedClasses = require("cachedClasses")
@@ -498,11 +499,15 @@ function ____exports.getPlayersOfType(self, ...)
498
499
  end
499
500
  )
500
501
  end
501
- function ____exports.getPlayersWithCollectible(self, collectibleType)
502
+ function ____exports.getPlayersWithCollectible(self, ...)
503
+ local collectibleTypes = {...}
502
504
  local players = ____exports.getPlayers(nil)
503
505
  return __TS__ArrayFilter(
504
506
  players,
505
- function(____, player) return player:HasCollectible(collectibleType) end
507
+ function(____, player) return __TS__ArrayEvery(
508
+ collectibleTypes,
509
+ function(____, collectibleType) return player:HasCollectible(collectibleType) end
510
+ ) end
506
511
  )
507
512
  end
508
513
  function ____exports.getSoulHearts(self, player)
@@ -611,9 +616,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
611
616
  itemPool:RemoveCollectible(collectibleType)
612
617
  end
613
618
  repeat
614
- local ____switch131 = activeSlot
615
- local ____cond131 = ____switch131 == ActiveSlot.SLOT_PRIMARY
616
- if ____cond131 then
619
+ local ____switch132 = activeSlot
620
+ local ____cond132 = ____switch132 == ActiveSlot.SLOT_PRIMARY
621
+ if ____cond132 then
617
622
  do
618
623
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
619
624
  player:RemoveCollectible(primaryCollectibleType)
@@ -622,8 +627,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
622
627
  break
623
628
  end
624
629
  end
625
- ____cond131 = ____cond131 or ____switch131 == ActiveSlot.SLOT_SECONDARY
626
- if ____cond131 then
630
+ ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SLOT_SECONDARY
631
+ if ____cond132 then
627
632
  do
628
633
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
629
634
  player:RemoveCollectible(primaryCollectibleType)
@@ -638,16 +643,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
638
643
  break
639
644
  end
640
645
  end
641
- ____cond131 = ____cond131 or ____switch131 == ActiveSlot.SLOT_POCKET
642
- if ____cond131 then
646
+ ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SLOT_POCKET
647
+ if ____cond132 then
643
648
  do
644
649
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
645
650
  player:SetActiveCharge(charge, activeSlot)
646
651
  break
647
652
  end
648
653
  end
649
- ____cond131 = ____cond131 or ____switch131 == ActiveSlot.SLOT_POCKET2
650
- if ____cond131 then
654
+ ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SLOT_POCKET2
655
+ if ____cond132 then
651
656
  do
652
657
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
653
658
  break
@@ -188,7 +188,7 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
188
188
  export declare function inSecretShop(): boolean;
189
189
  /**
190
190
  * Helper function to determine whether or not the current room is the starting room of a floor.
191
- * Only returns true for the starting room of the primary dimension (meaning that being in the
191
+ * It only returns true for the starting room of the primary dimension (meaning that being in the
192
192
  * starting room of the mirror world does not count).
193
193
  */
194
194
  export declare function inStartingRoom(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.132",
3
+ "version": "1.2.133",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -27,7 +27,7 @@
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.2",
29
29
  "isaac-typescript-definitions": "^1.0.364",
30
- "isaacscript-lint": "^1.0.86",
30
+ "isaacscript-lint": "^1.0.88",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.13",
33
33
  "typescript": "4.5.5"