isaacscript-common 26.1.1 → 26.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 (30) hide show
  1. package/dist/index.rollup.d.ts +23 -3
  2. package/dist/isaacscript-common.lua +26 -21
  3. package/dist/src/classes/features/other/CustomItemPools.d.ts +1 -2
  4. package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
  5. package/dist/src/classes/features/other/CustomItemPools.lua +6 -9
  6. package/dist/src/classes/features/other/CustomTrapdoors.lua +1 -2
  7. package/dist/src/classes/features/other/DisableInputs.d.ts.map +1 -1
  8. package/dist/src/classes/features/other/DisableInputs.lua +4 -3
  9. package/dist/src/classes/features/other/FadeInRemover.d.ts.map +1 -1
  10. package/dist/src/classes/features/other/FadeInRemover.lua +1 -1
  11. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +2 -2
  12. package/dist/src/functions/level.d.ts +10 -0
  13. package/dist/src/functions/level.d.ts.map +1 -1
  14. package/dist/src/functions/level.lua +11 -0
  15. package/dist/src/functions/levelGrid.d.ts +10 -0
  16. package/dist/src/functions/levelGrid.d.ts.map +1 -1
  17. package/dist/src/functions/levelGrid.lua +17 -7
  18. package/dist/src/functions/utils.d.ts +1 -1
  19. package/dist/src/functions/utils.lua +1 -1
  20. package/package.json +2 -2
  21. package/src/classes/features/other/CustomItemPools.ts +12 -14
  22. package/src/classes/features/other/CustomTrapdoors.ts +1 -1
  23. package/src/classes/features/other/DisableInputs.ts +3 -2
  24. package/src/classes/features/other/FadeInRemover.ts +1 -0
  25. package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -2
  26. package/src/functions/level.ts +18 -1
  27. package/src/functions/levelGrid.ts +21 -7
  28. package/src/functions/sort.ts +2 -2
  29. package/src/functions/stage.ts +1 -1
  30. package/src/functions/utils.ts +1 -1
@@ -1788,8 +1788,7 @@ declare class CustomHotkeys extends Feature {
1788
1788
  }
1789
1789
 
