isaacscript-common 7.1.1 → 7.2.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 (121) hide show
  1. package/dist/classes/DefaultMap.d.ts +5 -5
  2. package/dist/classes/DefaultMap.d.ts.map +1 -1
  3. package/dist/enums/AmbushType.d.ts +1 -0
  4. package/dist/enums/AmbushType.d.ts.map +1 -1
  5. package/dist/enums/AmbushType.lua +1 -0
  6. package/dist/enums/CornerType.d.ts +1 -0
  7. package/dist/enums/CornerType.d.ts.map +1 -1
  8. package/dist/enums/CornerType.lua +1 -0
  9. package/dist/enums/PocketItemType.d.ts +1 -0
  10. package/dist/enums/PocketItemType.d.ts.map +1 -1
  11. package/dist/enums/PocketItemType.lua +1 -0
  12. package/dist/enums/RockAltType.d.ts +1 -0
  13. package/dist/enums/RockAltType.d.ts.map +1 -1
  14. package/dist/enums/RockAltType.lua +1 -0
  15. package/dist/enums/SerializationType.d.ts +1 -0
  16. package/dist/enums/SerializationType.d.ts.map +1 -1
  17. package/dist/enums/SerializationType.lua +1 -0
  18. package/dist/enums/SlotDestructionType.d.ts +1 -0
  19. package/dist/enums/SlotDestructionType.d.ts.map +1 -1
  20. package/dist/enums/SlotDestructionType.lua +1 -0
  21. package/dist/features/customStage/backdrop.d.ts +1 -1
  22. package/dist/features/customStage/backdrop.d.ts.map +1 -1
  23. package/dist/features/customStage/backdrop.lua +1 -1
  24. package/dist/features/customStage/init.lua +2 -2
  25. package/dist/functions/cacheFlag.d.ts +23 -1
  26. package/dist/functions/cacheFlag.d.ts.map +1 -1
  27. package/dist/functions/cacheFlag.lua +78 -0
  28. package/dist/functions/flying.lua +2 -2
  29. package/dist/functions/index.d.ts +0 -1
  30. package/dist/functions/index.d.ts.map +1 -1
  31. package/dist/functions/index.lua +0 -8
  32. package/dist/functions/input.d.ts +4 -1
  33. package/dist/functions/input.d.ts.map +1 -1
  34. package/dist/functions/input.lua +10 -2
  35. package/dist/functions/rockAlt.d.ts.map +1 -1
  36. package/dist/functions/rockAlt.lua +11 -20
  37. package/dist/functions/rooms.d.ts.map +1 -1
  38. package/dist/functions/rooms.lua +1 -0
  39. package/dist/interfaces/ChargeBarSprites.d.ts +1 -1
  40. package/dist/interfaces/Corner.d.ts +5 -0
  41. package/dist/interfaces/Corner.d.ts.map +1 -1
  42. package/dist/interfaces/CustomStageLua.d.ts +57 -0
  43. package/dist/interfaces/CustomStageLua.d.ts.map +1 -1
  44. package/dist/interfaces/GridEntityCustomData.d.ts +6 -0
  45. package/dist/interfaces/GridEntityCustomData.d.ts.map +1 -1
  46. package/dist/interfaces/JSONRoomsFile.d.ts +7 -3
  47. package/dist/interfaces/JSONRoomsFile.d.ts.map +1 -1
  48. package/dist/interfaces/PlayerHealth.d.ts +1 -1
  49. package/dist/interfaces/PlayerHealth.d.ts.map +1 -1
  50. package/dist/interfaces/PocketItemDescription.d.ts +1 -1
  51. package/dist/interfaces/PocketItemDescription.d.ts.map +1 -1
  52. package/dist/interfaces/RoomDescription.d.ts +1 -1
  53. package/dist/interfaces/RoomDescription.d.ts.map +1 -1
  54. package/dist/interfaces/StatTypeType.d.ts +4 -0
  55. package/dist/interfaces/StatTypeType.d.ts.map +1 -1
  56. package/dist/interfaces/TrinketSituation.d.ts +1 -1
  57. package/dist/interfaces/TrinketSituation.d.ts.map +1 -1
  58. package/dist/maps/keyboardToString.d.ts +4 -0
  59. package/dist/maps/keyboardToString.d.ts.map +1 -0
  60. package/dist/maps/keyboardToString.lua +73 -0
  61. package/dist/types/AnyEntity.d.ts +5 -0
  62. package/dist/types/AnyEntity.d.ts.map +1 -1
  63. package/dist/types/AnyGridEntity.d.ts +5 -0
  64. package/dist/types/AnyGridEntity.d.ts.map +1 -1
  65. package/dist/types/CollectibleIndex.d.ts +4 -3
  66. package/dist/types/CollectibleIndex.d.ts.map +1 -1
  67. package/dist/types/Immutable.d.ts +3 -1
  68. package/dist/types/Immutable.d.ts.map +1 -1
  69. package/dist/types/PickupIndex.d.ts +4 -2
  70. package/dist/types/PickupIndex.d.ts.map +1 -1
  71. package/dist/types/PlayerIndex.d.ts +3 -2
  72. package/dist/types/PlayerIndex.d.ts.map +1 -1
  73. package/dist/types/SerializedIsaacAPIClass.d.ts +6 -0
  74. package/dist/types/SerializedIsaacAPIClass.d.ts.map +1 -1
  75. package/dist/types/TSTLClass.d.ts +5 -0
  76. package/dist/types/TSTLClass.d.ts.map +1 -1
  77. package/dist/types/TrapdoorDestination.d.ts +3 -0
  78. package/dist/types/TrapdoorDestination.d.ts.map +1 -1
  79. package/package.json +2 -2
  80. package/src/classes/DefaultMap.ts +7 -7
  81. package/src/enums/AmbushType.ts +1 -0
  82. package/src/enums/CornerType.ts +1 -0
  83. package/src/enums/PocketItemType.ts +1 -0
  84. package/src/enums/RockAltType.ts +1 -0
  85. package/src/enums/SerializationType.ts +1 -0
  86. package/src/enums/SlotDestructionType.ts +1 -0
  87. package/src/features/customStage/backdrop.ts +1 -1
  88. package/src/features/customStage/init.ts +2 -2
  89. package/src/features/fastReset.ts +1 -1
  90. package/src/features/indexTypeDoc.ts +2 -1
  91. package/src/functions/cacheFlag.ts +90 -1
  92. package/src/functions/flying.ts +1 -1
  93. package/src/functions/index.ts +0 -1
  94. package/src/functions/indexTypeDoc.ts +0 -1
  95. package/src/functions/input.ts +15 -2
  96. package/src/functions/rockAlt.ts +28 -13
  97. package/src/functions/rooms.ts +1 -0
  98. package/src/interfaces/ChargeBarSprites.ts +1 -1
  99. package/src/interfaces/Corner.ts +5 -0
  100. package/src/interfaces/CustomStageLua.ts +66 -0
  101. package/src/interfaces/GridEntityCustomData.ts +6 -0
  102. package/src/interfaces/JSONRoomsFile.ts +7 -3
  103. package/src/interfaces/PlayerHealth.ts +1 -1
  104. package/src/interfaces/PocketItemDescription.ts +1 -1
  105. package/src/interfaces/RoomDescription.ts +1 -1
  106. package/src/interfaces/StatTypeType.ts +4 -0
  107. package/src/interfaces/TrinketSituation.ts +1 -1
  108. package/src/maps/keyboardToString.ts +77 -0
  109. package/src/types/AnyEntity.ts +5 -0
  110. package/src/types/AnyGridEntity.ts +5 -0
  111. package/src/types/CollectibleIndex.ts +4 -3
  112. package/src/types/Immutable.ts +3 -1
  113. package/src/types/PickupIndex.ts +4 -2
  114. package/src/types/PlayerIndex.ts +3 -2
  115. package/src/types/SerializedIsaacAPIClass.ts +6 -0
  116. package/src/types/TSTLClass.ts +5 -0
  117. package/src/types/TrapdoorDestination.ts +3 -0
  118. package/dist/functions/collectibleCacheFlag.d.ts +0 -24
  119. package/dist/functions/collectibleCacheFlag.d.ts.map +0 -1
  120. package/dist/functions/collectibleCacheFlag.lua +0 -80
  121. package/src/functions/collectibleCacheFlag.ts +0 -90
