isaacscript-common 87.8.2 → 87.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.
Files changed (77) hide show
  1. package/dist/classes/ModFeature.d.ts.map +1 -1
  2. package/dist/classes/ModFeature.js +2 -0
  3. package/dist/classes/ModUpgraded.d.ts.map +1 -1
  4. package/dist/classes/ModUpgraded.js +1 -0
  5. package/dist/classes/features/other/CustomPickups.d.ts +6 -5
  6. package/dist/classes/features/other/CustomPickups.d.ts.map +1 -1
  7. package/dist/classes/features/other/CustomPickups.js +10 -9
  8. package/dist/classes/features/other/CustomPickups.lua +5 -5
  9. package/dist/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
  10. package/dist/classes/features/other/CustomTrapdoors.js +4 -1
  11. package/dist/classes/features/other/CustomTrapdoors.lua +3 -1
  12. package/dist/classes/features/other/FastReset.d.ts.map +1 -1
  13. package/dist/classes/features/other/FastReset.js +5 -1
  14. package/dist/classes/features/other/FastReset.lua +4 -1
  15. package/dist/classes/features/other/Pause.d.ts.map +1 -1
  16. package/dist/classes/features/other/Pause.js +11 -1
  17. package/dist/classes/features/other/Pause.lua +14 -3
  18. package/dist/classes/features/other/saveDataManager/restoreDefaults.js +1 -1
  19. package/dist/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  20. package/dist/core/constants.d.ts +2 -0
  21. package/dist/core/constants.d.ts.map +1 -1
  22. package/dist/core/constants.js +2 -0
  23. package/dist/core/constants.lua +2 -0
  24. package/dist/enums/ModCallbackCustom.d.ts +10 -8
  25. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  26. package/dist/enums/ModCallbackCustom.js +10 -8
  27. package/dist/functions/bosses.d.ts +2 -2
  28. package/dist/functions/bosses.d.ts.map +1 -1
  29. package/dist/functions/bosses.js +2 -2
  30. package/dist/functions/deepCopyTests.js +10 -16
  31. package/dist/functions/deepCopyTests.lua +8 -16
  32. package/dist/functions/entities.d.ts +4 -4
  33. package/dist/functions/entities.d.ts.map +1 -1
  34. package/dist/functions/entities.js +4 -4
  35. package/dist/functions/entitiesSpecific.d.ts +20 -20
  36. package/dist/functions/entitiesSpecific.d.ts.map +1 -1
  37. package/dist/functions/entitiesSpecific.js +20 -20
  38. package/dist/functions/pickupsSpecific.d.ts +18 -18
  39. package/dist/functions/pickupsSpecific.d.ts.map +1 -1
  40. package/dist/functions/pickupsSpecific.js +18 -18
  41. package/dist/functions/playerCollectibles.d.ts.map +1 -1
  42. package/dist/functions/playerCollectibles.js +1 -3
  43. package/dist/functions/playerCollectibles.lua +1 -1
  44. package/dist/index.rollup.d.ts +62 -57
  45. package/dist/isaacscript-common.lua +676 -46
  46. package/dist/objects/backdropTypeToRockAltType.d.ts +2 -0
  47. package/dist/objects/backdropTypeToRockAltType.d.ts.map +1 -1
  48. package/dist/objects/backdropTypeToRockAltType.js +2 -0
  49. package/dist/objects/backdropTypeToRockAltType.lua +3 -1
  50. package/dist/objects/roomTypeNames.d.ts +1 -0
  51. package/dist/objects/roomTypeNames.d.ts.map +1 -1
  52. package/dist/objects/roomTypeNames.js +1 -0
  53. package/dist/objects/roomTypeNames.lua +2 -1
  54. package/dist/objects/roomTypeSpecialGotoPrefixes.d.ts +1 -0
  55. package/dist/objects/roomTypeSpecialGotoPrefixes.d.ts.map +1 -1
  56. package/dist/objects/roomTypeSpecialGotoPrefixes.js +1 -0
  57. package/dist/objects/roomTypeSpecialGotoPrefixes.lua +2 -1
  58. package/dist/tsdoc-metadata.json +1 -1
  59. package/package.json +6 -6
  60. package/src/classes/ModFeature.ts +2 -0
  61. package/src/classes/ModUpgraded.ts +1 -0
  62. package/src/classes/features/other/CustomPickups.ts +25 -12
  63. package/src/classes/features/other/CustomTrapdoors.ts +5 -2
  64. package/src/classes/features/other/FastReset.ts +5 -1
  65. package/src/classes/features/other/Pause.ts +15 -2
  66. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  67. package/src/core/constants.ts +2 -0
  68. package/src/enums/ModCallbackCustom.ts +10 -8
  69. package/src/functions/bosses.ts +3 -3
  70. package/src/functions/deepCopyTests.ts +10 -16
  71. package/src/functions/entities.ts +6 -6
  72. package/src/functions/entitiesSpecific.ts +30 -30
  73. package/src/functions/pickupsSpecific.ts +27 -27
  74. package/src/functions/playerCollectibles.ts +1 -3
  75. package/src/objects/backdropTypeToRockAltType.ts +2 -0
  76. package/src/objects/roomTypeNames.ts +1 -0
  77. package/src/objects/roomTypeSpecialGotoPrefixes.ts +1 -0
