isaacscript-common 1.0.600 → 1.0.604

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 (69) hide show
  1. package/dist/callbacks/postFlip.lua +1 -2
  2. package/dist/callbacks/postPurchase.lua +7 -6
  3. package/dist/callbacks/preNewLevel.lua +7 -5
  4. package/dist/callbacks/subscriptions/{PreNewLevel.d.ts → preNewLevel.d.ts} +0 -0
  5. package/dist/callbacks/subscriptions/{PreNewLevel.lua → preNewLevel.lua} +0 -0
  6. package/dist/features/getCollectibleItemPoolType.d.ts +2 -2
  7. package/dist/features/saveDataManager/exports.lua +5 -0
  8. package/dist/features/sirenHelpers.lua +3 -1
  9. package/dist/functions/array.d.ts +5 -2
  10. package/dist/functions/array.lua +26 -31
  11. package/dist/functions/collectibles.d.ts +5 -0
  12. package/dist/functions/collectibles.lua +11 -11
  13. package/dist/functions/entity.d.ts +10 -10
  14. package/dist/functions/entity.lua +29 -31
  15. package/dist/functions/globals.d.ts +14 -0
  16. package/dist/functions/globals.lua +205 -0
  17. package/dist/functions/gridEntity.lua +7 -6
  18. package/dist/functions/input.d.ts +2 -2
  19. package/dist/functions/jsonRoom.lua +36 -27
  20. package/dist/functions/log.d.ts +4 -4
  21. package/dist/functions/log.lua +15 -18
  22. package/dist/functions/npc.lua +17 -23
  23. package/dist/functions/player.d.ts +3 -1
  24. package/dist/functions/player.lua +59 -54
  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/functions/util.d.ts +1 -0
  30. package/dist/functions/util.lua +10 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.lua +8 -0
  33. package/dist/types/CallbackParametersCustom.d.ts +1 -1
  34. package/dist/types/ModUpgraded.lua +3 -5
  35. package/package.json +2 -2
  36. package/dist/callbacks/postSlot.d.ts +0 -2
  37. package/dist/callbacks/postSlot.lua +0 -48
  38. package/dist/callbacks/postSlotRender.d.ts +0 -2
  39. package/dist/callbacks/postSlotRender.lua +0 -20
  40. package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.d.ts +0 -5
  41. package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.lua +0 -26
  42. package/dist/cardNameMap.d.ts +0 -2
  43. package/dist/cardNameMap.lua +0 -5
  44. package/dist/collectibleNameMap.d.ts +0 -2
  45. package/dist/collectibleNameMap.lua +0 -5
  46. package/dist/collectibleSet.d.ts +0 -1
  47. package/dist/collectibleSet.lua +0 -22
  48. package/dist/functions/card.d.ts +0 -25
  49. package/dist/functions/card.lua +0 -41
  50. package/dist/functions/items.d.ts +0 -9
  51. package/dist/functions/items.lua +0 -9
  52. package/dist/functions/localization.d.ts +0 -2
  53. package/dist/functions/localization.lua +0 -8
  54. package/dist/functions/sound.d.ts +0 -7
  55. package/dist/functions/sound.lua +0 -7
  56. package/dist/gridEntityMap.d.ts +0 -2
  57. package/dist/gridEntityMap.lua +0 -5
  58. package/dist/maps/roomTypeToItemPoolMap.d.ts +0 -2
  59. package/dist/maps/roomTypeToItemPoolMap.lua +0 -19
  60. package/dist/maps/transformationMap.d.ts +0 -5
  61. package/dist/maps/transformationMap.lua +0 -56
  62. package/dist/patchPrintFunction.d.ts +0 -1
  63. package/dist/patchPrintFunction.lua +0 -45
  64. package/dist/pillEffectNameMap.d.ts +0 -2
  65. package/dist/pillEffectNameMap.lua +0 -5
  66. package/dist/transformationMap.d.ts +0 -5
  67. package/dist/transformationMap.lua +0 -56
  68. package/dist/trinketNameMap.d.ts +0 -2
  69. package/dist/trinketNameMap.lua +0 -5
