isaacscript-common 7.4.3 → 7.5.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 (118) hide show
  1. package/dist/callbacks/postGridEntity.d.ts.map +1 -1
  2. package/dist/callbacks/postGridEntity.lua +53 -6
  3. package/dist/callbacks/postPlayerChangeStat.d.ts.map +1 -1
  4. package/dist/callbacks/postPlayerChangeStat.lua +9 -2
  5. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts +1 -0
  6. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts.map +1 -1
  7. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.lua +5 -2
  8. package/dist/callbacks/subscriptions/postGridEntityCustomInit.d.ts +9 -0
  9. package/dist/callbacks/subscriptions/postGridEntityCustomInit.d.ts.map +1 -0
  10. package/dist/callbacks/subscriptions/postGridEntityCustomInit.lua +23 -0
  11. package/dist/callbacks/subscriptions/postGridEntityCustomRemove.d.ts +9 -0
  12. package/dist/callbacks/subscriptions/postGridEntityCustomRemove.d.ts.map +1 -0
  13. package/dist/callbacks/subscriptions/postGridEntityCustomRemove.lua +23 -0
  14. package/dist/callbacks/subscriptions/postGridEntityCustomStateChanged.d.ts +9 -0
  15. package/dist/callbacks/subscriptions/postGridEntityCustomStateChanged.d.ts.map +1 -0
  16. package/dist/callbacks/subscriptions/postGridEntityCustomStateChanged.lua +29 -0
  17. package/dist/callbacks/subscriptions/postPlayerChangeStat.d.ts +3 -2
  18. package/dist/callbacks/subscriptions/postPlayerChangeStat.d.ts.map +1 -1
  19. package/dist/enums/ModCallbackCustom.d.ts +131 -81
  20. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  21. package/dist/enums/ModCallbackCustom.lua +67 -61
  22. package/dist/enums/StatType.d.ts +3 -1
  23. package/dist/enums/StatType.d.ts.map +1 -1
  24. package/dist/enums/StatType.lua +2 -0
  25. package/dist/features/customGridEntity.d.ts +30 -13
  26. package/dist/features/customGridEntity.d.ts.map +1 -1
  27. package/dist/features/customGridEntity.lua +67 -48
  28. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  29. package/dist/features/customStage/customStageGridEntities.lua +37 -31
  30. package/dist/functions/dev.d.ts +20 -0
  31. package/dist/functions/dev.d.ts.map +1 -0
  32. package/dist/functions/dev.lua +34 -0
  33. package/dist/functions/playerStats.d.ts.map +1 -1
  34. package/dist/functions/playerStats.lua +2 -1
  35. package/dist/functions/rooms.d.ts +5 -0
  36. package/dist/functions/rooms.d.ts.map +1 -1
  37. package/dist/functions/rooms.lua +12 -2
  38. package/dist/index.d.ts +204 -96
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.lua +1134 -8
  41. package/dist/interfaces/StatTypeType.d.ts +1 -0
  42. package/dist/interfaces/StatTypeType.d.ts.map +1 -1
  43. package/dist/interfaces/private/AddCallbackParameterCustom.d.ts +6 -0
  44. package/dist/interfaces/private/AddCallbackParameterCustom.d.ts.map +1 -1
  45. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  46. package/dist/objects/callbackRegisterFunctions.lua +9 -0
  47. package/dist/types/PossibleStatType.d.ts +7 -0
  48. package/dist/types/PossibleStatType.d.ts.map +1 -0
  49. package/dist/{interfaces/index.lua → types/PossibleStatType.lua} +0 -0
  50. package/package.json +1 -1
  51. package/src/callbacks/postGridEntity.ts +75 -10
  52. package/src/callbacks/postPlayerChangeStat.ts +8 -4
  53. package/src/callbacks/subscriptions/postGridEntityCustomBroken.ts +4 -0
  54. package/src/callbacks/subscriptions/postGridEntityCustomInit.ts +38 -0
  55. package/src/callbacks/subscriptions/postGridEntityCustomRemove.ts +35 -0
  56. package/src/callbacks/subscriptions/postGridEntityCustomStateChanged.ts +42 -0
  57. package/src/callbacks/subscriptions/postPlayerChangeStat.ts +4 -7
  58. package/src/enums/ModCallbackCustom.ts +73 -20
  59. package/src/enums/StatType.ts +3 -3
  60. package/src/features/customGridEntity.ts +87 -61
  61. package/src/features/customStage/customStageGridEntities.ts +16 -7
  62. package/src/functions/dev.ts +31 -0
  63. package/src/functions/playerStats.ts +1 -0
  64. package/src/functions/rooms.ts +18 -0
  65. package/src/index.ts +208 -9
  66. package/src/interfaces/StatTypeType.ts +1 -0
  67. package/src/interfaces/private/AddCallbackParameterCustom.ts +6 -0
  68. package/src/objects/callbackRegisterFunctions.ts +9 -0
  69. package/src/types/PossibleStatType.ts +12 -0
  70. package/dist/classes/index.d.ts +0 -3
  71. package/dist/classes/index.d.ts.map +0 -1
  72. package/dist/classes/index.lua +0 -18
  73. package/dist/core/index.d.ts +0 -5
  74. package/dist/core/index.d.ts.map +0 -1
  75. package/dist/core/index.lua +0 -34
  76. package/dist/enums/DecorationVariant.d.ts +0 -10
  77. package/dist/enums/DecorationVariant.d.ts.map +0 -1
  78. package/dist/enums/DecorationVariant.lua +0 -7
  79. package/dist/enums/index.d.ts +0 -11
  80. package/dist/enums/index.d.ts.map +0 -1
  81. package/dist/enums/index.lua +0 -82
  82. package/dist/features/index.d.ts +0 -30
  83. package/dist/features/index.d.ts.map +0 -1
  84. package/dist/features/index.lua +0 -216
  85. package/dist/functions/index.d.ts +0 -100
  86. package/dist/functions/index.d.ts.map +0 -1
  87. package/dist/functions/index.lua +0 -794
  88. package/dist/interfaces/index.d.ts +0 -12
  89. package/dist/interfaces/index.d.ts.map +0 -1
  90. package/dist/maps/index.d.ts +0 -5
  91. package/dist/maps/index.d.ts.map +0 -1
  92. package/dist/maps/index.lua +0 -34
  93. package/dist/objects/index.d.ts +0 -2
  94. package/dist/objects/index.d.ts.map +0 -1
  95. package/dist/objects/index.lua +0 -10
  96. package/dist/types/index.d.ts +0 -11
  97. package/dist/types/index.d.ts.map +0 -1
  98. package/dist/types/index.lua +0 -10
  99. package/src/classes/index.ts +0 -2
  100. package/src/classes/indexTypeDoc.ts +0 -2
  101. package/src/core/index.ts +0 -4
  102. package/src/core/indexTypeDoc.ts +0 -4
  103. package/src/enums/DecorationVariant.ts +0 -10
  104. package/src/enums/index.ts +0 -10
  105. package/src/enums/indexTypeDoc.ts +0 -10
  106. package/src/features/index.ts +0 -59
  107. package/src/features/indexTypeDoc.ts +0 -30
  108. package/src/functions/index.ts +0 -101
  109. package/src/functions/indexTypeDoc.ts +0 -101
  110. package/src/indexTypeDoc.ts +0 -13
  111. package/src/interfaces/index.ts +0 -11
  112. package/src/interfaces/indexTypeDoc.ts +0 -11
  113. package/src/maps/index.ts +0 -4
  114. package/src/maps/indexTypeDoc.ts +0 -4
  115. package/src/objects/index.ts +0 -1
  116. package/src/objects/indexTypeDoc.ts +0 -1
  117. package/src/types/index.ts +0 -10
  118. package/src/types/indexTypeDoc.ts +0 -10
