isaacscript-common 17.2.1 → 17.3.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 (34) hide show
  1. package/dist/index.d.ts +59 -55
  2. package/dist/isaacscript-common.lua +102 -97
  3. package/dist/src/classes/features/other/CustomHotkeys.d.ts +4 -0
  4. package/dist/src/classes/features/other/CustomHotkeys.d.ts.map +1 -1
  5. package/dist/src/classes/features/other/SpawnCollectible.d.ts +4 -4
  6. package/dist/src/classes/features/other/SpawnCollectible.d.ts.map +1 -1
  7. package/dist/src/classes/features/other/SpawnCollectible.lua +4 -4
  8. package/dist/src/classes/features/other/SpawnRockAltRewards.d.ts +3 -2
  9. package/dist/src/classes/features/other/SpawnRockAltRewards.d.ts.map +1 -1
  10. package/dist/src/classes/features/other/SpawnRockAltRewards.lua +4 -1
  11. package/dist/src/functions/bosses.d.ts +2 -2
  12. package/dist/src/functions/bosses.d.ts.map +1 -1
  13. package/dist/src/functions/bosses.lua +5 -5
  14. package/dist/src/functions/entities.d.ts +5 -5
  15. package/dist/src/functions/entities.d.ts.map +1 -1
  16. package/dist/src/functions/entities.lua +10 -8
  17. package/dist/src/functions/entitiesSpecific.d.ts +20 -20
  18. package/dist/src/functions/entitiesSpecific.d.ts.map +1 -1
  19. package/dist/src/functions/entitiesSpecific.lua +40 -40
  20. package/dist/src/functions/pickupsSpecific.d.ts +18 -18
  21. package/dist/src/functions/pickupsSpecific.d.ts.map +1 -1
  22. package/dist/src/functions/pickupsSpecific.lua +36 -36
  23. package/dist/src/functions/spawnCollectible.d.ts +4 -4
  24. package/dist/src/functions/spawnCollectible.d.ts.map +1 -1
  25. package/dist/src/functions/spawnCollectible.lua +6 -6
  26. package/package.json +1 -1
  27. package/src/classes/features/other/CustomHotkeys.ts +4 -0
  28. package/src/classes/features/other/SpawnCollectible.ts +6 -6
  29. package/src/classes/features/other/SpawnRockAltRewards.ts +7 -3
  30. package/src/functions/bosses.ts +13 -5
  31. package/src/functions/entities.ts +14 -8
  32. package/src/functions/entitiesSpecific.ts +40 -40
  33. package/src/functions/pickupsSpecific.ts +84 -36
  34. package/src/functions/spawnCollectible.ts +6 -6
@@ -209,7 +209,7 @@ function ____exports.removeAllTrinkets(self, trinketType, cap)
209
209
  return removeAllPickups(nil, PickupVariant.TRINKET, trinketType, cap)
210
210
  end
211
211
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.LIL_BATTERY` (90).
212
- function ____exports.spawnBattery(self, batterySubType, position, velocity, spawner, seedOrRNG)
212
+ function ____exports.spawnBattery(self, batterySubType, positionOrGridIndex, velocity, spawner, seedOrRNG)
213
213
  if velocity == nil then
214
214
  velocity = VectorZero
215
215
  end
@@ -223,7 +223,7 @@ function ____exports.spawnBattery(self, batterySubType, position, velocity, spaw
223
223
  nil,
224
224
  PickupVariant.LIL_BATTERY,
225
225
  batterySubType,
226
- position,
226
+ positionOrGridIndex,
227
227
  velocity,
228
228
  spawner,
229
229
  seedOrRNG
@@ -231,7 +231,7 @@ function ____exports.spawnBattery(self, batterySubType, position, velocity, spaw
231
231
  end
232
232
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.LIL_BATTERY` (90)
233
233
  -- and a specific seed.
234
- function ____exports.spawnBatteryWithSeed(self, batterySubType, position, seedOrRNG, velocity, spawner)
234
+ function ____exports.spawnBatteryWithSeed(self, batterySubType, positionOrGridIndex, seedOrRNG, velocity, spawner)
235
235
  if velocity == nil then
236
236
  velocity = VectorZero
237
237
  end
