isaacscript-common 6.12.0 → 6.15.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 (78) hide show
  1. package/dist/enums/private/SerializationBrand.d.ts +1 -1
  2. package/dist/enums/private/SerializationBrand.lua +1 -1
  3. package/dist/features/collectibleItemPoolType.d.ts +2 -2
  4. package/dist/features/collectibleItemPoolType.lua +2 -2
  5. package/dist/features/customGridEntity.d.ts +2 -2
  6. package/dist/features/customGridEntity.lua +2 -2
  7. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
  8. package/dist/features/customTrapdoor/blackSprite.lua +6 -6
  9. package/dist/features/extraConsoleCommands/exports.d.ts +4 -3
  10. package/dist/features/extraConsoleCommands/exports.d.ts.map +1 -1
  11. package/dist/features/extraConsoleCommands/exports.lua +4 -3
  12. package/dist/features/extraConsoleCommands/init.lua +12 -14
  13. package/dist/features/extraConsoleCommands/listCommands.d.ts +15 -19
  14. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  15. package/dist/features/extraConsoleCommands/listCommands.lua +30 -38
  16. package/dist/functions/collectibles.d.ts +6 -2
  17. package/dist/functions/collectibles.d.ts.map +1 -1
  18. package/dist/functions/collectibles.lua +4 -2
  19. package/dist/functions/color.d.ts +10 -0
  20. package/dist/functions/color.d.ts.map +1 -1
  21. package/dist/functions/color.lua +24 -0
  22. package/dist/functions/gridEntities.d.ts +2 -20
  23. package/dist/functions/gridEntities.d.ts.map +1 -1
  24. package/dist/functions/gridEntities.lua +2 -59
  25. package/dist/functions/itemPool.d.ts +10 -0
  26. package/dist/functions/itemPool.d.ts.map +1 -0
  27. package/dist/functions/itemPool.lua +116 -0
  28. package/dist/functions/kColor.d.ts +10 -0
  29. package/dist/functions/kColor.d.ts.map +1 -1
  30. package/dist/functions/kColor.lua +24 -0
  31. package/dist/functions/map.d.ts +2 -0
  32. package/dist/functions/map.d.ts.map +1 -1
  33. package/dist/functions/map.lua +7 -0
  34. package/dist/functions/npcs.d.ts +2 -2
  35. package/dist/functions/npcs.lua +2 -2
  36. package/dist/functions/random.d.ts +1 -1
  37. package/dist/functions/random.lua +1 -1
  38. package/dist/functions/rockAlt.d.ts +24 -0
  39. package/dist/functions/rockAlt.d.ts.map +1 -0
  40. package/dist/functions/rockAlt.lua +285 -0
  41. package/dist/functions/saveFile.d.ts +8 -7
  42. package/dist/functions/saveFile.d.ts.map +1 -1
  43. package/dist/functions/saveFile.lua +10 -96
  44. package/dist/functions/set.d.ts +2 -0
  45. package/dist/functions/set.d.ts.map +1 -1
  46. package/dist/functions/set.lua +6 -0
  47. package/dist/functions/trinketGive.d.ts +13 -0
  48. package/dist/functions/trinketGive.d.ts.map +1 -1
  49. package/dist/functions/trinketGive.lua +16 -0
  50. package/dist/functions/vector.d.ts +11 -0
  51. package/dist/functions/vector.d.ts.map +1 -1
  52. package/dist/functions/vector.lua +23 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.lua +16 -0
  56. package/package.json +2 -2
  57. package/src/callbacks/postPickupInitFirst.ts +2 -0
  58. package/src/enums/private/SerializationBrand.ts +1 -1
  59. package/src/features/collectibleItemPoolType.ts +3 -3
  60. package/src/features/customGridEntity.ts +2 -2
  61. package/src/features/customTrapdoor/blackSprite.ts +11 -5
  62. package/src/features/extraConsoleCommands/exports.ts +4 -3
  63. package/src/features/extraConsoleCommands/init.ts +18 -14
  64. package/src/features/extraConsoleCommands/listCommands.ts +33 -36
  65. package/src/functions/collectibles.ts +6 -2
  66. package/src/functions/color.ts +22 -0
  67. package/src/functions/gridEntities.ts +2 -54
  68. package/src/functions/itemPool.ts +153 -0
  69. package/src/functions/kColor.ts +22 -0
  70. package/src/functions/map.ts +10 -0
  71. package/src/functions/npcs.ts +2 -2
  72. package/src/functions/random.ts +1 -1
  73. package/src/functions/rockAlt.ts +309 -0
  74. package/src/functions/saveFile.ts +13 -119
  75. package/src/functions/set.ts +7 -1
  76. package/src/functions/trinketGive.ts +21 -0
  77. package/src/functions/vector.ts +23 -0
  78. package/src/index.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.12.0",
