isaacscript-common 6.6.3 → 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 (262) hide show
  1. package/dist/callbacks/customRevive.lua +4 -4
  2. package/dist/callbacks/postCursedTeleport.lua +2 -2
  3. package/dist/callbacks/postCustomDoorEnter.d.ts +1 -1
  4. package/dist/callbacks/postCustomDoorEnter.lua +6 -6
  5. package/dist/callbacks/postDiceRoomActivated.lua +2 -2
  6. package/dist/callbacks/postFlip.lua +3 -3
  7. package/dist/callbacks/postGridEntity.lua +3 -3
  8. package/dist/callbacks/postGridEntityCollision.lua +3 -3
  9. package/dist/callbacks/postGridEntityRender.lua +2 -2
  10. package/dist/callbacks/postNewRoomEarly.lua +5 -5
  11. package/dist/callbacks/postPickupCollect.lua +2 -2
  12. package/dist/callbacks/postPitRender.lua +2 -2
  13. package/dist/callbacks/postPitUpdate.lua +2 -2
  14. package/dist/callbacks/postPlayerCollectible.lua +2 -2
  15. package/dist/callbacks/postPoopRender.lua +2 -2
  16. package/dist/callbacks/postPoopUpdate.lua +2 -2
  17. package/dist/callbacks/postPressurePlateRender.lua +2 -2
  18. package/dist/callbacks/postPressurePlateUpdate.lua +2 -2
  19. package/dist/callbacks/postPurchase.lua +2 -2
  20. package/dist/callbacks/postRockRender.lua +2 -2
  21. package/dist/callbacks/postRockUpdate.lua +2 -2
  22. package/dist/callbacks/postSlotInitUpdate.lua +2 -2
  23. package/dist/callbacks/postSlotRender.lua +2 -2
  24. package/dist/callbacks/postSpikesRender.lua +2 -2
  25. package/dist/callbacks/postSpikesUpdate.lua +2 -2
  26. package/dist/callbacks/postTNTRender.lua +2 -2
  27. package/dist/callbacks/postTNTUpdate.lua +2 -2
  28. package/dist/callbacks/preBerserkDeath.lua +2 -2
  29. package/dist/callbacks/preNewLevel.lua +2 -2
  30. package/dist/callbacks/subscriptions/postDoorRender.d.ts +2 -3
  31. package/dist/callbacks/subscriptions/postDoorRender.d.ts.map +1 -1
  32. package/dist/callbacks/subscriptions/postDoorRender.lua +3 -3
  33. package/dist/callbacks/subscriptions/postDoorUpdate.d.ts +2 -3
  34. package/dist/callbacks/subscriptions/postDoorUpdate.d.ts.map +1 -1
  35. package/dist/callbacks/subscriptions/postDoorUpdate.lua +3 -3
  36. package/dist/callbacks/subscriptions/postPitRender.d.ts +2 -3
  37. package/dist/callbacks/subscriptions/postPitRender.d.ts.map +1 -1
  38. package/dist/callbacks/subscriptions/postPitRender.lua +3 -3
  39. package/dist/callbacks/subscriptions/postPitUpdate.d.ts +2 -3
  40. package/dist/callbacks/subscriptions/postPitUpdate.d.ts.map +1 -1
  41. package/dist/callbacks/subscriptions/postPitUpdate.lua +3 -3
  42. package/dist/callbacks/subscriptions/postPoopRender.d.ts +2 -3
  43. package/dist/callbacks/subscriptions/postPoopRender.d.ts.map +1 -1
  44. package/dist/callbacks/subscriptions/postPoopRender.lua +3 -3
  45. package/dist/callbacks/subscriptions/postPoopUpdate.d.ts +2 -3
  46. package/dist/callbacks/subscriptions/postPoopUpdate.d.ts.map +1 -1
  47. package/dist/callbacks/subscriptions/postPoopUpdate.lua +3 -3
  48. package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts +2 -3
  49. package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts.map +1 -1
  50. package/dist/callbacks/subscriptions/postPressurePlateRender.lua +3 -3
  51. package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts +2 -3
  52. package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts.map +1 -1
  53. package/dist/callbacks/subscriptions/postPressurePlateUpdate.lua +3 -3
  54. package/dist/enums/private/SerializationBrand.d.ts +0 -4
  55. package/dist/enums/private/SerializationBrand.d.ts.map +1 -1
  56. package/dist/features/characterStats.lua +2 -2
  57. package/dist/features/collectibleItemPoolType.lua +2 -2
  58. package/dist/features/customGridEntity.d.ts.map +1 -1
  59. package/dist/features/customGridEntity.lua +5 -5
  60. package/dist/features/customStage/backdrop.lua +2 -2
  61. package/dist/features/customStage/{gridEntities.d.ts → customStageGridEntities.d.ts} +1 -1
  62. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -0
  63. package/dist/features/customStage/{gridEntities.lua → customStageGridEntities.lua} +8 -8
  64. package/dist/features/customStage/{util.d.ts → customStageUtils.d.ts} +1 -1
  65. package/dist/features/customStage/customStageUtils.d.ts.map +1 -0
  66. package/dist/features/customStage/{util.lua → customStageUtils.lua} +0 -0
  67. package/dist/features/customStage/exports.lua +4 -4
  68. package/dist/features/customStage/init.lua +6 -6
  69. package/dist/features/customStage/shadows.lua +2 -2
  70. package/dist/features/customStage/versusScreen.lua +4 -4
  71. package/dist/features/debugDisplay/v.lua +4 -4
  72. package/dist/features/deployJSONRoom.lua +20 -20
  73. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  74. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  75. package/dist/features/extraConsoleCommands/listCommands.lua +14 -14
  76. package/dist/features/pause.lua +2 -2
  77. package/dist/features/persistentEntities.lua +2 -2
  78. package/dist/features/preventCollectibleRotation.lua +2 -2
  79. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  80. package/dist/features/saveDataManager/merge.lua +4 -3
  81. package/dist/features/sirenHelpers.lua +2 -2
  82. package/dist/functions/ambush.lua +5 -5
  83. package/dist/functions/array.d.ts.map +1 -1
  84. package/dist/functions/array.lua +1 -1
  85. package/dist/functions/{boss.d.ts → bosses.d.ts} +22 -4
  86. package/dist/functions/bosses.d.ts.map +1 -0
  87. package/dist/functions/{boss.lua → bosses.lua} +38 -13
  88. package/dist/functions/collectibleTag.lua +2 -2
  89. package/dist/functions/collectibles.lua +5 -5
  90. package/dist/functions/deepCopy.d.ts +8 -5
  91. package/dist/functions/deepCopy.d.ts.map +1 -1
  92. package/dist/functions/deepCopy.lua +142 -38
  93. package/dist/functions/deepCopyTests.d.ts +6 -1
  94. package/dist/functions/deepCopyTests.d.ts.map +1 -1
  95. package/dist/functions/deepCopyTests.lua +19 -16
  96. package/dist/functions/{entity.d.ts → entities.d.ts} +21 -19
  97. package/dist/functions/entities.d.ts.map +1 -0
  98. package/dist/functions/{entity.lua → entities.lua} +25 -20
  99. package/dist/functions/{entitySpecific.d.ts → entitiesSpecific.d.ts} +145 -68
  100. package/dist/functions/entitiesSpecific.d.ts.map +1 -0
  101. package/dist/functions/{entitySpecific.lua → entitiesSpecific.lua} +203 -65
  102. package/dist/functions/familiars.lua +2 -2
  103. package/dist/functions/{gridEntity.d.ts → gridEntities.d.ts} +48 -17
  104. package/dist/functions/gridEntities.d.ts.map +1 -0
  105. package/dist/functions/{gridEntity.lua → gridEntities.lua} +140 -90
  106. package/dist/functions/gridEntitiesSpecific.d.ts +141 -0
  107. package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -0
  108. package/dist/functions/gridEntitiesSpecific.lua +366 -0
  109. package/dist/functions/log.d.ts +1 -1
  110. package/dist/functions/log.d.ts.map +1 -1
  111. package/dist/functions/log.lua +16 -12
  112. package/dist/functions/mergeTests.d.ts +7 -1
  113. package/dist/functions/mergeTests.d.ts.map +1 -1
  114. package/dist/functions/mergeTests.lua +86 -7
  115. package/dist/functions/{npc.d.ts → npcs.d.ts} +24 -2
  116. package/dist/functions/npcs.d.ts.map +1 -0
  117. package/dist/functions/{npc.lua → npcs.lua} +44 -9
  118. package/dist/functions/pickups.d.ts +4 -119
  119. package/dist/functions/pickups.d.ts.map +1 -1
  120. package/dist/functions/pickups.lua +10 -439
  121. package/dist/functions/pickupsSpecific.d.ts +229 -0
  122. package/dist/functions/pickupsSpecific.d.ts.map +1 -0
  123. package/dist/functions/pickupsSpecific.lua +560 -0
  124. package/dist/functions/playerHealth.lua +6 -6
  125. package/dist/functions/{player.d.ts → players.d.ts} +1 -1
  126. package/dist/functions/players.d.ts.map +1 -0
  127. package/dist/functions/{player.lua → players.lua} +0 -0
  128. package/dist/functions/pocketItems.lua +2 -2
  129. package/dist/functions/positionVelocity.lua +6 -6
  130. package/dist/functions/pressurePlate.d.ts +10 -0
  131. package/dist/functions/pressurePlate.d.ts.map +1 -0
  132. package/dist/functions/pressurePlate.lua +29 -0
  133. package/dist/functions/revive.lua +7 -7
  134. package/dist/functions/rooms.lua +2 -2
  135. package/dist/functions/saveFile.lua +3 -3
  136. package/dist/functions/spawnCollectible.lua +4 -4
  137. package/dist/functions/{sprite.d.ts → sprites.d.ts} +1 -1
  138. package/dist/functions/sprites.d.ts.map +1 -0
  139. package/dist/functions/{sprite.lua → sprites.lua} +0 -0
  140. package/dist/functions/table.d.ts +1 -1
  141. package/dist/functions/table.lua +1 -1
  142. package/dist/functions/transformations.lua +2 -2
  143. package/dist/functions/trinketGive.lua +2 -2
  144. package/dist/functions/trinkets.lua +6 -6
  145. package/dist/functions/utils.d.ts +7 -0
  146. package/dist/functions/utils.d.ts.map +1 -1
  147. package/dist/functions/utils.lua +35 -22
  148. package/dist/index.d.ts +10 -8
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.lua +26 -10
  151. package/dist/types/AnyGridEntity.d.ts +10 -0
  152. package/dist/types/AnyGridEntity.d.ts.map +1 -0
  153. package/dist/types/AnyGridEntity.lua +2 -0
  154. package/package.json +2 -2
  155. package/src/callbacks/customRevive.ts +2 -2
  156. package/src/callbacks/postCursedTeleport.ts +2 -2
  157. package/src/callbacks/postCustomDoorEnter.ts +3 -3
  158. package/src/callbacks/postDiceRoomActivated.ts +1 -1
  159. package/src/callbacks/postFlip.ts +1 -1
  160. package/src/callbacks/postGridEntity.ts +1 -1
  161. package/src/callbacks/postGridEntityCollision.ts +1 -1
  162. package/src/callbacks/postGridEntityRender.ts +1 -1
  163. package/src/callbacks/postNewRoomEarly.ts +9 -3
  164. package/src/callbacks/postPickupCollect.ts +1 -1
  165. package/src/callbacks/postPitRender.ts +1 -1
  166. package/src/callbacks/postPitUpdate.ts +1 -1
  167. package/src/callbacks/postPlayerCollectible.ts +2 -2
  168. package/src/callbacks/postPoopRender.ts +1 -1
  169. package/src/callbacks/postPoopUpdate.ts +1 -1
  170. package/src/callbacks/postPressurePlateRender.ts +1 -1
  171. package/src/callbacks/postPressurePlateUpdate.ts +1 -1
  172. package/src/callbacks/postPurchase.ts +1 -1
  173. package/src/callbacks/postRockRender.ts +1 -1
  174. package/src/callbacks/postRockUpdate.ts +1 -1
  175. package/src/callbacks/postSacrifice.ts +1 -1
  176. package/src/callbacks/postSlotInitUpdate.ts +1 -1
  177. package/src/callbacks/postSlotRender.ts +1 -1
  178. package/src/callbacks/postSpikesRender.ts +1 -1
  179. package/src/callbacks/postSpikesUpdate.ts +1 -1
  180. package/src/callbacks/postTNTRender.ts +1 -1
  181. package/src/callbacks/postTNTUpdate.ts +1 -1
  182. package/src/callbacks/preBerserkDeath.ts +1 -1
  183. package/src/callbacks/preNewLevel.ts +1 -1
  184. package/src/callbacks/subscriptions/postDoorRender.ts +7 -5
  185. package/src/callbacks/subscriptions/postDoorUpdate.ts +7 -5
  186. package/src/callbacks/subscriptions/postPitRender.ts +6 -7
  187. package/src/callbacks/subscriptions/postPitUpdate.ts +6 -7
  188. package/src/callbacks/subscriptions/postPoopRender.ts +7 -5
  189. package/src/callbacks/subscriptions/postPoopUpdate.ts +7 -5
  190. package/src/callbacks/subscriptions/postPressurePlateRender.ts +7 -5
  191. package/src/callbacks/subscriptions/postPressurePlateUpdate.ts +7 -5
  192. package/src/enums/private/SerializationBrand.ts +0 -4
  193. package/src/features/characterStats.ts +1 -1
  194. package/src/features/collectibleItemPoolType.ts +1 -1
  195. package/src/features/customGridEntity.ts +6 -3
  196. package/src/features/customStage/backdrop.ts +1 -1
  197. package/src/features/customStage/{gridEntities.ts → customStageGridEntities.ts} +3 -3
  198. package/src/features/customStage/{util.ts → customStageUtils.ts} +0 -0
  199. package/src/features/customStage/exports.ts +2 -2
  200. package/src/features/customStage/init.ts +1 -1
  201. package/src/features/customStage/shadows.ts +1 -1
  202. package/src/features/customStage/versusScreen.ts +2 -2
  203. package/src/features/debugDisplay/v.ts +2 -2
  204. package/src/features/deployJSONRoom.ts +11 -7
  205. package/src/features/extraConsoleCommands/commandsSubroutines.ts +2 -2
  206. package/src/features/extraConsoleCommands/listCommands.ts +13 -9
  207. package/src/features/pause.ts +1 -1
  208. package/src/features/persistentEntities.ts +2 -2
  209. package/src/features/preventCollectibleRotation.ts +1 -1
  210. package/src/features/saveDataManager/exports.ts +7 -4
  211. package/src/features/saveDataManager/merge.ts +3 -3
  212. package/src/features/sirenHelpers.ts +1 -1
  213. package/src/functions/ambush.ts +2 -2
  214. package/src/functions/array.ts +5 -2
  215. package/src/functions/bitwise.ts +2 -2
  216. package/src/functions/{boss.ts → bosses.ts} +29 -21
  217. package/src/functions/collectibleTag.ts +1 -1
  218. package/src/functions/collectibles.ts +2 -2
  219. package/src/functions/deepCopy.ts +98 -19
  220. package/src/functions/deepCopyTests.ts +75 -19
  221. package/src/functions/{entity.ts → entities.ts} +23 -21
  222. package/src/functions/{entitySpecific.ts → entitiesSpecific.ts} +170 -99
  223. package/src/functions/familiars.ts +1 -1
  224. package/src/functions/{gridEntity.ts → gridEntities.ts} +110 -34
  225. package/src/functions/gridEntitiesSpecific.ts +490 -0
  226. package/src/functions/log.ts +19 -10
  227. package/src/functions/mergeTests.ts +152 -4
  228. package/src/functions/{npc.ts → npcs.ts} +42 -11
  229. package/src/functions/pickups.ts +8 -475
  230. package/src/functions/pickupsSpecific.ts +613 -0
  231. package/src/functions/playerHealth.ts +1 -1
  232. package/src/functions/{player.ts → players.ts} +0 -0
  233. package/src/functions/pocketItems.ts +1 -1
  234. package/src/functions/positionVelocity.ts +3 -3
  235. package/src/functions/pressurePlate.ts +29 -0
  236. package/src/functions/revive.ts +2 -2
  237. package/src/functions/rooms.ts +1 -1
  238. package/src/functions/saveFile.ts +1 -1
  239. package/src/functions/spawnCollectible.ts +2 -2
  240. package/src/functions/{sprite.ts → sprites.ts} +0 -0
  241. package/src/functions/table.ts +1 -1
  242. package/src/functions/transformations.ts +1 -1
  243. package/src/functions/trinketGive.ts +4 -4
  244. package/src/functions/trinkets.ts +3 -3
  245. package/src/functions/tstlClass.ts +1 -1
  246. package/src/functions/ui.ts +3 -3
  247. package/src/functions/utils.ts +32 -13
  248. package/src/index.ts +10 -8
  249. package/src/types/AnyGridEntity.ts +9 -0
  250. package/dist/features/customStage/gridEntities.d.ts.map +0 -1
  251. package/dist/features/customStage/util.d.ts.map +0 -1
  252. package/dist/functions/boss.d.ts.map +0 -1
  253. package/dist/functions/entity.d.ts.map +0 -1
  254. package/dist/functions/entitySpecific.d.ts.map +0 -1
  255. package/dist/functions/gridEntity.d.ts.map +0 -1
  256. package/dist/functions/gridEntitySpecific.d.ts +0 -29
  257. package/dist/functions/gridEntitySpecific.d.ts.map +0 -1
  258. package/dist/functions/gridEntitySpecific.lua +0 -114
  259. package/dist/functions/npc.d.ts.map +0 -1
  260. package/dist/functions/player.d.ts.map +0 -1
  261. package/dist/functions/sprite.d.ts.map +0 -1
  262. package/src/functions/gridEntitySpecific.ts +0 -143
