isaacscript-common 6.7.0 → 6.9.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.
@@ -287,7 +287,7 @@ function ____exports.spawnBombPickupWithSeed(self, bombSubType, position, seedOr
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, subType, position, velocity, spawner, seedOrRNG)
290
+ function ____exports.spawnCard(self, card, position, velocity, spawner, seedOrRNG)
291
291
  if velocity == nil then
292
292
  velocity = VectorZero
293
293
  end
@@ -300,7 +300,7 @@ function ____exports.spawnCard(self, subType, position, velocity, spawner, seedO
300
300
  return spawnPickup(
301
301
  nil,
302
302
  PickupVariant.TAROT_CARD,
303
- subType,
303
+ card,
304
304
  position,
305
305
  velocity,
306
306
  spawner,
@@ -309,7 +309,7 @@ function ____exports.spawnCard(self, subType, position, velocity, spawner, seedO
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, subType, position, seedOrRNG, velocity, spawner)
312
+ function ____exports.spawnCardWithSeed(self, card, position, seedOrRNG, velocity, spawner)
313
313
  if velocity == nil then
314
314
  velocity = VectorZero
315
315
  end
@@ -318,7 +318,7 @@ function ____exports.spawnCardWithSeed(self, subType, position, seedOrRNG, veloc
318
318
  end
319
319
  return ____exports.spawnCard(
320
320
  nil,
321
- subType,
321
+ card,
322
322
  position,
323
323
  velocity,
324
324
  spawner,
@@ -326,7 +326,7 @@ function ____exports.spawnCardWithSeed(self, subType, position, seedOrRNG, veloc
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, subType, position, velocity, spawner, seedOrRNG)
329
+ function ____exports.spawnCoin(self, coinSubType, position, velocity, spawner, seedOrRNG)
330
330
  if velocity == nil then
331
331
  velocity = VectorZero
332
332
  end
@@ -339,7 +339,7 @@ function ____exports.spawnCoin(self, subType, position, velocity, spawner, seedO
339
339
  return spawnPickup(
340
340
  nil,
341
341
  PickupVariant.COIN,
342
- subType,
342
+ coinSubType,
343
343
  position,
344
344
  velocity,
345
345
  spawner,
@@ -348,7 +348,7 @@ function ____exports.spawnCoin(self, subType, position, velocity, spawner, seedO
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, subType, position, seedOrRNG, velocity, spawner)
351
+ function ____exports.spawnCoinWithSeed(self, coinSubType, position, seedOrRNG, velocity, spawner)
352
352
  if velocity == nil then
353
353
  velocity = VectorZero
354
354
  end
@@ -357,7 +357,7 @@ function ____exports.spawnCoinWithSeed(self, subType, position, seedOrRNG, veloc
357
357
  end
358
358
  return ____exports.spawnCoin(
359
359
  nil,
360
- subType,
360
+ coinSubType,
361
361
  position,
362
362
  velocity,
363
363
  spawner,
@@ -365,7 +365,7 @@ function ____exports.spawnCoinWithSeed(self, subType, position, seedOrRNG, veloc
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, subType, position, velocity, spawner, seedOrRNG)
368
+ function ____exports.spawnHeart(self, heartSubType, position, velocity, spawner, seedOrRNG)
369
369
  if velocity == nil then
370
370
  velocity = VectorZero
371
371
  end
@@ -378,14 +378,14 @@ function ____exports.spawnHeart(self, subType, position, velocity, spawner, seed
378
378
  return spawnPickup(
379
379
  nil,
380
380
  PickupVariant.HEART,
381
- subType,
381
+ heartSubType,
382
382
  position,
383
383
  velocity,
384
384
  spawner,
385
385
  seedOrRNG
386
386
  )
387
387
  end
388
- function ____exports.spawnHeartWithSeed(self, subType, position, seedOrRNG, velocity, spawner)
388
+ function ____exports.spawnHeartWithSeed(self, heartSubType, position, seedOrRNG, velocity, spawner)
389
389
  if velocity == nil then
390
390
  velocity = VectorZero
391
391
  end
@@ -394,7 +394,7 @@ function ____exports.spawnHeartWithSeed(self, subType, position, seedOrRNG, velo
394
394
  end
395
395
  return ____exports.spawnHeart(
396
396
  nil,
397
- subType,
397
+ heartSubType,
398
398
  position,
399
399
  velocity,
400
400
  spawner,
@@ -402,7 +402,7 @@ function ____exports.spawnHeartWithSeed(self, subType, position, seedOrRNG, velo
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, subType, position, velocity, spawner, seedOrRNG)
405
+ function ____exports.spawnKey(self, keySubType, position, velocity, spawner, seedOrRNG)
406
406
  if velocity == nil then
407
407
  velocity = VectorZero
408
408
  end
@@ -415,7 +415,7 @@ function ____exports.spawnKey(self, subType, position, velocity, spawner, seedOr
415
415
  return spawnPickup(
416
416
  nil,
417
417
  PickupVariant.KEY,
418
- subType,
418
+ keySubType,
419
419
  position,
420
420
  velocity,
421
421
  spawner,
@@ -424,7 +424,7 @@ function ____exports.spawnKey(self, subType, position, velocity, spawner, seedOr
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, subType, position, seedOrRNG, velocity, spawner)
427
+ function ____exports.spawnKeyWithSeed(self, keySubType, position, seedOrRNG, velocity, spawner)
428
428
  if velocity == nil then
429
429
  velocity = VectorZero
430
430
  end
@@ -433,7 +433,7 @@ function ____exports.spawnKeyWithSeed(self, subType, position, seedOrRNG, veloci
433
433
  end
434
434
  return ____exports.spawnKey(
435
435
  nil,
436
- subType,
436
+ keySubType,
437
437
  position,
438
438
  velocity,
439
439
  spawner,
@@ -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, subType, position, seedOrRNG, velocity, spawner)
466
+ function ____exports.spawnPillWithSeed(self, pillColor, position, seedOrRNG, velocity, spawner)
467
467
  if velocity == nil then
468
468
  velocity = VectorZero
469
469
  end
@@ -472,7 +472,7 @@ function ____exports.spawnPillWithSeed(self, subType, position, seedOrRNG, veloc
472
472
  end
473
473
  return ____exports.spawnPill(
474
474
  nil,
475
- subType,
475
+ pillColor,
476
476
  position,
477
477
  velocity,
478
478
  spawner,
@@ -480,7 +480,7 @@ function ____exports.spawnPillWithSeed(self, subType, position, seedOrRNG, veloc
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, subType, position, velocity, spawner, seedOrRNG)
483
+ function ____exports.spawnSack(self, sackSubType, position, velocity, spawner, seedOrRNG)
484
484
  if velocity == nil then
485
485
  velocity = VectorZero
486
486
  end
@@ -493,7 +493,7 @@ function ____exports.spawnSack(self, subType, position, velocity, spawner, seedO
493
493
  return spawnPickup(
494
494
  nil,
495
495
  PickupVariant.SACK,
496
- subType,
496
+ sackSubType,
497
497
  position,
498
498
  velocity,
499
499
  spawner,
@@ -502,7 +502,7 @@ function ____exports.spawnSack(self, subType, position, velocity, spawner, seedO
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, subType, position, seedOrRNG, velocity, spawner)
505
+ function ____exports.spawnSackWithSeed(self, sackSubType, position, seedOrRNG, velocity, spawner)
506
506
  if velocity == nil then
507
507
  velocity = VectorZero
508
508
  end
@@ -511,7 +511,7 @@ function ____exports.spawnSackWithSeed(self, subType, position, seedOrRNG, veloc
511
511
  end
512
512
  return ____exports.spawnSack(
513
513
  nil,
514
- subType,
514
+ sackSubType,
515
515
  position,
516
516
  velocity,
517
517
  spawner,
@@ -519,7 +519,7 @@ function ____exports.spawnSackWithSeed(self, subType, position, seedOrRNG, veloc
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, subType, position, velocity, spawner, seedOrRNG)
522
+ function ____exports.spawnTrinket(self, trinketType, position, velocity, spawner, seedOrRNG)
523
523
  if velocity == nil then
524
524
  velocity = VectorZero
525
525
  end
@@ -532,7 +532,7 @@ function ____exports.spawnTrinket(self, subType, position, velocity, spawner, se
532
532
  return spawnPickup(
533
533
  nil,
534
534
  PickupVariant.TRINKET,
535
- subType,
535
+ trinketType,
536
536
  position,
537
537
  velocity,
538
538
  spawner,
@@ -541,7 +541,7 @@ function ____exports.spawnTrinket(self, subType, position, velocity, spawner, se
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, subType, position, seedOrRNG, velocity, spawner)
544
+ function ____exports.spawnTrinketWithSeed(self, trinketType, position, seedOrRNG, velocity, spawner)
545
545
  if velocity == nil then
546
546
  velocity = VectorZero
547
547
  end
@@ -550,7 +550,7 @@ function ____exports.spawnTrinketWithSeed(self, subType, position, seedOrRNG, ve
550
550
  end
551
551
  return ____exports.spawnTrinket(
552
552
  nil,
553
- subType,
553
+ trinketType,
554
554
  position,
555
555
  velocity,
556
556
  spawner,
@@ -13,6 +13,14 @@ export declare function onSetSeed(): boolean;
13
13
  * You can optionally specify a `PlayerType` to restart the game as that character.
14
14
  */
15
15
  export declare function restart(character?: PlayerType): void;
16
+ /**
17
+ * Helper function to restart on the next render frame. Useful because it is impossible to restart
18
+ * the game inside of the `POST_NEW_ROOM`, `POST_NEW_LEVEL`, or `POST_GAME_STARTED` callbacks when a
19
+ * run is first starting.
20
+ *
21
+ * You can optionally specify a `PlayerType` to restart the game as that character.
22
+ */
23
+ export declare function restartNextRenderFrame(character?: PlayerType): void;
16
24
  /**
17
25
  * Helper function to change the run status to that of an unseeded run with a new random seed.
18
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAKrE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMrE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAInE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
@@ -6,6 +6,8 @@ local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
7
  local ____constantsFirstLast = require("constantsFirstLast")
8
8
  local FIRST_CHARACTER = ____constantsFirstLast.FIRST_CHARACTER
9
+ local ____runInNFrames = require("features.runInNFrames")
10
+ local runNextRenderFrame = ____runInNFrames.runNextRenderFrame
9
11
  local ____log = require("functions.log")
10
12
  local log = ____log.log
11
13
  --- Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
@@ -36,6 +38,19 @@ function ____exports.restart(self, character)
36
38
  log((((("Restarting the run as PlayerType." .. tostring(PlayerType[character])) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command)
37
39
  Isaac.ExecuteCommand(command)
38
40
  end
41
+ --- Helper function to restart on the next render frame. Useful because it is impossible to restart
42
+ -- the game inside of the `POST_NEW_ROOM`, `POST_NEW_LEVEL`, or `POST_GAME_STARTED` callbacks when a
43
+ -- run is first starting.
44
+ --
45
+ -- You can optionally specify a `PlayerType` to restart the game as that character.
46
+ function ____exports.restartNextRenderFrame(self, character)
47
+ runNextRenderFrame(
48
+ nil,
49
+ function()
50
+ ____exports.restart(nil, character)
51
+ end
52
+ )
53
+ end
39
54
  --- Helper function to change the run status to that of an unseeded run with a new random seed.
40
55
  --
41
56
  -- This is useful to revert the behavior where playing on a set and restarting the game will not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.7.0",
3
+ "version": "6.9.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -9,7 +9,7 @@ import { game } from "../../cachedClasses";
9
9
  import { HealthType } from "../../enums/HealthType";
10
10
  import { directionToVector } from "../../functions/direction";
11
11
  import { spawnGridEntityWithVariant } from "../../functions/gridEntities";
12
- import { logEntities, logGridEntities } from "../../functions/log";
12
+ import { logAllEntities, logAllGridEntities } from "../../functions/log";
13
13
  import { addPlayerHealthType } from "../../functions/playerHealth";
14
14
  import { getRoomData, getRoomDescriptor } from "../../functions/roomData";
15
15
  import { changeRoom, getRoomGridIndexesForType } from "../../functions/rooms";
@@ -73,7 +73,7 @@ export function listEntities(
73
73
  }
74
74
  }
75
75
 
76
- logEntities(includeBackgroundEffects, entityTypeFilter);
76
+ logAllEntities(includeBackgroundEffects, entityTypeFilter);
77
77
  printConsole('Logged the entities in the room to the "log.txt" file.');
78
78
  }
79
79
 
@@ -87,7 +87,7 @@ export function listGridEntities(params: string, includeWalls: boolean): void {
87
87
  }
88
88
  }
89
89
 
90
- logGridEntities(includeWalls, gridEntityTypeFilter);
90
+ logAllGridEntities(includeWalls, gridEntityTypeFilter);
91
91
  printConsole('Logged the grid entities in the room to the "log.txt" file.');
92
92
  }
93
93