isaacscript-common 15.4.2 → 15.4.3

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.
package/dist/index.d.ts CHANGED
@@ -7683,6 +7683,13 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
7683
7683
  */
7684
7684
  export declare function isRoomShapeDoubleCharge(roomShape: RoomShape): boolean;
7685
7685
 
7686
+ /**
7687
+ * Helper function to check if the current room matches one of the given room types.
7688
+ *
7689
+ * This function is variadic, which means you can pass as many room types as you want to match for.
7690
+ */
7691
+ export declare function isRoomType(...roomTypes: RoomType[]): boolean;
7692
+
7686
7693
  /** Returns true for cards that have `CardType.RUNE`. */
7687
7694
  export declare function isRune(cardType: CardType): boolean;
7688
7695
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 15.4.2
3
+ isaacscript-common 15.4.3
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -25197,6 +25197,7 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
25197
25197
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
25198
25198
  local Set = ____lualib.Set
25199
25199
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
25200
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
25200
25201
  local ____exports = {}
25201
25202
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
25202
25203
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -25473,6 +25474,15 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
25473
25474
  function(____, roomDescriptor) return roomDescriptor.Clear end
25474
25475
  )
25475
25476
  end
25477
+ function ____exports.isRoomType(self, ...)
25478
+ local roomTypes = {...}
25479
+ local room = game:GetRoom()
25480
+ local thisRoomType = room:GetType()
25481
+ return __TS__ArraySome(
25482
+ roomTypes,
25483
+ function(____, roomType) return roomType == thisRoomType end
25484
+ )
25485
+ end
25476
25486
  function ____exports.roomUpdateSafe(self)
25477
25487
  local room = game:GetRoom()
25478
25488
  local entities = getEntities(nil)
@@ -25496,12 +25506,12 @@ function ____exports.setRoomCleared(self)
25496
25506
  for ____, door in ipairs(getDoors(nil)) do
25497
25507
  do
25498
25508
  if isHiddenSecretRoomDoor(nil, door) then
25499
- goto __continue53
25509
+ goto __continue55
25500
25510
  end
25501
25511
  openDoorFast(nil, door)
25502
25512
  door.ExtraVisible = false
25503
25513
  end
25504
- ::__continue53::
25514
+ ::__continue55::
25505
25515
  end
25506
25516
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
25507
25517
  game:ShakeScreen(0)
@@ -181,6 +181,12 @@ export declare function inStartingRoom(): boolean;
181
181
  * checked. Undefined by default.
182
182
  */
183
183
  export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
184
+ /**
185
+ * Helper function to check if the current room matches one of the given room types.
186
+ *
187
+ * This function is variadic, which means you can pass as many room types as you want to match for.
188
+ */
189
+ export declare function isRoomType(...roomTypes: RoomType[]): boolean;
184
190
  /**
185
191
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
186
192
  * slide around (such as the player). Since those entity velocities are already at zero, setting
@@ -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,EAMT,YAAY,EAEZ,UAAU,EAGV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAkCtC;;;;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,CA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AAU,GAAG,OAAO,CAWhE;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAWtC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAItC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAItC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAgBxE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
@@ -10,6 +10,7 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
10
10
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
11
11
  local Set = ____lualib.Set
12
12
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
13
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
13
14
  local ____exports = {}
14
15
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
15
16
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -395,6 +396,18 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
395
396
  function(____, roomDescriptor) return roomDescriptor.Clear end
396
397
  )
397
398
  end
399
+ --- Helper function to check if the current room matches one of the given room types.
400
+ --
401
+ -- This function is variadic, which means you can pass as many room types as you want to match for.
402
+ function ____exports.isRoomType(self, ...)
403
+ local roomTypes = {...}
404
+ local room = game:GetRoom()
405
+ local thisRoomType = room:GetType()
406
+ return __TS__ArraySome(
407
+ roomTypes,
408
+ function(____, roomType) return roomType == thisRoomType end
409
+ )
410
+ end
398
411
  --- If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
399
412
  -- slide around (such as the player). Since those entity velocities are already at zero, setting
400
413
  -- them to zero will have no effect. Thus, a generic solution is to record all of the entity
@@ -426,12 +439,12 @@ function ____exports.setRoomCleared(self)
426
439
  for ____, door in ipairs(getDoors(nil)) do
427
440
  do
428
441
  if isHiddenSecretRoomDoor(nil, door) then
429
- goto __continue53
442
+ goto __continue55
430
443
  end
431
444
  openDoorFast(nil, door)
432
445
  door.ExtraVisible = false
433
446
  end
434
- ::__continue53::
447
+ ::__continue55::
435
448
  end
436
449
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
437
450
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "15.4.2",
3
+ "version": "15.4.3",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -527,6 +527,17 @@ export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
527
527
  return matchingRooms.every((roomDescriptor) => roomDescriptor.Clear);
528
528
  }
529
529
 
530
+ /**
531
+ * Helper function to check if the current room matches one of the given room types.
532
+ *
533
+ * This function is variadic, which means you can pass as many room types as you want to match for.
534
+ */
535
+ export function isRoomType(...roomTypes: RoomType[]): boolean {
536
+ const room = game.GetRoom();
537
+ const thisRoomType = room.GetType();
538
+ return roomTypes.some((roomType) => roomType === thisRoomType);
539
+ }
540
+
530
541
  /**
531
542
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
532
543
  * slide around (such as the player). Since those entity velocities are already at zero, setting