isaacscript-common 1.0.598 → 1.0.602

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.
Files changed (66) hide show
  1. package/dist/callbacks/postFlip.lua +1 -2
  2. package/dist/callbacks/postPurchase.lua +7 -6
  3. package/dist/callbacks/preBerserkDeath.lua +3 -1
  4. package/dist/callbacks/preNewLevel.lua +7 -5
  5. package/dist/callbacks/subscriptions/{PreNewLevel.d.ts → preNewLevel.d.ts} +0 -0
  6. package/dist/callbacks/subscriptions/{PreNewLevel.lua → preNewLevel.lua} +0 -0
  7. package/dist/constants.d.ts +1 -0
  8. package/dist/constants.lua +1 -0
  9. package/dist/features/getCollectibleItemPoolType.d.ts +2 -2
  10. package/dist/features/saveDataManager/exports.lua +5 -0
  11. package/dist/features/sirenHelpers.lua +3 -1
  12. package/dist/functions/array.d.ts +5 -2
  13. package/dist/functions/array.lua +26 -31
  14. package/dist/functions/collectibles.d.ts +5 -0
  15. package/dist/functions/collectibles.lua +11 -11
  16. package/dist/functions/entity.d.ts +10 -10
  17. package/dist/functions/entity.lua +29 -31
  18. package/dist/functions/gridEntity.lua +7 -6
  19. package/dist/functions/input.d.ts +2 -2
  20. package/dist/functions/jsonRoom.lua +36 -27
  21. package/dist/functions/log.d.ts +4 -4
  22. package/dist/functions/log.lua +15 -18
  23. package/dist/functions/npc.lua +17 -23
  24. package/dist/functions/player.d.ts +8 -1
  25. package/dist/functions/player.lua +49 -42
  26. package/dist/functions/pocketItems.lua +4 -6
  27. package/dist/functions/rooms.lua +26 -33
  28. package/dist/functions/transformations.lua +3 -1
  29. package/dist/functions/trinkets.lua +4 -12
  30. package/dist/types/CallbackParametersCustom.d.ts +1 -1
  31. package/dist/types/ModUpgraded.lua +3 -5
  32. package/package.json +2 -2
  33. package/dist/callbacks/postSlot.d.ts +0 -2
  34. package/dist/callbacks/postSlot.lua +0 -48
  35. package/dist/callbacks/postSlotRender.d.ts +0 -2
  36. package/dist/callbacks/postSlotRender.lua +0 -20
  37. package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.d.ts +0 -5
  38. package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.lua +0 -26
  39. package/dist/cardNameMap.d.ts +0 -2
  40. package/dist/cardNameMap.lua +0 -5
  41. package/dist/collectibleNameMap.d.ts +0 -2
  42. package/dist/collectibleNameMap.lua +0 -5
  43. package/dist/collectibleSet.d.ts +0 -1
  44. package/dist/collectibleSet.lua +0 -22
  45. package/dist/functions/card.d.ts +0 -25
  46. package/dist/functions/card.lua +0 -41
  47. package/dist/functions/items.d.ts +0 -9
  48. package/dist/functions/items.lua +0 -9
  49. package/dist/functions/localization.d.ts +0 -2
  50. package/dist/functions/localization.lua +0 -8
  51. package/dist/functions/sound.d.ts +0 -7
  52. package/dist/functions/sound.lua +0 -7
  53. package/dist/gridEntityMap.d.ts +0 -2
  54. package/dist/gridEntityMap.lua +0 -5
  55. package/dist/maps/roomTypeToItemPoolMap.d.ts +0 -2
  56. package/dist/maps/roomTypeToItemPoolMap.lua +0 -19
  57. package/dist/maps/transformationMap.d.ts +0 -5
  58. package/dist/maps/transformationMap.lua +0 -56
  59. package/dist/patchPrintFunction.d.ts +0 -1
  60. package/dist/patchPrintFunction.lua +0 -45
  61. package/dist/pillEffectNameMap.d.ts +0 -2
  62. package/dist/pillEffectNameMap.lua +0 -5
  63. package/dist/transformationMap.d.ts +0 -5
  64. package/dist/transformationMap.lua +0 -56
  65. package/dist/trinketNameMap.d.ts +0 -2
  66. package/dist/trinketNameMap.lua +0 -5
@@ -45,8 +45,7 @@ function getNewLazarus(self, oldLazarus)
45
45
  return player
