isaacscript-common 26.1.2 → 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.
@@ -3855,6 +3855,7 @@ declare abstract class Feature {
3855
3855
  constructor();
3856
3856
  }
3857
3857
 
3858
+ /** Helper function to fill every possible square with a red room. */
3858
3859
  export declare function fillLevelWithRedRooms(): void;
3859
3860
 
3860
3861
  /**
@@ -6172,6 +6173,17 @@ export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
6172
6173
  */
6173
6174
  export declare function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>;
6174
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
+
6175
6187
  /**
6176
6188
  * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
6177
6189
  * visible and so on).
@@ -8654,6 +8666,15 @@ export declare const LEVEL_GRID_COLUMN_HEIGHT = 13;
8654
8666
  */
8655
8667
  export declare const LEVEL_GRID_ROW_WIDTH = 13;
8656
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
+
8657
8678
  /**
8658
8679
  * Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
8659
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.2
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
 
@@ -39287,7 +39287,6 @@ local __TS__Class = ____lualib.__TS__Class
39287
39287
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
39288
39288
  local __TS__Iterator = ____lualib.__TS__Iterator
39289
39289
  local __TS__Decorate = ____lualib.__TS__Decorate
39290
- local Set = ____lualib.Set
39291
39290
  local ____exports = {}
39292
39291
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
39293
39292
  local InputHook = ____isaac_2Dtypescript_2Ddefinitions.InputHook
@@ -39297,6 +39296,8 @@ local Exported = ____decorators.Exported
39297
39296
  local ____input = require("src.functions.input")
39298
39297
  local getMoveActions = ____input.getMoveActions
39299
39298
  local getShootActions = ____input.getShootActions
39299
+ local ____ReadonlySet = require("src.types.ReadonlySet")
39300
+ local ReadonlySet = ____ReadonlySet.ReadonlySet
39300
39301
  local ____Feature = require("src.classes.private.Feature")
39301
39302
  local Feature = ____Feature.Feature
39302
39303
  local v = {run = {
@@ -39348,13 +39349,13 @@ function DisableInputs.prototype.enableAllInputs(self, key)
39348
39349
  end
39349
39350
  function DisableInputs.prototype.disableInputs(self, key, ...)
39350
39351
  local buttonActions = {...}
39351
- local buttonActionsSet = __TS__New(Set, buttonActions)
39352
+ local buttonActionsSet = __TS__New(ReadonlySet, buttonActions)
39352
39353
  v.run.disableInputs:set(key, buttonActionsSet)
39353
39354
  end
39354
39355
  function DisableInputs.prototype.disableAllInputs(self, key)
39355
39356
  v.run.disableAllInputsWithWhitelistMap:set(
39356
39357
  key,
39357
- __TS__New(Set)
39358
+ __TS__New(ReadonlySet)
39358
39359
  )
39359
39360
  v.run.enableAllInputsWithBlacklistMap:delete(key)
39360
39361
  end
@@ -39865,7 +39866,6 @@ local __TS__New = ____lualib.__TS__New
39865
39866
  local Map = ____lualib.Map
39866
39867
  local __TS__Class = ____lualib.__TS__Class
39867
39868
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
39868
- local Set = ____lualib.Set
39869
39869
  local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
39870
39870
  local __TS__Decorate = ____lualib.__TS__Decorate
39871
39871
  local __TS__ArraySome = ____lualib.__TS__ArraySome
@@ -40207,7 +40207,7 @@ function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity,
40207
40207
  if tstlClassName == nil then
40208
40208
  error("Failed to find get the class name for the custom trapdoor feature.")
40209
40209
  end
40210
- local whitelist = __TS__New(Set, {ButtonAction.CONSOLE})
40210
+ local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
40211
40211
  self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
40212
40212
  setPlayerAttributes(nil, player, gridEntity.Position)
40213
40213
  dropTaintedForgotten(nil, player)
@@ -45912,15 +45912,18 @@ function ____exports.getRoomAdjacentGridIndexes(self, roomGridIndex)
45912
45912
  end
45913
45913
  return ____exports.getRoomShapeAdjacentExistingGridIndexes(nil, roomDescriptor.SafeGridIndex, roomData.Shape)
45914
45914
  end
45915
- function ____exports.getRoomGridIndexesForType(self, ...)
45915
+ function ____exports.getRoomDescriptorsForType(self, ...)
45916
45916
  local roomTypesSet = __TS__New(Set, {...})
45917
45917
  local rooms = getRoomsInsideGrid(nil)
45918
- local matchingRooms = __TS__ArrayFilter(
45918
+ return __TS__ArrayFilter(
45919
45919
  rooms,
45920
45920
  function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypesSet:has(roomDescriptor.Data.Type) end
45921
45921
  )
45922
+ end
45923
+ function ____exports.getRoomGridIndexesForType(self, ...)
45924
+ local roomDescriptors = ____exports.getRoomDescriptorsForType(nil, ...)
45922
45925
  return __TS__ArrayMap(
45923
- matchingRooms,
45926
+ roomDescriptors,
45924
45927
  function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
45925
45928
  )
45926
45929
  end
@@ -51713,6 +51716,7 @@ local DOOR_SLOT_VALUES = ____cachedEnumValues.DOOR_SLOT_VALUES
51713
51716
  local ____cachedClasses = require("src.core.cachedClasses")
51714
51717
  local game = ____cachedClasses.game
51715
51718
  local ____levelGrid = require("src.functions.levelGrid")
51719
+ local getRoomDescriptorsForType = ____levelGrid.getRoomDescriptorsForType
51716
51720
  local isDoorSlotValidAtGridIndexForRedRoom = ____levelGrid.isDoorSlotValidAtGridIndexForRedRoom
51717
51721
  local ____rooms = require("src.functions.rooms")
51718
51722
  local getNumRooms = ____rooms.getNumRooms
@@ -51734,6 +51738,10 @@ function ____exports.fillLevelWithRedRooms(self)
51734
51738
  end
51735
51739
  until not (numRoomsInGrid ~= getNumRooms(nil))
51736
51740
  end
51741
+ function ____exports.levelHasRoomType(self, ...)
51742
+ local roomDescriptors = getRoomDescriptorsForType(nil, ...)
51743
+ return #roomDescriptors > 0
51744
+ end
51737
51745
  return ____exports
51738
51746
  end,
51739
51747
  ["src.functions.minimap"] = function(...)
@@ -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,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,EAAE,gBAAgB,EAAE,GAAG,CAAC,GACvE,SAAS,CAOZ;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,aAAa,CAAC,EAAE,GAAG,GAClB,KAAK,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CA2CjD;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,KAAK,CACnD;IAAC,qBAAqB,EAAE,GAAG;IAAE,QAAQ,EAAE,QAAQ;IAAE,gBAAgB,EAAE,GAAG;CAAC,CACxE,CA2BA;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,CAAC,EAAE,GAAG,GAClB,WAAW,CAAC,QAAQ,EAAE,GA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;;;;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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "26.1.2",
3
+ "version": "26.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -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
 
@@ -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
  /**