isaacscript-common 1.0.597 → 1.0.601

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 (65) 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 +2 -0
  8. package/dist/constants.lua +16 -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 +16 -10
  17. package/dist/functions/entity.lua +34 -31
  18. package/dist/functions/gridEntity.lua +7 -6
  19. package/dist/functions/input.d.ts +2 -2
  20. package/dist/functions/jsonRoom.lua +1 -2
  21. package/dist/functions/log.d.ts +4 -4
  22. package/dist/functions/log.lua +15 -18
  23. package/dist/functions/player.d.ts +5 -0
  24. package/dist/functions/player.lua +14 -9
  25. package/dist/functions/pocketItems.lua +4 -6
  26. package/dist/functions/rooms.lua +26 -33
  27. package/dist/functions/transformations.lua +3 -1
  28. package/dist/functions/trinkets.lua +4 -12
  29. package/dist/types/CallbackParametersCustom.d.ts +1 -1
  30. package/dist/types/ModUpgraded.lua +3 -5
  31. package/package.json +2 -2
  32. package/dist/callbacks/postSlot.d.ts +0 -2
  33. package/dist/callbacks/postSlot.lua +0 -48
  34. package/dist/callbacks/postSlotRender.d.ts +0 -2
  35. package/dist/callbacks/postSlotRender.lua +0 -20
  36. package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.d.ts +0 -5
  37. package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.lua +0 -26
  38. package/dist/cardNameMap.d.ts +0 -2
  39. package/dist/cardNameMap.lua +0 -5
  40. package/dist/collectibleNameMap.d.ts +0 -2
  41. package/dist/collectibleNameMap.lua +0 -5
  42. package/dist/collectibleSet.d.ts +0 -1
  43. package/dist/collectibleSet.lua +0 -22
  44. package/dist/functions/card.d.ts +0 -25
  45. package/dist/functions/card.lua +0 -41
  46. package/dist/functions/items.d.ts +0 -9
  47. package/dist/functions/items.lua +0 -9
  48. package/dist/functions/localization.d.ts +0 -2
  49. package/dist/functions/localization.lua +0 -8
  50. package/dist/functions/sound.d.ts +0 -7
  51. package/dist/functions/sound.lua +0 -7
  52. package/dist/gridEntityMap.d.ts +0 -2
  53. package/dist/gridEntityMap.lua +0 -5
  54. package/dist/maps/roomTypeToItemPoolMap.d.ts +0 -2
  55. package/dist/maps/roomTypeToItemPoolMap.lua +0 -19
  56. package/dist/maps/transformationMap.d.ts +0 -5
  57. package/dist/maps/transformationMap.lua +0 -56
  58. package/dist/patchPrintFunction.d.ts +0 -1
  59. package/dist/patchPrintFunction.lua +0 -45
  60. package/dist/pillEffectNameMap.d.ts +0 -2
  61. package/dist/pillEffectNameMap.lua +0 -5
  62. package/dist/transformationMap.d.ts +0 -5
  63. package/dist/transformationMap.lua +0 -56
  64. package/dist/trinketNameMap.d.ts +0 -2
  65. 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.
@@ -105,6 +106,7 @@ export declare const MOVEMENT_ACTIONS: Set<ButtonAction>;
105
106
  export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
106
107
  export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: Set<CollectibleType>;
107
108
  export declare const SHOOTING_ACTIONS: Set<ButtonAction>;