46
46
  end
47
47
  end
48
- error("Failed to find the player entity for the new Lazarus.")
49
- return oldLazarus
48
+ return error("Failed to find the player entity for the new Lazarus.")
50
49
  end
51
50
  v = {run = {usedFlipAtLeastOnce = false}}
52
51
  function ____exports.postFlipCallbacksInit(self, mod)
@@ -4,6 +4,8 @@ local ____exports = {}
4
4
  local hasSubscriptions, postUpdate, checkPickupsPurchased, storePickupsInMap, storePlayersInMap, pickupIndexExists, v
5
5
  local ____exports = require("features.saveDataManager.exports")
6
6
  local saveDataManager = ____exports.saveDataManager
7
+ local ____entity = require("functions.entity")
8
+ local getPickups = ____entity.getPickups
7
9
  local ____player = require("functions.player")
8
10
  local getPlayerIndex = ____player.getPlayerIndex
9
11
  local getPlayers = ____player.getPlayers
@@ -17,7 +19,7 @@ function postUpdate(self)
17
19
  if not hasSubscriptions(nil) then
18
20
  return
19
21
  end
20
- local pickups = Isaac.FindByType(EntityType.ENTITY_PICKUP)
22
+ local pickups = getPickups(nil)
21
23
  local players = getPlayers(nil)
22
24
  checkPickupsPurchased(nil, pickups, players)
23
25
  storePickupsInMap(nil, pickups)
@@ -58,10 +60,9 @@ function checkPickupsPurchased(self, pickups, players)
58
60
  end
59
61
  end
60
62
  function storePickupsInMap(self, pickups)
61
- for ____, entity in ipairs(pickups) do
63
+ for ____, pickup in ipairs(pickups) do
62
64
  do
63
- local pickup = entity:ToPickup()
64
- if pickup == nil or pickup.Price == 0 then
65
+ if pickup.Price == 0 then
65
66
  goto __continue15
66
67
  end
67
68
  v.room.pickupMap:set(pickup.Index, {variant = pickup.Variant, subtype = pickup.SubType, price = pickup.Price})
@@ -77,8 +78,8 @@ function storePlayersInMap(self, players)
77
78
  end
78
79
  end
79
80
  function pickupIndexExists(self, index, pickups)
80
- for ____, entity in ipairs(pickups) do
81
- if entity.Index == index and entity:Exists() then
81
+ for ____, pickup in ipairs(pickups) do
82
+ if pickup.Index == index and pickup:Exists() then
82
83
  return true
83
84
  end
84
85
  end
@@ -4,6 +4,8 @@ local hasSubscriptions, postPEffectUpdateReordered
4
4
  local ____player = require("functions.player")
5
5
  local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
6
6
  local isChildPlayer = ____player.isChildPlayer
7
+ local ____revive = require("functions.revive")
8
+ local willPlayerRevive = ____revive.willPlayerRevive
7
9
  local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
8
10
  local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
9
11
  local ____preBerserkDeath = require("callbacks.subscriptions.preBerserkDeath")
@@ -22,7 +24,7 @@ function postPEffectUpdateReordered(self, player)
22
24
  local effects = player:GetEffects()
23
25
  local berserkEffect = effects:GetCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
24
26
  local playerNumAllHearts = getPlayerNumAllHearts(nil, player)
25
- if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and playerNumAllHearts == 0 then
27
+ if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and playerNumAllHearts == 0 and not willPlayerRevive(nil, player) then
26
28
  preBerserkDeathFire(nil, player)
27
29
  end
28
30
  end
@@ -1,13 +1,14 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
- local hasSubscriptions, postPlayerRender, firedOnStage
4
+ local hasSubscriptions, postPlayerRender, TRAVELING_TO_NEXT_FLOOR_ANIMATIONS, firedOnStage
4
5
  local ____sprite = require("functions.sprite")
5
6
  local getFinalFrameOfAnimation = ____sprite.getFinalFrameOfAnimation
6
7
  local ____stage = require("functions.stage")
7
8
  local getEffectiveStage = ____stage.getEffectiveStage
