isaacscript-common 6.22.3 → 6.22.4

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.
@@ -19,7 +19,7 @@ local ____rng = require("functions.rng")
19
19
  local newRNG = ____rng.newRNG
20
20
  local ____rooms = require("functions.rooms")
21
21
  local getRoomDataForTypeVariant = ____rooms.getRoomDataForTypeVariant
22
- local getRoomsInGrid = ____rooms.getRoomsInGrid
22
+ local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
23
23
  local ____stage = require("functions.stage")
24
24
  local setStage = ____stage.setStage
25
25
  local ____customStageUtils = require("features.customStage.customStageUtils")
@@ -32,7 +32,7 @@ local customStagesMap = ____v.customStagesMap
32
32
  function setStageRoomsData(self, customStage, rng, verbose)
33
33
  local level = game:GetLevel()
34
34
  local startingRoomGridIndex = level:GetStartingRoomIndex()
35
- for ____, room in ipairs(getRoomsInGrid(nil)) do
35
+ for ____, room in ipairs(getRoomsInsideGrid(nil)) do
36
36
  do
37
37
  if room.SafeGridIndex == startingRoomGridIndex then
38
38
  goto __continue7
@@ -9,13 +9,13 @@ local ____levelGrid = require("functions.levelGrid")
9
9
  local isDoorSlotValidAtGridIndexForRedRoom = ____levelGrid.isDoorSlotValidAtGridIndexForRedRoom
10
10
  local ____rooms = require("functions.rooms")
11
11
  local getNumRooms = ____rooms.getNumRooms
12
- local getRoomsInGrid = ____rooms.getRoomsInGrid
12
+ local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
13
13
  function ____exports.fillLevelWithRedRooms(self)
14
14
  local level = game:GetLevel()
15
15
  local numRoomsInGrid
16
16
  repeat
17
17
  do
18
- local roomsInGrid = getRoomsInGrid(nil)
18
+ local roomsInGrid = getRoomsInsideGrid(nil)
19
19
  numRoomsInGrid = #roomsInGrid
20
20
  for ____, roomDescriptor in ipairs(roomsInGrid) do
21
21
  for ____, doorSlot in ipairs(getEnumValues(nil, DoorSlot)) do
@@ -120,8 +120,10 @@ export declare function isRedKeyRoom(roomGridIndex?: int): boolean;
120
120
  * Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
121
121
  *
122
122
  * For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
123
+ *
124
+ * @param roomGridIndex Optional. Default is the current room index.
123
125
  */