109
+ export declare const STORY_BOSSES: Set<EntityType>;
108
110
  /**
109
111
  * This is the number of draw coordinates that each heart spans on the UI in the upper left hand
110
112
  * corner.
@@ -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,
@@ -98,5 +99,20 @@ ____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
98
99
  CollectibleType.COLLECTIBLE_R_KEY
99
100
  })
100
101
  ____exports.SHOOTING_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN})
102
+ ____exports.STORY_BOSSES = __TS__New(Set, {
103
+ EntityType.ENTITY_MOM,
104
+ EntityType.ENTITY_MOMS_HEART,
105
+ EntityType.ENTITY_SATAN,
106
+ EntityType.ENTITY_ISAAC,
107
+ EntityType.ENTITY_THE_LAMB,
108
+ EntityType.ENTITY_MEGA_SATAN,
109
+ EntityType.ENTITY_MEGA_SATAN_2,
110
+ EntityType.ENTITY_ULTRA_GREED,
111
+ EntityType.ENTITY_HUSH,
112
+ EntityType.ENTITY_DELIRIUM,
113
+ EntityType.ENTITY_MOTHER,
114
+ EntityType.ENTITY_DOGMA,
115
+ EntityType.ENTITY_BEAST
116
+ })
101
117
  ____exports.UI_HEART_WIDTH = 12
102
118
  return ____exports
@@ -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
  *
@@ -165,6 +165,12 @@ export declare function getTears(matchingVariant?: number, matchingSubType?: num
165
165
  * @param threshold Optional. The threshold from 0 to consider to be moving. 0.01 by default.
166
166
  */
167
167
  export declare function isEntityMoving(entity: Entity, threshold?: number): boolean;