@@ -39,9 +39,9 @@ export enum StatType {
39
39
  /** Corresponds to `CacheFlag.LUCK` (1 << 10) and `EntityPlayer.Luck`. */
40
40
  LUCK,
41
41
 
42
- // - `CacheFlag.SIZE` (1 << 12) does not have a corresponding `EntityPlayer` field. (After picking
43
- // up Magic Mushroom, the values of `EntityPlayer.Size` and `EntityPlayer.SizeMulti` do not
44
- // change.)
42
+ /** Corresponds to `CacheFlag.SIZE` (1 << 11) and `EntityPlayer.SpriteScale`. */
43
+ SIZE,
44
+
45
45
  // - `CacheFlag.COLOR` (1 << 12) does not have a corresponding `EntityPlayer` field.
46
46
  // - `CacheFlag.PICKUP_VISION` (1 << 13) does not have a corresponding `EntityPlayer` field.
47
47
  }
@@ -2,7 +2,6 @@ import {
2
2
  ActiveSlot,
3
3
  CollectibleType,
4
4
  DamageFlag,
5
- EntityFlag,
6
5
  EntityType,
7
6
  GridCollisionClass,
8
7
  GridEntityType,
@@ -13,24 +12,24 @@ import { postGridEntityCustomBrokenFire } from "../callbacks/subscriptions/postG
13
12
  import { DefaultMap } from "../classes/DefaultMap";
14
13
  import { ModUpgraded } from "../classes/ModUpgraded";
15
14
  import { game } from "../core/cachedClasses";
16
- import { DecorationVariant } from "../enums/DecorationVariant";
17
15
  import { ModCallbackCustom } from "../enums/ModCallbackCustom";
18
- import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
19
- import { spawn } from "../functions/entities";
16
+ import {
17
+ areFeaturesInitialized,
18
+ errorIfFeaturesNotInitialized,
19
+ } from "../featuresInitialized";
20
20
  import { hasFlag } from "../functions/flag";
21
21
  import {
22
22
  removeGridEntity,
23
23
  spawnGridEntityWithVariant,
24
24
  } from "../functions/gridEntities";
25
25
  import { getRoomListIndex } from "../functions/roomData";
26
- import { asNumber } from "../functions/types";
26
+ import { isNumber } from "../functions/types";
27
27
  import { isVector } from "../functions/vector";
28
28
  import { GridEntityCustomData } from "../interfaces/GridEntityCustomData";
29
29
  import { runNextGameFrame } from "./runInNFrames";
30
30
  import { saveDataManager } from "./saveDataManager/exports";
31
31
 
32
32
  const FEATURE_NAME = "customGridEntity";
33
- const GENERIC_PROP_SIZE_MULTIPLIER = 0.66;
34
33
 
35
34
  const v = {
36
35
  level: {
@@ -200,18 +199,24 @@ function postNewRoomReordered() {
200
199
  * will reappear if the player leaves and re-enters the room. (It will be manually respawned in the
201
200
  * `POST_NEW_ROOM` callback.)
202
201
  *
203
- * This is an IsaacScript feature because the vanilla game does not support any custom grid
204
- * entities. Under the hood, IsaacScript accomplishes this by using decorations with an arbitrary
205
- * non-zero variant to represent custom grid entities.
202
+ * Custom grid entities are built on top of real grid entities. You can use any existing grid entity
203
+ * type as a base. For example, if you want to create a custom rock that would be breakable like a
204
+ * normal rock, then you should specify `GridEntityType.ROCK` as the base grid entity type.
206
205
  *
207
206
  * Once a custom grid entity is spawned, you can take advantage of the custom grid callbacks such as
208
- * `POST_GRID_ENTITY_CUSTOM_UPDATE`.
207
+ * `POST_GRID_ENTITY_CUSTOM_UPDATE`. Note that the "normal" grid entities callbacks will not fire
208
+ * for custom entities. For example, if you had a custom grid entity based on `GridEntityType.ROCK`,
209
+ * and you also had a subscription to the `POST_GRID_ENTITY_UPDATE` callback, the callback would
210
+ * only fire for normal rocks and not the custom entity.
211
+ *
212
+ * Custom grid entities are an IsaacScript feature because the vanilla game does not support any
213
+ * custom grid entities.
209
214
  *
210
215
  * @param gridEntityTypeCustom An integer that identifies what kind of grid entity you are creating.
211
- * It should correspond to a local enum value in your mod. The integer
212
- * can be any unique value and will not correspond to the actual grid
213
- * entity type used. (This integer is used in the various custom grid
214
- * entity callbacks.)
216
+ * It should correspond to a local enum value created in your mod. The
217
+ * integer can be any unique value and will not correspond to the actual
218
+ * grid entity type used. (This integer is used in the various custom
219
+ * grid entity callbacks.)
215
220
  * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
216
221
  * entity at. If a position is specified, the closest grid index will be
217
222
  * used.
@@ -220,10 +225,10 @@ function postNewRoomReordered() {
220
225
  * @param defaultAnimation Optional. The name of the animation to play after the sprite is
221
226
  * initialized and after the player re-enters a room with this grid entity
222
227
  * in it. If not specified, the default animation in the anm2 will be used.
223
- * @param breakable Optional. Whether or not an explosion will be able to break this grid entity.
224
- * False by default. Use the `POST_GRID_ENTITY_CUSTOM_BROKEN` callback to detect
225
- * when it breaks. Due to technical limitations, you can only set the grid entity
226
- * to be breakable if it has a collision class.
228
+ * @param baseGridEntityType Optional. The type of the grid entity to use as a "base" for this
229
+ * custom grid entity. Default is `GridEntityType.DECORATION`.
230
+ * @param baseGridEntityVariant Optional. The variant of the grid entity to use as a "base" for this
231
+ * custom grid entity. Default is 0.
227
232
  */
228
233
  export function spawnCustomGridEntity(
229
234
  gridEntityTypeCustom: GridEntityType,
@@ -231,41 +236,28 @@ export function spawnCustomGridEntity(
231
236
  gridCollisionClass: GridCollisionClass,
232
237
  anm2Path: string,
233
238
  defaultAnimation?: string,
234
- breakable = false,
239
+ baseGridEntityType = GridEntityType.DECORATION,
240
+ baseGridEntityVariant = 0,
235
241
  ): GridEntity {
236
242
  errorIfFeaturesNotInitialized(FEATURE_NAME);
237
243
 
238
- if (breakable && gridCollisionClass === GridCollisionClass.NONE) {
239
- error(
240
- "Failed to spawn a custom grid entity because it is not possible to have breakable custom grid entities with a collision class of: GridCollisionClass.NONE (0)",
241
- );
242
- }
243
-
244
244
  const room = game.GetRoom();
245
245
  const roomListIndex = getRoomListIndex();
246
246
  const gridIndex = isVector(gridIndexOrPosition)
247
247
  ? room.GetGridIndex(gridIndexOrPosition)
248
248
  : gridIndexOrPosition;
249
249
 
250
- const existingGridEntity = room.GetGridEntity(gridIndex);
251
- const isExistingDecoration =
252
- existingGridEntity !== undefined &&
253
- existingGridEntity.GetType() === GridEntityType.DECORATION &&
254
- existingGridEntity.GetVariant() ===
255
- asNumber(DecorationVariant.CUSTOM_GRID_ENTITY);
256
- const decoration = isExistingDecoration
257
- ? existingGridEntity
258
- : spawnGridEntityWithVariant(
259
- GridEntityType.DECORATION,
260
- DecorationVariant.CUSTOM_GRID_ENTITY,
261
- gridIndexOrPosition,
262
- );
263
- if (decoration === undefined) {
264
- error("Failed to spawn a decoration for a custom grid entity.");
250
+ const customGridEntity = spawnGridEntityWithVariant(
251
+ baseGridEntityType,
252
+ baseGridEntityVariant,
253
+ gridIndexOrPosition,
254
+ );
255
+ if (customGridEntity === undefined) {
256
+ error("Failed to spawn a custom grid entity.");
265
257
  }
266
- decoration.CollisionClass = gridCollisionClass;
258
+ customGridEntity.CollisionClass = gridCollisionClass;
267
259
 
268
- const sprite = decoration.GetSprite();
260
+ const sprite = customGridEntity.GetSprite();
269
261
  sprite.Load(anm2Path, true);
270
262
  const animationToPlay =
271
263
  defaultAnimation === undefined
@@ -286,25 +278,7 @@ export function spawnCustomGridEntity(
286
278
  v.level.customGridEntities.getAndSetDefault(roomListIndex);
287
279
  roomCustomGridEntities.set(gridIndex, customGridEntityData);
288
280
 
289
- // We check to see if an explosion touches a custom grid entity by spawning a Dummy on top, and
290
- // the monitoring for explosions in the `ENTITY_TAKE_DMG` callback.
291
- if (breakable) {
292
- const position = room.GetGridPosition(gridIndex);
293
- const entity = spawn(EntityType.GENERIC_PROP, 0, 0, position);
294
- entity.ClearEntityFlags(EntityFlag.APPEAR);
295
- entity.Visible = false;
296
-
297
- // By default, it is larger than a grid tile, so make it a bit smaller.
298
- entity.SizeMulti = Vector(
299
- GENERIC_PROP_SIZE_MULTIPLIER,
300
- GENERIC_PROP_SIZE_MULTIPLIER,
301
- );
302
-
303
- const ptrHash = GetPtrHash(entity);
304
- v.room.genericPropPtrHashes.add(ptrHash);
305
- }
306
-
307
- return decoration;
281
+ return customGridEntity;
308
282
  }
309
283
 
310
284
  /**
@@ -326,6 +300,8 @@ export function removeCustomGridEntity(
326
300
  gridIndexOrPositionOrGridEntity: int | Vector | GridEntity,
327
301
  updateRoom = true,
328
302
  ): GridEntity | undefined {
303
+ errorIfFeaturesNotInitialized(FEATURE_NAME);
304
+
329
305
  const room = game.GetRoom();
330
306
  const roomListIndex = getRoomListIndex();
331
307
 
@@ -371,6 +347,10 @@ export function removeCustomGridEntity(
371
347
  export function getCustomGridEntities(): Array<
372
348
  [gridEntity: GridEntity, data: GridEntityCustomData]
373
349
  > {
350
+ if (!areFeaturesInitialized()) {
351
+ return [];
352
+ }
353
+
374
354
  const roomListIndex = getRoomListIndex();
375
355
  const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
376
356
  if (roomCustomGridEntities === undefined) {
@@ -388,3 +368,49 @@ export function getCustomGridEntities(): Array<
388
368
 
389
369
  return customGridEntities;
390
370
  }
371
+
372
+ /**
373
+ * Helper function to get the custom `GridEntityType` from a `GridEntity` or grid index. Returns
374
+ * undefined if the provided `GridEntity` is not a custom grid entity, or if there was not a grid
375
+ * entity on the provided grid index.
376
+ */
377
+ export function getCustomGridEntityType(
378
+ gridEntityOrGridIndex: GridEntity | int,
379
+ ): GridEntityType | undefined {
380
+ if (!areFeaturesInitialized()) {
381
+ return undefined;
382
+ }
383
+
384
+ const gridIndex = isNumber(gridEntityOrGridIndex)
385
+ ? gridEntityOrGridIndex
386
+ : gridEntityOrGridIndex.GetGridIndex();
387
+
388
+ const roomListIndex = getRoomListIndex();
389
+ const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
390
+ if (roomCustomGridEntities === undefined) {
391
+ return undefined;
392
+ }
393
+
394
+ for (const [_gridIndex, data] of roomCustomGridEntities.entries()) {
395
+ if (data.gridIndex === gridIndex) {
396
+ return data.gridEntityTypeCustom;
397
+ }
398
+ }
399
+
400
+ return undefined;
401
+ }
402
+
403
+ /**
404
+ * Helper function to check if a `GridEntity` is a custom grid entity or if a grid index has a
405
+ * custom grid entity.
406
+ */
407
+ export function isCustomGridEntity(
408
+ gridEntityOrGridIndex: GridEntity | int,
409
+ ): boolean {
410
+ if (!areFeaturesInitialized()) {
411
+ return false;
412
+ }
413
+
414
+ const gridEntityTypeCustom = getCustomGridEntityType(gridEntityOrGridIndex);
415
+ return gridEntityTypeCustom !== undefined;
416
+ }
@@ -5,7 +5,6 @@ import {
5
5
  LevelStage,
6
6
  TrinketType,
7
7
  } from "isaac-typescript-definitions";
8
- import { DecorationVariant } from "../../enums/DecorationVariant";
9
8
  import { removeEntities } from "../../functions/entities";
10
9
  import { getNPCs } from "../../functions/entitiesSpecific";
11
10
  import { removeGridEntity } from "../../functions/gridEntities";
@@ -15,10 +14,10 @@ import {
15
14
  getTrinkets,
16
15
  } from "../../functions/pickupsSpecific";
17
16
  import { calculateStageType } from "../../functions/stage";
18
- import { asNumber } from "../../functions/types";
19
17
  import { vectorEquals } from "../../functions/vector";
20
18
  import { CustomStage } from "../../interfaces/private/CustomStage";
21
19
  import { TrapdoorDestination } from "../../types/TrapdoorDestination";
20
+ import { isCustomGridEntity } from "../customGridEntity";
22
21
  import { spawnCustomTrapdoor } from "../customTrapdoor/exports";
23
22
  import { DEFAULT_BASE_STAGE } from "./exports";
24
23
  import v from "./v";
@@ -34,14 +33,12 @@ export function setCustomDecorationGraphics(
34
33
  return;
35
34
  }
36
35
 
37
- const gridEntityType = gridEntity.GetType();
38
- if (gridEntityType !== GridEntityType.DECORATION) {
36
+ if (isCustomGridEntity(gridEntity)) {
39
37
  return;
40
38
  }
41
39
 
42
- // Ignore custom grid entities. (They are represented as decorations with a non-zero variant.)
43
- const variant = gridEntity.GetVariant();
44
- if (variant !== asNumber(DecorationVariant.VANILLA_DECORATION)) {
40
+ const gridEntityType = gridEntity.GetType();
41
+ if (gridEntityType !== GridEntityType.DECORATION) {
45
42
  return;
46
43
  }
47
44
 
@@ -65,6 +62,10 @@ export function setCustomRockGraphics(
65
62
  return;
66
63
  }
67
64
 
65
+ if (isCustomGridEntity(gridEntity)) {
66
+ return;
67
+ }
68
+
68
69
  const gridEntityRock = gridEntity.ToRock();
69
70
  if (gridEntityRock === undefined) {
70
71
  return;
@@ -92,6 +93,10 @@ export function setCustomPitGraphics(
92
93
  return;
93
94
  }
94
95
 
96
+ if (isCustomGridEntity(gridEntity)) {
97
+ return;
98
+ }
99
+
95
100
  const gridEntityPit = gridEntity.ToPit();
96
101
  if (gridEntityPit === undefined) {
97
102
  return;
@@ -116,6 +121,10 @@ export function setCustomDoorGraphics(
116
121
  return;
117
122
  }
118
123
 
124
+ if (isCustomGridEntity(gridEntity)) {
125
+ return;
126
+ }
127
+
119
128
  const gridEntityDoor = gridEntity.ToDoor();
120
129
  if (gridEntityDoor === undefined) {
121
130
  return;
@@ -0,0 +1,31 @@
1
+ import { ModUpgraded } from "../classes/ModUpgraded";
2
+ import { enableExtraConsoleCommands } from "../features/extraConsoleCommands/exports";
3
+ import { removeFadeIn } from "../features/fadeInRemover";
4
+ import { enableFastReset } from "../features/fastReset";
5
+ import { saveDataManagerSetGlobal } from "../features/saveDataManager/exports";
6
+ import { setLogFunctionsGlobal } from "./log";
7
+
8
+ /**
9
+ * Helper function to enable some IsaacScript features that are useful when developing a mod. They
10
+ * shouldn't be enabled when your mod goes to production (i.e. it is uploaded to the Steam
11
+ * Workshop).
12
+ *
13
+ * The list of development features that are enabled are as follows:
14
+ *
15
+ * - `saveDataManagerSetGlobal` - Sets your local variables registered with the save data manager as
16
+ * global variables so you can access them from the in-game console.
17
+ * - `setLogFunctionsGlobal` - Sets the various log functions global so that you can access them
18
+ * from the in-game console.
19
+ * - `enableExtraConsoleCommands` - Enables many extra in-game console commands that make warping
20
+ * around easier (like e.g. `angel` to warp to the Angel Room).
21
+ * - `enableFastReset` - Makes it so that the r key resets the game instantaneously.
22
+ * - `removeFadeIn` - Removes the slow fade in that occurs at the beginning of the run, so that you
23
+ * can immediately start playing or testing.
24
+ */
25
+ export function enableDevFeatures(mod: ModUpgraded): void {
26
+ saveDataManagerSetGlobal();
27
+ setLogFunctionsGlobal();
28
+ enableExtraConsoleCommands(mod);
29
+ enableFastReset();
30
+ removeFadeIn();
31
+ }
@@ -21,5 +21,6 @@ export function getPlayerStat<T extends StatType>(
21
21
  [StatType.TEAR_COLOR]: player.TearColor, // 1 << 6
22
22
  [StatType.FLYING]: player.CanFly, // 1 << 7
23
23
  [StatType.LUCK]: player.Luck, // 1 << 10
24
+ [StatType.SIZE]: player.SpriteScale, // 1 << 11
24
25
  }[statType];
25
26
  }
@@ -4,6 +4,7 @@ import {
4
4
  BossID,
5
5
  Dimension,
6
6
  DoorSlot,
7
+ DownpourRoomSubType,
7
8
  DungeonSubType,
8
9
  GridRoom,
9
10
  HomeRoomSubType,
@@ -425,6 +426,23 @@ export function inMinibossRoomOf(minibossID: MinibossID): boolean {
425
426
  );
426
427
  }
427
428
 
429
+ /**
430
+ * Helper function to check if the current room is a "mirror room" in Downpour or Dross. (These
431
+ * rooms are marked with a specific sub-type.)
432
+ */
433
+ export function inMirrorRoom(): boolean {
434
+ const room = game.GetRoom();
435
+ const roomType = room.GetType();
436
+ const roomStageID = getRoomStageID();
437
+ const roomSubType = getRoomSubType();
438
+
439
+ return (
440
+ roomType === RoomType.DEFAULT &&
441
+ (roomStageID === StageID.DOWNPOUR || roomStageID === StageID.DROSS) &&
442
+ roomSubType === asNumber(DownpourRoomSubType.MIRROR)
443
+ );
444
+ }
445
+
428
446
  /**
429
447
  * Helper function for checking if the room is a secret shop (from the Member Card collectible).
430
448
  *
package/src/index.ts CHANGED
@@ -1,9 +1,208 @@
1
- export * from "./classes/index";
2
- export * from "./core/index";
3
- export * from "./enums/index";
4
- export * from "./features/index";
5
- export * from "./functions/index";
6
- export * from "./interfaces/index";
7
- export * from "./maps/index";
8
- export * from "./objects/index";
9
- export * from "./types/index";
1
+ export * from "./classes/DefaultMap";
2
+ export * from "./classes/ModUpgraded";
3
+ export * from "./core/cachedClasses";
4
+ export * from "./core/constants";
5
+ export * from "./core/constantsFirstLast";
6
+ export * from "./core/upgradeMod";
7
+ export * from "./enums/AmbushType";
8
+ export * from "./enums/CornerType";
9
+ export * from "./enums/HealthType";
10
+ export * from "./enums/ModCallbackCustom";
11
+ export * from "./enums/PocketItemType";
12
+ export * from "./enums/RockAltType";
13
+ export * from "./enums/SaveDataKey";
14
+ export * from "./enums/SerializationType";
15
+ export * from "./enums/SlotDestructionType";
16
+ export * from "./enums/StatType";
17
+ export {
18
+ ConversionHeartSubType,
19
+ registerCharacterHealthConversion,
20
+ } from "./features/characterHealthConversion";
21
+ export { registerCharacterStats } from "./features/characterStats";
22
+ export { getCollectibleItemPoolType } from "./features/collectibleItemPoolType";
23
+ export { initCustomDoor, spawnCustomDoor } from "./features/customDoor";
24
+ export {
25
+ removeCustomGridEntity as removeCustomGrid,
26
+ spawnCustomGridEntity as spawnCustomGrid,
27
+ } from "./features/customGridEntity";
28
+ export * from "./features/customStage/exports";
29
+ export * from "./features/customTrapdoor/exports";
30
+ export * from "./features/debugDisplay/exports";
31
+ export {
32
+ deployJSONRoom,
33
+ deployRandomJSONRoom,
34
+ emptyRoom,
35
+ } from "./features/deployJSONRoom";
36
+ export { disableAllSound, enableAllSound } from "./features/disableAllSound";
37
+ export {
38
+ disableAllInputs,
39
+ disableAllInputsExceptFor,
40
+ disableMovementInputs,
41
+ disableShootingInputs,
42
+ enableAllInputs,
43
+ enableAllInputsExceptFor,
44
+ } from "./features/disableInputs";
45
+ export * from "./features/extraConsoleCommands/exports";
46
+ export { removeFadeIn, restoreFadeIn } from "./features/fadeInRemover";
47
+ export { disableFastReset, enableFastReset } from "./features/fastReset";
48
+ export { forgottenSwitch } from "./features/forgottenSwitch";
49
+ export { pause, unpause } from "./features/pause";
50
+ export {
51
+ removePersistentEntity,
52
+ spawnPersistentEntity,
53
+ } from "./features/persistentEntities";
54
+ export * from "./features/pickupIndex";
55
+ export { getPlayerInventory } from "./features/playerInventory";
56
+ export {
57
+ anyPlayerUsingPony,
58
+ isPlayerUsingPony,
59
+ } from "./features/ponyDetection";
60
+ export { preventCollectibleRotation } from "./features/preventCollectibleRotation";
61
+ export { registerHotkey, unregisterHotkey } from "./features/registerHotkey";
62
+ export {
63
+ getRoomClearGameFrame,
64
+ getRoomClearRoomFrame,
65
+ } from "./features/roomClearFrame";
66
+ export * from "./features/roomHistory";
67
+ export {
68
+ runInNGameFrames,
69
+ runInNRenderFrames,
70
+ runNextGameFrame,
71
+ runNextRenderFrame,
72
+ setIntervalGameFrames,
73
+ setIntervalRenderFrames,
74
+ } from "./features/runInNFrames";
75
+ export * from "./features/saveDataManager/exports";
76
+ export {
77
+ hasSirenStolenFamiliar,
78
+ setFamiliarNoSirenSteal,
79
+ } from "./features/sirenHelpers";
80
+ export { getStageHistory, hasVisitedStage } from "./features/stageHistory";
81
+ export { getTaintedLazarusSubPlayer } from "./features/taintedLazarusPlayers";
82
+ export * from "./functions/ambush";
83
+ export * from "./functions/array";
84
+ export * from "./functions/benchmark";
85
+ export * from "./functions/bitSet128";
86
+ export * from "./functions/bitwise";
87
+ export * from "./functions/bombs";
88
+ export * from "./functions/bosses";
89
+ export * from "./functions/cacheFlag";
90
+ export * from "./functions/cards";
91
+ export * from "./functions/challenges";
92
+ export * from "./functions/characters";
93
+ export * from "./functions/charge";
94
+ export * from "./functions/chargeBar";
95
+ export * from "./functions/collectibles";
96
+ export * from "./functions/collectibleSet";
97
+ export * from "./functions/collectibleTag";
98
+ export * from "./functions/color";
99
+ export * from "./functions/curses";
100
+ export * from "./functions/debug";
101
+ export * from "./functions/deepCopy";
102
+ export * from "./functions/deepCopyTests";
103
+ export * from "./functions/dev";
104
+ export * from "./functions/dimensions";
105
+ export * from "./functions/direction";
106
+ export * from "./functions/doors";
107
+ export * from "./functions/easing";
108
+ export * from "./functions/eden";
109
+ export * from "./functions/effects";
110
+ export * from "./functions/entities";
111
+ export * from "./functions/entitiesSpecific";
112
+ export * from "./functions/entityTypes";
113
+ export * from "./functions/enums";
114
+ export * from "./functions/familiars";
115
+ export * from "./functions/flag";
116
+ export * from "./functions/flying";
117
+ export * from "./functions/globals";
118
+ export * from "./functions/gridEntities";
119
+ export * from "./functions/gridEntitiesSpecific";
120
+ export * from "./functions/input";
121
+ export * from "./functions/isaacAPIClass";
122
+ export * from "./functions/itemPool";
123
+ export * from "./functions/jsonHelpers";
124
+ export * from "./functions/jsonRoom";
125
+ export * from "./functions/kColor";
126
+ export * from "./functions/language";
127
+ export * from "./functions/level";
128
+ export * from "./functions/levelGrid";
129
+ export * from "./functions/log";
130
+ export * from "./functions/logEntities";
131
+ export * from "./functions/map";
132
+ export * from "./functions/math";
133
+ export * from "./functions/mergeTests";
134
+ export * from "./functions/minimap";
135
+ export * from "./functions/nextStage";
136
+ export * from "./functions/npcs";
137
+ export * from "./functions/pickups";
138
+ export * from "./functions/pickupsSpecific";
139
+ export * from "./functions/pickupVariants";
140
+ export * from "./functions/pills";
141
+ export * from "./functions/playerCenter";
142
+ export * from "./functions/playerDataStructures";
143
+ export * from "./functions/playerHealth";
144
+ export * from "./functions/playerIndex";
145
+ export * from "./functions/players";
146
+ export * from "./functions/playerStats";
147
+ export * from "./functions/pocketItems";
148
+ export * from "./functions/positionVelocity";
149
+ export * from "./functions/pressurePlate";
150
+ export * from "./functions/projectiles";
151
+ export * from "./functions/random";
152
+ export * from "./functions/reorderedCallbacks";
153
+ export * from "./functions/revive";
154
+ export * from "./functions/rng";
155
+ export * from "./functions/rockAlt";
156
+ export * from "./functions/roomData";
157
+ export * from "./functions/roomGrid";
158
+ export * from "./functions/rooms";
159
+ export * from "./functions/roomShape";
160
+ export * from "./functions/roomTransition";
161
+ export * from "./functions/run";
162
+ export * from "./functions/saveFile";
163
+ export * from "./functions/seeds";
164
+ export * from "./functions/serialization";
165
+ export * from "./functions/set";
166
+ export * from "./functions/sound";
167
+ export * from "./functions/spawnCollectible";
168
+ export * from "./functions/sprites";
169
+ export * from "./functions/stage";
170
+ export * from "./functions/string";
171
+ export * from "./functions/table";
172
+ export * from "./functions/tears";
173
+ export * from "./functions/transformations";
174
+ export * from "./functions/trinketCacheFlag";
175
+ export * from "./functions/trinketGive";
176
+ export * from "./functions/trinkets";
177
+ export * from "./functions/tstlClass";
178
+ export * from "./functions/types";
179
+ export * from "./functions/ui";
180
+ export * from "./functions/utils";
181
+ export * from "./functions/vector";
182
+ export * from "./interfaces/ChargeBarSprites";
183
+ export * from "./interfaces/Corner";
184
+ export * from "./interfaces/CustomStageLua";
185
+ export * from "./interfaces/GridEntityCustomData";
186
+ export * from "./interfaces/JSONRoomsFile";
187
+ export * from "./interfaces/PlayerHealth";
188
+ export * from "./interfaces/PocketItemDescription";
189
+ export * from "./interfaces/RoomDescription";
190
+ export * from "./interfaces/SaveData";
191
+ export * from "./interfaces/StatTypeType";
192
+ export * from "./interfaces/TrinketSituation";
193
+ export * from "./maps/cardMap";
194
+ export * from "./maps/characterMap";
195
+ export * from "./maps/pillEffectMap";
196
+ export * from "./maps/roomTypeMap";
197
+ export * from "./objects/colors";
198
+ export * from "./types/AnyEntity";
199
+ export * from "./types/AnyGridEntity";
200
+ export * from "./types/CollectibleIndex";
201
+ export * from "./types/Immutable";
202
+ export * from "./types/PickingUpItem";
203
+ export * from "./types/PickupIndex";
204
+ export * from "./types/PlayerIndex";
205
+ export * from "./types/PossibleStatType";
206
+ export * from "./types/SerializedIsaacAPIClass";
207
+ export * from "./types/TrapdoorDestination";
208
+ export * from "./types/TSTLClass";
@@ -18,4 +18,5 @@ export interface StatTypeType {
18
18
  [StatType.TEAR_COLOR]: Color;
19
19
  [StatType.FLYING]: boolean;
20
20
  [StatType.LUCK]: float;
21
+ [StatType.SIZE]: Vector;
21
22
  }
@@ -25,7 +25,10 @@ import { PostGridEntityBrokenRegisterParameters } from "../../callbacks/subscrip
25
25
  import { PostGridEntityCollisionRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCollision";
26
26
  import { PostGridEntityCustomBrokenRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomBroken";
27
27
  import { PostGridEntityCustomCollisionRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomCollision";
28
+ import { PostGridEntityCustomInitRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomInit";
29
+ import { PostGridEntityCustomRemoveRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomRemove";
28
30
  import { PostGridEntityCustomRenderRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomRender";
31
+ import { PostGridEntityCustomStateChangedRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomStateChanged";
29
32
  import { PostGridEntityCustomUpdateRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCustomUpdate";
30
33
  import { PostGridEntityInitRegisterParameters } from "../../callbacks/subscriptions/postGridEntityInit";
31
34
  import { PostGridEntityRemoveRegisterParameters } from "../../callbacks/subscriptions/postGridEntityRemove";
@@ -116,7 +119,10 @@ export interface AddCallbackParameterCustom {
116
119
  [ModCallbackCustom.POST_GRID_ENTITY_COLLISION]: PostGridEntityCollisionRegisterParameters;
117
120
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_BROKEN]: PostGridEntityCustomBrokenRegisterParameters;
118
121
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_COLLISION]: PostGridEntityCustomCollisionRegisterParameters;
122
+ [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_INIT]: PostGridEntityCustomInitRegisterParameters;
123
+ [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_REMOVE]: PostGridEntityCustomRemoveRegisterParameters;
119
124
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_RENDER]: PostGridEntityCustomRenderRegisterParameters;
125
+ [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_STATE_CHANGED]: PostGridEntityCustomStateChangedRegisterParameters;
120
126
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE]: PostGridEntityCustomUpdateRegisterParameters;
121
127
  [ModCallbackCustom.POST_GRID_ENTITY_INIT]: PostGridEntityInitRegisterParameters;
122
128
  [ModCallbackCustom.POST_GRID_ENTITY_REMOVE]: PostGridEntityRemoveRegisterParameters;
@@ -25,7 +25,10 @@ import { postGridEntityBrokenRegister } from "../callbacks/subscriptions/postGri
25
25
  import { postGridEntityCollisionRegister } from "../callbacks/subscriptions/postGridEntityCollision";
26
26
  import { postGridEntityCustomBrokenRegister } from "../callbacks/subscriptions/postGridEntityCustomBroken";
27
27
  import { postGridEntityCustomCollisionRegister } from "../callbacks/subscriptions/postGridEntityCustomCollision";
28
+ import { postGridEntityCustomInitRegister } from "../callbacks/subscriptions/postGridEntityCustomInit";
29
+ import { postGridEntityCustomRemoveRegister } from "../callbacks/subscriptions/postGridEntityCustomRemove";
28
30
  import { postGridEntityCustomRenderRegister } from "../callbacks/subscriptions/postGridEntityCustomRender";
31
+ import { postGridEntityCustomStateChangedRegister } from "../callbacks/subscriptions/postGridEntityCustomStateChanged";
29
32
  import { postGridEntityCustomUpdateRegister } from "../callbacks/subscriptions/postGridEntityCustomUpdate";
30
33
  import { postGridEntityInitRegister } from "../callbacks/subscriptions/postGridEntityInit";
31
34
  import { postGridEntityRemoveRegister } from "../callbacks/subscriptions/postGridEntityRemove";
@@ -127,8 +130,14 @@ export const CALLBACK_REGISTER_FUNCTIONS: {
127
130
  postGridEntityCustomBrokenRegister,
128
131
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_COLLISION]:
129
132
  postGridEntityCustomCollisionRegister,
133
+ [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_INIT]:
134
+ postGridEntityCustomInitRegister,
135
+ [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_REMOVE]:
136
+ postGridEntityCustomRemoveRegister,
130
137
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_RENDER]:
131
138
  postGridEntityCustomRenderRegister,
139
+ [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_STATE_CHANGED]:
140
+ postGridEntityCustomStateChangedRegister,
132
141
  [ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE]:
133
142
  postGridEntityCustomUpdateRegister,
134
143
  [ModCallbackCustom.POST_GRID_ENTITY_INIT]: postGridEntityInitRegister,