124
- export declare function isRoomGridIndexInBounds(roomGridIndex: int): boolean;
126
+ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
125
127
  /**
126
128
  * Helper function to generate a new room on the floor at a valid dead end attached to a normal
127
129
  * room.
@@ -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;AA6BtC;;;;;;;;;;;;;GAaG;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;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,aAAa,CAAC,EAAE,GAAG,GAClB,KAAK,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CA+CjD;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,KAAK,CACnD;IAAC,qBAAqB,EAAE,GAAG;IAAE,QAAQ,EAAE,QAAQ;IAAE,gBAAgB,EAAE,GAAG;CAAC,CACxE,CAsBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,SA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CAAC,CAapB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAUtD;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;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,IAAI,GAAG,GAAG,SAAS,CA6CzC;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"}
@@ -40,7 +40,7 @@ local getRoomGridIndex = ____roomData.getRoomGridIndex
40
40
  local getRoomShape = ____roomData.getRoomShape
41
41
  local ____rooms = require("functions.rooms")
42
42
  local getRooms = ____rooms.getRooms
43
- local getRoomsInGrid = ____rooms.getRoomsInGrid
43
+ local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
44
44
  local ____roomShape = require("functions.roomShape")
45
45
  local getGridIndexDelta = ____roomShape.getGridIndexDelta
46
46
  --- Helper function to get the room grid indexes that are adjacent to a given room grid index.
@@ -57,7 +57,7 @@ local getGridIndexDelta = ____roomShape.getGridIndexDelta
57
57
  -- @param roomGridIndex Optional. Default is the current room index.
58
58
  function ____exports.getAdjacentRoomGridIndexes(self, roomGridIndex)
59
59
  local roomGridIndexToUse = roomGridIndex == nil and getRoomGridIndex(nil) or roomGridIndex
60
- if not ____exports.isRoomGridIndexInBounds(nil, roomGridIndexToUse) then
60
+ if not ____exports.isRoomInsideGrid(nil, roomGridIndexToUse) then
61
61
  return {}
62
62
  end
63
63
  local adjacentRoomGridIndexes = __TS__ArrayMap(
@@ -66,7 +66,7 @@ function ____exports.getAdjacentRoomGridIndexes(self, roomGridIndex)
66
66
  )
67
67
  return __TS__ArrayFilter(
68
68
  adjacentRoomGridIndexes,
69
- function(____, adjacentRoomGridIndex) return ____exports.isRoomGridIndexInBounds(nil, adjacentRoomGridIndex) end
69
+ function(____, adjacentRoomGridIndex) return ____exports.isRoomInsideGrid(nil, adjacentRoomGridIndex) end
70
70
  )
71
71
  end
72
72
  --- Helper function to iterate through the possible doors for a room and see if any of them would be
@@ -76,7 +76,7 @@ end
76
76
  -- @returns A array of tuples of `DoorSlot` and room grid index.
77
77
  function ____exports.getNewRoomCandidatesBesideRoom(self, roomGridIndex)
78
78
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
79
- if not ____exports.isRoomGridIndexInBounds(nil, roomDescriptor.SafeGridIndex) then
79
+ if not ____exports.isRoomInsideGrid(nil, roomDescriptor.SafeGridIndex) then
80
80
  return {}
81
81
  end
82
82
  local roomData = roomDescriptor.Data
@@ -110,7 +110,7 @@ end
110
110
  --
111
111
  -- @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
112
112
  function ____exports.getNewRoomCandidatesForLevel(self)
113
- local rooms = getRoomsInGrid(nil)
113
+ local rooms = getRoomsInsideGrid(nil)
114
114
  local normalRooms = __TS__ArrayFilter(
115
115
  rooms,
116
116
  function(____, room) return room.Data ~= nil and room.Data.Type == RoomType.DEFAULT and room.Data.Subtype ~= DownpourRoomSubType.MIRROR and room.Data.Subtype ~= MinesRoomSubType.MINESHAFT_ENTRANCE end
@@ -149,7 +149,7 @@ function ____exports.getRoomShapeNeighborGridIndexes(self, safeRoomGridIndex, ro
149
149
  local doorSlot = ____value[1]
150
150
  local delta = ____value[2]
151
151
  local roomGridIndex = safeRoomGridIndex + delta
152
- if ____exports.isRoomGridIndexInBounds(nil, roomGridIndex) then
152
+ if ____exports.isRoomInsideGrid(nil, roomGridIndex) then
153
153
  neighborGridIndexes:set(doorSlot, roomGridIndex)
154
154
  end
155
155
  end
@@ -180,7 +180,12 @@ end
180
180
  --- Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
181
181
  --
182
182
  -- For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
183
- function ____exports.isRoomGridIndexInBounds(self, roomGridIndex)
183
+ --
184
+ -- @param roomGridIndex Optional. Default is the current room index.
185
+ function ____exports.isRoomInsideGrid(self, roomGridIndex)
186
+ if roomGridIndex == nil then
187
+ roomGridIndex = getRoomGridIndex(nil)
188
+ end
184
189
  return roomGridIndex >= 0 and roomGridIndex <= MAX_LEVEL_GRID_INDEX
185
190
  end
186
191
  --- Helper function to check if a room exists at the given room grid index. (A room will exist if it
@@ -229,7 +234,7 @@ end
229
234
  -- indexes for N room types.
230
235
  function ____exports.getRoomGridIndexesForType(self, ...)
231
236
  local roomTypesSet = __TS__New(Set, {...})
232
- local rooms = getRoomsInGrid(nil)
237
+ local rooms = getRoomsInsideGrid(nil)
233
238
  local matchingRooms = __TS__ArrayFilter(
234
239
  rooms,
235
240
  function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypesSet:has(roomDescriptor.Data.Type) end
@@ -249,7 +254,7 @@ end
249
254
  -- @returns A map of `DoorSlot` to the corresponding room grid index.
250
255
  function ____exports.getRoomNeighbors(self, roomGridIndex)
251
256
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
252
- if not ____exports.isRoomGridIndexInBounds(nil, roomDescriptor.SafeGridIndex) then
257
+ if not ____exports.isRoomInsideGrid(nil, roomDescriptor.SafeGridIndex) then
253
258
  return __TS__New(Map)
254
259
  end
255
260
  local roomData = roomDescriptor.Data
@@ -285,7 +290,7 @@ function ____exports.isDoorSlotValidAtGridIndexForRedRoom(self, doorSlot, roomGr
285
290
  return false
286
291
  end
287
292
  local redRoomGridIndex = roomGridIndex + delta
288
- return not ____exports.roomExists(nil, redRoomGridIndex) and ____exports.isRoomGridIndexInBounds(nil, redRoomGridIndex)
293
+ return not ____exports.roomExists(nil, redRoomGridIndex) and ____exports.isRoomInsideGrid(nil, redRoomGridIndex)
289
294
  end
290
295
  --- Helper function to detect if the provided room was created by the Red Key item. Under the hood,
291
296
  -- this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
@@ -10,7 +10,7 @@ local game = ____cachedClasses.game
10
10
  local ____roomData = require("functions.roomData")
11
11
  local getRoomDescriptor = ____roomData.getRoomDescriptor
12
12
  local ____rooms = require("functions.rooms")
13
- local getRoomsInGrid = ____rooms.getRoomsInGrid
13
+ local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
14
14
  --- Helper function to set a particular room's minimap display flags (e.g. whether or not it is
15
15
  -- visible and so on).
16
16
  --
@@ -26,7 +26,7 @@ end
26
26
  -- the changes will be immediately visible.
27
27
  function ____exports.clearFloorDisplayFlags(self)
28
28
  local level = game:GetLevel()
29
- for ____, room in ipairs(getRoomsInGrid(nil)) do
29
+ for ____, room in ipairs(getRoomsInsideGrid(nil)) do
30
30
  room.DisplayFlags = DisplayFlagZero
31
31
  end
32
32
  level:UpdateVisibility()
@@ -35,7 +35,7 @@ end
35
35
  -- that is indexed by the room's safe grid index.
36
36
  function ____exports.getFloorDisplayFlags(self)
37
37
  local displayFlagsMap = __TS__New(Map)
38
- local roomsInGrid = getRoomsInGrid(nil)
38
+ local roomsInGrid = getRoomsInsideGrid(nil)
39
39
  for ____, roomDescriptor in ipairs(roomsInGrid) do
40
40
  displayFlagsMap:set(roomDescriptor.SafeGridIndex, roomDescriptor.DisplayFlags)
41
41
  end
@@ -79,7 +79,7 @@ export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDe
79
79
  * extra-dimensional rooms are automatically be generated. Default
80
80
  * is false.
81
81
  */