@@ -6,30 +6,30 @@ import {
6
6
  KnifeVariant,
7
7
  LaserVariant,
8
8
  PickupVariant,
9
- ProjectilesMode,
10
9
  ProjectileVariant,
11
10
  SlotVariant,
12
11
  TearVariant,
13
12
  } from "isaac-typescript-definitions";
14
13
  import { VectorZero } from "../constants";
15
- import {
16
- getEntities,
17
- getFilteredNewEntities,
18
- removeEntities,
19
- spawn,
20
- } from "./entity";
14
+ import { getEntities, removeEntities, spawn } from "./entities";
21
15
 
22
16
  /**
23
- * Helper function to get all of the `EntityType.BOMB` in the room.
17
+ * Helper function to get all of the bombs in the room. (Specifically, this refers to the
18
+ * `EntityBomb` class, not bomb pickups.)
24
19
  *
25
20
  * For example:
26
21
  *
27
22
  * ```ts
28
- * // Make all of the bombs in the room invisible
23
+ * // Make all of the bombs in the room invisible.
29
24
  * for (const bomb of getBombs()) {
30
25
  * bomb.Visible = false;
31
26
  * }
32
27
  * ```
28
+ *
29
+ * @param bombVariant Optional. If specified, will only get the bombs that match the variant.
30
+ * Default is -1, which matches every variant.
31
+ * @param subType Optional. If specified, will only get the bombs that match the sub-type. Default
32
+ * is -1, which matches every sub-type.
33
33
  */