@@ -0,0 +1,205 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ local ____log = require("functions.log")
5
+ local log = ____log.log
6
+ local ____util = require("functions.util")
7
+ local combineSets = ____util.combineSets
8
+ local isLuaDebugEnabled = ____util.isLuaDebugEnabled
9
+ local DEFAULT_GLOBALS = __TS__New(Set, {
10
+ "ActionTriggers",
11
+ "ActiveSlot",
12
+ "BabySubType",
13
+ "BackdropType",
14
+ "BatterySubType",
15
+ "BedSubType",
16
+ "BitSet128",
17
+ "BombSubType",
18
+ "BombVariant",
19
+ "ButtonAction",
20
+ "CacheFlag",
21
+ "Card",
22
+ "Challenge",
23
+ "ChampionColor",
24
+ "ChestSubType",
25
+ "CoinSubType",
26
+ "CollectibleType",
27
+ "Color",
28
+ "CppContainer",
29
+ "DamageFlag",
30
+ "Difficulty",
31
+ "Direction",
32
+ "DoorSlot",
33
+ "DoorState",
34
+ "DoorVariant",
35
+ "EffectVariant",
36
+ "Entity",
37
+ "EntityBomb",
38
+ "EntityCollisionClass",
39
+ "EntityEffect",
40
+ "EntityFamiliar",
41
+ "EntityFlag",
42
+ "EntityGridCollisionClass",
43
+ "EntityKnife",
44
+ "EntityLaser",
45
+ "EntityNPC",
46
+ "EntityPartition",
47
+ "EntityPickup",
48
+ "EntityPlayer",
49
+ "EntityProjectile",
50
+ "EntityPtr",
51
+ "EntityRef",
52
+ "EntityTear",
53
+ "EntityType",
54
+ "FamiliarVariant",
55
+ "Font",
56
+ "Game",
57
+ "GameStateFlag",
58
+ "GetPtrHash",
59
+ "GridCollisionClass",
60
+ "GridEntity",
61
+ "GridEntityDesc",
62
+ "GridEntityDoor",
63
+ "GridEntityPit",
64
+ "GridEntityPoop",
65
+ "GridEntityPressurePlate",
66
+ "GridEntityRock",
67
+ "GridEntitySpikes",
68
+ "GridEntityTNT",
69
+ "GridEntityType",
70
+ "GridRooms",
71
+ "HUD",
72
+ "HeartSubType",
73
+ "Input",
74
+ "InputHook",
75
+ "Isaac",
76
+ "ItemConfig",
77
+ "ItemPool",
78
+ "ItemPoolType",
79
+ "ItemType",
80
+ "KColor",
81
+ "KeySubType",
82
+ "Keyboard",
83
+ "LaserOffset",
84
+ "LaserSubType",
85
+ "Level",
86
+ "LevelCurse",
87
+ "LevelStage",
88
+ "LevelStateFlag",
89
+ "LocustSubtypes",
90
+ "ModCallbacks",
91
+ "Mouse",
92
+ "Music",
93
+ "MusicManager",
94
+ "NpcState",
95
+ "NullItemID",
96
+ "Options",
97
+ "PathFinder",
98
+ "PickupPrice",
99
+ "PickupVariant",
100
+ "PillColor",
101
+ "PillEffect",
102
+ "PlayerForm",
103
+ "PlayerSpriteLayer",
104
+ "PlayerType",
105
+ "PlayerTypes",
106
+ "PoopPickupSubType",
107
+ "PoopSpellType",
108
+ "ProjectileFlags",
109
+ "ProjectileParams",
110
+ "ProjectileVariant",
111
+ "QueueItemData",
112
+ "REPENTANCE",
113
+ "RNG",
114
+ "Random",
115
+ "RandomVector",
116
+ "RegisterMod",
117
+ "RenderMode",
118
+ "Room",
119
+ "RoomConfig",
120
+ "RoomDescriptor",
121
+ "RoomShape",
122
+ "RoomTransitionAnim",
123
+ "RoomType",
124
+ "SFXManager",
125
+ "SackSubType",
126
+ "SeedEffect",
127
+ "Seeds",
128
+ "ShockwaveParams",
129
+ "SortingLayer",
130
+ "SoundEffect",
131
+ "Sprite",
132
+ "StageType",
133
+ "StartDebug",
134
+ "TearFlags",
135
+ "TearParams",
136
+ "TearVariant",
137
+ "TemporaryEffect",
138
+ "TemporaryEffects",
139
+ "TrinketType",
140
+ "UseFlag",
141
+ "Vector",
142
+ "WeaponType",
143
+ "_G",
144
+ "_VERSION",
145
+ "assert",
146
+ "collectgarbage",
147
+ "coroutine",
148
+ "dofile",
149
+ "error",
150
+ "getmetatable",
151
+ "include",
152
+ "ipairs",
153
+ "load",
154
+ "loadfile",
155
+ "math",
156
+ "next",
157
+ "pairs",
158
+ "pcall",
159
+ "print",
160
+ "rawequal",
161
+ "rawget",
162
+ "rawlen",
163
+ "rawset",
164
+ "require",
165
+ "select",
166
+ "setmetatable",
167
+ "string",
168
+ "table",
169
+ "tonumber",
170
+ "tostring",
171
+ "type",
172
+ "utf8",
173
+ "xpcall"
174
+ })
175
+ local LUA_DEBUG_ADDED_GLOBALS = __TS__New(Set, {"debug", "io", "os", "package"})
176
+ function ____exports.getDefaultGlobals(self)
177
+ return isLuaDebugEnabled(nil) and combineSets(nil, DEFAULT_GLOBALS, LUA_DEBUG_ADDED_GLOBALS) or DEFAULT_GLOBALS
178
+ end
179
+ function ____exports.getNewGlobals(self)
180
+ local defaultGlobals = ____exports.getDefaultGlobals(nil)
181
+ local newGlobals = {}
182
+ for key, value in pairs(_G) do
183
+ if not defaultGlobals:has(key) then
184
+ local keyValueTuple = {key, value}
185
+ __TS__ArrayPush(newGlobals, keyValueTuple)
186
+ end
187
+ end
188
+ return newGlobals
189
+ end
190
+ function ____exports.logNewGlobals(self)
191
+ local newGlobals = ____exports.getNewGlobals(nil)
192
+ log("List of added global variables in the Isaac environment:")
193
+ if #newGlobals == 0 then
194
+ log("- n/a (no extra global variables found)")
195
+ end
196
+ do
197
+ local i = 0
198
+ while i < #newGlobals do
199
+ local key, value = table.unpack(newGlobals[i + 1])
200
+ log((((tostring(i + 1) .. ") ") .. tostring(key)) .. " - ") .. tostring(value))
201
+ i = i + 1
202
+ end
203
+ end
204
+ end
205
+ return ____exports
@@ -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;
@@ -2,57 +2,66 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local getTotalWeightOfJSONRooms, getJSONRoomWithChosenWeight
5
+ local ____array = require("functions.array")
6
+ local arraySum = ____array.arraySum
5
7
  local ____log = require("functions.log")