@@ -1,5 +1,62 @@
1
- import { CacheFlag } from "isaac-typescript-definitions";
1
+ import { CacheFlag, CollectibleType } from "isaac-typescript-definitions";
2
+ import { itemConfig } from "../core/cachedClasses";
2
3
  import { DEFAULT_PLAYER_STAT_MAP } from "../maps/defaultPlayerStatMap";
4
+ import { getCollectibleArray } from "./collectibleSet";
5
+ import { getEnumValues } from "./enums";
6
+ import { hasFlag } from "./flag";
7
+ import { copySet, getSortedSetValues } from "./set";
8
+ import { repeat } from "./utils";
9
+
10
+ const CACHE_FLAG_TO_COLLECTIBLES_MAP = new Map<
11
+ CacheFlag,
12
+ Set<CollectibleType>
13
+ >();
14
+
15
+ function initCacheFlagMap() {
16
+ for (const cacheFlag of getEnumValues(CacheFlag)) {
17
+ const collectiblesSet = new Set<CollectibleType>();
18
+
19
+ for (const collectibleType of getCollectibleArray()) {
20
+ if (collectibleHasCacheFlag(collectibleType, cacheFlag)) {
21
+ collectiblesSet.add(collectibleType);
22
+ }
23
+ }
24
+
25
+ CACHE_FLAG_TO_COLLECTIBLES_MAP.set(cacheFlag, collectiblesSet);
26
+ }
27
+ }
28
+
29
+ export function collectibleHasCacheFlag(
30
+ collectibleType: CollectibleType,
31
+ cacheFlag: CacheFlag,
32
+ ): boolean {
33
+ const itemConfigItem = itemConfig.GetCollectible(collectibleType);
34
+ if (itemConfigItem === undefined) {
35
+ return false;
36
+ }
37
+
38
+ return hasFlag(itemConfigItem.CacheFlags, cacheFlag);
39
+ }
40
+
41
+ /**
42
+ * Returns a set containing every collectible type with the given cache flag, including modded
43
+ * collectibles.
44
+ */
45
+ export function getCollectiblesForCacheFlag(
46
+ cacheFlag: CacheFlag,
47
+ ): Set<CollectibleType> {
48
+ // Lazy initialize the map.
49
+ if (CACHE_FLAG_TO_COLLECTIBLES_MAP.size === 0) {
50
+ initCacheFlagMap();
51
+ }
52
+
53
+ const collectiblesSet = CACHE_FLAG_TO_COLLECTIBLES_MAP.get(cacheFlag);
54
+ if (collectiblesSet === undefined) {
55
+ return new Set();
56
+ }
57
+
58
+ return copySet(collectiblesSet);
59
+ }
3
60
 