@@ -61,5 +61,7 @@ export declare const BACKDROP_TYPE_TO_ROCK_ALT_TYPE: {
61
61
  readonly 58: RockAltType.MUSHROOM;
62
62
  readonly 59: RockAltType.MUSHROOM;
63
63
  readonly 60: RockAltType.SKULL;
64
+ readonly 61: RockAltType.URN;
65
+ readonly 62: RockAltType.URN;
64
66
  };
65
67
  //# sourceMappingURL=backdropTypeToRockAltType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backdropTypeToRockAltType.d.ts","sourceRoot":"","sources":["../../src/objects/backdropTypeToRockAltType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,6CAA6C;AAC7C,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DW,CAAC"}
1
+ {"version":3,"file":"backdropTypeToRockAltType.d.ts","sourceRoot":"","sources":["../../src/objects/backdropTypeToRockAltType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,6CAA6C;AAC7C,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DW,CAAC"}
@@ -65,4 +65,6 @@ exports.BACKDROP_TYPE_TO_ROCK_ALT_TYPE = {
65
65
  [isaac_typescript_definitions_1.BackdropType.MINES_SHAFT]: RockAltType_1.RockAltType.MUSHROOM, // 58
66
66
  [isaac_typescript_definitions_1.BackdropType.ASHPIT_SHAFT]: RockAltType_1.RockAltType.MUSHROOM, // 59
67
67
  [isaac_typescript_definitions_1.BackdropType.DARK_CLOSET]: RockAltType_1.RockAltType.SKULL, // 60
68
+ [isaac_typescript_definitions_1.BackdropType.DEATHMATCH]: RockAltType_1.RockAltType.URN, // 61
69
+ [isaac_typescript_definitions_1.BackdropType.LIL_PORTAL]: RockAltType_1.RockAltType.URN, // 62
68
70
  };
@@ -64,6 +64,8 @@ ____exports.BACKDROP_TYPE_TO_ROCK_ALT_TYPE = {
64
64
  [BackdropType.DUNGEON_BEAST] = RockAltType.URN,
65
65
  [BackdropType.MINES_SHAFT] = RockAltType.MUSHROOM,
66
66
  [BackdropType.ASHPIT_SHAFT] = RockAltType.MUSHROOM,
67
- [BackdropType.DARK_CLOSET] = RockAltType.SKULL
67
+ [BackdropType.DARK_CLOSET] = RockAltType.SKULL,
68
+ [BackdropType.DEATHMATCH] = RockAltType.URN,
69
+ [BackdropType.LIL_PORTAL] = RockAltType.URN
68
70
  }
69
71
  return ____exports
@@ -28,5 +28,6 @@ export declare const ROOM_TYPE_NAMES: {
28
28
  readonly 27: "Secret Exit";
29
29
  readonly 28: "Blue Room";
30
30
  readonly 29: "Ultra Secret Room";
31
+ readonly 30: "Deathmatch";
31
32
  };
32
33
  //# sourceMappingURL=roomTypeNames.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"roomTypeNames.d.ts","sourceRoot":"","sources":["../../src/objects/roomTypeNames.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BiB,CAAC"}
1
+ {"version":3,"file":"roomTypeNames.d.ts","sourceRoot":"","sources":["../../src/objects/roomTypeNames.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BiB,CAAC"}
@@ -32,4 +32,5 @@ exports.ROOM_TYPE_NAMES = {
32
32
  [isaac_typescript_definitions_1.RoomType.SECRET_EXIT]: "Secret Exit", // 27
33
33
  [isaac_typescript_definitions_1.RoomType.BLUE]: "Blue Room", // 28
34
34
  [isaac_typescript_definitions_1.RoomType.ULTRA_SECRET]: "Ultra Secret Room", // 29
35
+ [isaac_typescript_definitions_1.RoomType.DEATHMATCH]: "Deathmatch", // 30
35
36
  };
@@ -30,6 +30,7 @@ ____exports.ROOM_TYPE_NAMES = {
30
30
  [RoomType.TELEPORTER_EXIT] = "Teleporter Exit Room",
31
31
  [RoomType.SECRET_EXIT] = "Secret Exit",
32
32
  [RoomType.BLUE] = "Blue Room",
33
- [RoomType.ULTRA_SECRET] = "Ultra Secret Room"
33
+ [RoomType.ULTRA_SECRET] = "Ultra Secret Room",
34
+ [RoomType.DEATHMATCH] = "Deathmatch"
34
35
  }
35
36
  return ____exports
@@ -28,5 +28,6 @@ export declare const ROOM_TYPE_SPECIAL_GOTO_PREFIXES: {
28
28
  readonly 27: "secretexit";
29
29
  readonly 28: "blue";
30
30
  readonly 29: "ultrasecret";
31
+ readonly 30: "deathmatch";
31
32
  };
32
33
  //# sourceMappingURL=roomTypeSpecialGotoPrefixes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"roomTypeSpecialGotoPrefixes.d.ts","sourceRoot":"","sources":["../../src/objects/roomTypeSpecialGotoPrefixes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,CAAC"}
1
+ {"version":3,"file":"roomTypeSpecialGotoPrefixes.d.ts","sourceRoot":"","sources":["../../src/objects/roomTypeSpecialGotoPrefixes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,CAAC"}
@@ -32,4 +32,5 @@ exports.ROOM_TYPE_SPECIAL_GOTO_PREFIXES = {
32
32
  [isaac_typescript_definitions_1.RoomType.SECRET_EXIT]: "secretexit", // 27
33
33
  [isaac_typescript_definitions_1.RoomType.BLUE]: "blue", // 28
34
34
  [isaac_typescript_definitions_1.RoomType.ULTRA_SECRET]: "ultrasecret", // 29
35
+ [isaac_typescript_definitions_1.RoomType.DEATHMATCH]: "deathmatch", // 30
35
36
  };
@@ -30,6 +30,7 @@ ____exports.ROOM_TYPE_SPECIAL_GOTO_PREFIXES = {
30
30
  [RoomType.TELEPORTER_EXIT] = "teleporterexit",
31
31
  [RoomType.SECRET_EXIT] = "secretexit",
32
32
  [RoomType.BLUE] = "blue",
33
- [RoomType.ULTRA_SECRET] = "ultrasecret"
33
+ [RoomType.ULTRA_SECRET] = "ultrasecret",
34
+ [RoomType.DEATHMATCH] = "deathmatch"
34
35
  }
35
36
  return ____exports
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.53.3"
8
+ "packageVersion": "7.55.2"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "87.8.2",
3
+ "version": "87.9.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -34,13 +34,13 @@
34
34
  "lint": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/lint.mts"
35
35
  },
36
36
  "dependencies": {
37
- "isaac-typescript-definitions": "42.3.1"
37
+ "isaac-typescript-definitions": "43.0.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@microsoft/api-extractor": "7.53.3",
41
- "complete-node": "12.2.1",
40
+ "@microsoft/api-extractor": "7.55.2",
41
+ "complete-node": "16.2.0",
42
42
  "eslint-plugin-sort-exports": "0.9.1",
43
- "typescript-eslint": "8.46.2",
44
- "typescript-to-lua": "1.32.0"
43
+ "typescript-eslint": "8.51.0",
44
+ "typescript-to-lua": "1.33.2"
45
45
  }
46
46
  }
@@ -63,6 +63,8 @@ type ModFeatureConstructor = TSTLClassMetatable["constructor"] & {
63
63
  * upon first construction.)
64
64
  */
65
65
  export class ModFeature {
66
+ // Other features will extend from this feature and they might need access to the underlying mod.
67
+ // eslint-disable-next-line @typescript-eslint/no-unused-private-class-members
66
68
  private readonly mod: ModUpgraded;
67
69
 
68
70
  /**
@@ -410,6 +410,7 @@ export class ModUpgraded implements Mod {
410
410
  * called from the "upgradeMod" function, but we want to mark it as private so that end-users
411
411
  * don't have access to it.
412
412
  */
413
+ // eslint-disable-next-line @typescript-eslint/no-unused-private-class-members
413
414
  private initOptionalFeature(feature: ISCFeature): readonly FunctionTuple[] {
414
415
  const featureClass = this.features[feature];
415
416
  this.initFeature(featureClass);
@@ -14,8 +14,12 @@ import { spawnEffect } from "../../../functions/entitiesSpecific";
14
14
  import { Feature } from "../../private/Feature";
15
15
 
16
16
  interface CustomPickupFunctions {
17
- collectFunc: (this: void, player: EntityPlayer) => void;
18
- collisionFunc: (this: void, player: EntityPlayer) => boolean;
17
+ collectFunc: (this: void, pickup: EntityPickup, player: EntityPlayer) => void;
18
+ collisionFunc: (
19
+ this: void,
20
+ pickup: EntityPickup,
21
+ player: EntityPlayer,
22
+ ) => boolean | undefined;
19
23
  }
20
24
 
21
25
  /**
@@ -69,9 +73,9 @@ export class CustomPickups extends Feature {
69
73
  return undefined;
70
74
  }
71
75
 
72
- const shouldPickup = customPickupFunctions.collisionFunc(player);
73
- if (!shouldPickup) {
74
- return undefined;
76
+ const shouldPickup = customPickupFunctions.collisionFunc(pickup, player);
77
+ if (shouldPickup !== undefined) {
78
+ return shouldPickup;
75
79
  }
76
80
 
77
81
  pickup.Remove();
@@ -88,7 +92,7 @@ export class CustomPickups extends Feature {
88
92
  effectSprite.Load(fileName, true);
89
93
  effectSprite.Play("Collect", true);
90
94
 
91
- customPickupFunctions.collectFunc(player);
95
+ customPickupFunctions.collectFunc(pickup, player);
92
96
 
93
97
  return undefined;
94
98
  };
@@ -128,18 +132,27 @@ export class CustomPickups extends Feature {
128
132
  * @param subType The sub-type for the corresponding custom pickup.
129
133
  * @param collectFunc The function to run when the player collects this pickup.
130
134
  * @param collisionFunc Optional. The function to run when a player collides with the pickup.
131
- * Default is a function that always returns true, meaning that the player
132
- * will always immediately collect the pickup when they collide with it.
133
- * Specify this function if your pickup should only be able to be collected
134
- * under certain conditions.
135
+ * Default is a function that always returns undefined, meaning that the
136
+ * player will always immediately collect the pickup when they collide with
137
+ * it. Specify this function if your pickup should only be able to be
138
+ * collected under certain conditions. Return value acts similar to
139
+ * `ModCallback.PRE_PICKUP_COLLISION`.
135
140
  * @public
136
141
  */
137
142
  @Exported
138
143
  public registerCustomPickup(
139
144
  pickupVariantCustom: PickupVariant,
140
145
  subType: int,
141
- collectFunc: (this: void, player: EntityPlayer) => void,
142
- collisionFunc: (this: void, player: EntityPlayer) => boolean = () => true,
146
+ collectFunc: (
147
+ this: void,
148
+ pickup: EntityPickup,
149
+ player: EntityPlayer,
150
+ ) => void,
151
+ collisionFunc: (
152
+ this: void,
153
+ pickup: EntityPickup,
154
+ player: EntityPlayer,
155
+ ) => boolean | undefined = () => undefined,
143
156
  ): void {
144
157
  const entityID = getEntityIDFromConstituents(
145
158
  EntityType.PICKUP,
@@ -42,7 +42,7 @@ import {
42
42
  import { teleport } from "../../../functions/roomTransition";
43
43
  import { setStage } from "../../../functions/stage";
44
44
  import { getTSTLClassName } from "../../../functions/tstlClass";
45
- import { assertDefined } from "../../../functions/utils";
45
+ import { assertDefined, isRepentancePlus } from "../../../functions/utils";
46
46
  import { isVector } from "../../../functions/vector";
47
47
  import type { CustomTrapdoorDescription } from "../../../interfaces/private/CustomTrapdoorDescription";
48
48
  import { ReadonlySet } from "../../../types/ReadonlySet";
@@ -526,7 +526,10 @@ export class CustomTrapdoors extends Feature {
526
526
  // We don't want to allow pausing, since that will allow render frames to pass without advancing
527
527
  // the stage traveling logic. (We track how many render frames have passed to know when to move
528
528
  // to the next step.)
529
- const whitelist = new ReadonlySet([ButtonAction.CONSOLE]);
529
+ const buttonActionConsole = isRepentancePlus()
530
+ ? ButtonAction.CONSOLE_REPENTANCE_PLUS
531
+ : ButtonAction.CONSOLE_REPENTANCE;
532
+ const whitelist = new ReadonlySet([buttonActionConsole]);
530
533
  this.disableInputs.disableAllInputsExceptFor(tstlClassName, whitelist);
531
534
  setPlayerAttributes(player, gridEntity.Position);
532
535
  dropTaintedForgotten(player);
@@ -6,6 +6,7 @@ import {
6
6
  isModifierKeyPressed,
7
7
  } from "../../../functions/input";
8
8
  import { restart } from "../../../functions/run";
9
+ import { isRepentancePlus } from "../../../functions/utils";
9
10
  import { Feature } from "../../private/Feature";
10
11
 
11
12
  /** A global variable set by custom consoles. */
@@ -86,7 +87,10 @@ function checkResetInput() {
86
87
 
87
88
  // Check to see if the player has pressed the restart input. (We check all inputs instead of
88
89
  // `player.ControllerIndex` because a controller player might be using the keyboard to reset.)
89
- if (isActionTriggeredOnAnyInput(ButtonAction.RESTART)) {
90
+ const buttonActionRestart = isRepentancePlus()
91
+ ? ButtonAction.RESTART_REPENTANCE_PLUS
92
+ : ButtonAction.RESTART_REPENTANCE;
93
+ if (isActionTriggeredOnAnyInput(buttonActionRestart)) {
90
94
  restart();
91
95
  }
92
96
  }
@@ -3,7 +3,9 @@ import {
3
3
  CollectibleType,
4
4
  InputHook,
5
5
  ModCallback,
6
+ SoundEffect,
6
7
  } from "isaac-typescript-definitions";
8
+ import { sfxManager } from "../../../core/cachedClasses";
7
9
  import { VectorZero } from "../../../core/constants";
8
10
  import { Exported } from "../../../decorators";
9
11
  import {
@@ -17,7 +19,7 @@ import { logError } from "../../../functions/log";
17
19
  import { useActiveItemTemp } from "../../../functions/playerCollectibles";
18
20
  import { getAllPlayers } from "../../../functions/playerIndex";
19
21
  import { getTSTLClassName } from "../../../functions/tstlClass";
20
- import { assertDefined } from "../../../functions/utils";
22
+ import { assertDefined, isRepentancePlus } from "../../../functions/utils";
21
23
  import { ReadonlySet } from "../../../types/ReadonlySet";
22
24
  import { Feature } from "../../private/Feature";
23
25
  import type { DisableInputs } from "./DisableInputs";
@@ -73,6 +75,10 @@ export class Pause extends Feature {
73
75
  const firstPlayer = Isaac.GetPlayer();
74
76
  useActiveItemTemp(firstPlayer, CollectibleType.PAUSE);
75
77
 
78
+ if (isRepentancePlus()) {
79
+ sfxManager.Stop(SoundEffect.PAUSE_FREEZE);
80
+ }
81
+
76
82
  this.stopTearsAndProjectilesFromMoving();
77
83
  };
78
84
 
@@ -178,15 +184,22 @@ export class Pause extends Feature {
178
184
  const firstPlayer = Isaac.GetPlayer();
179
185
  useActiveItemTemp(firstPlayer, CollectibleType.PAUSE);
180
186
 
187
+ if (isRepentancePlus()) {
188
+ sfxManager.Stop(SoundEffect.PAUSE_FREEZE);
189
+ }
190
+
181
191
  const tstlClassName = getTSTLClassName(this);
182
192
  assertDefined(
183
193
  tstlClassName,
184
194
  "Failed to get the class name for the pause feature.",
185
195
  );
186
196
 
197
+ const buttonActionConsole = isRepentancePlus()
198
+ ? ButtonAction.CONSOLE_REPENTANCE_PLUS
199
+ : ButtonAction.CONSOLE_REPENTANCE;
187
200
  const whitelist = new ReadonlySet([
188
201
  ButtonAction.MENU_CONFIRM,
189
- ButtonAction.CONSOLE,
202
+ buttonActionConsole,
190
203
  ]);
191
204
  this.disableInputs.disableAllInputsExceptFor(tstlClassName, whitelist);
192
205
 
@@ -80,7 +80,7 @@ export function restoreDefaultForFeatureKey(
80
80
  const childTableDefaults = saveDataDefaults[saveDataKey];
81
81
  if (childTableDefaults === undefined) {
82
82
  logError(
83
- `Failed to find the default copy of the child table "${saveDataKey}" for subscriber "${subscriberName}". This error usually means that your mod-specific save data is out of date. You can try purging all of your mod-specific save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data`,
83
+ String.raw`Failed to find the default copy of the child table "${saveDataKey}" for subscriber "${subscriberName}". This error usually means that your mod-specific save data is out of date. You can try purging all of your mod-specific save data by deleting the following directory: C:\Program Files (x86)\Steam\steamapps\common\The Binding of Isaac Rebirth\data`,
84
84
  );
85
85
  return;
86
86
  }
@@ -276,6 +276,8 @@ export const NUM_DIMENSIONS = getEnumLength(Dimension) - 1;
276
276
  /**
277
277
  * An array containing every valid `Dimension`, not including `Dimension.CURRENT`. (This is derived
278
278
  * from the `NUM_DIMENSIONS` constant.)
279
+ *
280
+ * We cannot use the values of the `Dimension` enum because it includes -1.
279
281
  */
280
282
  export const DIMENSIONS: readonly Dimension[] = eRange(
281
283
  NUM_DIMENSIONS,
@@ -591,10 +591,11 @@ export enum ModCallbackCustom {
591
591
  *
592
592
  * `POST_GAME_STARTED_REORDERED` --> `POST_NEW_LEVEL_REORDERED` --> `POST_NEW_ROOM_REORDERED`
593
593
  *
594
- * - You must provide a third argument:
595
- * - Pass true if you want the callback to only fire if the run is continued.
596
- * - Pass false if you want the callback to only fire when the run is not continued.
597
- * - Pass undefined if you want the callback to fire in both situations.
594
+ * You must provide a third argument:
595
+ *
596
+ * - Pass true if you want the callback to only fire if the run is continued.
597
+ * - Pass false if you want the callback to only fire when the run is not continued.
598
+ * - Pass undefined if you want the callback to fire in both situations.
598
599
  *
599
600
  * (The third argument for this callback is mandatory in order to prevent users from shooting
600
601
  * themselves in the foot with respect to logic unexpectedly being executed on continued runs.)
@@ -611,10 +612,11 @@ export enum ModCallbackCustom {
611
612
  * new run has started (or continued), but you can be sure that all new-run-related initialization
612
613
  * has been completed.
613
614
  *
614
- * - You must provide a third argument:
615
- * - Pass true if you want the callback to only fire if the run is continued.
616
- * - Pass false if you want the callback to only fire when the run is not continued.
617
- * - Pass undefined if you want the callback to fire in both situations.
615
+ * You must provide a third argument:
616
+ *
617
+ * - Pass true if you want the callback to only fire if the run is continued.
618
+ * - Pass false if you want the callback to only fire when the run is not continued.
619
+ * - Pass undefined if you want the callback to fire in both situations.
618
620
  *
619
621
  * (The third argument for this callback is mandatory in order to prevent users from shooting
620
622
  * themselves in the foot with respect to logic unexpectedly being executed on continued runs.)
@@ -272,8 +272,8 @@ export function spawnBoss(
272
272
  subType: int,
273
273
  positionOrGridIndex: Vector | int,
274
274
  velocity: Vector = VectorZero,
275
- spawner: Entity | undefined = undefined,
276
- seedOrRNG: Seed | RNG | undefined = undefined,
275
+ spawner?: Entity,
276
+ seedOrRNG?: Seed | RNG,
277
277
  numSegments?: int,
278
278
  ): EntityNPC {
279
279
  const seed = isRNG(seedOrRNG) ? seedOrRNG.Next() : seedOrRNG;
@@ -322,7 +322,7 @@ export function spawnBossWithSeed(
322
322
  positionOrGridIndex: Vector | int,
323
323
  seedOrRNG: Seed | RNG,
324
324
  velocity: Vector = VectorZero,
325
- spawner: Entity | undefined = undefined,
325
+ spawner?: Entity,
326
326
  numSegments?: int,
327
327
  ): EntityNPC {
328
328
  const seed = isRNG(seedOrRNG) ? seedOrRNG.Next() : seedOrRNG;
@@ -262,8 +262,7 @@ function copiedObjectHasChildObject() {
262
262
  function copiedMapIsMap() {
263
263
  const keyToLookFor = "abc";
264
264
  const valueToLookFor = "def";
265
- const oldMap = new Map<string, string>();
266
- oldMap.set(keyToLookFor, valueToLookFor);
265
+ const oldMap = new Map<string, string>([[keyToLookFor, valueToLookFor]]);
267
266
 
268
267
  const newMap = deepCopy(oldMap, SerializationType.NONE, "copiedMapIsMap");
269
268
 
@@ -275,8 +274,7 @@ function copiedMapIsMap() {
275
274
  function copiedMapHasValue() {
276
275
  const keyToLookFor = "abc";
277
276
  const valueToLookFor = "def";
278
- const oldMap = new Map<string, string>();
279
- oldMap.set(keyToLookFor, valueToLookFor);
277
+ const oldMap = new Map<string, string>([[keyToLookFor, valueToLookFor]]);
280
278
 
281
279
  const newMap = deepCopy(oldMap, SerializationType.NONE, "copiedMapHasValue");
282
280
 
@@ -295,8 +293,7 @@ function copiedMapHasValue() {
295
293
 
296
294
  function copiedSetIsSet() {
297
295
  const valueToLookFor = "abc";
298
- const oldSet = new Set<string>();
299
- oldSet.add(valueToLookFor);
296
+ const oldSet = new Set<string>([valueToLookFor]);
300
297
 
301
298
  const newSet = deepCopy(oldSet, SerializationType.NONE, "copiedSetIsSet");
302
299
 
@@ -307,8 +304,7 @@ function copiedSetIsSet() {
307
304
 
308
305
  function copiedSetHasValue() {
309
306
  const valueToLookFor = "abc";
310
- const oldSet = new Set<string>();
311
- oldSet.add(valueToLookFor);
307
+ const oldSet = new Set<string>([valueToLookFor]);
312
308
 
313
309
  const newSet = deepCopy(oldSet, SerializationType.NONE, "copiedSetHasValue");
314
310
 
@@ -325,12 +321,12 @@ function copiedSetHasValue() {
325
321
  function copiedMapHasChildMap() {
326
322
  const childMapKey = 123;
327
323
  const childMapValue = 456;
328
- const oldChildMap = new Map<number, number>();
329
- oldChildMap.set(childMapKey, childMapValue);
324
+ const oldChildMap = new Map<number, number>([[childMapKey, childMapValue]]);
330
325
 
331
326
  const keyToLookFor = "childMap";
332
- const oldMap = new Map<string, Map<number, number>>();
333
- oldMap.set(keyToLookFor, oldChildMap);
327
+ const oldMap = new Map<string, Map<number, number>>([
328
+ [keyToLookFor, oldChildMap],
329
+ ]);
334
330
 
335
331
  const newMap = deepCopy(
336
332
  oldMap,
@@ -446,8 +442,7 @@ function copiedDefaultMapHasBrand() {
446
442
  function copiedSerializedMapHasStringKey() {
447
443
  const mapKey = "123";
448
444
  const mapValue = 456;
449
- const oldMap = new Map<string, number>();
450
- oldMap.set(mapKey, mapValue);
445
+ const oldMap = new Map<string, number>([[mapKey, mapValue]]);
451
446
 
452
447
  const serializedOldMap = deepCopy(
453
448
  oldMap,
@@ -473,8 +468,7 @@ function copiedSerializedMapHasStringKey() {
473
468
  function copiedSerializedMapHasNumberKey() {
474
469
  const mapKey = 123;
475
470
  const mapValue = 456;
476
- const oldMap = new Map<number, number>();
477
- oldMap.set(mapKey, mapValue);
471
+ const oldMap = new Map<number, number>([[mapKey, mapValue]]);
478
472
 
479
473
  const serializedOldMap = deepCopy(
480
474
  oldMap,
@@ -547,7 +547,7 @@ export function removeAllMatchingEntities(
547
547
  entityType: EntityType,
548
548
  entityVariant = -1,
549
549
  entitySubType = -1,
550
- cap: int | undefined = undefined,
550
+ cap?: int,
551
551
  ): readonly Entity[] {
552
552
  const entities = getEntities(entityType, entityVariant, entitySubType);
553
553
  return removeEntities(entities, cap);
@@ -662,8 +662,8 @@ export function spawn(
662
662
  subType: int,
663
663
  positionOrGridIndex: Vector | int,
664
664
  velocity: Vector = VectorZero,
665
- spawner: Entity | undefined = undefined,
666
- seedOrRNG: Seed | RNG | undefined = undefined,
665
+ spawner?: Entity,
666
+ seedOrRNG?: Seed | RNG,
667
667
  ): Entity {
668
668
  const room = game.GetRoom();
669
669
 
@@ -709,8 +709,8 @@ export function spawnEntityID(
709
709
  entityID: EntityID,
710
710
  positionOrGridIndex: Vector | int,
711
711
  velocity: Vector = VectorZero,
712
- spawner: Entity | undefined = undefined,
713
- seedOrRNG: Seed | RNG | undefined = undefined,
712
+ spawner?: Entity,
713
+ seedOrRNG?: Seed | RNG,
714
714
  ): Entity {
715
715
  const [entityType, variant, subType] = getConstituentsFromEntityID(entityID);
716
716
  return spawn(
@@ -735,7 +735,7 @@ export function spawnWithSeed(
735
735
  positionOrGridIndex: Vector | int,
736
736
  seedOrRNG: Seed | RNG,
737
737
  velocity: Vector = VectorZero,
738
- spawner: Entity | undefined = undefined,
738
+ spawner?: Entity,
739
739
  ): Entity {
740
740
  return spawn(
741
741
  entityType,