3
+ "version": "6.15.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/index",
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.34"
25
+ "isaac-typescript-definitions": "^3.0.35"
26
26
  }
27
27
  }
@@ -29,6 +29,8 @@ function postPickupInit(pickup: EntityPickup) {
29
29
  return;
30
30
  }
31
31
 
32
+ // The room visited count is not reset when re-entering a Treasure Room or Boss room in the
33
+ // Ascent.
32
34
  const roomVisitedCount = getRoomVisitedCount();
33
35
  if (roomVisitedCount > 0) {
34
36
  return;
@@ -2,7 +2,7 @@
2
2
  * During serialization, we write an arbitrary string key to the object with a value of an empty
3
3
  * string. This is used during deserialization to instantiate the correct type of object.
4
4
  *
5
- * Note that we do not bother branding TSTL classes because we have no way to invoke the proper
5
+ * Note that we do not bother branding TSTL classes because we have no way to run the proper
6
6
  * constructor during deserialization.
7
7
  */
8
8
  export enum SerializationBrand {
@@ -1,5 +1,5 @@
1
1
  // The item pool type of a collectible is not stored on the collectible. Thus, we scan for incoming
2
- // item pool types in the PreGetCollectible callback, and then assume that the next spawned
2
+ // item pool types in the `PRE_GET_COLLECTIBLE` callback, and then assume that the next spawned
3
3
  // collectible has this item pool type.
4
4
 
5
5
  import {
@@ -45,8 +45,8 @@ function postPickupInitCollectible(pickup: EntityPickup) {
45
45
 
46
46
  /**
47
47
  * Helper function to get the item pool type that a given collectible came from. Since there is no
48
- * native method in the API to get this, we listen in the PreGetCollectible callback for item pool
49
- * types, and then assume that the next spawned collectible will match.
48
+ * native method in the API to get this, we listen in the `PRE_GET_COLLECTIBLE` callback for item
49
+ * pool types, and then assume that the next spawned collectible will match.
50
50
  */
51
51
  export function getCollectibleItemPoolType(
52
52
  collectible: EntityPickup,
@@ -228,8 +228,8 @@ export function spawnCustomGridEntity(
228
228
  * Default is true. This is generally a good idea because if the room is not
229
229
  * updated, you will be unable to spawn another grid entity on the same tile until
230
230
  * a frame has passed. However, doing this is expensive, since it involves a call
231
- * to `Isaac.GetRoomEntities`, so set it to false if you need to invoke this
232
- * function multiple times.
231
+ * to `Isaac.GetRoomEntities`, so set it to false if you need to run this function
232
+ * multiple times.
233
233
  * @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
234
234
  * given location or if the given grid entity was not a custom grid entity.
235
235
  */
@@ -1,16 +1,22 @@
1
1
  import { VectorZero } from "../../constants";
2
2
  import { StageTravelState } from "../../enums/private/StageTravelState";
3
- import { ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH } from "../customStage/customStageConstants";
4
3
  import v from "./v";
5
4
 
6
- const sprite = Sprite();
7
- sprite.Load(`${ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH}/black.anm2`, true);
8
- sprite.SetFrame("Default", 0);
5
+ // In order to represent a black sprite, we just use the first frame of the boss versus screen
6
+ // animation. However, we must lazy load the sprite in order to prevent issues with mods that
7
+ // replace the vanilla files. (For some reason, loading the sprites will cause the overwrite to no
8
+ // longer apply on the second and subsequent runs.)
9
+ const blackSprite = Sprite();
9
10
 
10
11
  export function drawBlackSprite(): void {
11
12
  if (v.run.state !== StageTravelState.PAUSING_ON_BLACK) {
12
13
  return;
13
14
  }
14
15
 
15
- sprite.RenderLayer(0, VectorZero);
16
+ if (!blackSprite.IsLoaded()) {
17
+ blackSprite.Load("gfx/ui/boss/versusscreen.anm2", true);
18
+ blackSprite.SetFrame("Scene", 0);
19
+ }
20
+
21
+ blackSprite.RenderLayer(0, VectorZero);
16
22
  }
@@ -24,9 +24,10 @@ export function enableExtraConsoleCommands(mod: ModUpgraded): void {
24
24
  *
25
25
  * The standard library comes with many existing console commands that are useful for debugging, but
26
26
  * you can also add your own commands that are useful for your particular mod. It's easier to add
27
- * commands to the existing command system than to add logic manually to the ExecuteCmd callback.
27
+ * commands to the existing command system than to add your own logic manually to the `EXECUTE_CMD`
28
+ * callback.
28
29
  *
29
- * Before using this function, you must first invoke `enableExtraConsoleCommands`.
30
+ * Before using this function, you must first run the `enableExtraConsoleCommands` function.
30
31
  */
31
32
  export function addConsoleCommand(
32
33
  commandName: string,
@@ -59,7 +60,7 @@ export function addConsoleCommand(
59
60
  * The standard library comes with many existing console commands that are useful for debugging. If
60
61
  * you want to disable one of them, use this function.
61
62
  *
62
- * Before using this function, you must first invoke `enableExtraConsoleCommands`.
63
+ * Before using this function, you must first run the `enableExtraConsoleCommands` function.
63
64
  */
64
65
  export function removeConsoleCommand(commandName: string): void {
65
66
  if (!isExtraConsoleCommandsInitialized()) {
@@ -27,7 +27,7 @@ export function extraConsoleCommandsInit(mod: ModUpgraded): void {
27
27
  function initMap() {
28
28
  extraConsoleCommandsFunctionMap.set("1hp", commands.oneHP);
29
29
  extraConsoleCommandsFunctionMap.set("addCharges", commands.addCharges);
30
- extraConsoleCommandsFunctionMap.set("angel", commands.angel);
30
+ extraConsoleCommandsFunctionMap.set("angelRoom", commands.angelRoom);
31
31
  extraConsoleCommandsFunctionMap.set("ascent", commands.ascent);
32
32
  extraConsoleCommandsFunctionMap.set("bedroom", commands.bedroom);
33
33
  extraConsoleCommandsFunctionMap.set("bh", commands.bh);
@@ -46,7 +46,7 @@ function initMap() {
46
46
  );
47
47
  extraConsoleCommandsFunctionMap.set("bombs", commands.bombs);
48
48
  extraConsoleCommandsFunctionMap.set("boneHearts", commands.boneHearts);
49
- extraConsoleCommandsFunctionMap.set("boss", commands.boss);
49
+ extraConsoleCommandsFunctionMap.set("bossRoom", commands.bossRoom);
50
50
  extraConsoleCommandsFunctionMap.set("bossRush", commands.bossRush);
51
51
  extraConsoleCommandsFunctionMap.set("brokenHearts", commands.brokenHearts);
52
52
  extraConsoleCommandsFunctionMap.set("card", commands.card);
@@ -66,7 +66,7 @@ function initMap() {
66
66
  extraConsoleCommandsFunctionMap.set("d6", commands.d6);
67
67
  extraConsoleCommandsFunctionMap.set("damage", commands.damage);
68
68
  extraConsoleCommandsFunctionMap.set("dd", commands.dd);
69
- extraConsoleCommandsFunctionMap.set("devil", commands.devil);
69
+ extraConsoleCommandsFunctionMap.set("devilRoom", commands.devilRoom);
70
70
  extraConsoleCommandsFunctionMap.set("dirtyBedroom", commands.dirtyBedroom);
71
71
  extraConsoleCommandsFunctionMap.set("disableCurses", commands.disableCurses);
72
72
  extraConsoleCommandsFunctionMap.set(
@@ -89,7 +89,7 @@ function initMap() {
89
89
  commandsDisplay.effectsDisplay,
90
90
  );
91
91
  extraConsoleCommandsFunctionMap.set("eh", commands.eh);
92
- extraConsoleCommandsFunctionMap.set("error", commands.error);
92
+ extraConsoleCommandsFunctionMap.set("errorRoom", commands.errorRoom);
93
93
  extraConsoleCommandsFunctionMap.set("eternalHearts", commands.eternalHearts);
94
94
  extraConsoleCommandsFunctionMap.set(
95
95
  "familiarDisplay",
@@ -113,10 +113,9 @@ function initMap() {
113
113
  extraConsoleCommandsFunctionMap.set("grid2", commands.grid2);
114
114
  extraConsoleCommandsFunctionMap.set("gridCosts", commands.gridCosts);
115
115
  extraConsoleCommandsFunctionMap.set("gridEntities", commands.gridEntities);
116
- extraConsoleCommandsFunctionMap.set("h", commands.h);
117
116
  extraConsoleCommandsFunctionMap.set("hearts", commands.hearts);
118
117
  extraConsoleCommandsFunctionMap.set("hitboxes", commands.hitboxes);
119
- extraConsoleCommandsFunctionMap.set("iAmError", commands.iAmError);
118
+ extraConsoleCommandsFunctionMap.set("iAmErrorRoom", commands.iAmErrorRoom);
120
119
  extraConsoleCommandsFunctionMap.set("key", commands.key);
121
120
  extraConsoleCommandsFunctionMap.set("keys", commands.keys);
122
121
  extraConsoleCommandsFunctionMap.set(
@@ -146,7 +145,6 @@ function initMap() {
146
145
  extraConsoleCommandsFunctionMap.set("mana", commands.mana);
147
146
  extraConsoleCommandsFunctionMap.set("map", commands.map);
148
147
  extraConsoleCommandsFunctionMap.set("maxHearts", commands.maxHearts);
149
- extraConsoleCommandsFunctionMap.set("mh", commands.mh);
150
148
  extraConsoleCommandsFunctionMap.set("miniboss", commands.miniboss);
151
149
  extraConsoleCommandsFunctionMap.set("noCurses", commands.noCurses);
152
150
  extraConsoleCommandsFunctionMap.set("npcDisplay", commandsDisplay.npcDisplay);
@@ -207,7 +205,6 @@ function initMap() {
207
205
  commandsDisplay.projectilesDisplay,
208
206
  );
209
207
  extraConsoleCommandsFunctionMap.set("redHearts", commands.redHearts);
210
- extraConsoleCommandsFunctionMap.set("rh", commands.rh);
211
208
  extraConsoleCommandsFunctionMap.set("right", commands.right);
212
209
  extraConsoleCommandsFunctionMap.set(
213
210
  "rockDisplay",
@@ -221,13 +218,12 @@ function initMap() {
221
218
  extraConsoleCommandsFunctionMap.set("rottenHearts", commands.rottenHearts);
222
219
  extraConsoleCommandsFunctionMap.set("runTests", commands.runTests);
223
220
  extraConsoleCommandsFunctionMap.set("s", commands.s);
224
- extraConsoleCommandsFunctionMap.set("sacrifice", commands.sacrifice);
225
- extraConsoleCommandsFunctionMap.set("secret", commands.secret);
221
+ extraConsoleCommandsFunctionMap.set("sacrificeRoom", commands.sacrificeRoom);
222
+ extraConsoleCommandsFunctionMap.set("secretRoom", commands.secretRoom);
226
223
  extraConsoleCommandsFunctionMap.set("seedStick", commands.seedStick);
227
224
  extraConsoleCommandsFunctionMap.set("seeds", commands.seedsCommand);
228
225
  extraConsoleCommandsFunctionMap.set("setCharges", commands.setCharges);
229
226
  extraConsoleCommandsFunctionMap.set("setPosition", commands.setPosition);
230
- extraConsoleCommandsFunctionMap.set("sh", commands.sh);
231
227
  extraConsoleCommandsFunctionMap.set("shop", commands.shop);
232
228
  extraConsoleCommandsFunctionMap.set(
233
229
  "slotDisplay",
@@ -256,8 +252,12 @@ function initMap() {
256
252
  "spikesDisplay",
257
253
  commandsDisplay.spikesDisplay,
258
254
  );
259
- extraConsoleCommandsFunctionMap.set("supersecret", commands.superSecret);
255
+ extraConsoleCommandsFunctionMap.set(
256
+ "superSecretRoom",
257
+ commands.superSecretRoom,
258
+ );
260
259
  extraConsoleCommandsFunctionMap.set("startingRoom", commands.startingRoom);
260
+ extraConsoleCommandsFunctionMap.set("startRoom", commands.startRoom);
261
261
  extraConsoleCommandsFunctionMap.set(
262
262
  "tearDisplay",
263
263
  commandsDisplay.tearDisplay,
@@ -267,14 +267,18 @@ function initMap() {
267
267
  "tearsDisplay",
268
268
  commandsDisplay.tearsDisplay,
269
269
  );
270
+ extraConsoleCommandsFunctionMap.set("tests", commands.tests);
270
271
  extraConsoleCommandsFunctionMap.set("tntDisplay", commandsDisplay.tntDisplay);
271
272
  extraConsoleCommandsFunctionMap.set(
272
273
  "tntsDisplay",
273
274
  commandsDisplay.tntsDisplay,
274
275
  );
275
276
  extraConsoleCommandsFunctionMap.set("trapdoor", commands.trapdoorCommand);
276
- extraConsoleCommandsFunctionMap.set("treasure", commands.treasure);
277
- extraConsoleCommandsFunctionMap.set("ultraSecret", commands.ultraSecret);
277
+ extraConsoleCommandsFunctionMap.set("treasureRoom", commands.treasureRoom);
278
+ extraConsoleCommandsFunctionMap.set(
279
+ "ultraSecretRoom",
280
+ commands.ultraSecretRoom,
281
+ );
278
282
  extraConsoleCommandsFunctionMap.set("unseed", commands.unseed);
279
283
  extraConsoleCommandsFunctionMap.set("up", commands.up);
280
284
  extraConsoleCommandsFunctionMap.set("warp", commands.warp);
@@ -1,16 +1,23 @@
1
1
  // This file is arbitrarily named "listCommands.ts" instead of "commands.ts" so that it will appear
2
- // below the "init" page.
2
+ // below "exports.ts".
3
3
 
4
4
  // cspell:ignore addcharges
5
5
  /**
6
6
  * This is a list of custom console commands that are included with the standard library.
7
7
  *
8
- * Note that as a quality of life feature, you do not have to match the casing of the command. For
9
- * example, you can type the "addCharges" command as "addcharges", and it will still work the same.
8
+ * As a quality of life feature, you do not have to match the casing of the command. For example,
9
+ * you can type the "addCharges" command as "addcharges", and it will still work the same.
10
+ *
11
+ * Additionally, you can also abbreviate any command by omitting letters that do not overlap with
12
+ * any other command. For example, the command of "c" will be interpreted as the "card" command.
10
13
  *
11
14
  * In order for the custom console commands to work, you first have to call
12
15
  * `enableExtraConsoleCommands`. (See the "Extra Console Commands (Init)" page for more details.)
13
16
  *
17
+ * Each command has a corresponding function of the same name, but these functions are not actually
18
+ * exported for end-user consumption. (This is to cut down on namespace conflicts and because the
19
+ * names of the functions are not very descriptive.)
20
+ *
14
21
  * @module
15
22
  */
16
23
 
@@ -151,7 +158,7 @@ export function addCharges(params: string): void {
151
158
  * Warps to the Angel Room for the floor. If the Devil Room has already been visited or initialized,
152
159
  * this will uninitialize it and make an Angel Room instead.
153
160
  */
154
- export function angel(): void {
161
+ export function angelRoom(): void {
155
162
  devilAngel(false);
156
163
  }
157
164
 
@@ -276,7 +283,7 @@ export function boneHearts(params: string): void {
276
283
  }
277
284
 
278
285
  /** Warps to the first Boss Room on the floor. */
279
- export function boss(): void {
286
+ export function bossRoom(): void {
280
287
  warpToRoomType(RoomType.BOSS);
281
288
  }
282
289
 
@@ -473,14 +480,14 @@ export function damage(): void {
473
480
 
474
481
  /** Alias for the "devil" command. */
475
482
  export function dd(): void {
476
- devil();
483
+ devilRoom();
477
484
  }
478
485
 
479
486
  /**
480
487
  * Warps to the Devil Room for the floor. If the Angel Room has already been visited or initialized,
481
488
  * this will uninitialize it and make an Devil Room instead.
482
489
  */
483
- export function devil(): void {
490
+ export function devilRoom(): void {
484
491
  devilAngel(true);
485
492
  }
486
493
 
@@ -500,7 +507,7 @@ export function down(params: string): void {
500
507
  movePlayer(params, Direction.DOWN);
501
508
  }
502
509
 
503
- /** Warps to the Dungeon (i.e. crawl space) for the floor. */
510
+ /** Warps to the Dungeon (i.e. the crawl space room) for the floor. */
504
511
  export function dungeon(): void {
505
512
  changeRoom(GridRoom.DUNGEON);
506
513
  }
@@ -518,8 +525,8 @@ export function eh(params: string): void {
518
525
  }
519
526
 
520
527
  /** Alias for the "iAmError" command. */
521
- export function error(): void {
522
- iAmError();
528
+ export function errorRoom(): void {
529
+ iAmErrorRoom();
523
530
  }
524
531
 
525
532
  /**
@@ -663,11 +670,6 @@ export function gridEntities(): void {
663
670
  }
664
671
  }
665
672
 
666
- /** Alias for the "hearts" command. */
667
- export function h(params: string): void {
668
- hearts(params);
669
- }
670
-
671
673
  /**
672
674
  * Gives a half red heart. Provide a number to give a custom amount of hearts. (You can use negative
673
675
  * numbers to remove hearts.)
@@ -682,7 +684,7 @@ export function hitboxes(): void {
682
684
  }
683
685
 
684
686
  /** Warps to the I AM ERROR room for the floor. */
685
- export function iAmError(): void {
687
+ export function iAmErrorRoom(): void {
686
688
  changeRoom(GridRoom.ERROR);
687
689
  }
688
690
 
@@ -816,11 +818,6 @@ export function maxHearts(params: string): void {
816
818
  addHeart(params, HealthType.MAX_HEARTS);
817
819
  }
818
820
 
819
- /** Alias for the "maxHearts" command. */
820
- export function mh(params: string): void {
821
- maxHearts(params);
822
- }
823
-
824
821
  /** Warps to the first Miniboss Room on the floor. */
825
822
  export function miniboss(): void {
826
823
  warpToRoomType(RoomType.MINI_BOSS);
@@ -964,11 +961,6 @@ export function redHearts(params: string): void {
964
961
  hearts(params);
965
962
  }
966
963
 
967
- /** Alias for the "redHearts" command. */
968
- export function rh(params: string): void {
969
- redHearts(params);
970
- }
971
-
972
964
  /** Moves the player 0.5 units right. Provide a number to move a custom amount of units. */
973
965
  export function right(params: string): void {
974
966
  movePlayer(params, Direction.RIGHT);
@@ -1048,12 +1040,12 @@ export function s(params: string): void {
1048
1040
  }
1049
1041
 
1050
1042
  /** Warps to the first Sacrifice Room on the floor. */
1051
- export function sacrifice(): void {
1043
+ export function sacrificeRoom(): void {
1052
1044
  warpToRoomType(RoomType.SACRIFICE);
1053
1045
  }
1054
1046
 
1055
1047
  /** Warps to the first Secret Room on the floor. */
1056
- export function secret(): void {
1048
+ export function secretRoom(): void {
1057
1049
  warpToRoomType(RoomType.SECRET);
1058
1050
  }
1059
1051
 
@@ -1160,11 +1152,6 @@ export function setPosition(params: string): void {
1160
1152
  player.Position = position;
1161
1153
  }
1162
1154
 
1163
- /** Alias for the "soulHearts" command. */
1164
- export function sh(params: string): void {
1165
- soulHearts(params);
1166
- }
1167
-
1168
1155
  /** Warps to the first shop on the floor. */
1169
1156
  export function shop(): void {
1170
1157
  warpToRoomType(RoomType.SHOP);
@@ -1280,8 +1267,13 @@ export function startingRoom(): void {
1280
1267
  changeRoom(startingRoomIndex);
1281
1268
  }
1282
1269
 
1270
+ /** Alias for the "startingRoom" command. */
1271
+ export function startRoom(): void {
1272
+ startingRoom();
1273
+ }
1274
+
1283
1275
  /** Warps to the first Super Secret Room on the floor. */
1284
- export function superSecret(): void {
1276
+ export function superSecretRoom(): void {
1285
1277
  warpToRoomType(RoomType.SUPER_SECRET);
1286
1278
  }
1287
1279
 
@@ -1299,18 +1291,23 @@ export function tears(): void {
1299
1291
  printEnabled(v.run.maxDamage, "debug tear-rate");
1300
1292
  }
1301
1293
 
1294
+ /** Alias for the "runTests" command. */
1295
+ export function tests(): void {
1296
+ runTests();
1297
+ }
1298
+
1302
1299
  /** Creates a trapdoor next to the player. */
1303
1300
  export function trapdoorCommand(): void {
1304
1301
  spawnTrapdoorOrCrawlSpace(true);
1305
1302
  }
1306
1303
 
1307
1304
  /** Warps to the first Treasure Room on the floor. */
1308
- export function treasure(): void {
1305
+ export function treasureRoom(): void {
1309
1306
  warpToRoomType(RoomType.TREASURE);
1310
1307
  }
1311
1308
 
1312
1309
  /** Warps to the first Ultra Secret Room on the floor. */
1313
- export function ultraSecret(): void {
1310
+ export function ultraSecretRoom(): void {
1314
1311
  warpToRoomType(RoomType.ULTRA_SECRET);
1315
1312
  }
1316
1313
 
@@ -323,6 +323,10 @@ export function getCollectibleName(collectibleType: CollectibleType): string {
323
323
  return DEFAULT_COLLECTIBLE_NAME;
324
324
  }
325
325
 
326
+ /**
327
+ * Helper function to get the "pedestal type" of a collectible. For example, it might be sitting on
328
+ * top of a broken Blood Donation Machine, or it might be sitting on top of an opened Spiked Chest.
329
+ */
326
330
  export function getCollectiblePedestalType(
327
331
  collectible: EntityPickup,
328
332
  ): CollectiblePedestalType {
@@ -338,8 +342,8 @@ export function getCollectiblePedestalType(
338
342
  }
339
343
 
340
344
  /**
341
- * Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
342
- * type was not valid.
345
+ * Helper function to get a collectible's quality. For example, Mom's Knife has a quality of 4.
346
+ * Returns 0 if the provided collectible type was not valid.
343
347
  */
344
348
  export function getCollectibleQuality(collectibleType: CollectibleType): int {
345
349
  const itemConfigItem = itemConfig.GetCollectible(collectibleType);
@@ -1,6 +1,8 @@
1
1
  import { SerializationBrand } from "../enums/private/SerializationBrand";
2
2
  import { SerializationType } from "../enums/SerializationType";
3
3
  import { isaacAPIClassEquals, isIsaacAPIClassOfType } from "./isaacAPIClass";
4
+ import { getRandom } from "./random";
5
+ import { getRandomSeed, isRNG, newRNG } from "./rng";
4
6
  import { copyValuesToTable, getNumbersFromTable, tableHasKeys } from "./table";
5
7
  import { isTable } from "./types";
6
8
 
@@ -105,6 +107,26 @@ export function copyColor(
105
107
  }
106
108
  }
107
109
 
110
+ /**
111
+ * Helper function to get a random color.
112
+ *
113
+ * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
114
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
115
+ * @param alpha Optional. The alpha value to use. Default is 1.
116
+ */
117
+ export function getRandomColor(
118
+ seedOrRNG: Seed | RNG = getRandomSeed(),
119
+ alpha = 1,
120
+ ): Color {
121
+ const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
122
+
123
+ const r = getRandom(rng);
124
+ const g = getRandom(rng);
125
+ const b = getRandom(rng);
126
+
127
+ return Color(r, g, b, alpha);
128
+ }
129
+
108
130
  /** Helper function to check if something is an instantiated Color object. */
109
131
  export function isColor(object: unknown): object is Color {
110
132
  return isIsaacAPIClassOfType(object, OBJECT_NAME);
@@ -19,7 +19,6 @@ import {
19
19
  import { BACKDROP_TYPE_TO_ROCK_ALT_TYPE } from "../objects/backdropTypeToRockAltType";
20
20
  import { AnyGridEntity } from "../types/AnyGridEntity";
21
21
  import { isCircleIntersectingRectangle } from "./math";
22
- import { getRandomSeed } from "./rng";
23
22
  import { roomUpdateSafe } from "./rooms";
24
23
  import { clearSprite } from "./sprites";
25
24
  import { isNumber } from "./types";
@@ -488,7 +487,7 @@ export function removeAllMatchingGridEntities(
488
487
  * generally a good idea because if the room is not updated, you will be unable to
489
488
  * spawn another grid entity on the same tile until a frame has passed. However,
490
489
  * doing this is expensive, since it involves a call to `Isaac.GetRoomEntities`,
491
- * so set this to false if you need to invoke this function multiple times.
490
+ * so set this to false if you need to run this function multiple times.
492
491
  * @param cap Optional. If specified, will only remove the given amount of entities.
493
492
  * @returns An array of the entities that were removed.
494
493
  */
@@ -527,7 +526,7 @@ export function removeGridEntities<T extends AnyGridEntity>(
527
526
  * generally a good idea because if the room is not updated, you will be unable to
528
527
  * spawn another grid entity on the same tile until a frame has passed. However,
529
528
  * doing this is expensive, since it involves a call to `Isaac.GetRoomEntities`,
530
- * so set this to false if you need to invoke this function multiple times.
529
+ * so set this to false if you need to run this function multiple times.
531
530
  */
532
531
  export function removeGridEntity(
533
532
  gridEntityOrGridIndex: GridEntity | int,
@@ -654,57 +653,6 @@ export function spawnGridEntityWithVariant(
654
653
  return gridEntity;
655
654
  }
656
655
 
657
- /**
658
- * Helper function for emulating what happens when a vanilla `GridEntityType.ROCK_ALT` grid entity
659
- * breaks.
660
- *
661
- * Note that most of the time, this function will do nothing, similar to how most of the time, when
662
- * an individual urn is destroyed, nothing will spawn.
663
- *
664
- * The logic in this function is based on the rewards listed on the wiki:
665
- * https://bindingofisaacrebirth.fandom.com/wiki/Rocks
666
- *
667
- * @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a chance
668
- * at spawning coins and spiders.
669
- * @param _seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
670
- * the `RNG.Next` method will be called. Default is `getRandomSeed()`. Normally,
671
- * you should pass the `InitSeed` of the grid entity that was broken.
672
- * @returns Whether or not this function spawned something.
673
- */
674
- export function spawnRockAltReward(
675
- rockAltType: RockAltType,
676
- _seedOrRNG: Seed | RNG = getRandomSeed(),
677
- ): boolean {
678
- /// const chance = getRandom(seedOrRNG);
679
-
680
- switch (rockAltType) {
681
- case RockAltType.URN: {
682
- // TODO
683
- return false;
684
- }
685
-
686
- case RockAltType.MUSHROOM: {
687
- // TODO
688
- return false;
689
- }
690
-
691
- case RockAltType.SKULL: {
692
- // TODO
693
- return false;
694
- }
695
-
696
- case RockAltType.POLYP: {
697
- // TODO
698
- return false;
699
- }
700
-
701
- case RockAltType.BUCKET: {
702
- // TODO
703
- return false;
704
- }
705
- }
706
- }
707
-
708
656
  /**
709
657
  * Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
710
658
  * with the appropriate variant, as the game does not give it the correct sprite automatically.