4
61
  /**
5
62
  * Returns the starting stat that Isaac (the default character) starts with. For example, if you
@@ -10,3 +67,35 @@ import { DEFAULT_PLAYER_STAT_MAP } from "../maps/defaultPlayerStatMap";
10
67
  export function getDefaultPlayerStat(cacheFlag: CacheFlag): number | undefined {
11
68
  return DEFAULT_PLAYER_STAT_MAP.get(cacheFlag);
12
69
  }
70
+
71
+ /**
72
+ * Returns an array containing every collectible type that the player has that matches the provided
73
+ * CacheFlag.
74
+ *
75
+ * For example, if the cache flag is `CacheFlag.FLYING`, and the player has one Lord of the Pit and
76
+ * two Dead Doves, then this function would return:
77
+ *
78
+ * ```ts
79
+ * [
80
+ * CollectibleType.LORD_OF_THE_PIT,
81
+ * CollectibleType.DEAD_DOVE,
82
+ * CollectibleType.DEAD_DOVE,
83
+ * ]
84
+ * ```
85
+ */
86
+ export function getPlayerCollectiblesForCacheFlag(
87
+ player: EntityPlayer,
88
+ cacheFlag: CacheFlag,
89
+ ): CollectibleType[] {
90
+ const collectiblesForCacheFlag = getCollectiblesForCacheFlag(cacheFlag);
91
+
92
+ const playerCollectibles: CollectibleType[] = [];
93
+ for (const collectibleType of getSortedSetValues(collectiblesForCacheFlag)) {
94
+ const numCollectibles = player.GetCollectibleNum(collectibleType);
95
+ repeat(numCollectibles, () => {
96
+ playerCollectibles.push(collectibleType);
97
+ });
98
+ }
99
+
100
+ return playerCollectibles;
101
+ }
@@ -5,7 +5,7 @@ import {
5
5
  PlayerType,
6
6
  TrinketType,
7
7
  } from "isaac-typescript-definitions";
8
- import { getCollectiblesForCacheFlag } from "./collectibleCacheFlag";
8
+ import { getCollectiblesForCacheFlag } from "./cacheFlag";
9
9
  import { copySet, deleteSetsFromSet } from "./set";
10
10
 