34
34
  export function getBombs(
35
35
  bombVariant: BombVariant = -1,
@@ -49,16 +49,21 @@ export function getBombs(
49
49
  }
50
50
 
51
51
  /**
52
- * Helper function to get all of the `EntityType.EFFECT` in the room.
52
+ * Helper function to get all of the effects in the room.
53
53
  *
54
54
  * For example:
55
55
  *
56
56
  * ```ts
57
- * // Make all of the effects in the room invisible
57
+ * // Make all of the effects in the room invisible.
58
58
  * for (const effect of getEffects()) {
59
59
  * effect.Visible = false;
60
60
  * }
61
61
  * ```
62
+ *
63
+ * @param effectVariant Optional. If specified, will only get the effects that match the variant.
64
+ * Default is -1, which matches every variant.
65
+ * @param subType Optional. If specified, will only get the effects that match the sub-type. Default
66
+ * is -1, which matches every sub-type.
62
67
  */
63
68
  export function getEffects(
64
69
  effectVariant: EffectVariant = -1,
@@ -83,11 +88,16 @@ export function getEffects(
83
88
  * For example:
84
89
  *
85
90
  * ```ts
86
- * // Make all of the familiars in the room invisible
91
+ * // Make all of the familiars in the room invisible.
87
92
  * for (const familiar of getFamiliars()) {
88
93
  * familiar.Visible = false;
89
94
  * }
90
95
  * ```
96
+ *
97
+ * @param familiarVariant Optional. If specified, will only get the familiars that match the
98
+ * variant. Default is -1, which matches every variant.
99
+ * @param subType Optional. If specified, will only get the familiars that match the sub-type.
100
+ * Default is -1, which matches every sub-type.
91
101
  */
92
102
  export function getFamiliars(
93
103
  familiarVariant: FamiliarVariant = -1,
@@ -107,16 +117,21 @@ export function getFamiliars(
107
117
  }
108
118
 
109
119
  /**
110
- * Helper function to get all of the `EntityType.KNIFE` in the room.
120
+ * Helper function to get all of the knives in the room.
111
121
  *
112
122
  * For example:
113
123
  *
114
124
  * ```ts
115
- * // Make all of the knives in the room invisible
125
+ * // Make all of the knives in the room invisible.
116
126
  * for (const knife of getKnives()) {
117
127
  * knife.Visible = false;
118
128
  * }
119
129
  * ```
130
+ *
131
+ * @param knifeVariant Optional. If specified, will only get the knives that match the variant.
132
+ * Default is -1, which matches every variant.
133
+ * @param subType Optional. If specified, will only get the knives that match the sub-type. Default
134
+ * is -1, which matches every sub-type.
120
135
  */
121
136
  export function getKnives(
122
137
  knifeVariant: KnifeVariant = -1,
@@ -136,16 +151,21 @@ export function getKnives(
136
151
  }
137
152
 
138
153
  /**
139
- * Helper function to get all of the `EntityType.LASER` in the room.
154
+ * Helper function to get all of the lasers in the room.
140
155
  *
141
156
  * For example:
142
157
  *
143
158
  * ```ts
144
- * // Make all of the lasers in the room invisible
159
+ * // Make all of the lasers in the room invisible.
145
160
  * for (const laser of getLasers()) {
146
161
  * laser.Visible = false;
147
162
  * }
148
163
  * ```
164
+ *
165
+ * @param laserVariant Optional. If specified, will only get the lasers that match the variant.
166
+ * Default is -1, which matches every variant.
167
+ * @param subType Optional. If specified, will only get the lasers that match the sub-type. Default
168
+ * is -1, which matches every sub-type.
149
169
  */
150
170
  export function getLasers(
151
171
  laserVariant: LaserVariant = -1,
@@ -164,11 +184,23 @@ export function getLasers(
164
184
  return lasers;
165
185
  }
166
186
 
167
- /** The same thing as the `getEntities` function, but returns only NPCs. */
187
+ /**
188
+ * Helper function to get all of the NPCs in the room.
189
+ *
190
+ * @param entityType Optional. If specified, will only get the NPCs that match the type. Default is
191
+ * -1, which matches every entity type.
192
+ * @param variant Optional. If specified, will only get the NPCs that match the variant. Default is
193
+ * -1, which matches every entity type.
194
+ * @param subType Optional. If specified, will only get the bombs that match the sub-type. Default
195
+ * is -1, which matches every sub-type.
196
+ * @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
197
+ * returned. Default is false. Will only be taken into account if the
198
+ * `entityType` is specified.
199
+ */
168
200
  export function getNPCs(
169
- entityType?: EntityType,
170
- variant?: int,
171
- subType?: int,
201
+ entityType: EntityType = -1,
202
+ variant = -1,
203
+ subType = -1,
172
204
  ignoreFriendly = false,
173
205
  ): EntityNPC[] {
174
206
  const entities = getEntities(entityType, variant, subType, ignoreFriendly);
@@ -190,11 +222,16 @@ export function getNPCs(
190
222
  * For example:
191
223
  *
192
224
  * ```ts
193
- * // Make all of the pickups in the room invisible
225
+ * // Make all of the pickups in the room invisible.
194
226
  * for (const pickup of getPickups()) {
195
227
  * pickup.Visible = false;
196
228
  * }
197
229
  * ```
230
+ *
231
+ * @param pickupVariant Optional. If specified, will only get the pickups that match the variant.
232
+ * Default is -1, which matches every entity type.
233
+ * @param subType Optional. If specified, will only get the pickups that match the sub-type. Default
234
+ * is -1, which matches every sub-type.
198
235
  */
199
236
  export function getPickups(
200
237
  pickupVariant: PickupVariant = -1,
@@ -214,16 +251,21 @@ export function getPickups(
214
251
  }
215
252
 
216
253
  /**
217
- * Helper function to get all of the `EntityType.PROJECTILE` in the room.
254
+ * Helper function to get all of the projectiles in the room.
218
255
  *
219
256
  * For example:
220
257
  *
221
258
  * ```ts
222
- * // Make all of the projectiles in the room invisible
259
+ * // Make all of the projectiles in the room invisible.
223
260
  * for (const projectile of getProjectiles()) {
224
261
  * projectile.Visible = false;
225
262
  * }
226
263
  * ```
264
+ *
265
+ * @param projectileVariant Optional. If specified, will only get the projectiles that match the
266
+ * variant. Default is -1, which matches every entity type.
267
+ * @param subType Optional. If specified, will only get the projectiles that match the sub-type.
268
+ * Default is -1, which matches every sub-type.
227
269
  */
228
270
  export function getProjectiles(
229
271
  projectileVariant: ProjectileVariant = -1,
@@ -247,16 +289,21 @@ export function getProjectiles(
247
289
  }
248
290
 
249
291
  /**
250
- * Helper function to get all of the `EntityType.SLOT` in the room.
292
+ * Helper function to get all of the slots in the room.
251
293
  *
252
294
  * For example:
253
295
  *
254
296
  * ```ts
255
- * // Make all of the slots in the room invisible
297
+ * // Make all of the slots in the room invisible.
256
298
  * for (const slot of getSlots()) {
257
299
  * slot.Visible = false;
258
300
  * }
259
301
  * ```
302
+ *
303
+ * @param slotVariant Optional. If specified, will only get the slots that match the variant.
304
+ * Default is -1, which matches every entity type.
305
+ * @param subType Optional. If specified, will only get the slots that match the sub-type. Default
306
+ * is -1, which matches every sub-type.
260
307
  */
261
308
  export function getSlots(
262
309
  slotVariant: SlotVariant = -1,
@@ -268,16 +315,21 @@ export function getSlots(
268
315
  }
269
316
 
270
317
  /**
271
- * Helper function to get all of the `EntityType.TEAR` in the room.
318
+ * Helper function to get all of the tears in the room.
272
319
  *
273
320
  * For example:
274
321
  *
275
322
  * ```ts
276
- * // Make all of the tears in the room invisible
323
+ * // Make all of the tears in the room invisible.
277
324
  * for (const tear of getTears()) {
278
325
  * tear.Visible = false;
279
326
  * }
280
327
  * ```
328
+ *
329
+ * @param tearVariant Optional. If specified, will only get the tears that match the variant.
330
+ * Default is -1, which matches every entity type.
331
+ * @param subType Optional. If specified, will only get the tears that match the sub-type. Default
332
+ * is -1, which matches every sub-type.
281
333
  */
282
334
  export function getTears(
283
335
  tearVariant: TearVariant = -1,
@@ -297,44 +349,19 @@ export function getTears(
297
349
  }
298
350
 
299
351
  /**
300
- * The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
301
- * situations where you need to work with the fired projectiles. This function invokes that method,
302
- * and then returns the projectiles that were spawned.
303
- *
304
- * @param npc The EntityNPC firing projectiles.
305
- * @param position The starting position of the projectiles.
306
- * @param velocity The starting velocity of the projectiles.
307
- * @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
308
- * @param projectileParams A ProjectileParams object containing various parameters for the
309
- * projectiles.
310
- * @returns An array of EntityProjectiles containing all fired projectiles.
311
- */
312
- export function npcFireProjectiles(
313
- npc: EntityNPC,
314
- position: Vector,
315
- velocity: Vector,
316
- projectilesMode: ProjectilesMode,
317
- projectileParams: ProjectileParams,
318
- ): EntityProjectile[] {
319
- const oldEntities = getProjectiles();
320
- npc.FireProjectiles(position, velocity, projectilesMode, projectileParams);
321
- const newEntities = getProjectiles();
322
- const filteredNewEntities = getFilteredNewEntities(oldEntities, newEntities);
323
-
324
- return filteredNewEntities;
325
- }
326
-
327
- /**
328
- * Helper function to remove all of the `EntityType.BOMB` in the room.
352
+ * Helper function to remove all of the bombs in the room. (Specifically, this refers to the
353
+ * `EntityBomb` class, not bomb pickups.)
329
354
  *
330
- * @param bombVariant Optional. If specified, will only remove bombs that match this variant.
331
- * @param subType Optional. If specified, will only remove bombs that match this sub-type.
355
+ * @param bombVariant Optional. If specified, will only remove the bombs that match the variant.
356
+ * Default is -1, which matches every variant.
357
+ * @param subType Optional. If specified, will only remove the bombs that match the sub-type.
358
+ * Default is -1, which matches every sub-type.
332
359
  * @param cap Optional. If specified, will only remove the given amount of bombs.
333
360
  * @returns An array of the bombs that were removed.
334
361
  */
335
362
  export function removeAllBombs(
336
- bombVariant?: BombVariant,
337
- subType?: int,
363
+ bombVariant: BombVariant = -1,
364
+ subType = -1,
338
365
  cap?: int,
339
366
  ): EntityBomb[] {
340
367
  const bombs = getBombs(bombVariant, subType);
@@ -344,14 +371,16 @@ export function removeAllBombs(
344
371
  /**
345
372
  * Helper function to remove all of the effects in the room.
346
373
  *
347
- * @param effectVariant Optional. If specified, will only remove effects that match this variant.
348
- * @param subType Optional. If specified, will only remove effects that match this sub-type.
374
+ * @param effectVariant Optional. If specified, will only remove the effects that match the variant.
375
+ * Default is -1, which matches every variant.
376
+ * @param subType Optional. If specified, will only remove the effects that match the sub-type.
377
+ * Default is -1, which matches every sub-type.
349
378
  * @param cap Optional. If specified, will only remove the given amount of effects.
350
379
  * @returns An array of the effects that were removed.
351
380
  */
352
381
  export function removeAllEffects(
353
- effectVariant?: EffectVariant,
354
- subType?: int,
382
+ effectVariant: EffectVariant = -1,
383
+ subType = -1,
355
384
  cap?: int,
356
385
  ): EntityEffect[] {
357
386
  const effects = getEffects(effectVariant, subType);
@@ -361,15 +390,16 @@ export function removeAllEffects(
361
390
  /**
362
391
  * Helper function to remove all of the familiars in the room.
363
392
  *
364
- * @param familiarVariant Optional. If specified, will only remove familiars that match this
365
- * variant.
366
- * @param subType Optional. If specified, will only remove familiars that match this sub-type.
393
+ * @param familiarVariant Optional. If specified, will only remove the familiars that match the
394
+ * variant. Default is -1, which matches every variant.
395
+ * @param subType Optional. If specified, will only remove the familiars that match the sub-type.
396
+ * Default is -1, which matches every sub-type.
367
397
  * @param cap Optional. If specified, will only remove the given amount of familiars.
368
398
  * @returns An array of the familiars that were removed.
369
399
  */
370
400
  export function removeAllFamiliars(
371
- familiarVariant?: FamiliarVariant,
372
- subType?: int,
401
+ familiarVariant: FamiliarVariant = -1,
402
+ subType = -1,
373
403
  cap?: int,
374
404
  ): EntityFamiliar[] {
375
405
  const familiars = getFamiliars(familiarVariant, subType);
@@ -377,16 +407,18 @@ export function removeAllFamiliars(
377
407
  }
378
408
 
379
409
  /**
380
- * Helper function to remove all of the `EntityType.KNIFE` in the room.
410
+ * Helper function to remove all of the knives in the room.
381
411
  *
382
- * @param knifeVariant Optional. If specified, will only remove knives that match this variant.
383
- * @param subType Optional. If specified, will only remove knives that match this sub-type.
412
+ * @param knifeVariant Optional. If specified, will only remove the knives that match the variant.
413
+ * Default is -1, which matches every variant.
414
+ * @param subType Optional. If specified, will only remove the knives that match the sub-type.
415
+ * Default is -1, which matches every sub-type.
384
416
  * @param cap Optional. If specified, will only remove the given amount of knives.
385
417
  * @returns An array of the knives that were removed.
386
418
  */
387
419
  export function removeAllKnives(
388
- knifeVariant?: KnifeVariant,
389
- subType?: int,
420
+ knifeVariant: KnifeVariant = -1,
421
+ subType = -1,
390
422
  cap?: int,
391
423
  ): EntityKnife[] {
392
424
  const knives = getKnives(knifeVariant, subType);
@@ -394,16 +426,18 @@ export function removeAllKnives(
394
426
  }
395
427
 
396
428
  /**
397
- * Helper function to remove all of the `EntityType.LASER` in the room.
429
+ * Helper function to remove all of the lasers in the room.
398
430
  *
399
- * @param laserVariant Optional. If specified, will only remove lasers that match this variant.
400
- * @param subType Optional. If specified, will only remove lasers that match this sub-type.
431
+ * @param laserVariant Optional. If specified, will only remove the lasers that match the variant.
432
+ * Default is -1, which matches every variant.
433
+ * @param subType Optional. If specified, will only remove the lasers that match the sub-type.
434
+ * Default is -1, which matches every sub-type.
401
435
  * @param cap Optional. If specified, will only remove the given amount of lasers.
402
436
  * @returns An array of the lasers that were removed.
403
437
  */
404
438
  export function removeAllLasers(
405
- laserVariant?: LaserVariant,
406
- subType?: int,
439
+ laserVariant: LaserVariant = -1,
440
+ subType = -1,
407
441
  cap?: int,
408
442
  ): EntityLaser[] {
409
443
  const lasers = getLasers(laserVariant, subType);
@@ -411,13 +445,24 @@ export function removeAllLasers(
411
445
  }
412
446
 
413
447
  /**
414
- * Helper function to remove all NPCs in the room.
448
+ * Helper function to remove all of the NPCs in the room.
415
449
  *
450
+ * @param entityType Optional. If specified, will only remove the NPCs that match the type. Default
451
+ * is -1, which matches every type.
452
+ * @param variant Optional. If specified, will only remove the NPCs that match the variant. Default
453
+ * is -1, which matches every variant.
454
+ * @param subType Optional. If specified, will only remove the NPCs that match the sub-type. Default
455
+ * is -1, which matches every sub-type.
416
456
  * @param cap Optional. If specified, will only remove the given amount of NPCs.
417
457
  * @returns An array of the NPCs that were removed.
418
458
  */
419
- export function removeAllNPCs(cap?: int): EntityNPC[] {
420
- const npcs = getNPCs();
459
+ export function removeAllNPCs(
460
+ entityType: EntityType = -1,
461
+ variant = -1,
462
+ subType = -1,
463
+ cap?: int,
464
+ ): EntityNPC[] {
465
+ const npcs = getNPCs(entityType, variant, subType);
421
466
  return removeEntities(npcs, cap);
422
467
  }
423
468
 
@@ -425,13 +470,15 @@ export function removeAllNPCs(cap?: int): EntityNPC[] {
425
470
  * Helper function to remove all of the pickups in the room.
426
471
  *
427
472
  * @param pickupVariant Optional. If specified, will only remove pickups that match this variant.
428
- * @param subType Optional. If specified, will only remove pickups that match this sub-type.
473
+ * Default is -1, which matches every variant.
474
+ * @param subType Optional. If specified, will only remove pickups that match this sub-type. Default
475
+ * is -1, which matches every sub-type.
429
476
  * @param cap Optional. If specified, will only remove the given amount of pickups.
430
477
  * @returns An array of the pickups that were removed.
431
478
  */
432
479
  export function removeAllPickups(
433
- pickupVariant?: PickupVariant,
434
- subType?: int,
480
+ pickupVariant: PickupVariant = -1,
481
+ subType = -1,
435
482
  cap?: int,
436
483
  ): EntityPickup[] {
437
484
  const pickups = getPickups(pickupVariant, subType);
@@ -439,17 +486,18 @@ export function removeAllPickups(
439
486
  }
440
487
 
441
488
  /**
442
- * Helper function to remove all of the `EntityType.PROJECTILE` in the room.
489
+ * Helper function to remove all of the projectiles in the room.
443
490
  *
444
491
  * @param projectileVariant Optional. If specified, will only remove projectiles that match this
445
- * variant.
492
+ * variant. Default is -1, which matches every variant.
446
493
  * @param subType Optional. If specified, will only remove projectiles that match this sub-type.
494
+ * Default is -1, which matches every sub-type.
447
495
  * @param cap Optional. If specified, will only remove the given amount of projectiles.
448
496
  * @returns An array of the projectiles that were removed.
449
497
  */
450
498
  export function removeAllProjectiles(
451
- projectileVariant?: ProjectileVariant,
452
- subType?: int,
499
+ projectileVariant: ProjectileVariant = -1,
500
+ subType = -1,
453
501
  cap?: int,
454
502
  ): EntityProjectile[] {
455
503
  const projectiles = getProjectiles(projectileVariant, subType);
@@ -457,16 +505,18 @@ export function removeAllProjectiles(
457
505
  }
458
506
 
459
507
  /**
460
- * Helper function to remove all of the `EntityType.SLOT` in the room.
508
+ * Helper function to remove all of the slots in the room.
461
509
  *
462
510
  * @param slotVariant Optional. If specified, will only remove slots that match this variant.
463
- * @param subType Optional. If specified, will only remove slots that match this sub-type.
511
+ * Default is -1, which matches every variant.
512
+ * @param subType Optional. If specified, will only remove slots that match this sub-type. Default
513
+ * is -1, which matches every sub-type.
464
514
  * @param cap Optional. If specified, will only remove the given amount of slots.
465
515
  * @returns An array of the slots that were removed.
466
516
  */
467
517
  export function removeAllSlots(
468
- slotVariant?: SlotVariant,
469
- subType?: int,
518
+ slotVariant: SlotVariant = -1,
519
+ subType = -1,
470
520
  cap?: int,
471
521
  ): Entity[] {
472
522
  const slots = getSlots(slotVariant, subType);
@@ -474,16 +524,18 @@ export function removeAllSlots(
474
524
  }
475
525
 
476
526
  /**
477
- * Helper function to remove all of the `EntityType.TEAR` in the room.
527
+ * Helper function to remove all of the tears in the room.
478
528
  *
479
529
  * @param tearVariant Optional. If specified, will only remove tears that match this variant.
480
- * @param subType Optional. If specified, will only remove tears that match this sub-type.
530
+ * Default is -1, which matches every variant.
531
+ * @param subType Optional. If specified, will only remove tears that match this sub-type. Default
532
+ * is -1, which matches every sub-type.
481
533
  * @param cap Optional. If specified, will only remove the given amount of tears.
482
534
  * @returns An array of the tears that were removed.
483
535
  */
484
536
  export function removeAllTears(
485
- tearVariant?: TearVariant,
486
- subType?: int,
537
+ tearVariant: TearVariant = -1,
538
+ subType = -1,
487
539
  cap?: int,
488
540
  ): EntityTear[] {
489
541
  const tears = getTears(tearVariant, subType);
@@ -513,6 +565,7 @@ export function spawnBomb(
513
565
  if (bomb === undefined) {
514
566
  error("Failed to spawn a bomb.");
515
567
  }
568
+
516
569
  return bomb;
517
570
  }
518
571
 
@@ -558,6 +611,7 @@ export function spawnEffect(
558
611
  if (effect === undefined) {
559
612
  error("Failed to spawn an effect.");
560
613
  }
614
+
561
615
  return effect;
562
616
  }
563
617
 
@@ -603,6 +657,7 @@ export function spawnFamiliar(
603
657
  if (familiar === undefined) {
604
658
  error("Failed to spawn a familiar.");
605
659
  }
660
+
606
661
  return familiar;
607
662
  }
608
663
 
@@ -648,6 +703,7 @@ export function spawnKnife(
648
703
  if (knife === undefined) {
649
704
  error("Failed to spawn a knife.");
650
705
  }
706
+
651
707
  return knife;
652
708
  }
653
709
 
@@ -693,6 +749,7 @@ export function spawnLaser(
693
749
  if (laser === undefined) {
694
750
  error("Failed to spawn a laser.");
695
751
  }
752
+
696
753
  return laser;
697
754
  }
698
755
 
@@ -715,7 +772,12 @@ export function spawnLaserWithSeed(
715
772
  );
716
773
  }
717
774
 
718
- /** Helper function to spawn an NPC. */
775
+ /**
776
+ * Helper function to spawn an NPC.
777
+ *
778
+ * Note that if you pass a non-NPC `EntityType` to this function, it will cause a run-time error,
779
+ * since the `Entity.ToNPC` method will return undefined.
780
+ */
719
781
  export function spawnNPC(
720
782
  entityType: EntityType,
721
783
  variant: int,
@@ -739,10 +801,16 @@ export function spawnNPC(
739
801
  if (npc === undefined) {
740
802
  error("Failed to spawn an NPC.");
741
803
  }
804
+
742
805
  return npc;
743
806
  }
744
807
 
745
- /** Helper function to spawn an NPC with a specific seed. */
808
+ /**
809
+ * Helper function to spawn an NPC with a specific seed.
810
+ *
811
+ * Note that if you pass a non-NPC `EntityType` to this function, it will cause a run-time error,
812
+ * since the `Entity.ToNPC` method will return undefined.
813
+ */
746
814
  export function spawnNPCWithSeed(
747
815
  entityType: EntityType,
748
816
  variant: int,
@@ -786,6 +854,7 @@ export function spawnPickup(
786
854
  if (pickup === undefined) {
787
855
  error("Failed to spawn a pickup.");
788
856
  }
857
+
789
858
  return pickup;
790
859
  }
791
860
 
@@ -831,6 +900,7 @@ export function spawnProjectile(
831
900
  if (projectile === undefined) {
832
901
  error("Failed to spawn a projectile.");
833
902
  }
903
+
834
904
  return projectile;
835
905
  }
836
906
 
@@ -915,6 +985,7 @@ export function spawnTear(
915
985
  if (tear === undefined) {
916
986
  error("Failed to spawn a tear.");
917
987
  }
988
+
918
989
  return tear;
919
990
  }
920
991
 
@@ -1,7 +1,7 @@
1
1
  import { CollectibleType, FamiliarVariant } from "isaac-typescript-definitions";
2
2
  import { itemConfig } from "../cachedClasses";
3
3
  import { FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET } from "../sets/familiarsThatShootPlayerTearsSet";
4
- import { getFamiliars } from "./entitySpecific";
4
+ import { getFamiliars } from "./entitiesSpecific";
5
5
 
6
6
  /**
7
7
  * Helper function to add and remove familiars based on a target amount that you specify.