isaacscript-common 1.2.66 → 1.2.67

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.
@@ -11,6 +11,13 @@ export declare function closeDoorFast(door: GridEntityDoor): void;
11
11
  * room types.
12
12
  */
13
13
  export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
14
+ /**
15
+ * Helper function to get all of the doors in the room that lead to the provided room index.
16
+ *
17
+ * This function is variadic, meaning that you can specify N arguments to return all of the doors
18
+ * that match any of the N room grid indexes.
19
+ */
20
+ export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
14
21
  export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
15
22
  export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
16
23
  /**
@@ -3,6 +3,7 @@ local ____lualib = require("lualib_bundle")
3
3
  local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local __TS__ArrayPush = ____lualib.__TS__ArrayPush
6
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
7
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
7
8
  local ____exports = {}
8
9
  local ____constants = require("constants")
@@ -49,6 +50,15 @@ function ____exports.closeDoorFast(self, door)
49
50
  local sprite = door:GetSprite()
50
51
  sprite:Play("Closed", true)
51
52
  end
53
+ function ____exports.getDoorsToRoomIndex(self, ...)
54
+ local roomGridIndex = {...}
55
+ local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
56
+ local doors = ____exports.getDoors(nil)
57
+ return __TS__ArrayFilter(
58
+ doors,
59
+ function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
60
+ )
61
+ end
52
62
  function ____exports.getAngelRoomDoor(self)
53
63
  local angelRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_ANGEL)
54
64
  local ____temp_0
@@ -168,14 +178,14 @@ function ____exports.removeAllDoors(self, ...)
168
178
  do
169
179
  local door = room:GetDoor(i)
170
180
  if door == nil then
171
- goto __continue36
181
+ goto __continue38
172
182
  end
173
183
  if #roomTypes == 0 or roomTypesSet:has(door.TargetRoomType) then
174
184
  room:RemoveDoor(i)
175
185
  numDoorsRemoved = numDoorsRemoved + 1
176
186
  end
177
187
  end
178
- ::__continue36::
188
+ ::__continue38::
179
189
  i = i + 1
180
190
  end
181
191
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.66",
3
+ "version": "1.2.67",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",