@@ -241,14 +241,14 @@ function ____exports.spawnBatteryWithSeed(self, batterySubType, position, seedOr
241
241
  return ____exports.spawnBattery(
242
242
  nil,
243
243
  batterySubType,
244
- position,
244
+ positionOrGridIndex,
245
245
  velocity,
246
246
  spawner,
247
247
  seedOrRNG
248
248
  )
249
249
  end
250
250
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.BOMB` (40).
251
- function ____exports.spawnBombPickup(self, bombSubType, position, velocity, spawner, seedOrRNG)
251
+ function ____exports.spawnBombPickup(self, bombSubType, positionOrGridIndex, velocity, spawner, seedOrRNG)
252
252
  if velocity == nil then
253
253
  velocity = VectorZero
254
254
  end
@@ -262,7 +262,7 @@ function ____exports.spawnBombPickup(self, bombSubType, position, velocity, spaw
262
262
  nil,
263
263
  PickupVariant.BOMB,
264
264
  bombSubType,
265
- position,
265
+ positionOrGridIndex,
266
266
  velocity,
267
267
  spawner,
268
268
  seedOrRNG
@@ -270,7 +270,7 @@ function ____exports.spawnBombPickup(self, bombSubType, position, velocity, spaw
270
270
  end
271
271
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.BOMB` (40) and a
272
272
  -- specific seed.
273
- function ____exports.spawnBombPickupWithSeed(self, bombSubType, position, seedOrRNG, velocity, spawner)
273
+ function ____exports.spawnBombPickupWithSeed(self, bombSubType, positionOrGridIndex, seedOrRNG, velocity, spawner)
274
274
  if velocity == nil then
275
275
  velocity = VectorZero
276
276
  end
@@ -280,14 +280,14 @@ function ____exports.spawnBombPickupWithSeed(self, bombSubType, position, seedOr
280
280
  return ____exports.spawnBombPickup(
281
281
  nil,
282
282
  bombSubType,
283
- position,
283
+ positionOrGridIndex,
284
284
  velocity,
285
285
  spawner,
286
286
  seedOrRNG
287
287
  )
288
288
  end
289
289
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300).
290
- function ____exports.spawnCard(self, cardType, position, velocity, spawner, seedOrRNG)
290
+ function ____exports.spawnCard(self, cardType, positionOrGridIndex, velocity, spawner, seedOrRNG)
291
291
  if velocity == nil then
292
292
  velocity = VectorZero
293
293
  end
@@ -301,7 +301,7 @@ function ____exports.spawnCard(self, cardType, position, velocity, spawner, seed
301
301
  nil,
302
302
  PickupVariant.TAROT_CARD,
303
303
  cardType,
304
- position,
304
+ positionOrGridIndex,
305
305
  velocity,
306
306
  spawner,
307
307
  seedOrRNG
@@ -309,7 +309,7 @@ function ____exports.spawnCard(self, cardType, position, velocity, spawner, seed
309
309
  end
310
310
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300)
311
311
  -- and a specific seed.
312
- function ____exports.spawnCardWithSeed(self, cardType, position, seedOrRNG, velocity, spawner)
312
+ function ____exports.spawnCardWithSeed(self, cardType, positionOrGridIndex, seedOrRNG, velocity, spawner)
313
313
  if velocity == nil then
314
314
  velocity = VectorZero
315
315
  end
@@ -319,14 +319,14 @@ function ____exports.spawnCardWithSeed(self, cardType, position, seedOrRNG, velo
319
319
  return ____exports.spawnCard(
320
320
  nil,
321
321
  cardType,
322
- position,
322
+ positionOrGridIndex,
323
323
  velocity,
324
324
  spawner,
325
325
  seedOrRNG
326
326
  )
327
327
  end
328
328
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.COIN` (20).
329
- function ____exports.spawnCoin(self, coinSubType, position, velocity, spawner, seedOrRNG)
329
+ function ____exports.spawnCoin(self, coinSubType, positionOrGridIndex, velocity, spawner, seedOrRNG)
330
330
  if velocity == nil then
331
331
  velocity = VectorZero
332
332
  end
@@ -340,7 +340,7 @@ function ____exports.spawnCoin(self, coinSubType, position, velocity, spawner, s
340
340
  nil,
341
341
  PickupVariant.COIN,
342
342
  coinSubType,
343
- position,
343
+ positionOrGridIndex,
344
344
  velocity,
345
345
  spawner,
346
346
  seedOrRNG
@@ -348,7 +348,7 @@ function ____exports.spawnCoin(self, coinSubType, position, velocity, spawner, s
348
348
  end
349
349
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.COIN` (20) and a
350
350
  -- specific seed.
351
- function ____exports.spawnCoinWithSeed(self, coinSubType, position, seedOrRNG, velocity, spawner)
351
+ function ____exports.spawnCoinWithSeed(self, coinSubType, positionOrGridIndex, seedOrRNG, velocity, spawner)
352
352
  if velocity == nil then
353
353
  velocity = VectorZero
354
354
  end
@@ -358,14 +358,14 @@ function ____exports.spawnCoinWithSeed(self, coinSubType, position, seedOrRNG, v
358
358
  return ____exports.spawnCoin(
359
359
  nil,
360
360
  coinSubType,
361
- position,
361
+ positionOrGridIndex,
362
362
  velocity,
363
363
  spawner,
364
364
  seedOrRNG
365
365
  )
366
366
  end
367
367
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.HEART` (10).
368
- function ____exports.spawnHeart(self, heartSubType, position, velocity, spawner, seedOrRNG)
368
+ function ____exports.spawnHeart(self, heartSubType, positionOrGridIndex, velocity, spawner, seedOrRNG)
369
369
  if velocity == nil then
370
370
  velocity = VectorZero
371
371
  end
@@ -379,13 +379,13 @@ function ____exports.spawnHeart(self, heartSubType, position, velocity, spawner,
379
379
  nil,
380
380
  PickupVariant.HEART,
381
381
  heartSubType,
382
- position,
382
+ positionOrGridIndex,
383
383
  velocity,
384
384
  spawner,
385
385
  seedOrRNG
386
386
  )
387
387
  end
388
- function ____exports.spawnHeartWithSeed(self, heartSubType, position, seedOrRNG, velocity, spawner)
388
+ function ____exports.spawnHeartWithSeed(self, heartSubType, positionOrGridIndex, seedOrRNG, velocity, spawner)
389
389
  if velocity == nil then
390
390
  velocity = VectorZero
391
391
  end
@@ -395,14 +395,14 @@ function ____exports.spawnHeartWithSeed(self, heartSubType, position, seedOrRNG,
395
395
  return ____exports.spawnHeart(
396
396
  nil,
397
397
  heartSubType,
398
- position,
398
+ positionOrGridIndex,
399
399
  velocity,
400
400
  spawner,
401
401
  seedOrRNG
402
402
  )
403
403
  end
404
404
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.KEY` (30).
405
- function ____exports.spawnKey(self, keySubType, position, velocity, spawner, seedOrRNG)
405
+ function ____exports.spawnKey(self, keySubType, positionOrGridIndex, velocity, spawner, seedOrRNG)
406
406
  if velocity == nil then
407
407
  velocity = VectorZero
408
408
  end
@@ -416,7 +416,7 @@ function ____exports.spawnKey(self, keySubType, position, velocity, spawner, see
416
416
  nil,
417
417
  PickupVariant.KEY,
418
418
  keySubType,
419
- position,
419
+ positionOrGridIndex,
420
420
  velocity,
421
421
  spawner,
422
422
  seedOrRNG
@@ -424,7 +424,7 @@ function ____exports.spawnKey(self, keySubType, position, velocity, spawner, see
424
424
  end
425
425
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.KEY` (30) and a
426
426
  -- specific seed.
427
- function ____exports.spawnKeyWithSeed(self, keySubType, position, seedOrRNG, velocity, spawner)
427
+ function ____exports.spawnKeyWithSeed(self, keySubType, positionOrGridIndex, seedOrRNG, velocity, spawner)
428
428
  if velocity == nil then
429
429
  velocity = VectorZero
430
430
  end
@@ -434,14 +434,14 @@ function ____exports.spawnKeyWithSeed(self, keySubType, position, seedOrRNG, vel
434
434
  return ____exports.spawnKey(
435
435
  nil,
436
436
  keySubType,
437
- position,
437
+ positionOrGridIndex,
438
438
  velocity,
439
439
  spawner,
440
440
  seedOrRNG
441
441
  )
442
442
  end
443
443
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.PILL` (70).
444
- function ____exports.spawnPill(self, pillColor, position, velocity, spawner, seedOrRNG)
444
+ function ____exports.spawnPill(self, pillColor, positionOrGridIndex, velocity, spawner, seedOrRNG)
445
445
  if velocity == nil then
446
446
  velocity = VectorZero
447
447
  end
@@ -455,7 +455,7 @@ function ____exports.spawnPill(self, pillColor, position, velocity, spawner, see
455
455
  nil,
456
456
  PickupVariant.PILL,
457
457
  pillColor,
458
- position,
458
+ positionOrGridIndex,
459
459
  velocity,
460
460
  spawner,
461
461
  seedOrRNG
@@ -463,7 +463,7 @@ function ____exports.spawnPill(self, pillColor, position, velocity, spawner, see
463
463
  end
464
464
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.PILL` (70) and a
465
465
  -- specific seed.
466
- function ____exports.spawnPillWithSeed(self, pillColor, position, seedOrRNG, velocity, spawner)
466
+ function ____exports.spawnPillWithSeed(self, pillColor, positionOrGridIndex, seedOrRNG, velocity, spawner)
467
467
  if velocity == nil then
468
468
  velocity = VectorZero
469
469
  end
@@ -473,14 +473,14 @@ function ____exports.spawnPillWithSeed(self, pillColor, position, seedOrRNG, vel
473
473
  return ____exports.spawnPill(
474
474
  nil,
475
475
  pillColor,
476
- position,
476
+ positionOrGridIndex,
477
477
  velocity,
478
478
  spawner,
479
479
  seedOrRNG
480
480
  )
481
481
  end
482
482
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.SACK` (69).
483
- function ____exports.spawnSack(self, sackSubType, position, velocity, spawner, seedOrRNG)
483
+ function ____exports.spawnSack(self, sackSubType, positionOrGridIndex, velocity, spawner, seedOrRNG)
484
484
  if velocity == nil then
485
485
  velocity = VectorZero
486
486
  end
@@ -494,7 +494,7 @@ function ____exports.spawnSack(self, sackSubType, position, velocity, spawner, s
494
494
  nil,
495
495
  PickupVariant.SACK,
496
496
  sackSubType,
497
- position,
497
+ positionOrGridIndex,
498
498
  velocity,
499
499
  spawner,
500
500
  seedOrRNG
@@ -502,7 +502,7 @@ function ____exports.spawnSack(self, sackSubType, position, velocity, spawner, s
502
502
  end
503
503
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.SACK` (69) and a
504
504
  -- specific seed.
505
- function ____exports.spawnSackWithSeed(self, sackSubType, position, seedOrRNG, velocity, spawner)
505
+ function ____exports.spawnSackWithSeed(self, sackSubType, positionOrGridIndex, seedOrRNG, velocity, spawner)
506
506
  if velocity == nil then
507
507
  velocity = VectorZero
508
508
  end
@@ -512,14 +512,14 @@ function ____exports.spawnSackWithSeed(self, sackSubType, position, seedOrRNG, v
512
512
  return ____exports.spawnSack(
513
513
  nil,
514
514
  sackSubType,
515
- position,
515
+ positionOrGridIndex,
516
516
  velocity,
517
517
  spawner,
518
518
  seedOrRNG
519
519
  )
520
520
  end
521
521
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TRINKET` (350).
522
- function ____exports.spawnTrinket(self, trinketType, position, velocity, spawner, seedOrRNG)
522
+ function ____exports.spawnTrinket(self, trinketType, positionOrGridIndex, velocity, spawner, seedOrRNG)
523
523
  if velocity == nil then
524
524
  velocity = VectorZero
525
525
  end
@@ -533,7 +533,7 @@ function ____exports.spawnTrinket(self, trinketType, position, velocity, spawner
533
533
  nil,
534
534
  PickupVariant.TRINKET,
535
535
  trinketType,
536
- position,
536
+ positionOrGridIndex,
537
537
  velocity,
538
538
  spawner,
539
539
  seedOrRNG
@@ -541,7 +541,7 @@ function ____exports.spawnTrinket(self, trinketType, position, velocity, spawner
541
541
  end
542
542
  --- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TRINKET` (350) and
543
543
  -- a specific seed.
544
- function ____exports.spawnTrinketWithSeed(self, trinketType, position, seedOrRNG, velocity, spawner)
544
+ function ____exports.spawnTrinketWithSeed(self, trinketType, positionOrGridIndex, seedOrRNG, velocity, spawner)
545
545
  if velocity == nil then
546
546
  velocity = VectorZero
547
547
  end
@@ -551,7 +551,7 @@ function ____exports.spawnTrinketWithSeed(self, trinketType, position, seedOrRNG
551
551
  return ____exports.spawnTrinket(
552
552
  nil,
553
553
  trinketType,
554
- position,
554
+ positionOrGridIndex,
555
555
  velocity,
556
556
  spawner,
557
557
  seedOrRNG
@@ -10,7 +10,7 @@ import { CollectibleType } from "isaac-typescript-definitions";
10
10
  * (which is provided by `ISCFeature.SPAWN_COLLECTIBLE`).
11
11
  *
12
12
  * @param collectibleType The collectible type to spawn.
13
- * @param position The position to spawn the collectible at.
13
+ * @param positionOrGridIndex The position or grid index to spawn the collectible at.
14
14
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
15
15
  * `RNG.Next` method will be called. Default is `getRandomSeed()`.
16
16
  * @param options Optional. Set to true to make the collectible a "There's Options" style
@@ -19,7 +19,7 @@ import { CollectibleType } from "isaac-typescript-definitions";
19
19
  * Tainted Keeper. Default is false.
20
20
  * @param spawner Optional.
21
21
  */
22
- export declare function spawnCollectibleUnsafe(collectibleType: CollectibleType, position: Vector, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean, spawner?: Entity): EntityPickupCollectible;
22
+ export declare function spawnCollectibleUnsafe(collectibleType: CollectibleType, positionOrGridIndex: Vector | int, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean, spawner?: Entity): EntityPickupCollectible;
23
23
  /**
24
24
  * Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
25
25
  * with `CollectibleType.NULL` will result in spawning a collectible with a random type from the
@@ -28,9 +28,9 @@ export declare function spawnCollectibleUnsafe(collectibleType: CollectibleType,
28
28
  * Instead, this function arbitrarily spawns a collectible with `CollectibleType.SAD_ONION`, and
29
29
  * then converts it to an empty pedestal afterward.
30
30
  *
31
- * @param position The position to spawn the empty collectible at.
31
+ * @param positionOrGridIndex The position or grid index to spawn the empty collectible at.
32
32
  * @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
33
33
  * `RNG.Next` method will be called. Default is `getRandomSeed()`.
34
34
  */
35
- export declare function spawnEmptyCollectible(position: Vector, seedOrRNG?: Seed | RNG): EntityPickup;
35
+ export declare function spawnEmptyCollectible(positionOrGridIndex: Vector | int, seedOrRNG?: Seed | RNG): EntityPickup;
36
36
  //# sourceMappingURL=spawnCollectible.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawnCollectible.d.ts","sourceRoot":"","sources":["../../../src/functions/spawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAQtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,EACf,aAAa,UAAQ,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,uBAAuB,CAiCzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,YAAY,CAWd"}
1
+ {"version":3,"file":"spawnCollectible.d.ts","sourceRoot":"","sources":["../../../src/functions/spawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAQtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,EAChC,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,EACf,aAAa,UAAQ,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,uBAAuB,CAiCzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,YAAY,CAWd"}
@@ -26,7 +26,7 @@ local isRNG = ____rng.isRNG
26
26
  -- (which is provided by `ISCFeature.SPAWN_COLLECTIBLE`).
27
27
  --
28
28
  -- @param collectibleType The collectible type to spawn.
29
- -- @param position The position to spawn the collectible at.
29
+ -- @param positionOrGridIndex The position or grid index to spawn the collectible at.
30
30
  -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
31
31
  -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
32
32
  -- @param options Optional. Set to true to make the collectible a "There's Options" style
@@ -34,7 +34,7 @@ local isRNG = ____rng.isRNG
34
34
  -- @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
35
35
  -- Tainted Keeper. Default is false.
36
36
  -- @param spawner Optional.
37
- function ____exports.spawnCollectibleUnsafe(self, collectibleType, position, seedOrRNG, options, forceFreeItem, spawner)
37
+ function ____exports.spawnCollectibleUnsafe(self, collectibleType, positionOrGridIndex, seedOrRNG, options, forceFreeItem, spawner)
38
38
  if seedOrRNG == nil then
39
39
  seedOrRNG = getRandomSeed(nil)
40
40
  end
@@ -49,7 +49,7 @@ function ____exports.spawnCollectibleUnsafe(self, collectibleType, position, see
49
49
  nil,
50
50
  PickupVariant.COLLECTIBLE,
51
51
  collectibleType,
52
- position,
52
+ positionOrGridIndex,
53
53
  seed,
54
54
  VectorZero,
55
55
  spawner
@@ -70,17 +70,17 @@ end
70
70
  -- Instead, this function arbitrarily spawns a collectible with `CollectibleType.SAD_ONION`, and
71
71
  -- then converts it to an empty pedestal afterward.
72
72
  --
73
- -- @param position The position to spawn the empty collectible at.
73
+ -- @param positionOrGridIndex The position or grid index to spawn the empty collectible at.
74
74
  -- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
75
75
  -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
76
- function ____exports.spawnEmptyCollectible(self, position, seedOrRNG)
76
+ function ____exports.spawnEmptyCollectible(self, positionOrGridIndex, seedOrRNG)
77
77
  if seedOrRNG == nil then
78
78
  seedOrRNG = getRandomSeed(nil)
79
79
  end
80
80
  local collectible = ____exports.spawnCollectibleUnsafe(
81
81
  nil,
82
82
  CollectibleType.SAD_ONION,
83
- position,
83
+ positionOrGridIndex,
84
84
  seedOrRNG,
85
85
  false,
86
86
  true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "17.2.1",
3
+ "version": "17.3.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -67,6 +67,8 @@ export class CustomHotkeys extends Feature {
67
67
  * This can be used to easily set up custom hotkeys to facilitate custom game features or to
68
68
  * assist in debugging.
69
69
  *
70
+ * Inputs are checked for in the `POST_RENDER` callback.
71
+ *
70
72
  * This is different from the `setHotkey` function in that the keyboard activation key is not
71
73
  * hardcoded and is instead the return value of a provided function. This is useful for situations
72
74
  * where the key can change (like if end-users can specify a custom hotkey using Mod Config Menu).
@@ -97,6 +99,8 @@ export class CustomHotkeys extends Feature {
97
99
  * This can be used to easily set up custom hotkeys to facilitate custom game features or to
98
100
  * assist in debugging.
99
101
  *
102
+ * Inputs are checked for in the `POST_RENDER` callback.
103
+ *
100
104
  * In order to use this function, you must upgrade your mod with `ISCFeature.CUSTOM_HOTKEYS`.
101
105
  *
102
106
  * @param keyboard The key that you want to trigger the hotkey.
@@ -34,7 +34,7 @@ export class SpawnCollectible extends Feature {
34
34
  * In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
35
35
  *
36
36
  * @param collectibleType The collectible type to spawn.
37
- * @param position The position to spawn the collectible at.
37
+ * @param positionOrGridIndex The position or grid index to spawn the collectible at.
38
38
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
39
39
  * the `RNG.Next` method will be called. Default is `getRandomSeed()`.
40
40
  * @param options Optional. Set to true to make the collectible a "There's Options" style
@@ -46,7 +46,7 @@ export class SpawnCollectible extends Feature {
46
46
  @Exported
47
47
  public spawnCollectible(
48
48
  collectibleType: CollectibleType,
49
- position: Vector,
49
+ positionOrGridIndex: Vector | int,
50
50
  seedOrRNG: Seed | RNG = getRandomSeed(),
51
51
  options = false,
52
52
  forceFreeItem = false,
@@ -54,7 +54,7 @@ export class SpawnCollectible extends Feature {
54
54
  ): EntityPickupCollectible {
55
55
  const collectible = spawnCollectibleUnsafe(
56
56
  collectibleType,
57
- position,
57
+ positionOrGridIndex,
58
58
  seedOrRNG,
59
59
  options,
60
60
  forceFreeItem,
@@ -81,7 +81,7 @@ export class SpawnCollectible extends Feature {
81
81
  * In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
82
82
  *
83
83
  * @param itemPoolType The item pool to draw the collectible type from.
84
- * @param position The position to spawn the collectible at.
84
+ * @param positionOrGridIndex The position or grid index to spawn the collectible at.
85
85
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
86
86
  * the `RNG.Next` method will be called. Default is `getRandomSeed()`.
87
87
  * @param options Optional. Set to true to make the collectible a "There's Options" style
@@ -93,7 +93,7 @@ export class SpawnCollectible extends Feature {
93
93
  @Exported
94
94
  public spawnCollectibleFromPool(
95
95
  itemPoolType: ItemPoolType,
96
- position: Vector,
96
+ positionOrGridIndex: Vector | int,
97
97
  seedOrRNG: Seed | RNG = getRandomSeed(),
98
98
  options = false,
99
99
  forceFreeItem = false,
@@ -104,7 +104,7 @@ export class SpawnCollectible extends Feature {
104
104
 
105
105
  return this.spawnCollectible(
106
106
  collectibleType,
107
- position,
107
+ positionOrGridIndex,
108
108
  seedOrRNG,
109
109
  options,
110
110
  forceFreeItem,
@@ -31,7 +31,7 @@ import { getRandom } from "../../../functions/random";
31
31
  import { getRandomSeed, isRNG, newRNG } from "../../../functions/rng";
32
32
  import { spawnCollectibleUnsafe } from "../../../functions/spawnCollectible";
33
33
  import { repeat } from "../../../functions/utils";
34
- import { getRandomVector } from "../../../functions/vector";
34
+ import { getRandomVector, isVector } from "../../../functions/vector";
35
35
  import { Feature } from "../../private/Feature";
36
36
  import { ItemPoolDetection } from "./ItemPoolDetection";
37
37
 
@@ -92,7 +92,7 @@ export class SpawnRockAltRewards extends Feature {
92
92
  * In order to use this function, you must upgrade your mod with
93
93
  * `ISCFeature.SPAWN_ALT_ROCK_REWARDS`.
94
94
  *
95
- * @param position The place to spawn the reward.
95
+ * @param positionOrGridIndex The position or grid index to spawn the reward.
96
96
  * @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a
97
97
  * chance at spawning coins and spiders.
98
98
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
@@ -102,10 +102,14 @@ export class SpawnRockAltRewards extends Feature {
102
102
  */
103
103
  @Exported
104
104
  public spawnRockAltReward(
105
- position: Vector,
105
+ positionOrGridIndex: Vector | int,
106
106
  rockAltType: RockAltType,
107
107
  seedOrRNG: Seed | RNG = getRandomSeed(),
108
108
  ): boolean {
109
+ const room = game.GetRoom();
110
+ const position = isVector(positionOrGridIndex)
111
+ ? positionOrGridIndex
112
+ : room.GetGridPosition(positionOrGridIndex);
109
113
  const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
110
114
 
111
115
  switch (rockAltType) {
@@ -157,7 +157,7 @@ export function spawnBoss(
157
157
  entityType: EntityType,
158
158
  variant: int,
159
159
  subType: int,
160
- position: Vector,
160
+ positionOrGridIndex: Vector | int,
161
161
  velocity: Vector = VectorZero,
162
162
  spawner: Entity | undefined = undefined,
163
163
  seedOrRNG: Seed | RNG | undefined = undefined,
@@ -168,7 +168,7 @@ export function spawnBoss(
168
168
  entityType,
169
169
  variant,
170
170
  subType,
171
- position,
171
+ positionOrGridIndex,
172
172
  velocity,
173
173
  spawner,
174
174
  seed,
@@ -182,7 +182,15 @@ export function spawnBoss(
182
182
  );
183
183
  const remainingSegmentsToSpawn = numBossSegments - 1;
184
184
  repeat(remainingSegmentsToSpawn, () => {
185
- spawnNPC(entityType, variant, subType, position, velocity, spawner, seed);
185
+ spawnNPC(
186
+ entityType,
187
+ variant,
188
+ subType,
189
+ positionOrGridIndex,
190
+ velocity,
191
+ spawner,
192
+ seed,
193
+ );
186
194
  });
187
195
  }
188
196
 
@@ -231,7 +239,7 @@ export function spawnBossWithSeed(
231
239
  entityType: EntityType,
232
240
  variant: int,
233
241
  subType: int,
234
- position: Vector,
242
+ positionOrGridIndex: Vector | int,
235
243
  seedOrRNG: Seed | RNG,
236
244
  velocity: Vector = VectorZero,
237
245
  spawner: Entity | undefined = undefined,
@@ -242,7 +250,7 @@ export function spawnBossWithSeed(
242
250
  entityType,
243
251
  variant,
244
252
  subType,
245
- position,
253
+ positionOrGridIndex,
246
254
  velocity,
247
255
  spawner,
248
256
  seed,
@@ -488,7 +488,7 @@ export function setEntityRandomColor(entity: Entity): void {
488
488
  * @param entityType The `EntityType` of the entity to spawn.
489
489
  * @param variant The variant of the entity to spawn.
490
490
  * @param subType The sub-type of the entity to spawn.
491
- * @param position The position of the entity to spawn.
491
+ * @param positionOrGridIndex The position or grid index of the entity to spawn.
492
492
  * @param velocity Optional. The velocity of the entity to spawn. Default is `VectorZero`.
493
493
  * @param spawner Optional. The entity that will be the `SpawnerEntity`. Default is undefined.
494
494
  * @param seedOrRNG Optional. The seed or RNG object to use to generate the `InitSeed` of the
@@ -499,13 +499,15 @@ export function spawn(
499
499
  entityType: EntityType,
500
500
  variant: int,
501
501
  subType: int,
502
- position: Vector,
502
+ positionOrGridIndex: Vector | int,
503
503
  velocity: Vector = VectorZero,
504
504
  spawner: Entity | undefined = undefined,
505
505
  seedOrRNG: Seed | RNG | undefined = undefined,
506
506
  ): Entity {
507
+ const room = game.GetRoom();
508
+
507
509
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
508
- if (position === undefined) {
510
+ if (positionOrGridIndex === undefined) {
509
511
  const entityID = getEntityIDFromConstituents(entityType, variant, subType);
510
512
  error(
511
513
  `Failed to spawn entity ${entityID} since an undefined position was passed to the "spawn" function.`,
@@ -520,6 +522,10 @@ export function spawn(
520
522
  );
521
523
  }
522
524
 
525
+ const position = isVector(positionOrGridIndex)
526
+ ? positionOrGridIndex
527
+ : room.GetGridPosition(positionOrGridIndex);
528
+
523
529
  if (seedOrRNG === undefined) {
524
530
  return Isaac.Spawn(
525
531
  entityType,
@@ -547,7 +553,7 @@ export function spawn(
547
553
  * Helper function to spawn the entity corresponding to an `EntityID`.
548
554
  *
549
555
  * @param entityID The `EntityID` of the entity to spawn.
550
- * @param position The position of the entity to spawn.
556
+ * @param positionOrGridIndex The position or grid index of the entity to spawn.
551
557
  * @param velocity Optional. The velocity of the entity to spawn. Default is `VectorZero`.
552
558
  * @param spawner Optional. The entity that will be the `SpawnerEntity`. Default is undefined.
553
559
  * @param seedOrRNG Optional. The seed or RNG object to use to generate the `InitSeed` of the
@@ -556,7 +562,7 @@ export function spawn(
556
562
  */
557
563
  export function spawnEntityID(
558
564
  entityID: EntityID,
559
- position: Vector,
565
+ positionOrGridIndex: Vector | int,
560
566
  velocity: Vector = VectorZero,
561
567
  spawner: Entity | undefined = undefined,
562
568
  seedOrRNG: Seed | RNG | undefined = undefined,
@@ -566,7 +572,7 @@ export function spawnEntityID(
566
572
  entityType,
567
573
  variant,
568
574
  subType,
569
- position,
575
+ positionOrGridIndex,
570
576
  velocity,
571
577
  spawner,
572
578
  seedOrRNG,
@@ -581,7 +587,7 @@ export function spawnWithSeed(
581
587
  entityType: EntityType,
582
588
  variant: int,
583
589
  subType: int,
584
- position: Vector,
590
+ positionOrGridIndex: Vector | int,
585
591
  seedOrRNG: Seed | RNG,
586
592
  velocity: Vector = VectorZero,
587
593
  spawner: Entity | undefined = undefined,
@@ -590,7 +596,7 @@ export function spawnWithSeed(
590
596
  entityType,
591
597
  variant,
592
598
  subType,
593
- position,
599
+ positionOrGridIndex,
594
600
  velocity,
595
601
  spawner,
596
602
  seedOrRNG,