isaacscript-common 6.20.1 → 6.22.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 (122) hide show
  1. package/dist/constants.d.ts +6 -0
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.lua +4 -0
  4. package/dist/constantsFirstLast.d.ts +2 -2
  5. package/dist/constantsFirstLast.lua +2 -2
  6. package/dist/enums/RockAltType.d.ts +12 -1
  7. package/dist/enums/RockAltType.d.ts.map +1 -1
  8. package/dist/enums/RockAltType.lua +4 -2
  9. package/dist/enums/private/StageTravelState.d.ts +4 -3
  10. package/dist/enums/private/StageTravelState.d.ts.map +1 -1
  11. package/dist/enums/private/StageTravelState.lua +6 -4
  12. package/dist/features/customStage/backdrop.d.ts.map +1 -1
  13. package/dist/features/customStage/backdrop.lua +3 -2
  14. package/dist/features/customStage/customStageConstants.d.ts +11 -0
  15. package/dist/features/customStage/customStageConstants.d.ts.map +1 -1
  16. package/dist/features/customStage/customStageConstants.lua +10 -0
  17. package/dist/features/customStage/customStageGridEntities.d.ts +1 -0
  18. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  19. package/dist/features/customStage/customStageGridEntities.lua +65 -23
  20. package/dist/features/customStage/exports.d.ts +17 -3
  21. package/dist/features/customStage/exports.d.ts.map +1 -1
  22. package/dist/features/customStage/exports.lua +65 -46
  23. package/dist/features/customStage/init.d.ts.map +1 -1
  24. package/dist/features/customStage/init.lua +7 -12
  25. package/dist/features/customStage/shadows.d.ts.map +1 -1
  26. package/dist/features/customStage/shadows.lua +2 -1
  27. package/dist/features/customStage/streakText.d.ts +0 -7
  28. package/dist/features/customStage/streakText.d.ts.map +1 -1
  29. package/dist/features/customStage/streakText.lua +52 -85
  30. package/dist/features/customStage/v.d.ts +13 -0
  31. package/dist/features/customStage/v.d.ts.map +1 -1
  32. package/dist/features/customStage/v.lua +6 -1
  33. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  34. package/dist/features/customStage/versusScreen.lua +32 -1
  35. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
  36. package/dist/features/customTrapdoor/blackSprite.lua +2 -1
  37. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +4 -0
  38. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
  39. package/dist/features/customTrapdoor/exports.d.ts +11 -7
  40. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  41. package/dist/features/customTrapdoor/exports.lua +6 -5
  42. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  43. package/dist/features/customTrapdoor/init.lua +35 -20
  44. package/dist/features/customTrapdoor/touched.lua +1 -1
  45. package/dist/features/customTrapdoor/v.d.ts +2 -2
  46. package/dist/features/customTrapdoor/v.d.ts.map +1 -1
  47. package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
  48. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  49. package/dist/features/playerInventory.d.ts +7 -0
  50. package/dist/features/playerInventory.d.ts.map +1 -1
  51. package/dist/features/playerInventory.lua +7 -0
  52. package/dist/features/saveDataManager/exports.d.ts +3 -0
  53. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  54. package/dist/features/saveDataManager/exports.lua +3 -0
  55. package/dist/functions/collectibleSet.d.ts +1 -1
  56. package/dist/functions/collectibleSet.lua +1 -1
  57. package/dist/functions/doors.d.ts +10 -0
  58. package/dist/functions/doors.d.ts.map +1 -1
  59. package/dist/functions/doors.lua +6 -0
  60. package/dist/functions/levelGrid.lua +1 -1
  61. package/dist/functions/log.d.ts +1 -15
  62. package/dist/functions/log.d.ts.map +1 -1
  63. package/dist/functions/log.lua +3 -218
  64. package/dist/functions/logEntities.d.ts +16 -0
  65. package/dist/functions/logEntities.d.ts.map +1 -0
  66. package/dist/functions/logEntities.lua +220 -0
  67. package/dist/functions/rockAlt.d.ts +6 -5
  68. package/dist/functions/rockAlt.d.ts.map +1 -1
  69. package/dist/functions/rockAlt.lua +147 -18
  70. package/dist/functions/roomData.d.ts +1 -1
  71. package/dist/functions/roomData.d.ts.map +1 -1
  72. package/dist/functions/roomTransition.d.ts +26 -0
  73. package/dist/functions/roomTransition.d.ts.map +1 -0
  74. package/dist/functions/roomTransition.lua +75 -0
  75. package/dist/functions/rooms.d.ts +36 -35
  76. package/dist/functions/rooms.d.ts.map +1 -1
  77. package/dist/functions/rooms.lua +94 -99
  78. package/dist/index.d.ts +1 -0
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.lua +8 -0
  81. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
  82. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  83. package/dist/objects/backdropTypeToRockAltType.lua +3 -3
  84. package/dist/types/TrapdoorDestination.d.ts +3 -0
  85. package/dist/types/TrapdoorDestination.d.ts.map +1 -0
  86. package/dist/types/TrapdoorDestination.lua +2 -0
  87. package/package.json +2 -2
  88. package/src/constants.ts +6 -0
  89. package/src/constantsFirstLast.ts +2 -2
  90. package/src/enums/RockAltType.ts +14 -1
  91. package/src/enums/private/StageTravelState.ts +2 -1
  92. package/src/features/customStage/backdrop.ts +2 -1
  93. package/src/features/customStage/customStageConstants.ts +16 -0
  94. package/src/features/customStage/customStageGridEntities.ts +61 -0
  95. package/src/features/customStage/exports.ts +81 -42
  96. package/src/features/customStage/init.ts +7 -18
  97. package/src/features/customStage/shadows.ts +2 -1
  98. package/src/features/customStage/streakText.ts +59 -96
  99. package/src/features/customStage/v.ts +17 -0
  100. package/src/features/customStage/versusScreen.ts +29 -0
  101. package/src/features/customTrapdoor/blackSprite.ts +6 -1
  102. package/src/features/customTrapdoor/customTrapdoorConstants.ts +4 -0
  103. package/src/features/customTrapdoor/exports.ts +8 -6
  104. package/src/features/customTrapdoor/init.ts +55 -23
  105. package/src/features/customTrapdoor/touched.ts +4 -1
  106. package/src/features/customTrapdoor/v.ts +2 -5
  107. package/src/features/extraConsoleCommands/commandsSubroutines.ts +4 -1
  108. package/src/features/playerInventory.ts +7 -0
  109. package/src/features/saveDataManager/exports.ts +3 -0
  110. package/src/functions/collectibleSet.ts +1 -1
  111. package/src/functions/doors.ts +10 -0
  112. package/src/functions/levelGrid.ts +1 -1
  113. package/src/functions/log.ts +1 -279
  114. package/src/functions/logEntities.ts +276 -0
  115. package/src/functions/rockAlt.ts +147 -19
  116. package/src/functions/roomData.ts +1 -1
  117. package/src/functions/roomTransition.ts +78 -0
  118. package/src/functions/rooms.ts +104 -107
  119. package/src/index.ts +1 -0
  120. package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
  121. package/src/objects/backdropTypeToRockAltType.ts +3 -3
  122. package/src/types/TrapdoorDestination.ts +5 -0
@@ -1,5 +1,5 @@
1
1
  local ____exports = {}
2
- local spawnRockAltRewardUrn, spawnRockAltRewardMushroom, spawnRockAltRewardSkull, spawnRockAltRewardPolyp, spawnRockAltRewardBucket, ROCK_ALT_CHANCES, POLYP_PROJECTILE_SPEED, POLYP_NUM_PROJECTILES
2
+ local spawnRockAltRewardUrn, spawnRockAltRewardMushroom, spawnRockAltRewardSkull, spawnRockAltRewardPolyp, spawnRockAltRewardBucketDownpour, spawnRockAltRewardBucketDross, ROCK_ALT_CHANCES, COIN_VELOCITY_MULTIPLIER, POLYP_PROJECTILE_SPEED, POLYP_NUM_PROJECTILES
3
3
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
4
  local Card = ____isaac_2Dtypescript_2Ddefinitions.Card
5
5
  local CoinSubType = ____isaac_2Dtypescript_2Ddefinitions.CoinSubType
@@ -55,13 +55,12 @@ function spawnRockAltRewardUrn(self, position, rng)
55
55
  if chance < totalChance then
56
56
  local numCoinsChance = getRandom(nil, rng)
57
57
  local numCoins = numCoinsChance < 0.5 and 1 or 2
58
- local length = DISTANCE_OF_GRID_TILE
59
58
  ____repeat(
60
59
  nil,
61
60
  numCoins,
62
61
  function()
63
62
  local randomVector = getRandomVector(nil, rng)
64
- local velocity = randomVector * length
63
+ local velocity = randomVector * COIN_VELOCITY_MULTIPLIER
65
64
  spawnCoinWithSeed(
66
65
  nil,
67
66
  CoinSubType.NULL,
@@ -87,12 +86,12 @@ function spawnRockAltRewardUrn(self, position, rng)
87
86
  end
88
87
  return false
89
88
  end
90
- local numSpidersChance = getRandom(nil, rng)
91
- local numSpiders = numSpidersChance < 0.5 and 1 or 2
89
+ local numEnemiesChance = getRandom(nil, rng)
90
+ local numEnemies = numEnemiesChance < 0.5 and 1 or 2
92
91
  local length = DISTANCE_OF_GRID_TILE * 3
93
92
  ____repeat(
94
93
  nil,
95
- numSpiders,
94
+ numEnemies,
96
95
  function()
97
96
  local randomVector = getRandomVector(nil, rng)
98
97
  local offset = randomVector * length
@@ -266,16 +265,142 @@ function spawnRockAltRewardPolyp(self, position, rng)
266
265
  )
267
266
  return true
268
267
  end
269
- function spawnRockAltRewardBucket(self, _position, rng, _variant)
268
+ function spawnRockAltRewardBucketDownpour(self, position, rng)
270
269
  local chance = getRandom(nil, rng)
271
270
  local totalChance = 0
272
271
  totalChance = totalChance + ROCK_ALT_CHANCES.NOTHING
273
272
  if chance < totalChance then
274
273
  return false
275
274
  end
276
- return false
275
+ totalChance = totalChance + ROCK_ALT_CHANCES.BASIC_DROP
276
+ if chance < totalChance then
277
+ local numCoinsChance = getRandom(nil, rng)
278
+ local numCoins = numCoinsChance < 0.5 and 1 or 2
279
+ ____repeat(
280
+ nil,
281
+ numCoins,
282
+ function()
283
+ local randomVector = getRandomVector(nil, rng)
284
+ local velocity = randomVector * COIN_VELOCITY_MULTIPLIER
285
+ spawnCoinWithSeed(
286
+ nil,
287
+ CoinSubType.NULL,
288
+ position,
289
+ rng,
290
+ velocity
291
+ )
292
+ end
293
+ )
294
+ return true
295
+ end
296
+ totalChance = totalChance + ROCK_ALT_CHANCES.TRINKET
297
+ if chance < totalChance then
298
+ spawnTrinketWithSeed(nil, TrinketType.SWALLOWED_PENNY, position, rng)
299
+ return true
300
+ end
301
+ totalChance = totalChance + ROCK_ALT_CHANCES.COLLECTIBLE
302
+ if chance < totalChance then
303
+ local stillInPools = isCollectibleInItemPool(nil, CollectibleType.LEECH, ItemPoolType.TREASURE)
304
+ if stillInPools then
305
+ spawnCollectible(nil, CollectibleType.LEECH, position, rng)
306
+ return true
307
+ end
308
+ return false
309
+ end
310
+ local enemiesChance = getRandom(nil, rng)
311
+ local entityType = enemiesChance < 0.5 and EntityType.SPIDER or EntityType.SMALL_LEECH
312
+ local numEnemiesChance = getRandom(nil, rng)
313
+ local numEnemies = numEnemiesChance < 0.5 and 1 or 2
314
+ local jumpDistance = DISTANCE_OF_GRID_TILE * 3
315
+ ____repeat(
316
+ nil,
317
+ numEnemies,
318
+ function()
319
+ local randomVector = getRandomVector(nil, rng)
320
+ local offset = randomVector * jumpDistance
321
+ local targetPos = position + offset
322
+ local spider = EntityNPC.ThrowSpider(
323
+ position,
324
+ nil,
325
+ targetPos,
326
+ false,
327
+ 0
328
+ )
329
+ if entityType == EntityType.SMALL_LEECH and spider.Type ~= entityType then
330
+ spider:Morph(entityType, 0, 0, -1)
331
+ end
332
+ end
333
+ )
334
+ return true
335
+ end
336
+ function spawnRockAltRewardBucketDross(self, position, rng)
337
+ local chance = getRandom(nil, rng)
338
+ local totalChance = 0
339
+ totalChance = totalChance + ROCK_ALT_CHANCES.NOTHING
340
+ if chance < totalChance then
341
+ return false
342
+ end
343
+ totalChance = totalChance + ROCK_ALT_CHANCES.BASIC_DROP
344
+ if chance < totalChance then
345
+ local numCoinsChance = getRandom(nil, rng)
346
+ local numCoins = numCoinsChance < 0.5 and 1 or 2
347
+ ____repeat(
348
+ nil,
349
+ numCoins,
350
+ function()
351
+ local randomVector = getRandomVector(nil, rng)
352
+ local velocity = randomVector * COIN_VELOCITY_MULTIPLIER
353
+ spawnCoinWithSeed(
354
+ nil,
355
+ CoinSubType.NULL,
356
+ position,
357
+ rng,
358
+ velocity
359
+ )
360
+ end
361
+ )
362
+ return true
363
+ end
364
+ totalChance = totalChance + ROCK_ALT_CHANCES.TRINKET
365
+ if chance < totalChance then
366
+ spawnTrinketWithSeed(nil, TrinketType.BUTT_PENNY, position, rng)
367
+ return true
368
+ end
369
+ totalChance = totalChance + ROCK_ALT_CHANCES.COLLECTIBLE
370
+ if chance < totalChance then
371
+ local stillInPools = isCollectibleInItemPool(nil, CollectibleType.POOP, ItemPoolType.TREASURE)
372
+ if stillInPools then
373
+ spawnCollectible(nil, CollectibleType.POOP, position, rng)
374
+ return true
375
+ end
376
+ return false
377
+ end
378
+ local enemiesChance = getRandom(nil, rng)
379
+ local entityType = enemiesChance < 0.5 and EntityType.DRIP or EntityType.SMALL_LEECH
380
+ local numEnemiesChance = getRandom(nil, rng)
381
+ local numEnemies = numEnemiesChance < 0.5 and 1 or 2
382
+ local jumpDistance = DISTANCE_OF_GRID_TILE * 3
383
+ ____repeat(
384
+ nil,
385
+ numEnemies,
386
+ function()
387
+ local randomVector = getRandomVector(nil, rng)
388
+ local offset = randomVector * jumpDistance
389
+ local targetPos = position + offset
390
+ local spider = EntityNPC.ThrowSpider(
391
+ position,
392
+ nil,
393
+ targetPos,
394
+ false,
395
+ 0
396
+ )
397
+ spider:Morph(entityType, 0, 0, -1)
398
+ end
399
+ )
400
+ return true
277
401
  end
278
402
  ROCK_ALT_CHANCES = {NOTHING = 0.68, BASIC_DROP = 0.0967, TRINKET = 0.025, COLLECTIBLE = 0.005}
403
+ COIN_VELOCITY_MULTIPLIER = 2
279
404
  POLYP_PROJECTILE_SPEED = 10
280
405
  POLYP_NUM_PROJECTILES = 6
281
406
  --- Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
@@ -306,24 +431,22 @@ end
306
431
  -- trinket is still in the pool. Thus, it will always have a chance to spawn the respective trinket
307
432
  -- (e.g. Swallowed Penny from urns).
308
433
  --
434
+ -- When filled buckets are destroyed, 6 projectiles will always spawn in a random pattern (in
435
+ -- addition to any other rewards that are spawned). This function does not account for this, so if
436
+ -- you want to specifically emulate destroying a filled bucket, you have to account for the
437
+ -- projectiles yourself.
438
+ --
309
439
  -- The logic in this function is based on the rewards listed on the wiki:
310
440
  -- https://bindingofisaacrebirth.fandom.com/wiki/Rocks
311
441
  --
312
442
  -- @param position The place to spawn the reward.
313
443
  -- @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a chance
314
444
  -- at spawning coins and spiders.
315
- -- @param variant Optional. The variant of the grid entity to emulate. Default is 0, which
316
- -- corresponds to a "normal" grid entity or an empty bucket. This only matters when
317
- -- spawning the reward for buckets. (Empty buckets have different rewards than full
318
- -- buckets.)
319
445
  -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
320
446
  -- `RNG.Next` method will be called. Default is `getRandomSeed()`. Normally, you
321
447
  -- should pass the `InitSeed` of the grid entity that was broken.
322
448
  -- @returns Whether or not this function spawned something.
323
- function ____exports.spawnRockAltReward(self, position, rockAltType, variant, seedOrRNG)
324
- if variant == nil then
325
- variant = 0
326
- end
449
+ function ____exports.spawnRockAltReward(self, position, rockAltType, seedOrRNG)
327
450
  if seedOrRNG == nil then
328
451
  seedOrRNG = getRandomSeed(nil)
329
452
  end
@@ -354,10 +477,16 @@ function ____exports.spawnRockAltReward(self, position, rockAltType, variant, se
354
477
  return spawnRockAltRewardPolyp(nil, position, rng)
355
478
  end
356
479
  end
357
- ____cond4 = ____cond4 or ____switch4 == RockAltType.BUCKET
480
+ ____cond4 = ____cond4 or ____switch4 == RockAltType.BUCKET_DOWNPOUR
481
+ if ____cond4 then
482
+ do
483
+ return spawnRockAltRewardBucketDownpour(nil, position, rng)
484
+ end
485
+ end
486
+ ____cond4 = ____cond4 or ____switch4 == RockAltType.BUCKET_DROSS
358
487
  if ____cond4 then
359
488
  do
360
- return spawnRockAltRewardBucket(nil, position, rng, variant)
489
+ return spawnRockAltRewardBucketDross(nil, position, rng)
361
490
  end
362
491
  end
363
492
  until true
@@ -20,7 +20,7 @@ export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
20
20
  * Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
21
21
  * `RoomDescriptor` object that you are retrieving.
22
22
  */
23
- export declare function getRoomDescriptorReadOnly(): ReadonlyRoomDescriptor;
23
+ export declare function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>;
24
24
  /**
25
25
  * Helper function to get the grid index of the current room.
26
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"roomData.d.ts","sourceRoot":"","sources":["../../src/functions/roomData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAiBtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,cAAc,CAQrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,sBAAsB,CAGlE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAatC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAGzD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,MAAM,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,SAAS,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAG3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAA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AAE,GAAG,GAAG,SAAS,GAAG,SAAS,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAG3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,QAAQ,CAGzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAGvD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAG5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,GAAG,EAClB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,GAC7B,IAAI,CAGN"}
@@ -0,0 +1,26 @@
1
+ import { Direction, RoomTransitionAnim } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to reload the current room using `Game.StartRoomTransition`.
4
+ *
5
+ * This is useful for canceling the "goto" console command or to make the `Level.SetStage` method
6
+ * take effect.
7
+ */
8
+ export declare function reloadRoom(): void;
9
+ /**
10
+ * Helper function to change the current room. It can be used for both teleportation and "normal"
11
+ * room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
12
+ * arguments.
13
+ *
14
+ * Use this function instead of invoking the `Game.StartRoomTransition` method directly so that:
15
+ * - you do not forget to set `Level.LeaveDoor` property
16
+ * - to prevent crashing on invalid room grid indexes
17
+ * - to automatically handle Curse of the Maze
18
+ *
19
+ * @param roomGridIndex The room grid index of the destination room.
20
+ * @param direction Optional. Default is `Direction.NO_DIRECTION`.
21
+ * @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
22
+ * @param force Optional. Whether to temporarily disable Curse of the Maze. Default is false. If set
23
+ * to false, then this function may not go to the provided room grid index.
24
+ */
25
+ export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim, force?: boolean): void;
26
+ //# sourceMappingURL=roomTransition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomTransition.d.ts","sourceRoot":"","sources":["../../src/functions/roomTransition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAMtC;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAQjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,aAAa,EAAE,GAAG,EAClB,SAAS,YAAyB,EAClC,kBAAkB,qBAA8B,EAChD,KAAK,UAAQ,GACZ,IAAI,CA6BN"}
@@ -0,0 +1,75 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
4
+ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
5
+ local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
6
+ local RoomTransitionAnim = ____isaac_2Dtypescript_2Ddefinitions.RoomTransitionAnim
7
+ local ____cachedClasses = require("cachedClasses")
8
+ local game = ____cachedClasses.game
9
+ local ____runNextRoom = require("features.runNextRoom")
10
+ local runNextRoom = ____runNextRoom.runNextRoom
11
+ local ____curses = require("functions.curses")
12
+ local hasCurse = ____curses.hasCurse
13
+ local ____roomData = require("functions.roomData")
14
+ local getRoomData = ____roomData.getRoomData
15
+ local getRoomGridIndex = ____roomData.getRoomGridIndex
16
+ --- Helper function to change the current room. It can be used for both teleportation and "normal"
17
+ -- room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
18
+ -- arguments.
19
+ --
20
+ -- Use this function instead of invoking the `Game.StartRoomTransition` method directly so that:
21
+ -- - you do not forget to set `Level.LeaveDoor` property
22
+ -- - to prevent crashing on invalid room grid indexes
23
+ -- - to automatically handle Curse of the Maze
24
+ --
25
+ -- @param roomGridIndex The room grid index of the destination room.
26
+ -- @param direction Optional. Default is `Direction.NO_DIRECTION`.
27
+ -- @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
28
+ -- @param force Optional. Whether to temporarily disable Curse of the Maze. Default is false. If set
29
+ -- to false, then this function may not go to the provided room grid index.
30
+ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim, force)
31
+ if direction == nil then
32
+ direction = Direction.NO_DIRECTION
33
+ end
34
+ if roomTransitionAnim == nil then
35
+ roomTransitionAnim = RoomTransitionAnim.TELEPORT
36
+ end
37
+ if force == nil then
38
+ force = false
39
+ end
40
+ local level = game:GetLevel()
41
+ local shouldTempDisableCurse = force and hasCurse(nil, LevelCurse.MAZE)
42
+ if shouldTempDisableCurse then
43
+ level:RemoveCurses(LevelCurse.MAZE)
44
+ end
45
+ local roomData = getRoomData(nil, roomGridIndex)
46
+ if roomData == nil then
47
+ error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
48
+ end
49
+ level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
50
+ game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
51
+ if shouldTempDisableCurse then
52
+ runNextRoom(
53
+ nil,
54
+ function()
55
+ local futureLevel = game:GetLevel()
56
+ futureLevel:AddCurse(LevelCurse.MAZE, false)
57
+ end
58
+ )
59
+ end
60
+ end
61
+ --- Helper function to reload the current room using `Game.StartRoomTransition`.
62
+ --
63
+ -- This is useful for canceling the "goto" console command or to make the `Level.SetStage` method
64
+ -- take effect.
65
+ function ____exports.reloadRoom(self)
66
+ local roomGridIndex = getRoomGridIndex(nil)
67
+ ____exports.teleport(
68
+ nil,
69
+ roomGridIndex,
70
+ Direction.NO_DIRECTION,
71
+ RoomTransitionAnim.FADE,
72
+ true
73
+ )
74
+ end
75
+ return ____exports
@@ -1,4 +1,4 @@
1
- import { BossID, Dimension, Direction, ItemPoolType, MinibossID, RoomTransitionAnim, RoomType } from "isaac-typescript-definitions";
1
+ import { BackdropType, BossID, Dimension, ItemPoolType, MinibossID, RoomType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function for quickly switching to a new room without playing a particular animation. Use
4
4
  * this helper function over invoking the `Game.ChangeRoom` method directly to ensure that you do
@@ -10,6 +10,18 @@ export declare function changeRoom(roomGridIndex: int): void;
10
10
  * include off-grid rooms, like the Devil Room.
11
11
  */
12
12
  export declare function getNumRooms(): int;
13
+ /**
14
+ * Helper function to get a read-only copy of the room descriptor for every room on the level. This
15
+ * includes off-grid rooms, such as the Devil Room, and extra-dimensional rooms, if they are
16
+ * generated and exist.
17
+ *
18
+ * Room descriptors without any data are assumed to be non-existent and are not included.
19
+ *
20
+ * Under the hood, this is performed by iterating over the `RoomList` from the `Level.GetRooms`
21
+ * method. This is the best way to see if off-grid rooms have been initialized, since it is possible
22
+ * for mods to insert room data at non-official negative room grid indexes.
23
+ */
24
+ export declare function getReadOnlyRooms(): Array<Readonly<RoomDescriptor>>;
13
25
  /**
14
26
  * Helper function to get the room data for a specific room type and variant combination. This is
15
27
  * accomplished by using the "goto" console command to load the specified room into the
@@ -45,39 +57,43 @@ export declare function getRoomItemPoolType(): ItemPoolType;
45
57
  export declare function getRoomTypeName(roomType: RoomType): string;
46
58
  /**
47
59
  * Helper function to get the room descriptor for every room on the level. This includes off-grid
48
- * rooms, such as the Devil Room. (Off-grid rooms will only be included if they the data exists,
49
- * which only usually happens once they have been visited at least once.)
60
+ * rooms, such as the Devil Room.
50
61
  *
51
- * Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
52
- * data are assumed to be non-existent and are not added to the list.
62
+ * Room descriptors without any data are assumed to be non-existent and are not included.
63
+ *
64
+ * - If you want just the rooms inside of the grid, use the `getRoomsInGrid` helper function.
65
+ * - If you want just the rooms outside of the grid, use the `getRoomsOutsideGrid` helper function.
53
66
  *
54
67
  * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
55
- * extra-dimensional rooms are automatically generated and can be
56
- * seen when you iterate over the `RoomList`. Default is false.
68
+ * extra-dimensional rooms are automatically generated. Default is
69
+ * false.
57
70
  */
58
71
  export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
59
72
  /**
60
- * Helper function to get the room descriptor for every room on the level except for rooms that are
61
- * not on the grid.
73
+ * Helper function to get the room descriptor for every room on the level that is on the grid. (For
74
+ * example, Devil Rooms are excluded.)
62
75
  *
63
- * Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
64
- * data are assumed to be non-existent and are not added to the list.
76
+ * Room descriptors without any data are assumed to be non-existent and are not included.
65
77
  *
66
78
  * @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
67
- * extra-dimensional rooms are automatically be generated and can be
68
- * seen when you iterate over the `RoomList`. Default is false.
79
+ * extra-dimensional rooms are automatically be generated. Default
80
+ * is false.
69
81
  */
70
82
  export declare function getRoomsInGrid(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
71
83
  /**
72
84
  * Helper function to get the room descriptor for every room on the level in a specific dimension.
73
85
  * This will not include any off-grid rooms, such as the Devil Room.
74
86
  *
75
- * Under the hood, this function uses the `Level.GetRooms` method to accomplish this. Rooms without
76
- * data are assumed to be non-existent and are not added to the list.
77
- *
78
- * @returns A map of room ListIndex to RoomDescriptor.
87
+ * Room descriptors without any data are assumed to be non-existent and are not included.
79
88
  */
80
89
  export declare function getRoomsOfDimension(dimension: Dimension): RoomDescriptor[];
90
+ /**
91
+ * Helper function to get the room descriptor for every room on the level that is outside of the
92
+ * grid (like a Devil Room).
93
+ *
94
+ * Room descriptors without any data are assumed to be non-existent and are not included.
95
+ */
96
+ export declare function getRoomsOutsideGrid(): RoomDescriptor[];
81
97
  /**
82
98
  * Helper function to determine if the current room shape is equal to `RoomShape.1x2` or
83
99
  * `RoomShape.2x1`.
@@ -139,7 +155,7 @@ export declare function inStartingRoom(): boolean;
139
155
  /**
140
156
  * Helper function to loop through every room on the floor and see if it has been cleared.
141
157
  *
142
- * This function will only check rooms in the current dimension.
158
+ * This function will only check rooms inside the gird and inside the current dimension.
143
159
  *
144
160
  * @param onlyCheckRoomTypes Optional. A whitelist of room types. If specified, room types not in
145
161
  * the array will be ignored. If not specified, then all rooms will be
@@ -153,6 +169,8 @@ export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolea
153
169
  * positions/velocities before updating the room, and then restore those positions/velocities.
154
170
  */
155
171
  export declare function roomUpdateSafe(): void;
172
+ /** Helper function to set the backdrop of the current room. */
173
+ export declare function setBackdrop(backdropType: BackdropType): void;
156
174
  /**
157
175
  * Helper function to convert an uncleared room to a cleared room in the `POST_NEW_ROOM` callback.
158
176
  * This is useful because if enemies are removed in this callback, a room drop will be awarded and
@@ -164,21 +182,4 @@ export declare function setRoomCleared(): void;
164
182
  * spawns an NPC.
165
183
  */
166
184
  export declare function setRoomUncleared(): void;
167
- /**
168
- * Helper function to change the current room. It can be used for both teleportation and "normal"
169
- * room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
170
- * arguments.
171
- *
172
- * Use this function instead of invoking the `Game.StartRoomTransition` method directly so that:
173
- * - you do not forget to set `Level.LeaveDoor` property
174
- * - to prevent crashing on invalid room grid indexes
175
- * - to automatically handle Curse of the Maze
176
- *
177
- * @param roomGridIndex The room grid index of the destination room.
178
- * @param direction Optional. Default is `Direction.NO_DIRECTION`.
179
- * @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
180
- * @param force Optional. Whether to temporarily disable Curse of the Maze. Default is false. If set
181
- * to false, then this function may not go to the provided room grid index.
182
- */
183
- export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim, force?: boolean): void;
184
185
  //# sourceMappingURL=rooms.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["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