82
- export declare function getRoomsInGrid(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
82
+ export declare function getRoomsInsideGrid(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
83
83
  /**
84
84
  * Helper function to get the room descriptor for every room on the level in a specific dimension.
85
85
  * This will not include any off-grid rooms, such as the Devil Room.
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,SAAS,EAKT,YAAY,EACZ,UAAU,EAGV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAiCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAenD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAChB,oBAAoB,UAAO,GAC1B,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAUlC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAOlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAqBlB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,EAAE,CAe1E;AAED;;;;;GAKG;AACH,wB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OtC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAWhD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAGnD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAKvC;AAED,+FAA+F;AAC/F,wBAAgB,OAAO,IAAI,OAAO,CAUjC;AAED,wBAAgB,eAAe,IAAI,OAAO,CAKzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAWhE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAKtC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAcxE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
@@ -97,7 +97,7 @@ end
97
97
  -- @param includeExtraDimensionalRooms Optional. On some floors (e.g. Downpour 2, Mines 2),
98
98
  -- extra-dimensional rooms are automatically be generated. Default
99
99
  -- is false.
100
- function ____exports.getRoomsInGrid(self, includeExtraDimensionalRooms)
100
+ function ____exports.getRoomsInsideGrid(self, includeExtraDimensionalRooms)
101
101
  if includeExtraDimensionalRooms == nil then
102
102
  includeExtraDimensionalRooms = false
103
103
  end
@@ -146,7 +146,7 @@ end
146
146
  --- Helper function to get the number of rooms that are currently on the floor layout. This does not
147
147
  -- include off-grid rooms, like the Devil Room.
148
148
  function ____exports.getNumRooms(self)
149
- local rooms = ____exports.getRoomsInGrid(nil)
149
+ local rooms = ____exports.getRoomsInsideGrid(nil)
150
150
  return #rooms
151
151
  end
152
152
  --- Helper function to get the room data for a specific room type and variant combination. This is
@@ -210,7 +210,7 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
210
210
  if includeExtraDimensionalRooms == nil then
211
211
  includeExtraDimensionalRooms = false
212
212
  end
213
- local roomsInGrid = ____exports.getRoomsInGrid(nil, includeExtraDimensionalRooms)
213
+ local roomsInGrid = ____exports.getRoomsInsideGrid(nil, includeExtraDimensionalRooms)
214
214
  local roomsOutsideGrid = ____exports.getRoomsOutsideGrid(nil)
215
215
  local ____array_0 = __TS__SparseArrayNew(table.unpack(roomsInGrid))
216
216
  __TS__SparseArrayPush(
@@ -356,7 +356,7 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
356
356
  ____temp_1 = __TS__New(Set, onlyCheckRoomTypes)
357
357
  end
358
358
  local roomTypeWhitelist = ____temp_1
359
- local rooms = ____exports.getRoomsInGrid(nil)
359
+ local rooms = ____exports.getRoomsInsideGrid(nil)
360
360
  local matchingRooms = roomTypeWhitelist == nil and rooms or __TS__ArrayFilter(
361
361
  rooms,
362
362
  function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypeWhitelist:has(roomDescriptor.Data.Type) end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.22.3",
3
+ "version": "6.22.4",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -21,7 +21,7 @@ import { logError } from "../../functions/log";
21
21
  import { newRNG } from "../../functions/rng";
22
22
  import {
23
23
  getRoomDataForTypeVariant,
24
- getRoomsInGrid,
24
+ getRoomsInsideGrid,
25
25
  } from "../../functions/rooms";
26
26
  import { setStage } from "../../functions/stage";
27
27
  import { CustomStage } from "../../interfaces/private/CustomStage";
@@ -121,7 +121,7 @@ function setStageRoomsData(
121
121
  const level = game.GetLevel();
122
122
  const startingRoomGridIndex = level.GetStartingRoomIndex();
123
123
 
124
- for (const room of getRoomsInGrid()) {
124
+ for (const room of getRoomsInsideGrid()) {
125
125
  // The starting floor of each room should stay empty.
126
126
  if (room.SafeGridIndex === startingRoomGridIndex) {
127
127
  continue;
@@ -2,14 +2,14 @@ import { DoorSlot } from "isaac-typescript-definitions";
2
2
  import { game } from "../core/cachedClasses";
3
3
  import { getEnumValues } from "./enums";
4
4
  import { isDoorSlotValidAtGridIndexForRedRoom } from "./levelGrid";
5
- import { getNumRooms, getRoomsInGrid } from "./rooms";
5
+ import { getNumRooms, getRoomsInsideGrid } from "./rooms";
6
6
 
7
7
  export function fillLevelWithRedRooms(): void {
8
8
  const level = game.GetLevel();
9
9
 
10
10
  let numRoomsInGrid: int;
11
11
  do {
12
- const roomsInGrid = getRoomsInGrid();
12
+ const roomsInGrid = getRoomsInsideGrid();
13
13
  numRoomsInGrid = roomsInGrid.length;
14
14
 
15
15
  for (const roomDescriptor of roomsInGrid) {
@@ -35,7 +35,7 @@ import {
35
35
  getRoomGridIndex,
36
36
  getRoomShape,
37
37
  } from "./roomData";
38
- import { getRooms, getRoomsInGrid } from "./rooms";
38
+ import { getRooms, getRoomsInsideGrid } from "./rooms";
39
39
  import { getGridIndexDelta } from "./roomShape";
40
40
 
41
41
  const LEFT = -1;
@@ -63,7 +63,7 @@ export function getAdjacentRoomGridIndexes(roomGridIndex?: int): int[] {
63
63
  const roomGridIndexToUse =
64
64
  roomGridIndex === undefined ? getRoomGridIndex() : roomGridIndex;
65
65
 
66
- if (!isRoomGridIndexInBounds(roomGridIndexToUse)) {
66
+ if (!isRoomInsideGrid(roomGridIndexToUse)) {
67
67
  return [];
68
68
  }
69
69
 
@@ -72,7 +72,7 @@ export function getAdjacentRoomGridIndexes(roomGridIndex?: int): int[] {
72
72
  );
73
73
 
74
74
  return adjacentRoomGridIndexes.filter((adjacentRoomGridIndex) =>
75
- isRoomGridIndexInBounds(adjacentRoomGridIndex),
75
+ isRoomInsideGrid(adjacentRoomGridIndex),
76
76
  );
77
77
  }
78
78
 
@@ -117,7 +117,7 @@ export function getNewRoomCandidatesBesideRoom(
117
117
  ): Array<[doorSlot: DoorSlot, roomGridIndex: int]> {
118
118
  const roomDescriptor = getRoomDescriptor(roomGridIndex);
119
119
 
120
- if (!isRoomGridIndexInBounds(roomDescriptor.SafeGridIndex)) {
120
+ if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
121
121
  return [];
122
122
  }
123
123
 
@@ -172,7 +172,7 @@ export function getNewRoomCandidatesBesideRoom(
172
172
  export function getNewRoomCandidatesForLevel(): Array<
173
173
  [adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int]
174
174
  > {
175
- const rooms = getRoomsInGrid();
175
+ const rooms = getRoomsInsideGrid();
176
176
  const normalRooms = rooms.filter(
177
177
  (room) =>
178
178
  room.Data !== undefined &&
@@ -207,7 +207,7 @@ export function getNewRoomCandidatesForLevel(): Array<
207
207
  export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
208
208
  const roomTypesSet = new Set<RoomType>([...roomTypes]);
209
209
 
210
- const rooms = getRoomsInGrid();
210
+ const rooms = getRoomsInsideGrid();
211
211
  const matchingRooms = rooms.filter(
212
212
  (roomDescriptor) =>
213
213
  roomDescriptor.Data !== undefined &&
@@ -230,7 +230,7 @@ export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
230
230
  export function getRoomNeighbors(roomGridIndex?: int): Map<DoorSlot, int> {
231
231
  const roomDescriptor = getRoomDescriptor(roomGridIndex);
232
232
 
233
- if (!isRoomGridIndexInBounds(roomDescriptor.SafeGridIndex)) {
233
+ if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
234
234
  return new Map();
235
235
  }
236
236
 
@@ -293,7 +293,7 @@ export function getRoomShapeNeighborGridIndexes(
293
293
  const neighborGridIndexes = new Map<DoorSlot, int>();
294
294
  for (const [doorSlot, delta] of roomShapeNeighborGridIndexDeltas.entries()) {
295
295
  const roomGridIndex = safeRoomGridIndex + delta;
296
- if (isRoomGridIndexInBounds(roomGridIndex)) {
296
+ if (isRoomInsideGrid(roomGridIndex)) {
297
297
  neighborGridIndexes.set(doorSlot, roomGridIndex);
298
298
  }
299
299
  }
@@ -356,9 +356,7 @@ export function isDoorSlotValidAtGridIndexForRedRoom(
356
356
  }
357
357
 
358
358
  const redRoomGridIndex = roomGridIndex + delta;
359
- return (
360
- !roomExists(redRoomGridIndex) && isRoomGridIndexInBounds(redRoomGridIndex)
361
- );
359
+ return !roomExists(redRoomGridIndex) && isRoomInsideGrid(redRoomGridIndex);
362
360
  }
363
361
 
364
362
  /**
@@ -376,8 +374,14 @@ export function isRedKeyRoom(roomGridIndex?: int): boolean {
376
374
  * Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
377
375
  *
378
376
  * For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
377
+ *
378
+ * @param roomGridIndex Optional. Default is the current room index.
379
379
  */
380
- export function isRoomGridIndexInBounds(roomGridIndex: int): boolean {
380
+ export function isRoomInsideGrid(roomGridIndex?: int): boolean {
381
+ if (roomGridIndex === undefined) {
382
+ roomGridIndex = getRoomGridIndex();
383
+ }
384
+
381
385
  return roomGridIndex >= 0 && roomGridIndex <= MAX_LEVEL_GRID_INDEX;
382
386
  }
383
387
 
@@ -1,7 +1,7 @@
1
1
  import { DisplayFlag, DisplayFlagZero } from "isaac-typescript-definitions";
2
2
  import { game } from "../core/cachedClasses";
3
3
  import { getRoomDescriptor } from "./roomData";
4
- import { getRoomsInGrid } from "./rooms";
4
+ import { getRoomsInsideGrid } from "./rooms";
5
5
 
6
6
  /**
7
7
  * Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
@@ -12,7 +12,7 @@ import { getRoomsInGrid } from "./rooms";
12
12
  export function clearFloorDisplayFlags(): void {
13
13
  const level = game.GetLevel();
14
14
 
15
- for (const room of getRoomsInGrid()) {
15
+ for (const room of getRoomsInsideGrid()) {
16
16
  room.DisplayFlags = DisplayFlagZero;
17
17
  }
18
18
 
@@ -27,7 +27,7 @@ export function clearFloorDisplayFlags(): void {
27
27
  export function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>> {
28
28
  const displayFlagsMap = new Map<int, BitFlags<DisplayFlag>>();
29
29
 
30
- const roomsInGrid = getRoomsInGrid();
30
+ const roomsInGrid = getRoomsInsideGrid();
31
31
  for (const roomDescriptor of roomsInGrid) {
32
32
  displayFlagsMap.set(
33
33
  roomDescriptor.SafeGridIndex,
@@ -74,7 +74,7 @@ export function changeRoom(roomGridIndex: int): void {
74
74
  * include off-grid rooms, like the Devil Room.
75
75
  */
76
76
  export function getNumRooms(): int {
77
- const rooms = getRoomsInGrid();
77
+ const rooms = getRoomsInsideGrid();
78
78
  return rooms.length;
79
79
  }
80
80
 
@@ -186,7 +186,7 @@ export function getRooms(
186
186
  // The obvious way to get all of the rooms would be to iterate over the `RoomList` from the
187
187
  // `Level.GetRooms` method. However, this results in read-only data, and we want to return a
188
188
  // writable object. Instead, we let the heavy lifting be handled by other functions.
189
- const roomsInGrid = getRoomsInGrid(includeExtraDimensionalRooms);
189
+ const roomsInGrid = getRoomsInsideGrid(includeExtraDimensionalRooms);
190
190
  const roomsOutsideGrid = getRoomsOutsideGrid();
191
191
  return [...roomsInGrid, ...roomsOutsideGrid];
192
192
  }
@@ -201,7 +201,7 @@ export function getRooms(
201
201
  * extra-dimensional rooms are automatically be generated. Default
202
202
  * is false.
203
203
  */
204
- export function getRoomsInGrid(
204
+ export function getRoomsInsideGrid(
205
205
  includeExtraDimensionalRooms = false,
206
206
  ): RoomDescriptor[] {
207
207
  const level = game.GetLevel();
@@ -463,7 +463,7 @@ export function inStartingRoom(): boolean {
463
463
  export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
464
464
  const roomTypeWhitelist =
465
465
  onlyCheckRoomTypes === undefined ? null : new Set(onlyCheckRoomTypes);
466
- const rooms = getRoomsInGrid();
466
+ const rooms = getRoomsInsideGrid();
467
467
  const matchingRooms =
468
468
  roomTypeWhitelist === null
469
469
  ? rooms