8
- local ____PreNewLevel = require("callbacks.subscriptions.PreNewLevel")
9
- local preNewLevelFire = ____PreNewLevel.preNewLevelFire
10
- local preNewLevelHasSubscriptions = ____PreNewLevel.preNewLevelHasSubscriptions
9
+ local ____preNewLevel = require("callbacks.subscriptions.preNewLevel")
10
+ local preNewLevelFire = ____preNewLevel.preNewLevelFire
11
+ local preNewLevelHasSubscriptions = ____preNewLevel.preNewLevelHasSubscriptions
11
12
  function hasSubscriptions(self)
12
13
  return preNewLevelHasSubscriptions(nil)
13
14
  end
@@ -21,7 +22,7 @@ function postPlayerRender(self, player)
21
22
  end
22
23
  local sprite = player:GetSprite()
23
24
  local animation = sprite:GetAnimation()
24
- if animation ~= "Trapdoor" and animation ~= "LightTravel" then
25
+ if not TRAVELING_TO_NEXT_FLOOR_ANIMATIONS:has(animation) then
25
26
  return
26
27
  end
27
28
  local frame = sprite:GetFrame()
@@ -31,6 +32,7 @@ function postPlayerRender(self, player)
31
32
  preNewLevelFire(nil, player)
32
33
  end
33
34
  end
35
+ TRAVELING_TO_NEXT_FLOOR_ANIMATIONS = __TS__New(Set, {"Trapdoor", "LightTravel"})
34
36
  firedOnStage = nil
35
37
  function ____exports.preNewLevelCallbackInit(self, mod)
36
38
  mod:AddCallback(ModCallbacks.MC_POST_PLAYER_RENDER, postPlayerRender)
@@ -13,6 +13,7 @@ export declare const BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.
13
13
  export declare const BOMB_EXPLODE_FRAME = 45;
14
14
  export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
15
15
  export declare const CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART: Set<PlayerType>;
16
+ export declare const CHARACTERS_WITH_FREE_DEVIL_DEALS: Set<PlayerType>;
16
17
  /**
17
18
  * The set of characters where red heart containers will be turned into soul hearts (e.g. Blue
18
19
  * Baby). This includes The Lost and Tainted Lost. This does not include Keeper or Tainted Keeper.
@@ -18,6 +18,7 @@ ____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {
18
18
  PlayerType.PLAYER_EDEN_B
19
19
  })
20
20
  ____exports.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = __TS__New(Set, {PlayerType.PLAYER_BLACKJUDAS, PlayerType.PLAYER_JUDAS_B})
21
+ ____exports.CHARACTERS_WITH_FREE_DEVIL_DEALS = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_THELOST_B, PlayerType.PLAYER_JACOB2_B})
21
22
  ____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {
22
23
  PlayerType.PLAYER_BLUEBABY,
23
24
  PlayerType.PLAYER_THELOST,
@@ -1,7 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * Helper function to get the item pool type that a given collectible came from. Since there is no
4
- * native method in the API to get this, IsaacScript listens in the PreGetCollectible callback for
5
- * item pool types, and then assumes that the next spawned collectible will match.
4
+ * native method in the API to get this, we listen in the PreGetCollectible callback for item pool
5
+ * types, and then assume that the next spawned collectible will match.
6
6
  */
7
7
  export declare function getCollectibleItemPoolType(collectible: EntityPickup): ItemPoolType;
@@ -1,4 +1,5 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
4
  local ____errors = require("errors")
4
5
  local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
@@ -26,6 +27,10 @@ function ____exports.saveDataManager(self, key, saveData, conditionalFunc)
26
27
  error("The save data manager is already managing save data for a key of: " .. key)
27
28
  end
28
29
  saveDataMap[key] = saveData
30
+ local saveDataKeys = __TS__ObjectKeys(saveData)
31
+ if #saveDataKeys == 1 and saveDataKeys[1] == "room" then
32
+ saveData.dontSave = true
33
+ end
29
34
  local saveDataTable = saveData
30
35
  local saveDataTableCopy = deepCopy(nil, saveDataTable, SerializationType.NONE, key)
31
36
  local saveDataCopy = saveDataTableCopy
@@ -4,6 +4,8 @@ local ____exports = {}
4
4
  local postNPCInitSirenHelper, checkReturnFamiliarToPlayer, blacklistEntryExists, v
5
5
  local ____errors = require("errors")
6
6
  local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
+ local ____entity = require("functions.entity")
8
+ local getEntities = ____entity.getEntities
7
9
  local ____exports = require("features.saveDataManager.exports")
8
10
  local saveDataManager = ____exports.saveDataManager
9
11
  function postNPCInitSirenHelper(self, npc)
@@ -55,7 +57,7 @@ function ____exports.setFamiliarNoSirenSteal(self, familiarVariant, familiarSubT
55
57
  end
56
58
  local function getSirenHelper(self, familiar)
57
59
  local familiarHash = GetPtrHash(familiar)
58
- local sirenHelpers = Isaac.FindByType(EntityType.ENTITY_SIREN_HELPER)
60
+ local sirenHelpers = getEntities(nil, EntityType.ENTITY_SIREN_HELPER)
59
61
  for ____, sirenHelper in ipairs(sirenHelpers) do
60
62
  if sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarHash then
61
63
  return sirenHelper
@@ -9,7 +9,10 @@ export declare function arrayCombine<T>(...arrays: T[][]): T[];
9
9
  /** Helper function to perform a shallow copy. */
10
10
  export declare function arrayCopy<T>(array: T[]): T[];
11
11
  export declare function arrayEmpty<T>(array: T[]): void;
12
- /** Helper function for determining if two arrays contain the exact same elements. */
12
+ /**
13
+ * Helper function for determining if two arrays contain the exact same elements. Note that this
14
+ * only performs a shallow comparison.
15
+ */
13
16
  export declare function arrayEquals<T>(array1: T[], array2: T[]): boolean;
14
17
  export declare function arrayInArray<T>(arrayToMatch: T[], parentArray: T[][]): boolean;
15
18
  /**
@@ -45,7 +48,7 @@ export declare function arrayToString<T>(array: T[]): string;
45
48
  export declare function arrayRemove<T>(originalArray: T[], ...elements: T[]): T[];
46
49
  /**
47
50
  * Removes the specified element(s) from the array. If the specified element(s) are not found in the
48
- * array, this function will do nothing. Returns whether or not one or more elements were found.
51
+ * array, this function will do nothing. Returns whether or not one or more elements were removed.
49
52
  *
50
53
  * This function is variadic, meaning that you can specify N arguments to remove N elements.
51
54
  */
@@ -49,24 +49,19 @@ function ____exports.arrayEquals(self, array1, array2)
49
49
  if #array1 ~= #array2 then
50
50
  return false
51
51
  end
52
- do
53
- local i = 0
54
- while i < #array1 do
55
- if array1[i + 1] ~= array2[i + 1] then
56
- return false
57
- end
58
- i = i + 1
52
+ return __TS__ArrayEvery(
53
+ array1,
54
+ function(____, array1Element, i)
55
+ local array2Element = array2[i + 1]
56
+ return array1Element == array2Element
59
57
  end
60
- end
61
- return true
58
+ )
62
59
  end
63
60
  function ____exports.arrayInArray(self, arrayToMatch, parentArray)
64
- for ____, element in ipairs(parentArray) do
65
- if ____exports.arrayEquals(nil, element, arrayToMatch) then
66
- return true
67
- end
68
- end
69
- return false
61
+ return __TS__ArraySome(
62
+ parentArray,
63
+ function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
64
+ )
70
65
  end
71
66
  function ____exports.arrayInit(self, defaultValue, size)
72
67
  local array = {}
@@ -83,36 +78,36 @@ function ____exports.arrayShuffle(self, originalArray, seed)
83
78
  if seed == nil then
84
79
  seed = Random()
85
80
  end
86
- local array = {table.unpack(originalArray)}
81
+ local array = ____exports.arrayCopy(nil, originalArray)
87
82
  ____exports.arrayShuffleInPlace(nil, array, seed)
88
83
  return array
89
84
  end
90
85
  function ____exports.arraySum(self, array)
91
- local sum = 0
92
- for ____, element in ipairs(array) do
93
- sum = sum + element
94
- end
95
- return sum
86
+ return __TS__ArrayReduce(
87
+ array,
88
+ function(____, accumulator, element) return accumulator + element end,
89
+ 0
90
+ )
96
91
  end
97
92
  function ____exports.arrayToString(self, array)
98
93
  if #array == 0 then
99
94
  return "[]"
100
95
  end
101
- local strings = {}
102
- for ____, value in ipairs(array) do
103
- __TS__ArrayPush(
104
- strings,
105
- tostring(value)
106
- )
107
- end
108
- return ("[" .. table.concat(strings, ", " or ",")) .. "]"
96
+ local strings = __TS__ArrayMap(
97
+ array,
98
+ function(____, element) return tostring(element) end
99
+ )
100
+ local commaSeparatedStrings = table.concat(strings, ", " or ",")
101
+ return ("[" .. commaSeparatedStrings) .. "]"
109
102
  end
110
103
  function ____exports.arrayRemove(self, originalArray, ...)
111
104
  local elements = {...}
112
- local array = {table.unpack(originalArray)}
105
+ local array = ____exports.arrayCopy(nil, originalArray)
113
106
  for ____, element in ipairs(elements) do
114
107
  local index = __TS__ArrayIndexOf(array, element)
115
- __TS__ArraySplice(array, index, 1)
108
+ if index > -1 then
109
+ __TS__ArraySplice(array, index, 1)
110
+ end
116
111
  end
117
112
  return array
118
113
  end
@@ -20,6 +20,11 @@ export declare function getCollectibleGfxFilename(collectibleType: CollectibleTy
20
20
  * provided collectible type was not valid.
21
21
  */
22
22
  export declare function getCollectibleInitCharges(collectibleType: CollectibleType | int): int;
23
+ /**
24
+ * Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
25
+ * type was not valid.
26
+ */
27
+ export declare function getCollectibleQuality(collectibleType: CollectibleType | int): int;
23
28
  /**
24
29
  * Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
25
30
  * provided collectible type was not valid.
@@ -1,5 +1,4 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
- require("lualib_bundle");
3
2
  local ____exports = {}
4
3
  local COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER
5
4
  local ____constants = require("constants")
@@ -10,6 +9,7 @@ local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DE
10
9
  local ____collectibleNameMap = require("maps.collectibleNameMap")
11
10
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
12
11
  local ____entity = require("functions.entity")
12
+ local getPickups = ____entity.getPickups
13
13
  local removeAllPickups = ____entity.removeAllPickups
14
14
  local ____sprite = require("functions.sprite")
15
15
  local clearSprite = ____sprite.clearSprite
@@ -85,6 +85,14 @@ function ____exports.getCollectibleInitCharges(self, collectibleType)
85
85
  end
86
86
  return itemConfigItem.InitCharge
87
87
  end
88
+ function ____exports.getCollectibleQuality(self, collectibleType)
89
+ local itemConfig = Isaac.GetItemConfig()
90
+ local itemConfigItem = itemConfig:GetCollectible(collectibleType)
91
+ if itemConfigItem == nil then
92
+ return 0
93
+ end
94
+ return itemConfigItem.Quality
95
+ end
88
96
  function ____exports.getCollectibleItemType(self, collectibleType)
89
97
  local itemConfig = Isaac.GetItemConfig()
90
98
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
@@ -121,15 +129,7 @@ function ____exports.getCollectibles(self, matchingSubType)
121
129
  if matchingSubType == nil then
122
130
  matchingSubType = -1
123
131
  end
124
- local entities = Isaac.FindByType(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, matchingSubType)
125
- local collectibles = {}
126
- for ____, entity in ipairs(entities) do
127
- local pickup = entity:ToPickup()
128
- if pickup ~= nil then
129
- __TS__ArrayPush(collectibles, pickup)
130
- end
131
- end
132
- return collectibles
132
+ return getPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, matchingSubType)
133
133
  end
134
134
  function ____exports.getMaxCollectibleID(self)
135
135
  local itemConfig = Isaac.GetItemConfig()
@@ -176,7 +176,7 @@ function ____exports.setCollectibleEmpty(self, collectible)
176
176
  end
177
177
  function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
178
178
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
179
- error("You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant))
179
+ error("You cannot set a collectible sub-type for pickups of variant: " .. tostring(collectible.Variant))
180
180
  end
181
181
  if newCollectibleType == CollectibleType.COLLECTIBLE_NULL then
182
182
  ____exports.setCollectibleEmpty(nil, collectible)
@@ -12,7 +12,7 @@ export declare function anyEntityCloserThan(entities: Entity[], position: Vector
12
12
  * }
13
13
  * ```
14
14
  */
15
- export declare function getBombs(matchingVariant?: number, matchingSubType?: number): EntityBomb[];
15
+ export declare function getBombs(matchingVariant?: BombVariant | int, matchingSubType?: number): EntityBomb[];
16
16
  /**
17
17
  * Given an array of entities, this helper function returns the closest one to a provided reference
18
18
  * entity.
@@ -20,7 +20,7 @@ export declare function getBombs(matchingVariant?: number, matchingSubType?: num
20
20
  * Example:
21
21
  * ```ts
22
22
  * const player = Isaac.GetPlayer();
23
- * const gapers = Isaac.FindByType(EntityType.ENTITY_GAPER);
23
+ * const gapers = getEntities(EntityType.ENTITY_GAPER);
24
24
  * const closestGaper = getClosestEntityTo(player, gapers);
25
25
  * ```
26
26
  */
@@ -41,7 +41,7 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
41
41
  * }
42
42
  * ```
43
43
  */
44
- export declare function getEffects(matchingVariant?: number, matchingSubType?: number): EntityEffect[];
44
+ export declare function getEffects(matchingVariant?: EffectVariant | int, matchingSubType?: number): EntityEffect[];
45
45
  /**
46
46
  * Helper function to get all of the entities in the room or all of the entities that match a
47
47
  * specific entity type / variant / sub-type.
@@ -96,7 +96,7 @@ export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, V
96
96
  * }
97
97
  * ```
98
98
  */
99
- export declare function getFamiliars(matchingVariant?: number, matchingSubType?: number): EntityFamiliar[];
99
+ export declare function getFamiliars(matchingVariant?: FamiliarVariant | int, matchingSubType?: number): EntityFamiliar[];
100
100
  /**
101
101
  * Helper function to get all of the knives in the room.
102
102
  *
@@ -108,7 +108,7 @@ export declare function getFamiliars(matchingVariant?: number, matchingSubType?:
108
108
  * }
109
109
  * ```
110
110
  */
111
- export declare function getKnives(matchingVariant?: number, matchingSubType?: number): EntityKnife[];
111
+ export declare function getKnives(matchingVariant?: KnifeVariant | int, matchingSubType?: number): EntityKnife[];
112
112
  /**
113
113
  * Helper function to get all of the lasers in the room.
114
114
  *
@@ -120,7 +120,7 @@ export declare function getKnives(matchingVariant?: number, matchingSubType?: nu
120
120
  * }
121
121
  * ```
122
122
  */
123
- export declare function getLasers(matchingVariant?: number, matchingSubType?: number): EntityLaser[];
123
+ export declare function getLasers(matchingVariant?: LaserVariant | int, matchingSubType?: number): EntityLaser[];
124
124
  /**
125
125
  * Helper function to get all of the pickups in the room.
126
126
  *
@@ -132,7 +132,7 @@ export declare function getLasers(matchingVariant?: number, matchingSubType?: nu
132
132
  * }
133
133
  * ```
134
134
  */
135
- export declare function getPickups(matchingVariant?: number, matchingSubType?: number): EntityPickup[];
135
+ export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
136
136
  /**
137
137
  * Helper function to get all of the projectiles in the room.
138
138
  *
@@ -144,8 +144,8 @@ export declare function getPickups(matchingVariant?: number, matchingSubType?: n
144
144
  * }
145
145
  * ```
146
146
  */
147
- export declare function getProjectiles(matchingVariant?: number, matchingSubType?: number): EntityProjectile[];
148
- export declare function getSlots(matchingVariant?: number, matchingSubType?: number): Entity[];
147
+ export declare function getProjectiles(matchingVariant?: ProjectileVariant | int, matchingSubType?: number): EntityProjectile[];
148
+ export declare function getSlots(matchingVariant?: SlotVariant | int, matchingSubType?: number): Entity[];
149
149
  /**
150
150
  * Helper function to get all of the tears in the room.
151
151
  *
@@ -157,7 +157,7 @@ export declare function getSlots(matchingVariant?: number, matchingSubType?: num
157
157
  * }
158
158
  * ```
159
159
  */
160
- export declare function getTears(matchingVariant?: number, matchingSubType?: number): EntityTear[];
160
+ export declare function getTears(matchingVariant?: TearVariant | int, matchingSubType?: number): EntityTear[];
161
161
  /**
162
162
  * Helper function to measure an entity's velocity to see if it is moving.
163
163
  *
@@ -6,13 +6,26 @@ local STORY_BOSSES = ____constants.STORY_BOSSES
6
6
  local ____random = require("functions.random")
7
7
  local getRandom = ____random.getRandom
8
8
  local nextSeed = ____random.nextSeed
9
- function ____exports.anyEntityCloserThan(self, entities, position, distance)
10
- for ____, entity in ipairs(entities) do
11
- if position:Distance(entity.Position) <= distance then
12
- return true
13
- end
9
+ function ____exports.getEntities(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
10
+ if matchingVariant == nil then
11
+ matchingVariant = -1
12
+ end
13
+ if matchingSubType == nil then
14
+ matchingSubType = -1
14
15
  end
15
- return false
16
+ if ignoreFriendly == nil then
17
+ ignoreFriendly = false
18
+ end
19
+ if matchingEntityType == nil then
20
+ return Isaac.GetRoomEntities()
21
+ end
22
+ return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
23
+ end
24
+ function ____exports.anyEntityCloserThan(self, entities, position, distance)
25
+ return __TS__ArraySome(
26
+ entities,
27
+ function(____, entity) return position:Distance(entity.Position) <= distance end
28
+ )
16
29
  end
17
30
  function ____exports.getBombs(self, matchingVariant, matchingSubType)
18
31
  if matchingVariant == nil then
@@ -21,7 +34,7 @@ function ____exports.getBombs(self, matchingVariant, matchingSubType)
21
34
  if matchingSubType == nil then
22
35
  matchingSubType = -1
23
36
  end
24
- local entities = Isaac.FindByType(EntityType.ENTITY_BOMB, matchingVariant, matchingSubType)
37
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_BOMB, matchingVariant, matchingSubType)
25
38
  local bombs = {}
26
39
  for ____, entity in ipairs(entities) do
27
40
  local bomb = entity:ToBomb()
@@ -67,7 +80,7 @@ function ____exports.getEffects(self, matchingVariant, matchingSubType)
67
80
  if matchingSubType == nil then
68
81
  matchingSubType = -1
69
82
  end
70
- local entities = Isaac.FindByType(EntityType.ENTITY_EFFECT, matchingVariant, matchingSubType)
83
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_EFFECT, matchingVariant, matchingSubType)
71
84
  local effects = {}
72
85
  for ____, entity in ipairs(entities) do
73
86
  local effect = entity:ToEffect()
@@ -77,21 +90,6 @@ function ____exports.getEffects(self, matchingVariant, matchingSubType)
77
90
  end
78
91
  return effects
79
92
  end
80
- function ____exports.getEntities(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
81
- if matchingVariant == nil then
82
- matchingVariant = -1
83
- end
84
- if matchingSubType == nil then
85
- matchingSubType = -1
86
- end
87
- if ignoreFriendly == nil then
88
- ignoreFriendly = false
89
- end
90
- if matchingEntityType == nil then
91
- return Isaac.GetRoomEntities()
92
- end
93
- return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
94
- end
95
93
  function ____exports.getEntityPositions(self, entities)
96
94
  if entities == nil then
97
95
  entities = ____exports.getEntities(nil)
@@ -121,7 +119,7 @@ function ____exports.getFamiliars(self, matchingVariant, matchingSubType)
121
119
  if matchingSubType == nil then
122
120
  matchingSubType = -1
123
121
  end
124
- local entities = Isaac.FindByType(EntityType.ENTITY_FAMILIAR, matchingVariant, matchingSubType)
122
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_FAMILIAR, matchingVariant, matchingSubType)
125
123
  local familiars = {}
126
124
  for ____, entity in ipairs(entities) do
127
125
  local familiar = entity:ToFamiliar()
@@ -138,7 +136,7 @@ function ____exports.getKnives(self, matchingVariant, matchingSubType)
138
136
  if matchingSubType == nil then
139
137
  matchingSubType = -1
140
138
  end
141
- local entities = Isaac.FindByType(EntityType.ENTITY_KNIFE, matchingVariant, matchingSubType)
139
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_KNIFE, matchingVariant, matchingSubType)
142
140
  local knives = {}
143
141
  for ____, entity in ipairs(entities) do
144
142
  local knife = entity:ToKnife()
@@ -155,7 +153,7 @@ function ____exports.getLasers(self, matchingVariant, matchingSubType)
155
153
  if matchingSubType == nil then
156
154
  matchingSubType = -1
157
155
  end
158
- local entities = Isaac.FindByType(EntityType.ENTITY_LASER, matchingVariant, matchingSubType)
156
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_LASER, matchingVariant, matchingSubType)
159
157
  local lasers = {}
160
158
  for ____, entity in ipairs(entities) do
161
159
  local laser = entity:ToLaser()
@@ -172,7 +170,7 @@ function ____exports.getPickups(self, matchingVariant, matchingSubType)
172
170
  if matchingSubType == nil then
173
171
  matchingSubType = -1
174
172
  end
175
- local entities = Isaac.FindByType(EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
173
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
176
174
  local pickups = {}
177
175
  for ____, entity in ipairs(entities) do
178
176
  local pickup = entity:ToPickup()
@@ -189,7 +187,7 @@ function ____exports.getProjectiles(self, matchingVariant, matchingSubType)
189
187
  if matchingSubType == nil then
190
188
  matchingSubType = -1
191
189
  end
192
- local entities = Isaac.FindByType(EntityType.ENTITY_PROJECTILE, matchingVariant, matchingSubType)
190
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_PROJECTILE, matchingVariant, matchingSubType)
193
191
  local projectiles = {}
194
192
  for ____, entity in ipairs(entities) do
195
193
  local projectile = entity:ToProjectile()
@@ -206,7 +204,7 @@ function ____exports.getSlots(self, matchingVariant, matchingSubType)
206
204
  if matchingSubType == nil then
207
205
  matchingSubType = -1
208
206
  end
209
- local slots = Isaac.FindByType(EntityType.ENTITY_SLOT, matchingVariant, matchingSubType)
207
+ local slots = ____exports.getEntities(nil, EntityType.ENTITY_SLOT, matchingVariant, matchingSubType)
210
208
  return slots
211
209
  end
212
210
  function ____exports.getTears(self, matchingVariant, matchingSubType)
@@ -216,7 +214,7 @@ function ____exports.getTears(self, matchingVariant, matchingSubType)
216
214
  if matchingSubType == nil then
217
215
  matchingSubType = -1
218
216
  end
219
- local entities = Isaac.FindByType(EntityType.ENTITY_TEAR, matchingVariant, matchingSubType)
217
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_TEAR, matchingVariant, matchingSubType)
220
218
  local tears = {}
221
219
  for ____, entity in ipairs(entities) do
222
220
  local tear = entity:ToTear()
@@ -284,7 +282,7 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
284
282
  if cap == nil then
285
283
  cap = nil
286
284
  end
287
- local entities = Isaac.FindByType(entityType, entityVariant, entitySubType)
285
+ local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
288
286
  return ____exports.removeEntities(nil, entities, cap)
289
287
  end
290
288
  function ____exports.removeAllPickups(self, variant, subType, cap)
@@ -130,13 +130,14 @@ function ____exports.isAllPressurePlatesPushed(self)
130
130
  if not hasPressurePlates then
131
131
  return true
132
132
  end
133
- for ____, gridEntity in ipairs(____exports.getGridEntities(nil, GridEntityType.GRID_PRESSURE_PLATE)) do
134
- local gridEntityDesc = gridEntity:GetSaveState()
135
- if gridEntityDesc.State ~= 3 then
136
- return false
133
+ local pressurePlates = ____exports.getGridEntities(nil, GridEntityType.GRID_PRESSURE_PLATE)
134
+ return __TS__ArrayEvery(
135
+ pressurePlates,
136
+ function(____, pressurePlate)
137
+ local gridEntityDesc = pressurePlate:GetSaveState()
138
+ return gridEntityDesc.State == 3
137
139
  end
138
- end
139
- return true
140
+ )
140
141
  end
141
142
  function ____exports.isPostBossVoidPortal(self, gridEntity)
142
143
  local saveState = gridEntity:GetSaveState()
@@ -1,10 +1,10 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /** Helper function to get the enum name for the specified `Controller` value. */
3
3
  export declare function controllerToString(controller: Controller): string;
4
- /** Iterates over all 4 inputs to determine if a particular button is pressed (i.e. held down). */
4
+ /** Iterates over all inputs to determine if a particular button is pressed (i.e. held down). */
5
5
  export declare function isActionPressedOnAnyInput(buttonAction: ButtonAction): boolean;
6
6
  /**
7
- * Iterates over all 4 inputs to determine if a particular button is triggered (i.e. held down and
7
+ * Iterates over all inputs to determine if a particular button is triggered (i.e. held down and
8
8
  * then released).
9
9
  */
10
10
  export declare function isActionTriggeredOnAnyInput(buttonAction: ButtonAction): boolean;