isaacscript-common 6.6.5 → 6.7.0

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 (232) hide show
  1. package/dist/callbacks/customRevive.lua +4 -4
  2. package/dist/callbacks/postCursedTeleport.lua +2 -2
  3. package/dist/callbacks/postCustomDoorEnter.lua +5 -5
  4. package/dist/callbacks/postDiceRoomActivated.lua +2 -2
  5. package/dist/callbacks/postFlip.lua +3 -3
  6. package/dist/callbacks/postGridEntity.lua +3 -3
  7. package/dist/callbacks/postGridEntityCollision.lua +3 -3
  8. package/dist/callbacks/postGridEntityRender.lua +2 -2
  9. package/dist/callbacks/postNewRoomEarly.lua +5 -5
  10. package/dist/callbacks/postPickupCollect.lua +2 -2
  11. package/dist/callbacks/postPitRender.lua +2 -2
  12. package/dist/callbacks/postPitUpdate.lua +2 -2
  13. package/dist/callbacks/postPlayerCollectible.lua +2 -2
  14. package/dist/callbacks/postPoopRender.lua +2 -2
  15. package/dist/callbacks/postPoopUpdate.lua +2 -2
  16. package/dist/callbacks/postPressurePlateRender.lua +2 -2
  17. package/dist/callbacks/postPressurePlateUpdate.lua +2 -2
  18. package/dist/callbacks/postPurchase.lua +2 -2
  19. package/dist/callbacks/postRockRender.lua +2 -2
  20. package/dist/callbacks/postRockUpdate.lua +2 -2
  21. package/dist/callbacks/postSlotInitUpdate.lua +2 -2
  22. package/dist/callbacks/postSlotRender.lua +2 -2
  23. package/dist/callbacks/postSpikesRender.lua +2 -2
  24. package/dist/callbacks/postSpikesUpdate.lua +2 -2
  25. package/dist/callbacks/postTNTRender.lua +2 -2
  26. package/dist/callbacks/postTNTUpdate.lua +2 -2
  27. package/dist/callbacks/preBerserkDeath.lua +2 -2
  28. package/dist/callbacks/preNewLevel.lua +2 -2
  29. package/dist/callbacks/subscriptions/postDoorRender.d.ts +2 -3
  30. package/dist/callbacks/subscriptions/postDoorRender.d.ts.map +1 -1
  31. package/dist/callbacks/subscriptions/postDoorRender.lua +3 -3
  32. package/dist/callbacks/subscriptions/postDoorUpdate.d.ts +2 -3
  33. package/dist/callbacks/subscriptions/postDoorUpdate.d.ts.map +1 -1
  34. package/dist/callbacks/subscriptions/postDoorUpdate.lua +3 -3
  35. package/dist/callbacks/subscriptions/postPitRender.d.ts +2 -3
  36. package/dist/callbacks/subscriptions/postPitRender.d.ts.map +1 -1
  37. package/dist/callbacks/subscriptions/postPitRender.lua +3 -3
  38. package/dist/callbacks/subscriptions/postPitUpdate.d.ts +2 -3
  39. package/dist/callbacks/subscriptions/postPitUpdate.d.ts.map +1 -1
  40. package/dist/callbacks/subscriptions/postPitUpdate.lua +3 -3
  41. package/dist/callbacks/subscriptions/postPoopRender.d.ts +2 -3
  42. package/dist/callbacks/subscriptions/postPoopRender.d.ts.map +1 -1
  43. package/dist/callbacks/subscriptions/postPoopRender.lua +3 -3
  44. package/dist/callbacks/subscriptions/postPoopUpdate.d.ts +2 -3
  45. package/dist/callbacks/subscriptions/postPoopUpdate.d.ts.map +1 -1
  46. package/dist/callbacks/subscriptions/postPoopUpdate.lua +3 -3
  47. package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts +2 -3
  48. package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts.map +1 -1
  49. package/dist/callbacks/subscriptions/postPressurePlateRender.lua +3 -3
  50. package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts +2 -3
  51. package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts.map +1 -1
  52. package/dist/callbacks/subscriptions/postPressurePlateUpdate.lua +3 -3
  53. package/dist/features/characterStats.lua +2 -2
  54. package/dist/features/collectibleItemPoolType.lua +2 -2
  55. package/dist/features/customGridEntity.d.ts.map +1 -1
  56. package/dist/features/customGridEntity.lua +5 -5
  57. package/dist/features/customStage/backdrop.lua +2 -2
  58. package/dist/features/customStage/{gridEntities.d.ts → customStageGridEntities.d.ts} +1 -1
  59. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -0
  60. package/dist/features/customStage/{gridEntities.lua → customStageGridEntities.lua} +8 -8
  61. package/dist/features/customStage/{util.d.ts → customStageUtils.d.ts} +1 -1
  62. package/dist/features/customStage/customStageUtils.d.ts.map +1 -0
  63. package/dist/features/customStage/{util.lua → customStageUtils.lua} +0 -0
  64. package/dist/features/customStage/exports.lua +4 -4
  65. package/dist/features/customStage/init.lua +6 -6
  66. package/dist/features/customStage/shadows.lua +2 -2
  67. package/dist/features/customStage/versusScreen.lua +4 -4
  68. package/dist/features/debugDisplay/v.lua +4 -4
  69. package/dist/features/deployJSONRoom.lua +20 -20
  70. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  71. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  72. package/dist/features/extraConsoleCommands/listCommands.lua +14 -14
  73. package/dist/features/pause.lua +2 -2
  74. package/dist/features/persistentEntities.lua +2 -2
  75. package/dist/features/preventCollectibleRotation.lua +2 -2
  76. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  77. package/dist/features/sirenHelpers.lua +2 -2
  78. package/dist/functions/ambush.lua +5 -5
  79. package/dist/functions/{boss.d.ts → bosses.d.ts} +22 -4
  80. package/dist/functions/bosses.d.ts.map +1 -0
  81. package/dist/functions/{boss.lua → bosses.lua} +38 -13
  82. package/dist/functions/collectibleTag.lua +2 -2
  83. package/dist/functions/collectibles.lua +5 -5
  84. package/dist/functions/{entity.d.ts → entities.d.ts} +21 -19
  85. package/dist/functions/entities.d.ts.map +1 -0
  86. package/dist/functions/{entity.lua → entities.lua} +25 -20
  87. package/dist/functions/{entitySpecific.d.ts → entitiesSpecific.d.ts} +145 -68
  88. package/dist/functions/entitiesSpecific.d.ts.map +1 -0
  89. package/dist/functions/{entitySpecific.lua → entitiesSpecific.lua} +203 -65
  90. package/dist/functions/familiars.lua +2 -2
  91. package/dist/functions/{gridEntity.d.ts → gridEntities.d.ts} +48 -17
  92. package/dist/functions/gridEntities.d.ts.map +1 -0
  93. package/dist/functions/{gridEntity.lua → gridEntities.lua} +140 -90
  94. package/dist/functions/gridEntitiesSpecific.d.ts +141 -0
  95. package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -0
  96. package/dist/functions/gridEntitiesSpecific.lua +366 -0
  97. package/dist/functions/log.lua +8 -8
  98. package/dist/functions/{npc.d.ts → npcs.d.ts} +24 -2
  99. package/dist/functions/npcs.d.ts.map +1 -0
  100. package/dist/functions/{npc.lua → npcs.lua} +44 -9
  101. package/dist/functions/pickups.d.ts +4 -119
  102. package/dist/functions/pickups.d.ts.map +1 -1
  103. package/dist/functions/pickups.lua +10 -439
  104. package/dist/functions/pickupsSpecific.d.ts +229 -0
  105. package/dist/functions/pickupsSpecific.d.ts.map +1 -0
  106. package/dist/functions/pickupsSpecific.lua +560 -0
  107. package/dist/functions/playerHealth.lua +6 -6
  108. package/dist/functions/{player.d.ts → players.d.ts} +1 -1
  109. package/dist/functions/players.d.ts.map +1 -0
  110. package/dist/functions/{player.lua → players.lua} +0 -0
  111. package/dist/functions/pocketItems.lua +2 -2
  112. package/dist/functions/positionVelocity.lua +6 -6
  113. package/dist/functions/pressurePlate.d.ts +10 -0
  114. package/dist/functions/pressurePlate.d.ts.map +1 -0
  115. package/dist/functions/pressurePlate.lua +29 -0
  116. package/dist/functions/revive.lua +7 -7
  117. package/dist/functions/rooms.lua +2 -2
  118. package/dist/functions/saveFile.lua +3 -3
  119. package/dist/functions/spawnCollectible.lua +4 -4
  120. package/dist/functions/{sprite.d.ts → sprites.d.ts} +1 -1
  121. package/dist/functions/sprites.d.ts.map +1 -0
  122. package/dist/functions/{sprite.lua → sprites.lua} +0 -0
  123. package/dist/functions/transformations.lua +2 -2
  124. package/dist/functions/trinketGive.lua +2 -2
  125. package/dist/functions/trinkets.lua +6 -6
  126. package/dist/functions/utils.d.ts +7 -0
  127. package/dist/functions/utils.d.ts.map +1 -1
  128. package/dist/functions/utils.lua +35 -22
  129. package/dist/index.d.ts +10 -8
  130. package/dist/index.d.ts.map +1 -1
  131. package/dist/index.lua +26 -10
  132. package/dist/types/AnyGridEntity.d.ts +10 -0
  133. package/dist/types/AnyGridEntity.d.ts.map +1 -0
  134. package/dist/types/AnyGridEntity.lua +2 -0
  135. package/package.json +2 -2
  136. package/src/callbacks/customRevive.ts +2 -2
  137. package/src/callbacks/postCursedTeleport.ts +1 -1
  138. package/src/callbacks/postCustomDoorEnter.ts +2 -2
  139. package/src/callbacks/postDiceRoomActivated.ts +1 -1
  140. package/src/callbacks/postFlip.ts +1 -1
  141. package/src/callbacks/postGridEntity.ts +1 -1
  142. package/src/callbacks/postGridEntityCollision.ts +1 -1
  143. package/src/callbacks/postGridEntityRender.ts +1 -1
  144. package/src/callbacks/postNewRoomEarly.ts +9 -3
  145. package/src/callbacks/postPickupCollect.ts +1 -1
  146. package/src/callbacks/postPitRender.ts +1 -1
  147. package/src/callbacks/postPitUpdate.ts +1 -1
  148. package/src/callbacks/postPlayerCollectible.ts +1 -1
  149. package/src/callbacks/postPoopRender.ts +1 -1
  150. package/src/callbacks/postPoopUpdate.ts +1 -1
  151. package/src/callbacks/postPressurePlateRender.ts +1 -1
  152. package/src/callbacks/postPressurePlateUpdate.ts +1 -1
  153. package/src/callbacks/postPurchase.ts +1 -1
  154. package/src/callbacks/postRockRender.ts +1 -1
  155. package/src/callbacks/postRockUpdate.ts +1 -1
  156. package/src/callbacks/postSlotInitUpdate.ts +1 -1
  157. package/src/callbacks/postSlotRender.ts +1 -1
  158. package/src/callbacks/postSpikesRender.ts +1 -1
  159. package/src/callbacks/postSpikesUpdate.ts +1 -1
  160. package/src/callbacks/postTNTRender.ts +1 -1
  161. package/src/callbacks/postTNTUpdate.ts +1 -1
  162. package/src/callbacks/preBerserkDeath.ts +1 -1
  163. package/src/callbacks/preNewLevel.ts +1 -1
  164. package/src/callbacks/subscriptions/postDoorRender.ts +7 -5
  165. package/src/callbacks/subscriptions/postDoorUpdate.ts +7 -5
  166. package/src/callbacks/subscriptions/postPitRender.ts +6 -7
  167. package/src/callbacks/subscriptions/postPitUpdate.ts +6 -7
  168. package/src/callbacks/subscriptions/postPoopRender.ts +7 -5
  169. package/src/callbacks/subscriptions/postPoopUpdate.ts +7 -5
  170. package/src/callbacks/subscriptions/postPressurePlateRender.ts +7 -5
  171. package/src/callbacks/subscriptions/postPressurePlateUpdate.ts +7 -5
  172. package/src/features/characterStats.ts +1 -1
  173. package/src/features/collectibleItemPoolType.ts +1 -1
  174. package/src/features/customGridEntity.ts +6 -3
  175. package/src/features/customStage/backdrop.ts +1 -1
  176. package/src/features/customStage/{gridEntities.ts → customStageGridEntities.ts} +3 -3
  177. package/src/features/customStage/{util.ts → customStageUtils.ts} +0 -0
  178. package/src/features/customStage/exports.ts +2 -2
  179. package/src/features/customStage/init.ts +1 -1
  180. package/src/features/customStage/shadows.ts +1 -1
  181. package/src/features/customStage/versusScreen.ts +2 -2
  182. package/src/features/debugDisplay/v.ts +2 -2
  183. package/src/features/deployJSONRoom.ts +11 -7
  184. package/src/features/extraConsoleCommands/commandsSubroutines.ts +2 -2
  185. package/src/features/extraConsoleCommands/listCommands.ts +10 -6
  186. package/src/features/pause.ts +1 -1
  187. package/src/features/persistentEntities.ts +1 -1
  188. package/src/features/preventCollectibleRotation.ts +1 -1
  189. package/src/features/saveDataManager/exports.ts +7 -4
  190. package/src/features/sirenHelpers.ts +1 -1
  191. package/src/functions/ambush.ts +2 -2
  192. package/src/functions/{boss.ts → bosses.ts} +29 -21
  193. package/src/functions/collectibleTag.ts +1 -1
  194. package/src/functions/collectibles.ts +2 -2
  195. package/src/functions/{entity.ts → entities.ts} +23 -21
  196. package/src/functions/{entitySpecific.ts → entitiesSpecific.ts} +170 -99
  197. package/src/functions/familiars.ts +1 -1
  198. package/src/functions/{gridEntity.ts → gridEntities.ts} +110 -34
  199. package/src/functions/gridEntitiesSpecific.ts +490 -0
  200. package/src/functions/log.ts +3 -3
  201. package/src/functions/{npc.ts → npcs.ts} +42 -11
  202. package/src/functions/pickups.ts +8 -475
  203. package/src/functions/pickupsSpecific.ts +613 -0
  204. package/src/functions/playerHealth.ts +1 -1
  205. package/src/functions/{player.ts → players.ts} +0 -0
  206. package/src/functions/pocketItems.ts +1 -1
  207. package/src/functions/positionVelocity.ts +3 -3
  208. package/src/functions/pressurePlate.ts +29 -0
  209. package/src/functions/revive.ts +2 -2
  210. package/src/functions/rooms.ts +1 -1
  211. package/src/functions/saveFile.ts +1 -1
  212. package/src/functions/spawnCollectible.ts +2 -2
  213. package/src/functions/{sprite.ts → sprites.ts} +0 -0
  214. package/src/functions/transformations.ts +1 -1
  215. package/src/functions/trinketGive.ts +1 -1
  216. package/src/functions/trinkets.ts +3 -3
  217. package/src/functions/utils.ts +32 -13
  218. package/src/index.ts +10 -8
  219. package/src/types/AnyGridEntity.ts +9 -0
  220. package/dist/features/customStage/gridEntities.d.ts.map +0 -1
  221. package/dist/features/customStage/util.d.ts.map +0 -1
  222. package/dist/functions/boss.d.ts.map +0 -1
  223. package/dist/functions/entity.d.ts.map +0 -1
  224. package/dist/functions/entitySpecific.d.ts.map +0 -1
  225. package/dist/functions/gridEntity.d.ts.map +0 -1
  226. package/dist/functions/gridEntitySpecific.d.ts +0 -29
  227. package/dist/functions/gridEntitySpecific.d.ts.map +0 -1
  228. package/dist/functions/gridEntitySpecific.lua +0 -114
  229. package/dist/functions/npc.d.ts.map +0 -1
  230. package/dist/functions/player.d.ts.map +0 -1
  231. package/dist/functions/sprite.d.ts.map +0 -1
  232. package/src/functions/gridEntitySpecific.ts +0 -143