168
+ /**
169
+ * Helper function to determine if the current entity is an end-game story boss, like Isaac, Blue
170
+ * Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only apply
171
+ * to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
172
+ */
173
+ export declare function isStoryBoss(entity: Entity): boolean;
168
174
  /**
169
175
  * Helper function to remove all of the entities in the supplied array.
170
176
  *
@@ -1,16 +1,31 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
+ local ____constants = require("constants")
5
+ local STORY_BOSSES = ____constants.STORY_BOSSES
4
6
  local ____random = require("functions.random")
5
7
  local getRandom = ____random.getRandom
6
8
  local nextSeed = ____random.nextSeed
7
- function ____exports.anyEntityCloserThan(self, entities, position, distance)
8
- for ____, entity in ipairs(entities) do
9
- if position:Distance(entity.Position) <= distance then
10
- return true
11
- 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
12
15
  end
13
- 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
+ )
14
29
  end
15
30
  function ____exports.getBombs(self, matchingVariant, matchingSubType)
16
31
  if matchingVariant == nil then
@@ -19,7 +34,7 @@ function ____exports.getBombs(self, matchingVariant, matchingSubType)
19
34
  if matchingSubType == nil then
20
35
  matchingSubType = -1
21
36
  end
22
- local entities = Isaac.FindByType(EntityType.ENTITY_BOMB, matchingVariant, matchingSubType)
37
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_BOMB, matchingVariant, matchingSubType)
23
38
  local bombs = {}
24
39
  for ____, entity in ipairs(entities) do
25
40
  local bomb = entity:ToBomb()
@@ -65,7 +80,7 @@ function ____exports.getEffects(self, matchingVariant, matchingSubType)
65
80
  if matchingSubType == nil then
66
81
  matchingSubType = -1
67
82
  end
68
- local entities = Isaac.FindByType(EntityType.ENTITY_EFFECT, matchingVariant, matchingSubType)
83
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_EFFECT, matchingVariant, matchingSubType)
69
84
  local effects = {}
70
85
  for ____, entity in ipairs(entities) do
71
86
  local effect = entity:ToEffect()
@@ -75,21 +90,6 @@ function ____exports.getEffects(self, matchingVariant, matchingSubType)
75
90
  end
76
91
  return effects
77
92
  end
78
- function ____exports.getEntities(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
79
- if matchingVariant == nil then
80
- matchingVariant = -1
81
- end
82
- if matchingSubType == nil then
83
- matchingSubType = -1
84
- end
85
- if ignoreFriendly == nil then
86
- ignoreFriendly = false
87
- end
88
- if matchingEntityType == nil then
89
- return Isaac.GetRoomEntities()
90
- end
91
- return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
92
- end
93
93
  function ____exports.getEntityPositions(self, entities)
94
94
  if entities == nil then
95
95
  entities = ____exports.getEntities(nil)
@@ -119,7 +119,7 @@ function ____exports.getFamiliars(self, matchingVariant, matchingSubType)
119
119
  if matchingSubType == nil then
120
120
  matchingSubType = -1
121
121
  end
122
- local entities = Isaac.FindByType(EntityType.ENTITY_FAMILIAR, matchingVariant, matchingSubType)
122
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_FAMILIAR, matchingVariant, matchingSubType)
123
123
  local familiars = {}
124
124
  for ____, entity in ipairs(entities) do
125
125
  local familiar = entity:ToFamiliar()
@@ -136,7 +136,7 @@ function ____exports.getKnives(self, matchingVariant, matchingSubType)
136
136
  if matchingSubType == nil then
137
137
  matchingSubType = -1
138
138
  end
139
- local entities = Isaac.FindByType(EntityType.ENTITY_KNIFE, matchingVariant, matchingSubType)
139
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_KNIFE, matchingVariant, matchingSubType)
140
140
  local knives = {}
141
141
  for ____, entity in ipairs(entities) do
142
142
  local knife = entity:ToKnife()
@@ -153,7 +153,7 @@ function ____exports.getLasers(self, matchingVariant, matchingSubType)
153
153
  if matchingSubType == nil then
154
154
  matchingSubType = -1
155
155
  end
156
- local entities = Isaac.FindByType(EntityType.ENTITY_LASER, matchingVariant, matchingSubType)
156
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_LASER, matchingVariant, matchingSubType)
157
157
  local lasers = {}
158
158
  for ____, entity in ipairs(entities) do
159
159
  local laser = entity:ToLaser()
@@ -170,7 +170,7 @@ function ____exports.getPickups(self, matchingVariant, matchingSubType)
170
170
  if matchingSubType == nil then
171
171
  matchingSubType = -1
172
172
  end
173
- local entities = Isaac.FindByType(EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
173
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
174
174
  local pickups = {}
175
175
  for ____, entity in ipairs(entities) do
176
176
  local pickup = entity:ToPickup()
@@ -187,7 +187,7 @@ function ____exports.getProjectiles(self, matchingVariant, matchingSubType)
187
187
  if matchingSubType == nil then
188
188
  matchingSubType = -1
189
189
  end
190
- local entities = Isaac.FindByType(EntityType.ENTITY_PROJECTILE, matchingVariant, matchingSubType)
190
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_PROJECTILE, matchingVariant, matchingSubType)
191
191
  local projectiles = {}
192
192
  for ____, entity in ipairs(entities) do
193
193
  local projectile = entity:ToProjectile()
@@ -204,7 +204,7 @@ function ____exports.getSlots(self, matchingVariant, matchingSubType)
204
204
  if matchingSubType == nil then
205
205
  matchingSubType = -1
206
206
  end
207
- local slots = Isaac.FindByType(EntityType.ENTITY_SLOT, matchingVariant, matchingSubType)
207
+ local slots = ____exports.getEntities(nil, EntityType.ENTITY_SLOT, matchingVariant, matchingSubType)
208
208
  return slots
209
209
  end
210
210
  function ____exports.getTears(self, matchingVariant, matchingSubType)
@@ -214,7 +214,7 @@ function ____exports.getTears(self, matchingVariant, matchingSubType)
214
214
  if matchingSubType == nil then
215
215
  matchingSubType = -1
216
216
  end
217
- local entities = Isaac.FindByType(EntityType.ENTITY_TEAR, matchingVariant, matchingSubType)
217
+ local entities = ____exports.getEntities(nil, EntityType.ENTITY_TEAR, matchingVariant, matchingSubType)
218
218
  local tears = {}
219
219
  for ____, entity in ipairs(entities) do
220
220
  local tear = entity:ToTear()
@@ -230,6 +230,9 @@ function ____exports.isEntityMoving(self, entity, threshold)
230
230
  end
231
231
  return entity.Velocity:Length() >= threshold
232
232
  end
233
+ function ____exports.isStoryBoss(self, entity)
234
+ return STORY_BOSSES:has(entity.Type)
235
+ end
233
236
  function ____exports.removeEntities(self, entities, cap)
234
237
  if #entities == 0 then
235
238
  return false
@@ -279,7 +282,7 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
279
282
  if cap == nil then
280
283
  cap = nil
281
284
  end
282
- local entities = Isaac.FindByType(entityType, entityVariant, entitySubType)
285
+ local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
283
286
  return ____exports.removeEntities(nil, entities, cap)
284
287
  end
285
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()