11
11
  const FLYING_CHARACTERS: ReadonlySet<PlayerType> = new Set([
@@ -13,7 +13,6 @@ export * from "./challenges";
13
13
  export * from "./characters";
14
14
  export * from "./charge";
15
15
  export * from "./chargeBar";
16
- export * from "./collectibleCacheFlag";
17
16
  export * from "./collectibles";
18
17
  export * from "./collectibleSet";
19
18
  export * from "./collectibleTag";
@@ -13,7 +13,6 @@ export * as Challenges from "./challenges";
13
13
  export * as Characters from "./characters";
14
14
  export * as Charge from "./charge";
15
15
  export * as ChargeBar from "./chargeBar";
16
- export * as CollectibleCacheFlag from "./collectibleCacheFlag";
17
16
  export * as Collectibles from "./collectibles";
18
17
  export * as CollectibleSet from "./collectibleSet";
19
18
  export * as CollectibleTag from "./collectibleTag";
@@ -4,6 +4,7 @@ import {
4
4
  ControllerIndex,
5
5
  Keyboard,
6
6
  } from "isaac-typescript-definitions";
7
+ import { KEYBOARD_TO_STRING } from "../maps/keyboardToString";
7
8
  import { getEnumValues } from "./enums";
8
9
  import { copySet } from "./set";
9
10
  import { trimPrefix } from "./string";
@@ -133,6 +134,18 @@ export function isShootActionTriggeredOnAnyInput(): boolean {
133
134
  );
134
135
  }
135
136
 
136
- export function keyboardToString(keyboard: Keyboard): string {
137
- return Keyboard[keyboard] ?? "unknown";
137
+ /**
138
+ * Helper function to get the string that would be typed if someone pressed the corresponding key.
139
+ */
140
+ export function keyboardToString(
141
+ keyboard: Keyboard,
142
+ uppercase: boolean,
143
+ ): string | undefined {
144
+ const tuple = KEYBOARD_TO_STRING.get(keyboard);
145
+ if (tuple === undefined) {
146
+ return undefined;
147
+ }
148
+
149
+ const [lowercaseCharacter, uppercaseCharacter] = tuple;
150
+ return uppercase ? uppercaseCharacter : lowercaseCharacter;
138
151
  }
@@ -41,6 +41,13 @@ const ROCK_ALT_CHANCES = {
41
41
  } as const;
42
42
 
43
43
  const COIN_VELOCITY_MULTIPLIER = 2;
44
+
45
+ /** Matches the vanilla value, according to Fly's decompilation. */
46
+ const FIND_FREE_INITIAL_STEP = 70;
47
+
48
+ /** Matches the vanilla value, according to Fly's decompilation. */
49
+ const FART_RADIUS = DISTANCE_OF_GRID_TILE * 3;
50
+
44
51
  const POLYP_PROJECTILE_SPEED = 10;
45
52
  const POLYP_NUM_PROJECTILES = 6;
46
53
 
@@ -128,6 +135,8 @@ export function spawnRockAltReward(
128
135
  }
129
136
 
130
137
  function spawnRockAltRewardUrn(position: Vector, rng: RNG): boolean {
138
+ const room = game.GetRoom();
139
+
131
140
  const chance = getRandom(rng);
132
141
  let totalChance = 0;
133
142
 
@@ -171,11 +180,11 @@ function spawnRockAltRewardUrn(position: Vector, rng: RNG): boolean {
171
180
  // Since the detrimental effect is the final option, we don't need to check the chance.
172
181
  const numEnemiesChance = getRandom(rng);
173
182
  const numEnemies = numEnemiesChance < 0.5 ? 1 : 2;
174
- const length = DISTANCE_OF_GRID_TILE * 3;
175
183
  repeat(numEnemies, () => {
176
- const randomVector = getRandomVector(rng);
177
- const offset = randomVector.mul(length);
178
- const targetPos = position.add(offset);
184
+ const targetPos = room.FindFreePickupSpawnPosition(
185
+ position,
186
+ FIND_FREE_INITIAL_STEP,
187
+ );
179
188
  EntityNPC.ThrowSpider(position, undefined, targetPos, false, 0);
180
189
  });
181
190
  return true;
@@ -253,7 +262,8 @@ function spawnRockAltRewardMushroom(position: Vector, rng: RNG): boolean {
253
262
  }
254
263
 
255
264
  // Since the detrimental effect is the final option, we don't need to check the chance.
256
- spawnEffectWithSeed(EffectVariant.FART, 0, position, rng);
265
+ game.Fart(position);
266
+ game.ButterBeanFart(position, FART_RADIUS, undefined);
257
267
  return true;
258
268
  }
259
269
 
@@ -383,6 +393,8 @@ function spawnRockAltRewardPolyp(position: Vector, rng: RNG): boolean {
383
393
  }
384
394
 
385
395
  function spawnRockAltRewardBucketDownpour(position: Vector, rng: RNG): boolean {
396
+ const room = game.GetRoom();
397
+
386
398
  const chance = getRandom(rng);
387
399
  let totalChance = 0;
388
400
 
@@ -430,11 +442,12 @@ function spawnRockAltRewardBucketDownpour(position: Vector, rng: RNG): boolean {
430
442
 
431
443
  const numEnemiesChance = getRandom(rng);
432
444
  const numEnemies = numEnemiesChance < 0.5 ? 1 : 2;
433
- const jumpDistance = DISTANCE_OF_GRID_TILE * 3;
434
445
  repeat(numEnemies, () => {
435
- const randomVector = getRandomVector(rng);
436
- const offset = randomVector.mul(jumpDistance);
437
- const targetPos = position.add(offset);
446
+ const targetPos = room.FindFreePickupSpawnPosition(
447
+ position,
448
+ FIND_FREE_INITIAL_STEP,
449
+ );
450
+
438
451
  // If the room has water, Spiders will automatically be replaced with Striders.
439
452
  const spider = EntityNPC.ThrowSpider(
440
453
  position,
@@ -455,6 +468,8 @@ function spawnRockAltRewardBucketDownpour(position: Vector, rng: RNG): boolean {
455
468
  }
456
469
 
457
470
  function spawnRockAltRewardBucketDross(position: Vector, rng: RNG): boolean {
471
+ const room = game.GetRoom();
472
+
458
473
  const chance = getRandom(rng);
459
474
  let totalChance = 0;
460
475
 
@@ -502,11 +517,11 @@ function spawnRockAltRewardBucketDross(position: Vector, rng: RNG): boolean {
502
517
 
503
518
  const numEnemiesChance = getRandom(rng);
504
519
  const numEnemies = numEnemiesChance < 0.5 ? 1 : 2;
505
- const jumpDistance = DISTANCE_OF_GRID_TILE * 3;
506
520
  repeat(numEnemies, () => {
507
- const randomVector = getRandomVector(rng);
508
- const offset = randomVector.mul(jumpDistance);
509
- const targetPos = position.add(offset);
521
+ const targetPos = room.FindFreePickupSpawnPosition(
522
+ position,
523
+ FIND_FREE_INITIAL_STEP,
524
+ );
510
525
  const spider = EntityNPC.ThrowSpider(
511
526
  position,
512
527
  undefined,
@@ -498,6 +498,7 @@ export function roomUpdateSafe(): void {
498
498
  /** Helper function to set the backdrop of the current room. */
499
499
  export function setBackdrop(backdropType: BackdropType): void {
500
500
  game.ShowHallucination(0, backdropType);
501
+ sfxManager.Stop(SoundEffect.DEATH_CARD);
501
502
  }
502
503
 
503
504
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A collection of the four sprites necessary in order to render a charge bar.
3
3
  *
4
- * Used in the `newChargeBarSprites` and related helper functions.
4
+ * This is used in the `newChargeBarSprites` and related helper functions.
5
5
  */
6
6
  export interface ChargeBarSprites {
7
7
  back: Sprite;
@@ -1,5 +1,10 @@
1
1
  import { CornerType } from "../enums/CornerType";
2
2
 
3
+ /**
4
+ * An interface representing a corner in the room.
5
+ *
6
+ * This is used by the `getRoomShapeCorners` helper function.
7
+ */
3
8
  export interface Corner {
4
9
  readonly type: CornerType;
5
10
  readonly position: Readonly<Vector>;
@@ -27,6 +27,9 @@ export type CustomStageTSConfig = Readonly<{
27
27
  * Make sure the chosen prefix does not conflict with any other mods. You can find a list of
28
28
  * registered room variant prefixes on the IsaacScript website:
29
29
  * https://isaacscript.github.io/main/custom-stages
30
+ *
31
+ * @minimum 101
32
+ * @maximum 109
30
33
  */
31
34
  roomVariantPrefix: number;
32
35
 
@@ -39,6 +42,9 @@ export type CustomStageTSConfig = Readonly<{
39
42
  * method.)
40
43
  *
41
44
  * If not specified, `LevelStage.BASEMENT_2` (2) will be used.
45
+ *
46
+ * @minimum 2
47
+ * @maximum 13
42
48
  */
43
49
  baseStage?: number;
44
50
 
@@ -48,6 +54,9 @@ export type CustomStageTSConfig = Readonly<{
48
54
  * generation algorithm.
49
55
  *
50
56
  * If not specified, `StageType.ORIGINAL` (0) will be used.
57
+ *
58
+ * @minimum 0
59
+ * @maximum 5
51
60
  */
52
61
  baseStageType?: number;
53
62
 
@@ -331,9 +340,28 @@ export type CustomStageTSConfig = Readonly<{
331
340
  * `versusScreenBackgroundColors.ts`.
332
341
  */
333
342
  backgroundColor?: Readonly<{
343
+ /**
344
+ * @minimum 0
345
+ * @maximum 1
346
+ */
334
347
  r: number;
348
+
349
+ /**
350
+ * @minimum 0
351
+ * @maximum 1
352
+ */
335
353
  g: number;
354
+
355
+ /**
356
+ * @minimum 0
357
+ * @maximum 1
358
+ */
336
359
  b: number;
360
+
361
+ /**
362
+ * @minimum 0
363
+ * @maximum 1
364
+ */
337
365
  a: number;
338
366
  }>;
339
367
 
@@ -346,9 +374,28 @@ export type CustomStageTSConfig = Readonly<{
346
374
  * `versusScreenDirtSpotColors.ts`.
347
375
  */
348
376
  dirtSpotColor?: Readonly<{
377
+ /**
378
+ * @minimum 0
379
+ * @maximum 1
380
+ */
349
381
  r: number;
382
+
383
+ /**
384
+ * @minimum 0
385
+ * @maximum 1
386
+ */
350
387
  g: number;
388
+
389
+ /**
390
+ * @minimum 0
391
+ * @maximum 1
392
+ */
351
393
  b: number;
394
+
395
+ /**
396
+ * @minimum 0
397
+ * @maximum 1
398
+ */
352
399
  a: number;
353
400
  }>;
354
401
  }>;
@@ -376,9 +423,28 @@ export type CustomStageShadow = Readonly<{
376
423
  * to 75% faded black).
377
424
  */
378
425
  color?: Readonly<{
426
+ /**
427
+ * @minimum 0
428
+ * @maximum 1
429
+ */
379
430
  r: number;
431
+
432
+ /**
433
+ * @minimum 0
434
+ * @maximum 1
435
+ */
380
436
  g: number;
437
+
438
+ /**
439
+ * @minimum 0
440
+ * @maximum 1
441
+ */
381
442
  b: number;
443
+
444
+ /**
445
+ * @minimum 0
446
+ * @maximum 1
447
+ */
382
448
  a: number;
383
449
  }>;
384
450
  }>;
@@ -3,6 +3,12 @@ import {
3
3
  GridEntityType,
4
4
  } from "isaac-typescript-definitions";
5
5
 
6
+ /**
7
+ * This is meta-data that describes a custom grid entity.
8
+ *
9
+ * (One of the extra features that the standard library offers is the ability to spawn custom grid
10
+ * entities with the `spawnCustomGridEntity` helper function.)
11
+ */
6
12
  export interface GridEntityCustomData {
7
13
  /**
8
14
  * This is not a real `GridEntityType`; rather it is an arbitrary integer selected by end-user
@@ -1,13 +1,17 @@
1
1
  /**
2
- * Custom rooms are created with the Basement Renovator program, which outputs XML files and STB
3
- * files. A `JSONRoomsFile` object is simply an XML file converted to JSON. (It is useful to have
4
- * the room data in JSON format so that it can be directly consumed by TypeScript programs.)
2
+ * The standard library has the feature to deploy a new room on-the-fly with the `deployJSONRoom`
3
+ * helper function. It requires a `JSONRoomsFile` as an argument, which is simply an XML file
4
+ * converted to JSON. (You create XML room files using the Basement Renovator program.)
5
5
  *
6
6
  * You can convert your XML files using the following command:
7
7
  *
8
8
  * ```sh
9
9
  * npx convert-xml-to-json foo.xml foo.json
10
10
  * ```
11
+ *
12
+ * Note that the custom stages feature of the standard library uses real XML/STB files, not JSON
13
+ * rooms, so you would only need to do this if you are using the `deployJSONRoom` command
14
+ * specifically.
11
15
  */
12
16
  export interface JSONRoomsFile {
13
17
  rooms: JSONRooms;
@@ -1,6 +1,6 @@
1
1
  import { HeartSubType } from "isaac-typescript-definitions";
2
2
 
3
- /** Used by the `getPlayerHealth` and `setPlayerHealth` helper functions. */
3
+ /** This is used by the `getPlayerHealth` and `setPlayerHealth` helper functions. */
4
4
  export interface PlayerHealth {
5
5
  maxHearts: int;
6
6
  hearts: int;
@@ -1,7 +1,7 @@
1
1
  import { PocketItemSlot } from "isaac-typescript-definitions";
2
2
  import { PocketItemType } from "../enums/PocketItemType";
3
3
 
4
- /** Used by the `getPocketItems` and related helper functions. */
4
+ /** This is used by the `getPocketItems` and related helper functions. */
5
5
  export interface PocketItemDescription {
6
6
  slot: PocketItemSlot;
7
7
  type: PocketItemType;
@@ -5,7 +5,7 @@ import {
5
5
  StageType,
6
6
  } from "isaac-typescript-definitions";
7
7
 
8
- /** Used by the room history feature. */
8
+ /** This is used by the room history feature of the standard library. */
9
9
  export interface RoomDescription {
10
10
  stage: LevelStage;
11
11
  stageType: StageType;
@@ -1,6 +1,10 @@
1
1
  import { TearFlag } from "isaac-typescript-definitions";
2
2
  import { StatType } from "../enums/StatType";
3
3
 
4
+ /**
5
+ * This is an interface mapping a stat type to the data type. For example, `StatType.DAMAGE` is a
6
+ * `float` type.
7
+ */
4
8
  export interface StatTypeType {
5
9
  [StatType.DAMAGE]: float;
6
10
  [StatType.FIRE_DELAY]: float;
@@ -1,6 +1,6 @@
1
1
  import { TrinketType } from "isaac-typescript-definitions";
2
2
 
3
- /** Used by the `temporarilyRemoveTrinkets` and related helper functions. */
3
+ /** This is used by the `temporarilyRemoveTrinkets` and related helper functions. */
4
4
  export interface TrinketSituation {
5
5
  trinketTypeRemoved: TrinketType;
6
6
  trinketType1: TrinketType;
@@ -0,0 +1,77 @@
1
+ import { Keyboard } from "isaac-typescript-definitions";
2
+
3
+ /** Maps each keyboard enum member to its corresponding lowercase and uppercase characters. */
4
+ export const KEYBOARD_TO_STRING: ReadonlyMap<
5
+ Keyboard,
6
+ readonly [lowercaseCharacter: string, uppercaseCharacter: string]
7
+ > = new Map([
8
+ [Keyboard.SPACE, [" ", " "]], // 32
9
+ [Keyboard.APOSTROPHE, ["'", '"']], // 39
10
+ [Keyboard.COMMA, [",", "<"]], // 44
11
+ [Keyboard.MINUS, ["-", "_"]], // 45
12
+ [Keyboard.PERIOD, [".", ">"]], // 46
13
+ [Keyboard.SLASH, ["/", "?"]], // 47
14
+
15
+ [Keyboard.ZERO, ["0", ")"]], // 48
16
+ [Keyboard.ONE, ["1", "!"]], // 49
17
+ [Keyboard.TWO, ["2", "@"]], // 50
18
+ [Keyboard.THREE, ["3", "#"]], // 51
19
+ [Keyboard.FOUR, ["4", "$"]], // 52
20
+ [Keyboard.FIVE, ["5", "%"]], // 53
21
+ [Keyboard.SIX, ["6", "^"]], // 54
22
+ [Keyboard.SEVEN, ["7", "&"]], // 55
23
+ [Keyboard.EIGHT, ["8", "*"]], // 56
24
+ [Keyboard.NINE, ["9", "("]], // 57
25
+
26
+ [Keyboard.SEMICOLON, [";", ":"]], // 59
27
+ [Keyboard.EQUAL, ["=", "+"]], // 61
28
+
29
+ [Keyboard.A, ["a", "A"]], // 65
30
+ [Keyboard.B, ["b", "B"]], // 66
31
+ [Keyboard.C, ["c", "C"]], // 67
32
+ [Keyboard.D, ["d", "D"]], // 68
33
+ [Keyboard.E, ["e", "E"]], // 69
34
+ [Keyboard.F, ["f", "F"]], // 70
35
+ [Keyboard.G, ["g", "G"]], // 71
36
+ [Keyboard.H, ["h", "H"]], // 72
37
+ [Keyboard.I, ["i", "I"]], // 73
38
+ [Keyboard.J, ["j", "J"]], // 74
39
+ [Keyboard.K, ["k", "K"]], // 75
40
+ [Keyboard.L, ["l", "L"]], // 76
41
+ [Keyboard.M, ["m", "M"]], // 77
42
+ [Keyboard.N, ["n", "N"]], // 78
43
+ [Keyboard.O, ["o", "O"]], // 79
44
+ [Keyboard.P, ["p", "P"]], // 80
45
+ [Keyboard.Q, ["q", "Q"]], // 81
46
+ [Keyboard.R, ["r", "R"]], // 82
47
+ [Keyboard.S, ["s", "S"]], // 83
48
+ [Keyboard.T, ["t", "T"]], // 84
49
+ [Keyboard.U, ["u", "U"]], // 85
50
+ [Keyboard.V, ["v", "V"]], // 86
51
+ [Keyboard.W, ["w", "W"]], // 87
52
+ [Keyboard.X, ["x", "X"]], // 88
53
+ [Keyboard.Y, ["y", "Y"]], // 89
54
+ [Keyboard.Z, ["z", "Z"]], // 90
55
+
56
+ [Keyboard.KP_0, ["0", "0"]], // 320
57
+ [Keyboard.KP_1, ["1", "1"]], // 321
58
+ [Keyboard.KP_2, ["2", "2"]], // 322
59
+ [Keyboard.KP_3, ["3", "3"]], // 323
60
+ [Keyboard.KP_4, ["4", "4"]], // 324
61
+ [Keyboard.KP_5, ["5", "5"]], // 325
62
+ [Keyboard.KP_6, ["6", "6"]], // 326
63
+ [Keyboard.KP_7, ["7", "7"]], // 327
64
+ [Keyboard.KP_8, ["8", "8"]], // 328
65
+ [Keyboard.KP_9, ["9", "9"]], // 329
66
+
67
+ [Keyboard.KP_DECIMAL, [".", "."]], // 330
68
+ [Keyboard.KP_DIVIDE, ["/", "/"]], // 331
69
+ [Keyboard.KP_MULTIPLY, ["*", "*"]], // 332
70
+ [Keyboard.KP_SUBTRACT, ["-", "-"]], // 333
71
+ [Keyboard.KP_ADD, ["+", "+"]], // 334
72
+
73
+ [Keyboard.LEFT_BRACKET, ["[", "{"]], // 91
74
+ [Keyboard.BACKSLASH, ["\\", "|"]], // 92
75
+ [Keyboard.RIGHT_BRACKET, ["]", "}"]], // 93
76
+ [Keyboard.GRAVE_ACCENT, ["`", "~"]], // 96
77
+ ]);
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A type union that matches `Entity`, `EntityBomb`, `EntityEffect`, and so on.
3
+ *
4
+ * This is useful for building generic functions that should accept any kind of entity.
5
+ */
1
6
  export type AnyEntity =
2
7
  | Entity
3
8
  | EntityBomb
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A type union that matches `GridEntity`, `GridEntityDoor`, `GridEntityPit`, and so on.
3
+ *
4
+ * This is useful for building generic functions that should accept any kind of grid entity.
5
+ */
1
6
  export type AnyGridEntity =
2
7
  | GridEntity
3
8
  | GridEntityDoor
@@ -1,7 +1,8 @@
1
1
  /**
2
- * `CollectibleIndex` is a specific type of string; see the documentation for the
3
- * `getCollectibleIndex` function. Mods can signify that data structures handle collectibles by
4
- * using this type.
2
+ * `CollectibleIndex` is a specific type of string that represents a unique identifier for a
3
+ * collectible. Mods can signify that data structures handle collectibles by using this type.
4
+ *
5
+ * For more information, see the documentation for the `getCollectibleIndex` function.
5
6
  *
6
7
  * For example:
7
8
  *
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Immutable is a type that will make the given array/map/set/object recursively read-only.
2
+ * Immutable is a utility type that will make the given array/map/set/object recursively read-only.
3
+ *
4
+ * You can use this type to easily build safe data structures.
3
5
  *
4
6
  * From: https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
5
7
  */
@@ -1,6 +1,8 @@
1
1
  /**
2
- * `PickupIndex` is a specific type of string; see the documentation for the `getPickupIndex`
3
- * function. Mods can signify that data structures handle collectibles by using this type.
2
+ * `PickupIndex` is a specific type of number that represents a unique identifier for a pickup. Mods
3
+ * can signify that data structures handle collectibles by using this type.
4
+ *
5
+ * For more information, see the documentation for the `getPickupIndex` function.
4
6
  *
5
7
  * For example:
6
8
  *
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * `PlayerIndex` is a specific type of number that represents a unique identifier for a player. Mods
3
- * can signify that data structures handle `EntityPlayer` by using this type. For more information,
4
- * see the documentation for the `getPlayerIndex` function.
3
+ * can signify that data structures handle `EntityPlayer` by using this type.
4
+ *
5
+ * For more information, see the documentation for the `getPlayerIndex` function.
5
6
  *
6
7
  * For example:
7
8
  *
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This is a type representing an Isaac API class like `Color` or `RNG` that has been written to the
3
+ * "save#.dat" file. It is used by the save data manager when reading and writing to that file.
4
+ *
5
+ * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
6
+ */
1
7
  export type SerializedIsaacAPIClass = LuaMap<string, unknown> & {
2
8
  readonly __serializedIsaacAPIClassBrand: symbol;
3
9
  };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This is a type representing a user-created class from TypeScript code.
3
+ *
4
+ * This type is used by the save data manager to when copying, serializing, and deserializing.
5
+ */
1
6
  export type TSTLClass = LuaMap<AnyNotNil, unknown> & {
2
7
  readonly __tstlClassBrand: symbol;
3
8
  };
@@ -1,5 +1,8 @@
1
1
  import { LevelStage, StageType } from "isaac-typescript-definitions";
2
2
 
3
+ /**
4
+ * This is the type that you need to specify when using the `spawnCustomTrapdoor` helper function.
5
+ */
3
6
  export type TrapdoorDestination =
4
7
  | [stage: LevelStage, stageType: StageType]
5
8
  | [customStageName: string, floorNum: int];