@@ -5,7 +5,7 @@ import {
5
5
  ModCallback,
6
6
  } from "isaac-typescript-definitions";
7
7
  import { logError } from "../functions/log";
8
- import { useActiveItemTemp } from "../functions/player";
8
+ import { useActiveItemTemp } from "../functions/players";
9
9
  import { disableAllInputsExceptFor, enableAllInputs } from "./disableInputs";
10
10
  import { saveDataManager } from "./saveDataManager/exports";
11
11
 
@@ -7,7 +7,7 @@ import { game } from "../cachedClasses";
7
7
  import { ModUpgraded } from "../classes/ModUpgraded";
8
8
  import { ModCallbackCustom } from "../enums/ModCallbackCustom";
9
9
  import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
10
- import { spawn } from "../functions/entity";
10
+ import { spawn } from "../functions/entities";
11
11
  import { getRoomListIndex } from "../functions/roomData";
12
12
  import { saveDataManager } from "./saveDataManager/exports";
13
13
 
@@ -10,7 +10,7 @@ import {
10
10
  import { game } from "../cachedClasses";
11
11
  import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
12
12
  import { setCollectibleSubType } from "../functions/collectibles";
13
- import { getEntityID } from "../functions/entity";
13
+ import { getEntityID } from "../functions/entities";
14
14
  import { isCollectible } from "../functions/pickupVariants";
15
15
  import { saveDataManager } from "./saveDataManager/exports";
16
16
 
@@ -169,8 +169,11 @@ export function saveDataManagerSave(): void {
169
169
  forceSaveDataManagerSave();
170
170
  }
171
171
 
172
- declare let g: LuaTable<string, SaveData>; // Globals
173
- declare let gd: LuaTable<string, SaveData>; // Globals defaults
172
+ /** "g" stands for "globals". */
173
+ declare let g: LuaTable<string, SaveData>; // eslint-disable-line @typescript-eslint/no-unused-vars
174
+
175
+ /** "gd" stands for "globals defaults". */
176
+ declare let gd: LuaTable<string, SaveData>; // eslint-disable-line @typescript-eslint/no-unused-vars
174
177
 
175
178
  /**
176
179
  * - Sets the global variable of "g" equal to all of the save data variables for this mod.
@@ -182,8 +185,8 @@ declare let gd: LuaTable<string, SaveData>; // Globals defaults
182
185
  export function saveDataManagerSetGlobal(): void {
183
186
  errorIfFeaturesNotInitialized(SAVE_DATA_MANAGER_FEATURE_NAME);
184
187
 
185
- g = saveDataMap; // eslint-disable-line @typescript-eslint/no-unused-vars
186
- gd = saveDataDefaultsMap; // eslint-disable-line @typescript-eslint/no-unused-vars
188
+ g = saveDataMap;
189
+ gd = saveDataDefaultsMap;
187
190
  }
188
191
 
189
192
  /**
@@ -4,7 +4,7 @@ import {
4
4
  ModCallback,
5
5
  } from "isaac-typescript-definitions";
6
6
  import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
7
- import { getEntities } from "../functions/entity";
7
+ import { getEntities } from "../functions/entities";
8
8
  import { saveDataManager } from "./saveDataManager/exports";
9
9
 
10
10
  const FEATURE_NAME = "sirenHelpers";
@@ -1,7 +1,7 @@
1
1
  import { SackSubType } from "isaac-typescript-definitions";
2
2
  import { runNextGameFrame } from "../features/runInNFrames";
3
- import { removeEntities } from "./entity";
4
- import { getCoins, spawnSackWithSeed } from "./pickups";
3
+ import { removeEntities } from "./entities";
4
+ import { getCoins, spawnSackWithSeed } from "./pickupsSpecific";
5
5
 
6
6
  /** Hard-coding this makes it easier to clean up the pickups afterwards. */
7
7
  const SACK_SEED_THAT_SPAWNS_TWO_COINS = 6 as Seed;
@@ -10,8 +10,8 @@ import {
10
10
  STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP,
11
11
  } from "../sets/bossSets";
12
12
  import { SIN_ENTITY_TYPES_SET } from "../sets/sinEntityTypesSet";
13
- import { getNPCs, spawnNPC } from "./entitySpecific";
14
- import { getAliveNPCs } from "./npc";
13
+ import { getNPCs, spawnNPC } from "./entitiesSpecific";
14
+ import { getAliveNPCs } from "./npcs";
15
15
  import { isRNG } from "./rng";
16
16
  import { copySet } from "./set";
17
17
  import { repeat } from "./utils";
@@ -31,19 +31,22 @@ const DEFAULT_BOSS_MULTI_SEGMENTS = 4;
31
31
  *
32
32
  * This function will not include bosses on an internal blacklist, such as Death's scythes or Big
33
33
  * Horn holes.
34
+ *
35
+ * @param entityType Optional. If specified, will only get the bosses that match the type. Default
36
+ * is -1, which matches every type.
37
+ * @param variant Optional. If specified, will only get the bosses that match the variant. Default
38
+ * is -1, which matches every variant.
39
+ * @param subType Optional. If specified, will only get the bosses that match the sub-type. Default
40
+ * is -1, which matches every sub-type.
41
+ * @param ignoreFriendly Optional. Default is false.
34
42
  */
35
43
  export function getAliveBosses(
36
- matchingEntityType?: EntityType,
37
- matchingVariant?: int,
38
- matchingSubType?: int,
44
+ entityType: EntityType = -1,
45
+ variant = -1,
46
+ subType = -1,
39
47
  ignoreFriendly = false,
40
48
  ): EntityNPC[] {
41
- const aliveNPCs = getAliveNPCs(
42
- matchingEntityType,
43
- matchingVariant,
44
- matchingSubType,
45
- ignoreFriendly,
46
- );
49
+ const aliveNPCs = getAliveNPCs(entityType, variant, subType, ignoreFriendly);
47
50
  return aliveNPCs.filter((aliveNPC) => aliveNPC.IsBoss());
48
51
  }
49
52
 
@@ -83,19 +86,24 @@ export function getBossSet(
83
86
  return copySet(bossSet);
84
87
  }
85
88
 
86
- /** Helper function to get all of the bosses in the room. */
89
+ /**
90
+ * Helper function to get all of the bosses in the room.
91
+ *
92
+ * @param entityType Optional. If specified, will only get the bosses that match the type. Default
93
+ * is -1, which matches every type.
94
+ * @param variant Optional. If specified, will only get the bosses that match the variant. Default
95
+ * is -1, which matches every variant.
96
+ * @param subType Optional. If specified, will only get the bosses that match the sub-type. Default
97
+ * is -1, which matches every sub-type.
98
+ * @param ignoreFriendly Optional. Default is false.
99
+ */
87
100
  export function getBosses(
88
- matchingEntityType?: EntityType,
89
- matchingVariant?: int,
90
- matchingSubType?: int,
101
+ entityType?: EntityType,
102
+ variant?: int,
103
+ subType?: int,
91
104
  ignoreFriendly = false,
92
105
  ): EntityNPC[] {
93
- const npcs = getNPCs(
94
- matchingEntityType,
95
- matchingVariant,
96
- matchingSubType,
97
- ignoreFriendly,
98
- );
106
+ const npcs = getNPCs(entityType, variant, subType, ignoreFriendly);
99
107
  return npcs.filter((npc) => npc.IsBoss());
100
108
  }
101
109
 
@@ -3,7 +3,7 @@ import { itemConfig } from "../cachedClasses";
3
3
  import { getCollectibleArray } from "./collectibleSet";
4
4
  import { getEnumValues } from "./enums";
5
5
  import { getFlagName } from "./flag";
6
- import { getPlayerCollectibleCount } from "./player";
6
+ import { getPlayerCollectibleCount } from "./players";
7
7
  import { copySet } from "./set";
8
8
 
9
9
  const TAG_TO_COLLECTIBLE_TYPES_MAP = new Map<
@@ -27,10 +27,10 @@ import {
27
27
  } from "../maps/collectibleNameMap";
28
28
  import { SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET } from "../sets/singleUseActiveCollectibleTypesSet";
29
29
  import { CollectibleIndex } from "../types/CollectibleIndex";
30
- import { getEntityID } from "./entity";
30
+ import { getEntityID } from "./entities";
31
31
  import { isCollectible } from "./pickupVariants";
32
32
  import { getRoomListIndex } from "./roomData";
33
- import { clearSprite, spriteEquals } from "./sprite";
33
+ import { clearSprite, spriteEquals } from "./sprites";
34
34
  import { irange } from "./utils";
35
35
 
36
36
  const COLLECTIBLE_SPRITE_LAYER = 1;
@@ -13,10 +13,10 @@ import { isPrimitive } from "./types";
13
13
  * `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
14
14
  * enemies.
15
15
  *
16
- * @param entityType Default is -1. -1 matches every entity type.
17
- * @param variant Default is -1. -1 matches every variant.
18
- * @param subType Default is -1. -1 matches every sub-type.
19
- * @param ignoreFriendly Default is false.
16
+ * @param entityType Optional. Default is -1, which matches every entity type.
17
+ * @param variant Optional. Default is -1, which matches every variant.
18
+ * @param subType Optional. Default is -1, which matches every sub-type.
19
+ * @param ignoreFriendly Optional. Default is false.
20
20
  */
21
21
  export function countEntities(
22
22
  entityType: EntityType = -1,
@@ -43,10 +43,10 @@ export function countEntities(
43
43
  * Helper function to check if one or more of a specific kind of entity is present in the current
44
44
  * room. It uses the `countEntities` helper function to determine this.
45
45
  *
46
- * @param entityType Default is -1. -1 matches every entity type.
47
- * @param variant Default is -1. -1 matches every variant.
48
- * @param subType Default is -1. -1 matches every sub-type.
49
- * @param ignoreFriendly Default is false.
46
+ * @param entityType Optional. Default is -1, which matches every entity type.
47
+ * @param variant Optional. Default is -1, which matches every variant.
48
+ * @param subType Optional. Default is -1, which matches every sub-type.
49
+ * @param ignoreFriendly Optional. Default is false.
50
50
  */
51
51
  export function doesEntityExist(
52
52
  entityType: EntityType = -1,
@@ -99,28 +99,29 @@ export function getClosestEntityTo<T extends AnyEntity>(
99
99
  * For example:
100
100
  *
101
101
  * ```ts
102
- * // Make all of the entities in the room invisible
102
+ * // Make all of the entities in the room invisible.
103
103
  * for (const entity of getEntities()) {
104
104
  * entity.Visible = false;
105
105
  * }
106
106
  * ```
107
107
  *
108
- * @param entityType Optional. If specified, will only return NPCs that match this entity type.
109
- * @param variant Optional. If specified, will only return NPCs that match this variant. Default is
110
- * -1. -1 matches every variant.
111
- * @param subType Optional. If specified, will only return NPCs that match this sub-type. Default is
112
- * -1. -1 matches every sub-type.
108
+ * @param entityType Optional. If specified, will only get the entities that match the type. Default
109
+ * is -1, which matches every type.
110
+ * @param variant Optional. If specified, will only get the entities that match the variant. Default
111
+ * is -1, which matches every variant.
112
+ * @param subType Optional. If specified, will only get the entities that match the sub-type.
113
+ * Default is -1, which matches every sub-type.
113
114
  * @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
114
- * returned. Default is false. Will only be taken into account if
115
- * `matchingEntityType` is specified.
115
+ * returned. Default is false. Will only be taken into account if the
116
+ * `entityType` is specified.
116
117
  */
117
118
  export function getEntities(
118
- entityType?: EntityType,
119
+ entityType: EntityType = -1,
119
120
  variant = -1,
120
121
  subType = -1,
121
122
  ignoreFriendly = false,
122
123
  ): Entity[] {
123
- if (entityType === undefined) {
124
+ if ((entityType as int) === -1) {
124
125
  return Isaac.GetRoomEntities();
125
126
  }
126
127
 
@@ -317,8 +318,9 @@ export function parseEntityTypeVariantString(
317
318
  * Helper function to remove all of the matching entities in the room.
318
319
  *
319
320
  * @param entityType The entity type to match.
320
- * @param entityVariant Optional. The variant to match. Default is -1. -1 matches every variant.
321
- * @param entitySubType Optional. The sub-type to match. Default is -1. -1 matches every sub-type.
321
+ * @param entityVariant Optional. The variant to match. Default is -1, which matches every variant.
322
+ * @param entitySubType Optional. The sub-type to match. Default is -1, which matches every
323
+ * sub-type.
322
324
  * @param cap Optional. If specified, will only remove the given amount of collectibles.
323
325
  * @returns An array of the entities that were removed.
324
326
  */
@@ -353,7 +355,7 @@ export function removeEntities<T extends AnyEntity>(
353
355
 
354
356
  entitiesRemoved.push(entity);
355
357
  if (cap !== undefined && entitiesRemoved.length >= cap) {
356
- return entitiesRemoved;
358
+ break;
357
359
  }
358
360
  }
359
361