1790
1790
  declare class CustomItemPools extends Feature {
1791
- private customItemPoolMap;
1792
- private postGameStartedReordered;
1791
+ private postGameStartedReorderedFalse;
1793
1792
  /**
1794
1793
  * Helper function to register a custom item pool. Use this function once when your mod first
1795
1794
  * loads to declare the items that you want to be in the item pools. Then, in the middle of a run,
@@ -3856,6 +3855,7 @@ declare abstract class Feature {
3856
3855
  constructor();
3857
3856
  }
3858
3857
 
3858
+ /** Helper function to fill every possible square with a red room. */
3859
3859
  export declare function fillLevelWithRedRooms(): void;
3860
3860
 
3861
3861
  /**
@@ -6173,6 +6173,17 @@ export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
6173
6173
  */
6174
6174
  export declare function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>;
6175
6175
 
6176
+ /**
6177
+ * Helper function to get an array of all of the room descriptors for rooms that match the specified
6178
+ * room type.
6179
+ *
6180
+ * This function only searches through rooms in the current dimension.
6181
+ *
6182
+ * This function is variadic, meaning that you can specify N arguments to get the combined room
6183
+ * descriptors for N room types.
6184
+ */
6185
+ export declare function getRoomDescriptorsForType(...roomTypes: RoomType[]): RoomDescriptor[];
6186
+
6176
6187
  /**
6177
6188
  * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
6178
6189
  * visible and so on).
@@ -8062,7 +8073,7 @@ export declare function isReflectionRender(): boolean;
8062
8073
  /**
8063
8074
  * Helper function to check if the player is using Afterbirth+ or Repentance.
8064
8075
  *
8065
- * This function should always be used over the `REPENTANCE` constant, since it is not safe.
8076
+ * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
8066
8077
  *
8067
8078
  * Specifically, this function checks for the `Sprite.GetAnimation` method:
8068
8079
  * https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
@@ -8655,6 +8666,15 @@ export declare const LEVEL_GRID_COLUMN_HEIGHT = 13;
8655
8666
  */
8656
8667
  export declare const LEVEL_GRID_ROW_WIDTH = 13;
8657
8668
 
8669
+ /**
8670
+ * Helper function to check to see if the current floor has one or more of a specific room type in
8671
+ * it.
8672
+ *
8673
+ * This function is variadic, meaning that you can pass as many room types as you want to check for.
8674
+ * This function will return true if any of the room types are found.
8675
+ */
8676
+ export declare function levelHasRoomType(...roomTypes: RoomType[]): boolean;
8677
+
8658
8678
  /**
8659
8679
  * Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
8660
8680
  * because in addition to calling the `GridEntityDoor.SetLocked` method, you must also:
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 26.1.1
3
+ isaacscript-common 26.2.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -38349,6 +38349,7 @@ local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedA
38349
38349
  local ____Feature = require("src.classes.private.Feature")
38350
38350
  local Feature = ____Feature.Feature
38351
38351
  local v = {run = {customItemPools = __TS__New(Map)}}
38352
+ local customItemPoolMap = __TS__New(Map)
38352
38353
  ____exports.CustomItemPools = __TS__Class()
38353
38354
  local CustomItemPools = ____exports.CustomItemPools
38354
38355
  CustomItemPools.name = "CustomItemPools"
@@ -38356,20 +38357,16 @@ __TS__ClassExtends(CustomItemPools, Feature)
38356
38357
  function CustomItemPools.prototype.____constructor(self)
38357
38358
  Feature.prototype.____constructor(self)
38358
38359
  self.v = v
38359
- self.customItemPoolMap = __TS__New(Map)
38360
- self.postGameStartedReordered = function(____, isContinued)
38361
- if isContinued then
38362
- return
38363
- end
38364
- v.run.customItemPools = copyMap(nil, self.customItemPoolMap)
38360
+ self.postGameStartedReorderedFalse = function()
38361
+ v.run.customItemPools = copyMap(nil, customItemPoolMap)
38365
38362
  end
38366
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
38363
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReorderedFalse, {false}}}
38367
38364
  end
38368
38365
  function CustomItemPools.prototype.registerCustomItemPool(self, itemPoolTypeCustom, collectibles)
38369
- if self.customItemPoolMap:has(itemPoolTypeCustom) then
38366
+ if customItemPoolMap:has(itemPoolTypeCustom) then
38370
38367
  error(("Failed to register a custom item pool since the provided type of " .. tostring(itemPoolTypeCustom)) .. " was already registered.")
38371
38368
  end
38372
- self.customItemPoolMap:set(itemPoolTypeCustom, collectibles)
38369
+ customItemPoolMap:set(itemPoolTypeCustom, collectibles)
38373
38370
  end
38374
38371
  function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTypeCustom, decrease, seedOrRNG, defaultItem)
38375
38372
  if decrease == nil then
@@ -39290,7 +39287,6 @@ local __TS__Class = ____lualib.__TS__Class
39290
39287
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
39291
39288
  local __TS__Iterator = ____lualib.__TS__Iterator
39292
39289
  local __TS__Decorate = ____lualib.__TS__Decorate
39293
- local Set = ____lualib.Set
39294
39290
  local ____exports = {}
39295
39291
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
39296
39292
  local InputHook = ____isaac_2Dtypescript_2Ddefinitions.InputHook
@@ -39300,6 +39296,8 @@ local Exported = ____decorators.Exported
39300
39296
  local ____input = require("src.functions.input")
39301
39297
  local getMoveActions = ____input.getMoveActions
39302
39298
  local getShootActions = ____input.getShootActions
39299
+ local ____ReadonlySet = require("src.types.ReadonlySet")
39300
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
39303
39301
  local ____Feature = require("src.classes.private.Feature")
39304
39302
  local Feature = ____Feature.Feature
39305
39303
  local v = {run = {
@@ -39351,13 +39349,13 @@ function DisableInputs.prototype.enableAllInputs(self, key)
39351
39349
  end
39352
39350
  function DisableInputs.prototype.disableInputs(self, key, ...)
39353
39351
  local buttonActions = {...}
39354
- local buttonActionsSet = __TS__New(Set, buttonActions)
39352
+ local buttonActionsSet = __TS__New(ReadonlySet, buttonActions)
39355
39353
  v.run.disableInputs:set(key, buttonActionsSet)
39356
39354
  end
39357
39355
  function DisableInputs.prototype.disableAllInputs(self, key)
39358
39356
  v.run.disableAllInputsWithWhitelistMap:set(
39359
39357
  key,
39360
- __TS__New(Set)
39358
+ __TS__New(ReadonlySet)
39361
39359
  )
39362
39360
  v.run.enableAllInputsWithBlacklistMap:delete(key)
39363
39361
  end
@@ -39868,7 +39866,6 @@ local __TS__New = ____lualib.__TS__New
39868
39866
  local Map = ____lualib.Map
39869
39867
  local __TS__Class = ____lualib.__TS__Class
39870
39868
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
39871
- local Set = ____lualib.Set
39872
39869
  local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
39873
39870
  local __TS__Decorate = ____lualib.__TS__Decorate
39874
39871
  local __TS__ArraySome = ____lualib.__TS__ArraySome
@@ -40210,7 +40207,7 @@ function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity,
40210
40207
  if tstlClassName == nil then
40211
40208
  error("Failed to find get the class name for the custom trapdoor feature.")
40212
40209
  end
40213
- local whitelist = __TS__New(Set, {ButtonAction.CONSOLE})
40210
+ local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
40214
40211
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
40215
40212
  setPlayerAttributes(nil, player, gridEntity.Position)
40216
40213
  dropTaintedForgotten(nil, player)
@@ -45915,15 +45912,18 @@ function ____exports.getRoomAdjacentGridIndexes(self, roomGridIndex)
45915
45912
  end
45916
45913
  return ____exports.getRoomShapeAdjacentExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
45917
45914
  end
45918
- function ____exports.getRoomGridIndexesForType(self, ...)
45915
+ function ____exports.getRoomDescriptorsForType(self, ...)
45919
45916
  local roomTypesSet = __TS__New(Set, {...})
45920
45917
  local rooms = getRoomsInsideGrid(nil)
45921
- local matchingRooms = __TS__ArrayFilter(
45918
+ return __TS__ArrayFilter(
45922
45919
  rooms,
45923
45920
  function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypesSet:has(roomDescriptor.Data.Type) end
45924
45921
  )
45922
+ end
45923
+ function ____exports.getRoomGridIndexesForType(self, ...)
45924
+ local roomDescriptors = ____exports.getRoomDescriptorsForType(nil, ...)
45925
45925
  return __TS__ArrayMap(
45926
- matchingRooms,
45926
+ roomDescriptors,
45927
45927
  function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
45928
45928
  )
45929
45929
  end
@@ -48010,7 +48010,7 @@ function ____exports.flight(self, params)
48010
48010
  else
48011
48011
  removeCollectibleCostume(nil, player, collectibleUsedToShowFlight)
48012
48012
  end
48013
- printEnabled(nil, v.persistent.speed, "set speed")
48013
+ printEnabled(nil, v.persistent.flight, "flight")
48014
48014
  end
48015
48015
  function ____exports.fool(self)
48016
48016
  ____exports.startingRoom(nil)
@@ -48499,7 +48499,7 @@ function ____exports.speed(self, params)
48499
48499
  player:EvaluateItems()
48500
48500
  local value = tostring(v.persistent.speed)
48501
48501
  ____exports.flight(nil, value)
48502
- printEnabled(nil, v.persistent.speed, "set speed and flight")
48502
+ printEnabled(nil, v.persistent.speed, "set speed")
48503
48503
  end
48504
48504
  function ____exports.startRoom(self)
48505
48505
  ____exports.startingRoom(nil)
@@ -48759,7 +48759,7 @@ function FadeInRemover.prototype.____constructor(self)
48759
48759
  game:Fadein(INSTANT_FADE_IN_SPEED)
48760
48760
  end
48761
48761
  end
48762
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
48762
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered, {nil}}}
48763
48763
  end
48764
48764
  function FadeInRemover.prototype.removeFadeIn(self)
48765
48765
  self.enabled = true
@@ -51716,6 +51716,7 @@ local DOOR_SLOT_VALUES = ____cachedEnumValues.DOOR_SLOT_VALUES
51716
51716
  local ____cachedClasses = require("src.core.cachedClasses")
51717
51717
  local game = ____cachedClasses.game
51718
51718
  local ____levelGrid = require("src.functions.levelGrid")
51719
+ local getRoomDescriptorsForType = ____levelGrid.getRoomDescriptorsForType
51719
51720
  local isDoorSlotValidAtGridIndexForRedRoom = ____levelGrid.isDoorSlotValidAtGridIndexForRedRoom
51720
51721
  local ____rooms = require("src.functions.rooms")
51721
51722
  local getNumRooms = ____rooms.getNumRooms
@@ -51737,6 +51738,10 @@ function ____exports.fillLevelWithRedRooms(self)
51737
51738
  end
51738
51739
  until not (numRoomsInGrid ~= getNumRooms(nil))
51739
51740
  end
51741
+ function ____exports.levelHasRoomType(self, ...)
51742
+ local roomDescriptors = getRoomDescriptorsForType(nil, ...)
51743
+ return #roomDescriptors > 0
51744
+ end
51740
51745
  return ____exports
51741
51746
  end,
51742
51747
  ["src.functions.minimap"] = function(...)
@@ -2,8 +2,7 @@ import { CollectibleType, ItemPoolType } from "isaac-typescript-definitions";
2
2
  import { WeightedArray } from "../../../types/WeightedArray";
3
3
  import { Feature } from "../../private/Feature";
4
4
  export declare class CustomItemPools extends Feature {
5
- private customItemPoolMap;
6
- private postGameStartedReordered;
5
+ private postGameStartedReorderedFalse;
7
6
  /**
8
7
  * Helper function to register a custom item pool. Use this function once when your mod first
9
8
  * loads to declare the items that you want to be in the item pools. Then, in the middle of a run,
@@ -1 +1 @@
1
- {"version":3,"file":"CustomItemPools.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomItemPools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAO7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,eAAgB,SAAQ,OAAO;IAI1C,OAAO,CAAC,iBAAiB,CAGrB;IAeJ,OAAO,CAAC,wBAAwB,CAM9B;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IAEI,sBAAsB,CAC3B,kBAAkB,EAAE,YAAY,EAChC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,GAC3C,IAAI;IAUP;;;;;;;;;;;;;;;;;OAiBG;IAEI,4BAA4B,CACjC,kBAAkB,EAAE,YAAY,EAChC,QAAQ,UAAQ,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,WAAW,kBAAuB,GACjC,eAAe;CA2BnB"}
1
+ {"version":3,"file":"CustomItemPools.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomItemPools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAO7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAahD,qBAAa,eAAgB,SAAQ,OAAO;IAmB1C,OAAO,CAAC,6BAA6B,CAEnC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IAEI,sBAAsB,CAC3B,kBAAkB,EAAE,YAAY,EAChC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,GAC3C,IAAI;IAUP;;;;;;;;;;;;;;;;;OAiBG;IAEI,4BAA4B,CACjC,kBAAkB,EAAE,YAAY,EAChC,QAAQ,UAAQ,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,WAAW,kBAAuB,GACjC,eAAe;CA2BnB"}
@@ -22,6 +22,7 @@ local getRandomIndexFromWeightedArray = ____weighted.getRandomIndexFromWeightedA
22
22
  local ____Feature = require("src.classes.private.Feature")
23
23
  local Feature = ____Feature.Feature
24
24
  local v = {run = {customItemPools = __TS__New(Map)}}
25
+ local customItemPoolMap = __TS__New(Map)
25
26
  ____exports.CustomItemPools = __TS__Class()
26
27
  local CustomItemPools = ____exports.CustomItemPools
27
28
  CustomItemPools.name = "CustomItemPools"
@@ -29,20 +30,16 @@ __TS__ClassExtends(CustomItemPools, Feature)
29
30
  function CustomItemPools.prototype.____constructor(self)
30
31
  Feature.prototype.____constructor(self)
31
32
  self.v = v
32
- self.customItemPoolMap = __TS__New(Map)
33
- self.postGameStartedReordered = function(____, isContinued)
34
- if isContinued then
35
- return
36
- end
37
- v.run.customItemPools = copyMap(nil, self.customItemPoolMap)
33
+ self.postGameStartedReorderedFalse = function()
34
+ v.run.customItemPools = copyMap(nil, customItemPoolMap)
38
35
  end
39
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
36
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReorderedFalse, {false}}}
40
37
  end
41
38
  function CustomItemPools.prototype.registerCustomItemPool(self, itemPoolTypeCustom, collectibles)
42
- if self.customItemPoolMap:has(itemPoolTypeCustom) then
39
+ if customItemPoolMap:has(itemPoolTypeCustom) then
43
40
  error(("Failed to register a custom item pool since the provided type of " .. tostring(itemPoolTypeCustom)) .. " was already registered.")
44
41
  end
45
- self.customItemPoolMap:set(itemPoolTypeCustom, collectibles)
42
+ customItemPoolMap:set(itemPoolTypeCustom, collectibles)
46
43
  end
47
44
  function CustomItemPools.prototype.getCustomItemPoolCollectible(self, itemPoolTypeCustom, decrease, seedOrRNG, defaultItem)
48
45
  if decrease == nil then
@@ -3,7 +3,6 @@ local __TS__New = ____lualib.__TS__New
3
3
  local Map = ____lualib.Map
4
4
  local __TS__Class = ____lualib.__TS__Class
5
5
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
6
- local Set = ____lualib.Set
7
6
  local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
8
7
  local __TS__Decorate = ____lualib.__TS__Decorate
9
8
  local __TS__ArraySome = ____lualib.__TS__ArraySome
@@ -346,7 +345,7 @@ function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity,
346
345
  if tstlClassName == nil then
347
346
  error("Failed to find get the class name for the custom trapdoor feature.")
348
347
  end
349
- local whitelist = __TS__New(Set, {ButtonAction.CONSOLE})
348
+ local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
350
349
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
351
350
  setPlayerAttributes(nil, player, gridEntity.Position)
352
351
  dropTaintedForgotten(nil, player)
@@ -1 +1 @@
1
- {"version":3,"file":"DisableInputs.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/DisableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,aAAc,SAAQ,OAAO;IAiCxC,OAAO,CAAC,eAAe,CAIsB;IAG7C,OAAO,CAAC,iBAAiB,CAIoB;IAG7C,OAAO,CAAC,cAAc,CAIwB;IAE9C,OAAO,CAAC,cAAc;IAwBtB;;;;;;;;OAQG;IAEI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKzC;;;;;;;;;;;;;OAaG;IAEI,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,IAAI;IAKzE;;;;;;;;;;OAUG;IAEI,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK1C;;;;;;;;;;;OAWG;IAEI,wBAAwB,CAC7B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;OAWG;IAEI,yBAAyB,CAC9B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;OAWG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK/C;;;;;;;;;;OAUG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAIhD"}
1
+ {"version":3,"file":"DisableInputs.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/DisableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,aAAc,SAAQ,OAAO;IAiCxC,OAAO,CAAC,eAAe,CAIsB;IAG7C,OAAO,CAAC,iBAAiB,CAIoB;IAG7C,OAAO,CAAC,cAAc,CAIwB;IAE9C,OAAO,CAAC,cAAc;IAwBtB;;;;;;;;OAQG;IAEI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKzC;;;;;;;;;;;;;OAaG;IAEI,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,IAAI;IAKzE;;;;;;;;;;OAUG;IAEI,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK1C;;;;;;;;;;;OAWG;IAEI,wBAAwB,CAC7B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;OAWG;IAEI,yBAAyB,CAC9B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;OAWG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK/C;;;;;;;;;;OAUG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAIhD"}
@@ -5,7 +5,6 @@ local __TS__Class = ____lualib.__TS__Class
5
5
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
6
6
  local __TS__Iterator = ____lualib.__TS__Iterator
7
7
  local __TS__Decorate = ____lualib.__TS__Decorate
8
- local Set = ____lualib.Set
9
8
  local ____exports = {}
10
9
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
11
10
  local InputHook = ____isaac_2Dtypescript_2Ddefinitions.InputHook
@@ -15,6 +14,8 @@ local Exported = ____decorators.Exported
15
14
  local ____input = require("src.functions.input")
16
15
  local getMoveActions = ____input.getMoveActions
17
16
  local getShootActions = ____input.getShootActions
17
+ local ____ReadonlySet = require("src.types.ReadonlySet")
18
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
18
19
  local ____Feature = require("src.classes.private.Feature")
19
20
  local Feature = ____Feature.Feature
20
21
  local v = {run = {
@@ -66,13 +67,13 @@ function DisableInputs.prototype.enableAllInputs(self, key)
66
67
  end
67
68
  function DisableInputs.prototype.disableInputs(self, key, ...)
68
69
  local buttonActions = {...}
69
- local buttonActionsSet = __TS__New(Set, buttonActions)
70
+ local buttonActionsSet = __TS__New(ReadonlySet, buttonActions)
70
71
  v.run.disableInputs:set(key, buttonActionsSet)
71
72
  end
72
73
  function DisableInputs.prototype.disableAllInputs(self, key)
73
74
  v.run.disableAllInputsWithWhitelistMap:set(
74
75
  key,
75
- __TS__New(Set)
76
+ __TS__New(ReadonlySet)
76
77
  )
77
78
  v.run.enableAllInputsWithBlacklistMap:delete(key)
78
79
  end
@@ -1 +1 @@
1
- {"version":3,"file":"FadeInRemover.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/FadeInRemover.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,qBAAa,aAAc,SAAQ,OAAO;IACxC,OAAO,CAAC,OAAO,CAAS;IAexB,OAAO,CAAC,wBAAwB,CAI9B;IAEF;;;;;;;;;OASG;IAEI,YAAY,IAAI,IAAI;IAI3B;;;;;OAKG;IAEI,aAAa,IAAI,IAAI;CAG7B"}
1
+ {"version":3,"file":"FadeInRemover.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/FadeInRemover.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,qBAAa,aAAc,SAAQ,OAAO;IACxC,OAAO,CAAC,OAAO,CAAS;IAgBxB,OAAO,CAAC,wBAAwB,CAI9B;IAEF;;;;;;;;;OASG;IAEI,YAAY,IAAI,IAAI;IAI3B;;;;;OAKG;IAEI,aAAa,IAAI,IAAI;CAG7B"}
@@ -24,7 +24,7 @@ function FadeInRemover.prototype.____constructor(self)
24
24
  game:Fadein(INSTANT_FADE_IN_SPEED)
25
25
  end
26
26
  end
27
- self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered}}
27
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_GAME_STARTED_REORDERED, self.postGameStartedReordered, {nil}}}
28
28
  end
29
29
  function FadeInRemover.prototype.removeFadeIn(self)
30
30
  self.enabled = true
@@ -585,7 +585,7 @@ function ____exports.flight(self, params)
585
585
  else
586
586
  removeCollectibleCostume(nil, player, collectibleUsedToShowFlight)
587
587
  end
588
- printEnabled(nil, v.persistent.speed, "set speed")
588
+ printEnabled(nil, v.persistent.flight, "flight")
589
589
  end
590
590
  --- Alias for the "startingRoom" command.
591
591
  function ____exports.fool(self)
@@ -1176,7 +1176,7 @@ function ____exports.speed(self, params)
1176
1176
  player:EvaluateItems()
1177
1177
  local value = tostring(v.persistent.speed)
1178
1178
  ____exports.flight(nil, value)
1179
- printEnabled(nil, v.persistent.speed, "set speed and flight")
1179
+ printEnabled(nil, v.persistent.speed, "set speed")
1180
1180
  end
1181
1181
  --- Alias for the "startingRoom" command.
1182
1182
  function ____exports.startRoom(self)
@@ -1,2 +1,12 @@
1
+ import { RoomType } from "isaac-typescript-definitions";
2
+ /** Helper function to fill every possible square with a red room. */
1
3
  export declare function fillLevelWithRedRooms(): void;
4
+ /**
5
+ * Helper function to check to see if the current floor has one or more of a specific room type in
6
+ * it.
7
+ *
8
+ * This function is variadic, meaning that you can pass as many room types as you want to check for.
9
+ * This function will return true if any of the room types are found.
10
+ */
11
+ export declare function levelHasRoomType(...roomTypes: RoomType[]): boolean;
2
12
  //# sourceMappingURL=level.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../../src/functions/level.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,IAAI,IAAI,CAqB5C"}
1
+ {"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../../src/functions/level.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AASxD,qEAAqE;AACrE,wBAAgB,qBAAqB,IAAI,IAAI,CAqB5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAGlE"}
@@ -4,10 +4,12 @@ local DOOR_SLOT_VALUES = ____cachedEnumValues.DOOR_SLOT_VALUES
4
4
  local ____cachedClasses = require("src.core.cachedClasses")
5
5
  local game = ____cachedClasses.game
6
6
  local ____levelGrid = require("src.functions.levelGrid")
7
+ local getRoomDescriptorsForType = ____levelGrid.getRoomDescriptorsForType
7
8
  local isDoorSlotValidAtGridIndexForRedRoom = ____levelGrid.isDoorSlotValidAtGridIndexForRedRoom
8
9
  local ____rooms = require("src.functions.rooms")
9
10
  local getNumRooms = ____rooms.getNumRooms
10
11
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
12
+ --- Helper function to fill every possible square with a red room.
11
13
  function ____exports.fillLevelWithRedRooms(self)
12
14
  local level = game:GetLevel()
13
15
  local numRoomsInGrid
@@ -25,4 +27,13 @@ function ____exports.fillLevelWithRedRooms(self)
25
27
  end
26
28
  until not (numRoomsInGrid ~= getNumRooms(nil))
27
29
  end
30
+ --- Helper function to check to see if the current floor has one or more of a specific room type in
31
+ -- it.
32
+ --
33
+ -- This function is variadic, meaning that you can pass as many room types as you want to check for.
34
+ -- This function will return true if any of the room types are found.
35
+ function ____exports.levelHasRoomType(self, ...)
36
+ local roomDescriptors = getRoomDescriptorsForType(nil, ...)
37
+ return #roomDescriptors > 0
38
+ end
28
39
  return ____exports
@@ -83,6 +83,16 @@ export declare function getNewRoomCandidatesForLevel(): Array<[
83
83
  * @returns A map of `DoorSlot` to the corresponding room grid index.
84
84
  */
85
85
  export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int): ReadonlyMap<DoorSlot, int>;
86
+ /**
87
+ * Helper function to get an array of all of the room descriptors for rooms that match the specified
88
+ * room type.
89
+ *
90
+ * This function only searches through rooms in the current dimension.
91
+ *
92
+ * This function is variadic, meaning that you can specify N arguments to get the combined room
93
+ * descriptors for N room types.
94
+ */
95
+ export declare function getRoomDescriptorsForType(...roomTypes: RoomType[]): RoomDescriptor[];
86
96
  /**
87
97
  * Helper function to get an array of all of the safe grid indexes for rooms that match the
88
98
  * specified room type.
@@ -1 +1 @@
1
- {"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,QAAQ,EAKR,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AA+BtC;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAK7E;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,aAAa,CAAC,EAAE,GAAG,GAClB,GAAG,EAAE,CAKP;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAerE;AAED,0FAA0F;AAC1F,wBAAgB,qBAAqB,IAAI,GAAG,EAAE,CAG7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,GAAE,IAAI,GAAG,GAAqB,GAErC,CAAC,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,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CAA0C,CACxD,iBAAiB,EAAE,GAAG,EACtB,SAAS,EAAE,SAAS,GACnB,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAa5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAKtD;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAGT;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAqBT;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAM7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAmD/D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAKtE"}
@@ -305,22 +305,32 @@ function ____exports.getRoomAdjacentGridIndexes(self, roomGridIndex)
305
305
  end
306
306
  return ____exports.getRoomShapeAdjacentExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
307
307
  end
308
- --- Helper function to get an array of all of the safe grid indexes for rooms that match the
309
- -- specified room type.
308
+ --- Helper function to get an array of all of the room descriptors for rooms that match the specified
309
+ -- room type.
310
310
  --
311
311
  -- This function only searches through rooms in the current dimension.
312
312
  --
313
- -- This function is variadic, meaning that you can specify N arguments to get the combined grid
314
- -- indexes for N room types.
315
- function ____exports.getRoomGridIndexesForType(self, ...)
313
+ -- This function is variadic, meaning that you can specify N arguments to get the combined room
314
+ -- descriptors for N room types.
315
+ function ____exports.getRoomDescriptorsForType(self, ...)
316
316
  local roomTypesSet = __TS__New(Set, {...})
317
317
  local rooms = getRoomsInsideGrid(nil)
318
- local matchingRooms = __TS__ArrayFilter(
318
+ return __TS__ArrayFilter(
319
319
  rooms,
320
320
  function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypesSet:has(roomDescriptor.Data.Type) end
321
321
  )
322
+ end
323
+ --- Helper function to get an array of all of the safe grid indexes for rooms that match the
324
+ -- specified room type.
325
+ --
326
+ -- This function only searches through rooms in the current dimension.
327
+ --
328
+ -- This function is variadic, meaning that you can specify N arguments to get the combined grid
329
+ -- indexes for N room types.
330
+ function ____exports.getRoomGridIndexesForType(self, ...)
331
+ local roomDescriptors = ____exports.getRoomDescriptorsForType(nil, ...)
322
332
  return __TS__ArrayMap(
323
- matchingRooms,
333
+ roomDescriptors,
324
334
  function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
325
335
  )
326
336
  end
@@ -60,7 +60,7 @@ export declare function isReflectionRender(): boolean;
60
60
  /**
61
61
  * Helper function to check if the player is using Afterbirth+ or Repentance.
62
62
  *
63
- * This function should always be used over the `REPENTANCE` constant, since it is not safe.
63
+ * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
64
64
  *
65
65
  * Specifically, this function checks for the `Sprite.GetAnimation` method:
66
66
  * https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
@@ -104,7 +104,7 @@ function ____exports.isReflectionRender(self)
104
104
  end
105
105
  --- Helper function to check if the player is using Afterbirth+ or Repentance.
106
106
  --
107
- -- This function should always be used over the `REPENTANCE` constant, since it is not safe.
107
+ -- This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
108
108
  --
109
109
  -- Specifically, this function checks for the `Sprite.GetAnimation` method:
110
110
  -- https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "26.1.1",
3
+ "version": "26.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/index.rollup.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^12.0.0"
25
+ "isaac-typescript-definitions": "^12.0.1"
26
26
  }
27
27
  }
@@ -14,15 +14,15 @@ const v = {
14
14
  },
15
15
  };
16
16
 
17
+ const customItemPoolMap = new Map<
18
+ ItemPoolType,
19
+ WeightedArray<CollectibleType>
20
+ >();
21
+
17
22
  export class CustomItemPools extends Feature {
18
23
  /** @internal */
19
24
  public override v = v;
20
25
 
21
- private customItemPoolMap = new Map<
22
- ItemPoolType,
23
- WeightedArray<CollectibleType>
24
- >();
25
-
26
26
  /** @internal */
27
27
  constructor() {
28
28
  super();
@@ -30,18 +30,16 @@ export class CustomItemPools extends Feature {
30
30
  this.customCallbacksUsed = [
31
31
  [
32
32
  ModCallbackCustom.POST_GAME_STARTED_REORDERED,
33
- this.postGameStartedReordered,
33
+ this.postGameStartedReorderedFalse,
34
+ [false],
34
35
  ],
35
36
  ];
36
37
  }
37
38
 
38
39
  // ModCallbackCustom.POST_GAME_STARTED_REORDERED
39
- private postGameStartedReordered = (isContinued: boolean) => {
40
- if (isContinued) {
41
- return;
42
- }
43
-
44
- v.run.customItemPools = copyMap(this.customItemPoolMap);
40
+ // false
41
+ private postGameStartedReorderedFalse = () => {
42
+ v.run.customItemPools = copyMap(customItemPoolMap);
45
43
  };
46
44
 
47
45
  /**
@@ -82,13 +80,13 @@ export class CustomItemPools extends Feature {
82
80
  itemPoolTypeCustom: ItemPoolType,
83
81
  collectibles: WeightedArray<CollectibleType>,
84
82
  ): void {
85
- if (this.customItemPoolMap.has(itemPoolTypeCustom)) {
83
+ if (customItemPoolMap.has(itemPoolTypeCustom)) {
86
84
  error(
87
85
  `Failed to register a custom item pool since the provided type of ${itemPoolTypeCustom} was already registered.`,
88
86
  );
89
87
  }
90
88
 
91
- this.customItemPoolMap.set(itemPoolTypeCustom, collectibles);
89
+ customItemPoolMap.set(itemPoolTypeCustom, collectibles);
92
90
  }
93
91
 
94
92
  /**
@@ -513,7 +513,7 @@ export class CustomTrapdoors extends Feature {
513
513
  // We don't want to allow pausing, since that will allow render frames to pass without advancing
514
514
  // the stage traveling logic. (We track how many render frames have passed to know when to move
515
515
  // to the next step.)
516
- const whitelist = new Set([ButtonAction.CONSOLE]);
516
+ const whitelist = new ReadonlySet([ButtonAction.CONSOLE]);
517
517
  this.disableInputs.disableAllInputsExceptFor(tstlClassName, whitelist);
518
518
  setPlayerAttributes(player, gridEntity.Position);
519
519
  dropTaintedForgotten(player);
@@ -5,6 +5,7 @@ import {
5
5
  } from "isaac-typescript-definitions";
6
6
  import { Exported } from "../../../decorators";
7
7
  import { getMoveActions, getShootActions } from "../../../functions/input";
8
+ import { ReadonlySet } from "../../../types/ReadonlySet";
8
9
  import { Feature } from "../../private/Feature";
9
10
 
10
11
  const v = {
@@ -141,7 +142,7 @@ export class DisableInputs extends Feature {
141
142
  */
142
143
  @Exported
143
144
  public disableInputs(key: string, ...buttonActions: ButtonAction[]): void {
144
- const buttonActionsSet = new Set(buttonActions);
145
+ const buttonActionsSet = new ReadonlySet(buttonActions);
145
146
  v.run.disableInputs.set(key, buttonActionsSet);
146
147
  }
147
148
 
@@ -158,7 +159,7 @@ export class DisableInputs extends Feature {
158
159
  */
159
160
  @Exported
160
161
  public disableAllInputs(key: string): void {
161
- v.run.disableAllInputsWithWhitelistMap.set(key, new Set());
162
+ v.run.disableAllInputsWithWhitelistMap.set(key, new ReadonlySet());
162
163
  v.run.enableAllInputsWithBlacklistMap.delete(key);
163
164
  }
164
165
 
@@ -16,6 +16,7 @@ export class FadeInRemover extends Feature {
16
16
  [
17
17
  ModCallbackCustom.POST_GAME_STARTED_REORDERED,
18
18
  this.postGameStartedReordered,
19
+ [undefined],
19
20
  ],
20
21
  ];
21
22
  }
@@ -639,7 +639,7 @@ export function flight(params: string): void {
639
639
  removeCollectibleCostume(player, collectibleUsedToShowFlight);
640
640
  }
641
641
 
642
- printEnabled(v.persistent.speed, "set speed");
642
+ printEnabled(v.persistent.flight, "flight");
643
643
  }
644
644
 
645
645
  /** Alias for the "startingRoom" command. */
@@ -1479,7 +1479,7 @@ export function speed(params: string): void {
1479
1479
  const value = tostring(v.persistent.speed);
1480
1480
  flight(value);
1481
1481
 
1482
- printEnabled(v.persistent.speed, "set speed and flight");
1482
+ printEnabled(v.persistent.speed, "set speed");
1483
1483
  }
1484
1484
 
1485
1485
  /** Alias for the "startingRoom" command. */
@@ -1,8 +1,13 @@
1
+ import { RoomType } from "isaac-typescript-definitions";
1
2
  import { DOOR_SLOT_VALUES } from "../arrays/cachedEnumValues";
2
3
  import { game } from "../core/cachedClasses";
3
- import { isDoorSlotValidAtGridIndexForRedRoom } from "./levelGrid";
4
+ import {
5
+ getRoomDescriptorsForType,
6
+ isDoorSlotValidAtGridIndexForRedRoom,
7
+ } from "./levelGrid";
4
8
  import { getNumRooms, getRoomsInsideGrid } from "./rooms";
5
9
 
10
+ /** Helper function to fill every possible square with a red room. */
6
11
  export function fillLevelWithRedRooms(): void {
7
12
  const level = game.GetLevel();
8
13
 
@@ -25,3 +30,15 @@ export function fillLevelWithRedRooms(): void {
25
30
  }
26
31
  } while (numRoomsInGrid !== getNumRooms());
27
32
  }
33
+
34
+ /**
35
+ * Helper function to check to see if the current floor has one or more of a specific room type in
36
+ * it.
37
+ *
38
+ * This function is variadic, meaning that you can pass as many room types as you want to check for.
39
+ * This function will return true if any of the room types are found.
40
+ */
41
+ export function levelHasRoomType(...roomTypes: RoomType[]): boolean {
42
+ const roomDescriptors = getRoomDescriptorsForType(...roomTypes);
43
+ return roomDescriptors.length > 0;
44
+ }
@@ -261,25 +261,39 @@ export function getRoomAdjacentGridIndexes(
261
261
  }
262
262
 
263
263
  /**
264
- * Helper function to get an array of all of the safe grid indexes for rooms that match the
265
- * specified room type.
264
+ * Helper function to get an array of all of the room descriptors for rooms that match the specified
265
+ * room type.
266
266
  *
267
267
  * This function only searches through rooms in the current dimension.
268
268
  *
269
- * This function is variadic, meaning that you can specify N arguments to get the combined grid
270
- * indexes for N room types.
269
+ * This function is variadic, meaning that you can specify N arguments to get the combined room
270
+ * descriptors for N room types.
271
271
  */
272
- export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
272
+ export function getRoomDescriptorsForType(
273
+ ...roomTypes: RoomType[]
274
+ ): RoomDescriptor[] {
273
275
  const roomTypesSet = new Set<RoomType>([...roomTypes]);
274
276
 
275
277
  const rooms = getRoomsInsideGrid();
276
- const matchingRooms = rooms.filter(
278
+ return rooms.filter(
277
279
  (roomDescriptor) =>
278
280
  roomDescriptor.Data !== undefined &&
279
281
  roomTypesSet.has(roomDescriptor.Data.Type),
280
282
  );
283
+ }
281
284
 
282
- return matchingRooms.map((roomDescriptor) => roomDescriptor.SafeGridIndex);
285
+ /**
286
+ * Helper function to get an array of all of the safe grid indexes for rooms that match the
287
+ * specified room type.
288
+ *
289
+ * This function only searches through rooms in the current dimension.
290
+ *
291
+ * This function is variadic, meaning that you can specify N arguments to get the combined grid
292
+ * indexes for N room types.
293
+ */
294
+ export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
295
+ const roomDescriptors = getRoomDescriptorsForType(...roomTypes);
296
+ return roomDescriptors.map((roomDescriptor) => roomDescriptor.SafeGridIndex);
283
297
  }
284
298
 
285
299
  /**
@@ -2,11 +2,11 @@ import { isNumber, isString, isTable } from "./types";
2
2
 
3
3
  function sortNormal(a: unknown, b: unknown): -1 | 0 | 1 {
4
4
  if (!isNumber(a) && !isString(a)) {
5
- error(`Failed to sort since the first value was not a number or string.`);
5
+ error("Failed to sort since the first value was not a number or string.");
6
6
  }
7
7
 
8
8
  if (!isNumber(b) && !isString(b)) {
9
- error(`Failed to sort since the second value was not a number or string.`);
9
+ error("Failed to sort since the second value was not a number or string.");
10
10
  }
11
11
 
12
12
  if (a < b) {
@@ -137,7 +137,7 @@ export function getGotoCommand(
137
137
  const isNormalRoom =
138
138
  roomType === RoomType.DEFAULT && !useSpecialRoomsForRoomTypeDefault;
139
139
  const roomTypeSpecialGotoPrefix = ROOM_TYPE_SPECIAL_GOTO_PREFIXES[roomType];
140
- const prefix = isNormalRoom ? `d` : `s.${roomTypeSpecialGotoPrefix}`;
140
+ const prefix = isNormalRoom ? "d" : `s.${roomTypeSpecialGotoPrefix}`;
141
141
 
142
142
  return `goto ${prefix}.${roomVariant}`;
143
143
  }
@@ -111,7 +111,7 @@ export function isReflectionRender(): boolean {
111
111
  /**
112
112
  * Helper function to check if the player is using Afterbirth+ or Repentance.
113
113
  *
114
- * This function should always be used over the `REPENTANCE` constant, since it is not safe.
114
+ * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
115
115
  *
116
116
  * Specifically, this function checks for the `Sprite.GetAnimation` method:
117
117
  * https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes