isaacscript-common 87.8.2 → 87.8.3

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 (63) 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/CustomTrapdoors.d.ts.map +1 -1
  6. package/dist/classes/features/other/CustomTrapdoors.js +4 -1
  7. package/dist/classes/features/other/CustomTrapdoors.lua +3 -1
  8. package/dist/classes/features/other/FastReset.d.ts.map +1 -1
  9. package/dist/classes/features/other/FastReset.js +5 -1
  10. package/dist/classes/features/other/FastReset.lua +4 -1
  11. package/dist/classes/features/other/Pause.d.ts.map +1 -1
  12. package/dist/classes/features/other/Pause.js +11 -1
  13. package/dist/classes/features/other/Pause.lua +14 -3
  14. package/dist/classes/features/other/saveDataManager/restoreDefaults.js +1 -1
  15. package/dist/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  16. package/dist/enums/ModCallbackCustom.d.ts +10 -8
  17. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  18. package/dist/enums/ModCallbackCustom.js +10 -8
  19. package/dist/functions/bosses.d.ts +2 -2
  20. package/dist/functions/bosses.d.ts.map +1 -1
  21. package/dist/functions/bosses.js +2 -2
  22. package/dist/functions/deepCopyTests.js +10 -16
  23. package/dist/functions/deepCopyTests.lua +8 -16
  24. package/dist/functions/entities.d.ts +4 -4
  25. package/dist/functions/entities.d.ts.map +1 -1
  26. package/dist/functions/entities.js +4 -4
  27. package/dist/functions/entitiesSpecific.d.ts +20 -20
  28. package/dist/functions/entitiesSpecific.d.ts.map +1 -1
  29. package/dist/functions/entitiesSpecific.js +20 -20
  30. package/dist/functions/pickupsSpecific.d.ts +18 -18
  31. package/dist/functions/pickupsSpecific.d.ts.map +1 -1
  32. package/dist/functions/pickupsSpecific.js +18 -18
  33. package/dist/index.rollup.d.ts +54 -52
  34. package/dist/isaacscript-common.lua +668 -40
  35. package/dist/objects/backdropTypeToRockAltType.d.ts +2 -0
  36. package/dist/objects/backdropTypeToRockAltType.d.ts.map +1 -1
  37. package/dist/objects/backdropTypeToRockAltType.js +2 -0
  38. package/dist/objects/backdropTypeToRockAltType.lua +3 -1
  39. package/dist/objects/roomTypeNames.d.ts +1 -0
  40. package/dist/objects/roomTypeNames.d.ts.map +1 -1
  41. package/dist/objects/roomTypeNames.js +1 -0
  42. package/dist/objects/roomTypeNames.lua +2 -1
  43. package/dist/objects/roomTypeSpecialGotoPrefixes.d.ts +1 -0
  44. package/dist/objects/roomTypeSpecialGotoPrefixes.d.ts.map +1 -1
  45. package/dist/objects/roomTypeSpecialGotoPrefixes.js +1 -0
  46. package/dist/objects/roomTypeSpecialGotoPrefixes.lua +2 -1
  47. package/dist/tsdoc-metadata.json +1 -1
  48. package/package.json +6 -6
  49. package/src/classes/ModFeature.ts +2 -0
  50. package/src/classes/ModUpgraded.ts +1 -0
  51. package/src/classes/features/other/CustomTrapdoors.ts +5 -2
  52. package/src/classes/features/other/FastReset.ts +5 -1
  53. package/src/classes/features/other/Pause.ts +15 -2
  54. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  55. package/src/enums/ModCallbackCustom.ts +10 -8
  56. package/src/functions/bosses.ts +3 -3
  57. package/src/functions/deepCopyTests.ts +10 -16
  58. package/src/functions/entities.ts +6 -6
  59. package/src/functions/entitiesSpecific.ts +30 -30
  60. package/src/functions/pickupsSpecific.ts +27 -27
  61. package/src/objects/backdropTypeToRockAltType.ts +2 -0
  62. package/src/objects/roomTypeNames.ts +1 -0
  63. 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.8.3",
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);
@@ -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
  }
@@ -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,
@@ -549,8 +549,8 @@ export function spawnBomb(
549
549
  subType: int,
550
550
  positionOrGridIndex: Vector | int,
551
551
  velocity: Vector = VectorZero,
552
- spawner: Entity | undefined = undefined,
553
- seedOrRNG: Seed | RNG | undefined = undefined,
552
+ spawner?: Entity,
553
+ seedOrRNG?: Seed | RNG,
554
554
  ): EntityBomb {
555
555
  const entity = spawn(
556
556
  EntityType.BOMB,
@@ -575,7 +575,7 @@ export function spawnBombWithSeed(
575
575
  positionOrGridIndex: Vector | int,
576
576
  seedOrRNG: Seed | RNG,
577
577
  velocity: Vector = VectorZero,
578
- spawner: Entity | undefined = undefined,
578
+ spawner?: Entity,
579
579
  ): EntityBomb {
580
580
  return spawnBomb(
581
581
  bombVariant,
@@ -593,8 +593,8 @@ export function spawnEffect(
593
593
  subType: int,
594
594
  positionOrGridIndex: Vector | int,
595
595
  velocity: Vector = VectorZero,
596
- spawner: Entity | undefined = undefined,
597
- seedOrRNG: Seed | RNG | undefined = undefined,
596
+ spawner?: Entity,
597
+ seedOrRNG?: Seed | RNG,
598
598
  ): EntityEffect {
599
599
  const entity = spawn(
600
600
  EntityType.EFFECT,
@@ -619,7 +619,7 @@ export function spawnEffectWithSeed(
619
619
  positionOrGridIndex: Vector | int,
620
620
  seedOrRNG: Seed | RNG,
621
621
  velocity: Vector = VectorZero,
622
- spawner: Entity | undefined = undefined,
622
+ spawner?: Entity,
623
623
  ): EntityEffect {
624
624
  return spawnEffect(
625
625
  effectVariant,
@@ -642,8 +642,8 @@ export function spawnFamiliar(
642
642
  subType: int,
643
643
  positionOrGridIndex: Vector | int,
644
644
  velocity: Vector = VectorZero,
645
- spawner: Entity | undefined = undefined,
646
- seedOrRNG: Seed | RNG | undefined = undefined,
645
+ spawner?: Entity,
646
+ seedOrRNG?: Seed | RNG,
647
647
  ): EntityFamiliar {
648
648
  const entity = spawn(
649
649
  EntityType.FAMILIAR,
@@ -668,7 +668,7 @@ export function spawnFamiliarWithSeed(
668
668
  positionOrGridIndex: Vector | int,
669
669
  seedOrRNG: Seed | RNG,
670
670
  velocity: Vector = VectorZero,
671
- spawner: Entity | undefined = undefined,
671
+ spawner?: Entity,
672
672
  ): EntityFamiliar {
673
673
  return spawnFamiliar(
674
674
  familiarVariant,
@@ -686,8 +686,8 @@ export function spawnKnife(
686
686
  subType: int,
687
687
  positionOrGridIndex: Vector | int,
688
688
  velocity: Vector = VectorZero,
689
- spawner: Entity | undefined = undefined,
690
- seedOrRNG: Seed | RNG | undefined = undefined,
689
+ spawner?: Entity,
690
+ seedOrRNG?: Seed | RNG,
691
691
  ): EntityKnife {
692
692
  const entity = spawn(
693
693
  EntityType.KNIFE,
@@ -712,7 +712,7 @@ export function spawnKnifeWithSeed(
712
712
  positionOrGridIndex: Vector | int,
713
713
  seedOrRNG: Seed | RNG,
714
714
  velocity: Vector = VectorZero,
715
- spawner: Entity | undefined = undefined,
715
+ spawner?: Entity,
716
716
  ): EntityKnife {
717
717
  return spawnKnife(
718
718
  knifeVariant,
@@ -730,8 +730,8 @@ export function spawnLaser(
730
730
  subType: int,
731
731
  positionOrGridIndex: Vector | int,
732
732
  velocity: Vector = VectorZero,
733
- spawner: Entity | undefined = undefined,
734
- seedOrRNG: Seed | RNG | undefined = undefined,
733
+ spawner?: Entity,
734
+ seedOrRNG?: Seed | RNG,
735
735
  ): EntityLaser {
736
736
  const entity = spawn(
737
737
  EntityType.LASER,
@@ -756,7 +756,7 @@ export function spawnLaserWithSeed(
756
756
  positionOrGridIndex: Vector | int,
757
757
  seedOrRNG: Seed | RNG,
758
758
  velocity: Vector = VectorZero,
759
- spawner: Entity | undefined = undefined,
759
+ spawner?: Entity,
760
760
  ): EntityLaser {
761
761
  return spawnLaser(
762
762
  laserVariant,
@@ -780,8 +780,8 @@ export function spawnNPC(
780
780
  subType: int,
781
781
  positionOrGridIndex: Vector | int,
782
782
  velocity: Vector = VectorZero,
783
- spawner: Entity | undefined = undefined,
784
- seedOrRNG: Seed | RNG | undefined = undefined,
783
+ spawner?: Entity,
784
+ seedOrRNG?: Seed | RNG,
785
785
  ): EntityNPC {
786
786
  const entity = spawn(
787
787
  entityType,
@@ -812,7 +812,7 @@ export function spawnNPCWithSeed(
812
812
  positionOrGridIndex: Vector | int,
813
813
  seedOrRNG: Seed | RNG,
814
814
  velocity: Vector = VectorZero,
815
- spawner: Entity | undefined = undefined,
815
+ spawner?: Entity,
816
816
  ): EntityNPC {
817
817
  return spawnNPC(
818
818
  entityType,
@@ -831,8 +831,8 @@ export function spawnPickup(
831
831
  subType: int,
832
832
  positionOrGridIndex: Vector | int,
833
833
  velocity: Vector = VectorZero,
834
- spawner: Entity | undefined = undefined,
835
- seedOrRNG: Seed | RNG | undefined = undefined,
834
+ spawner?: Entity,
835
+ seedOrRNG?: Seed | RNG,
836
836
  ): EntityPickup {
837
837
  const entity = spawn(
838
838
  EntityType.PICKUP,
@@ -857,7 +857,7 @@ export function spawnPickupWithSeed(
857
857
  positionOrGridIndex: Vector | int,
858
858
  seedOrRNG: Seed | RNG,
859
859
  velocity: Vector = VectorZero,
860
- spawner: Entity | undefined = undefined,
860
+ spawner?: Entity,
861
861
  ): EntityPickup {
862
862
  return spawnPickup(
863
863
  pickupVariant,
@@ -875,8 +875,8 @@ export function spawnProjectile(
875
875
  subType: int,
876
876
  positionOrGridIndex: Vector | int,
877
877
  velocity: Vector = VectorZero,
878
- spawner: Entity | undefined = undefined,
879
- seedOrRNG: Seed | RNG | undefined = undefined,
878
+ spawner?: Entity,
879
+ seedOrRNG?: Seed | RNG,
880
880
  ): EntityProjectile {
881
881
  const entity = spawn(
882
882
  EntityType.PROJECTILE,
@@ -901,7 +901,7 @@ export function spawnProjectileWithSeed(
901
901
  positionOrGridIndex: Vector | int,
902
902
  seedOrRNG: Seed | RNG,
903
903
  velocity: Vector = VectorZero,
904
- spawner: Entity | undefined = undefined,
904
+ spawner?: Entity,
905
905
  ): EntityProjectile {
906
906
  return spawnProjectile(
907
907
  projectileVariant,
@@ -919,8 +919,8 @@ export function spawnSlot(
919
919
  subType: int,
920
920
  positionOrGridIndex: Vector | int,
921
921
  velocity: Vector = VectorZero,
922
- spawner: Entity | undefined = undefined,
923
- seedOrRNG: Seed | RNG | undefined = undefined,
922
+ spawner?: Entity,
923
+ seedOrRNG?: Seed | RNG,
924
924
  ): EntitySlot {
925
925
  return spawn(
926
926
  EntityType.SLOT,
@@ -940,7 +940,7 @@ export function spawnSlotWithSeed(
940
940
  positionOrGridIndex: Vector | int,
941
941
  seedOrRNG: Seed | RNG,
942
942
  velocity: Vector = VectorZero,
943
- spawner: Entity | undefined = undefined,
943
+ spawner?: Entity,
944
944
  ): EntitySlot {
945
945
  return spawnSlot(
946
946
  slotVariant,
@@ -958,8 +958,8 @@ export function spawnTear(
958
958
  subType: int,
959
959
  positionOrGridIndex: Vector | int,
960
960
  velocity: Vector = VectorZero,
961
- spawner: Entity | undefined = undefined,
962
- seedOrRNG: Seed | RNG | undefined = undefined,
961
+ spawner?: Entity,
962
+ seedOrRNG?: Seed | RNG,
963
963
  ): EntityTear {
964
964
  const entity = spawn(
965
965
  EntityType.TEAR,
@@ -984,7 +984,7 @@ export function spawnTearWithSeed(
984
984
  positionOrGridIndex: Vector | int,
985
985
  seedOrRNG: Seed | RNG,
986
986
  velocity: Vector = VectorZero,
987
- spawner: Entity | undefined = undefined,
987
+ spawner?: Entity,
988
988
  ): EntityTear {
989
989
  return spawnTear(
990
990
  tearVariant,