6
8
  local log = ____log.log
7
9
  local ____random = require("functions.random")
8
10
  local getRandomFloat = ____random.getRandomFloat
9
11
  function getTotalWeightOfJSONRooms(self, jsonRooms)
10
- local totalWeight = 0
11
- for ____, jsonRoom in ipairs(jsonRooms) do
12
- local roomWeightString = jsonRoom["$"].weight
13
- local roomWeight = tonumber(roomWeightString)
14
- if roomWeight == nil then
15
- error(("Failed to parse the weight of a room: " .. roomWeightString) .. ".")
12
+ local weights = __TS__ArrayMap(
13
+ jsonRooms,
14
+ function(____, jsonRoom)
15
+ local roomWeightString = jsonRoom["$"].weight
16
+ local roomWeight = tonumber(roomWeightString)
17
+ if roomWeight == nil then
18
+ error(("Failed to parse the weight of a JSON room: " .. roomWeightString) .. ".")
19
+ end
20
+ return roomWeight
16
21
  end
17
- totalWeight = totalWeight + roomWeight
18
- end
19
- return totalWeight
22
+ )
23
+ return arraySum(nil, weights)
20
24
  end
21
25
  function getJSONRoomWithChosenWeight(self, jsonRooms, chosenWeight)
22
26
  for ____, jsonRoom in ipairs(jsonRooms) do
23
27
  local roomWeightString = jsonRoom["$"].weight
24
28
  local roomWeight = tonumber(roomWeightString)
25
29
  if roomWeight == nil then
26
- error("Failed to parse the weight of a room: " .. roomWeightString)
30
+ error("Failed to parse the weight of a JSON room: " .. roomWeightString)
27
31
  end
28
32
  if chosenWeight < roomWeight then
29
33
  return jsonRoom
30
34
  end
31
35
  chosenWeight = chosenWeight - roomWeight
32
36
  end
33
- error("Failed to get a room with chosen weight: " .. tostring(chosenWeight))
34
- return jsonRooms[1]
37
+ return error("Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight))
35
38
  end
36
39
  function ____exports.getJSONRoomOfVariant(self, jsonRooms, variant)
37
- for ____, jsonRoom in ipairs(jsonRooms) do
38
- local roomVariantString = jsonRoom["$"].variant
39
- local roomVariant = tonumber(roomVariantString)
40
- if roomVariant == variant then
41
- return jsonRoom
40
+ local jsonRoomsOfVariant = __TS__ArrayFilter(
41
+ jsonRooms,
42
+ function(____, jsonRoom)
43
+ local roomVariantString = jsonRoom["$"].variant
44
+ local roomVariant = tonumber(roomVariantString)
45
+ return roomVariant == variant
42
46
  end
47
+ )
48
+ if #jsonRoomsOfVariant == 0 then
49
+ return nil
50
+ end
51
+ if #jsonRoomsOfVariant == 1 then
52
+ return jsonRoomsOfVariant[1]
43
53
  end
44
- return nil
54
+ return error(((("Found " .. tostring(#jsonRoomsOfVariant)) .. " JSON rooms with a variant of ") .. tostring(variant)) .. ", when there should only be 1.")
45
55
  end
46
56
  function ____exports.getJSONRoomsOfSubType(self, jsonRooms, subType)
47
- local jsonRoomsOfSubType = {}
48
- for ____, jsonRoom in ipairs(jsonRooms) do
49
- local roomSubTypeString = jsonRoom["$"].subtype
50
- local roomSubType = tonumber(roomSubTypeString)
51
- if roomSubType == subType then
52
- __TS__ArrayPush(jsonRoomsOfSubType, jsonRoom)
57
+ return __TS__ArrayFilter(
58
+ jsonRooms,
59
+ function(____, jsonRoom)
60
+ local roomSubTypeString = jsonRoom["$"].subtype
61
+ local roomSubType = tonumber(roomSubTypeString)
62
+ return roomSubType == subType
53
63
  end
54
- end
55
- return jsonRoomsOfSubType
64
+ )
56
65
  end
57
66
  function ____exports.getRandomJSONRoom(self, jsonRooms, seed, verbose)
58
67
  if seed == nil then
@@ -67,7 +76,7 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seed, verbose)
67
76
  end
68
77
  local chosenWeight = getRandomFloat(nil, 0, totalWeight, seed)
69
78
  if verbose then
70
- log("Randomly chose weight: " .. tostring(chosenWeight))
79
+ log("Randomly chose weight for JSON room: " .. tostring(chosenWeight))
71
80
  end
72
81
  return getJSONRoomWithChosenWeight(nil, jsonRooms, chosenWeight)
73
82
  end
@@ -24,15 +24,15 @@ export declare function logAllGameStateFlags(this: void): void;
24
24
  * Helper function for printing out every projectile flag that is turned on. Helpful when debugging.
25
25
  */
26
26
  export declare function logAllProjectileFlags(this: void, flags: int): void;
27
- /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
28
- export declare function logAllTearFlags(this: void, flags: int): void;
29
- /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
30
- export declare function logAllUseFlags(this: void, flags: int): void;
31
27
  /**
32
28
  * Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
33
29
  * particular run.
34
30
  */
35
31
  export declare function logAllSeedEffects(this: void): void;
32
+ /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
33
+ export declare function logAllTearFlags(this: void, flags: int): void;
34
+ /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
35
+ export declare function logAllUseFlags(this: void, flags: int): void;
36
36
  export declare function logArray<T>(this: void, array: T[]): void;
37
37
  export declare function logColor(this: void, color: Color): void;
38
38
  export declare function logEntity(this: void, entity: Entity): void;
@@ -38,11 +38,9 @@ function ____exports.logAllFlags(flags, flagEnum, description)
38
38
  ____exports.log(("Logging all " .. description) .. "flags:")
39
39
  local hasNoFlags = true
40
40
  local i = 1
41
- for ____, ____value in ipairs(__TS__ObjectEntries(flagEnum)) do
42
- local key = ____value[1]
43
- local value = ____value[2]
41
+ for key, value in pairs(flagEnum) do
44
42
  if hasFlag(nil, flags, value) then
45
- ____exports.log((((((" " .. tostring(i)) .. ") Has flag: ") .. key) .. " (") .. tostring(value)) .. ")")
43
+ ____exports.log((((((" " .. tostring(i)) .. ") Has flag: ") .. tostring(key)) .. " (") .. tostring(value)) .. ")")
46
44
  hasNoFlags = false
47
45
  end
48
46
  i = i + 1
@@ -62,9 +60,7 @@ function ____exports.logAllGameStateFlags()
62
60
  ____exports.log("Logging all game state flags:")
63
61
  local hasNoFlags = true
64
62
  local i = 1
65
- for ____, ____value in ipairs(__TS__ObjectEntries(GameStateFlag)) do
66
- local key = ____value[1]
67
- local value = ____value[2]
63
+ for key, value in pairs(GameStateFlag) do
68
64
  local gameStateFlag = value
69
65
  local flagValue = game:GetStateFlag(gameStateFlag)
70
66
  if flagValue then
@@ -80,21 +76,13 @@ end
80
76
  function ____exports.logAllProjectileFlags(flags)
81
77
  ____exports.logAllFlags(flags, ProjectileFlags, "projectile")
82
78
  end
83
- function ____exports.logAllTearFlags(flags)
84
- ____exports.logAllFlags(flags, TearFlags, "tear")
85
- end
86
- function ____exports.logAllUseFlags(flags)
87
- ____exports.logAllFlags(flags, UseFlag, "use")
88
- end
89
79
  function ____exports.logAllSeedEffects()
90
80
  local game = Game()
91
81
  local seeds = game:GetSeeds()
92
82
  ____exports.log("Logging all seed effects:")
93
83
  local hasNoSeedEffects = true
94
84
  local i = 1
95
- for ____, ____value in ipairs(__TS__ObjectEntries(SeedEffect)) do
96
- local key = ____value[1]
97
- local value = ____value[2]
85
+ for key, value in pairs(SeedEffect) do
98
86
  local seedEffect = value
99
87
  if seeds:HasSeedEffect(seedEffect) then
100
88
  ____exports.log((((((" " .. tostring(i)) .. ") ") .. key) .. " (") .. tostring(value)) .. ")")
@@ -106,6 +94,12 @@ function ____exports.logAllSeedEffects()
106
94
  ____exports.log(" n/a (no seed effects)")
107
95
  end
108
96
  end
97
+ function ____exports.logAllTearFlags(flags)
98
+ ____exports.logAllFlags(flags, TearFlags, "tear")
99
+ end
100
+ function ____exports.logAllUseFlags(flags)
101
+ ____exports.logAllFlags(flags, UseFlag, "use")
102
+ end
109
103
  function ____exports.logArray(array)
110
104
  local arrayString = arrayToString(nil, array)
111
105
  ____exports.log("Array: " .. arrayString)
@@ -148,7 +142,7 @@ function ____exports.logTemporaryEffects(player)
148
142
  do
149
143
  local effect = effectsList:Get(i)
150
144
  if effect == nil then
151
- goto __continue39
145
+ goto __continue36
152
146
  end
153
147
  if effect.Item:IsCollectible() then
154
148
  local collectibleName = getCollectibleName(nil, effect.Item.ID)
@@ -162,7 +156,7 @@ function ____exports.logTemporaryEffects(player)
162
156
  ____exports.log(((" " .. tostring(i + 1)) .. ") Unknown type of temporary effect: ") .. tostring(effect.Item.ID))
163
157
  end
164
158
  end
165
- ::__continue39::
159
+ ::__continue36::
166
160
  i = i + 1
167
161
  end
168
162
  end
@@ -185,6 +179,8 @@ function ____exports.setLogFunctionsGlobal(self)
185
179
  globals.logAllFlags = ____exports.logAllFlags
186
180
  globals.logAllGameStateFlags = ____exports.logAllGameStateFlags
187
181
  globals.logAllProjectileFlags = ____exports.logAllProjectileFlags
182
+ globals.logAllSeedEffects = ____exports.logAllSeedEffects
183
+ globals.logAllTearFlags = ____exports.logAllTearFlags
188
184
  globals.logAllUseFlags = ____exports.logAllUseFlags
189
185
  globals.logArray = ____exports.logArray
190
186
  globals.logColor = ____exports.logColor
@@ -192,6 +188,7 @@ function ____exports.setLogFunctionsGlobal(self)
192
188
  globals.logKColor = ____exports.logKColor
193
189
  globals.logMap = ____exports.logMap
194
190
  globals.logTable = ____exports.logTable
191
+ globals.logTemporaryEffects = ____exports.logTemporaryEffects
195
192
  globals.logSet = ____exports.logSet
196
193
  globals.logVector = ____exports.logVector
197
194
  end
@@ -9,14 +9,12 @@ local getEntities = ____entity.getEntities
9
9
  local getFilteredNewEntities = ____entity.getFilteredNewEntities
10
10
  local getProjectiles = ____entity.getProjectiles
11
11
  local removeEntities = ____entity.removeEntities
12
- function ____exports.getBosses(self)
13
- local bosses = {}
14
- for ____, npc in ipairs(____exports.getNPCs(nil)) do
15
- if npc:IsBoss() then
16
- __TS__ArrayPush(bosses, npc)
17
- end
18
- end
19
- return bosses
12
+ function ____exports.getAliveNPCs(self)
13
+ local npcs = ____exports.getNPCs(nil)
14
+ return __TS__ArrayFilter(
15
+ npcs,
16
+ function(____, npc) return not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) end
17
+ )
20
18
  end
21
19
  function ____exports.getNPCs(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
22
20
  if ignoreFriendly == nil then
@@ -92,22 +90,18 @@ function ____exports.fireProjectiles(self, npc, position, velocity, projectilesM
92
90
  return getFilteredNewEntities(nil, oldProjectiles, newProjectiles)
93
91
  end
94
92
  function ____exports.getAliveBosses(self)
95
- local aliveBosses = {}
96
- for ____, boss in ipairs(____exports.getBosses(nil)) do
97
- if not boss:IsDead() and not ____exports.isAliveExceptionNPC(nil, boss) then
98
- __TS__ArrayPush(aliveBosses, boss)
99
- end
100
- end
101
- return aliveBosses
93
+ local aliveNPCs = ____exports.getAliveNPCs(nil)
94
+ return __TS__ArrayFilter(
95
+ aliveNPCs,
96
+ function(____, aliveNPC) return aliveNPC:IsBoss() end
97
+ )
102
98
  end
103
- function ____exports.getAliveNPCs(self)
104
- local aliveNPCs = {}
105
- for ____, npc in ipairs(____exports.getNPCs(nil)) do
106
- if not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) then
107
- __TS__ArrayPush(aliveNPCs, npc)
108
- end
109
- end
110
- return aliveNPCs
99
+ function ____exports.getBosses(self)
100
+ local npcs = ____exports.getNPCs(nil)
101
+ return __TS__ArrayFilter(
102
+ npcs,
103
+ function(____, npc) return npc:IsBoss() end
104
+ )
111
105
  end
112
106
  function ____exports.removeAllNPCs(self, cap)
113
107
  local npcs = ____exports.getNPCs(nil)
@@ -25,7 +25,7 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
25
25
  * This function is variadic, meaning that you can supply as many characters as you want to check
26
26
  * for. Returns true if any of the characters supplied are present.
27
27
  */
28
- export declare function anyPlayerIs(...characters: PlayerType[]): boolean;
28
+ export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean;
29
29
  /**
30
30
  * Helper function to determine if the provided character can have red heart containers. Returns
31
31
  * true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
@@ -83,6 +83,8 @@ export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
83
83
  * Kiss; use the `getPlayerMaxHeartContainers()` function for that.
84
84
  */
85
85
  export declare function getCharacterMaxHeartContainers(character: PlayerType): int;
86
+ /** Helper function to get an array containing the characters of all of the current players. */
87
+ export declare function getCharacters(): number[];
86
88
  /**
87
89
  * Iterates over all players and checks if any are close enough to the specified position.
88
90
  *