isaacscript-common 69.3.1 → 69.4.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.
@@ -9594,6 +9594,15 @@ export declare function isRNG(object: unknown): object is RNG;
9594
9594
  /** Helper function to detect if a variable is of type `GridEntityRock`. */
9595
9595
  export declare function isRock(variable: unknown): variable is GridEntityRock;
9596
9596
 
9597
+ /**
9598
+ * Helper function to check if the room contains one or more enemies/projectiles that could damage
9599
+ * the player.
9600
+ *
9601
+ * This is useful to check to see if it is safe to pause the game or display some informational
9602
+ * text.
9603
+ */
9604
+ export declare function isRoomDangerous(): boolean;
9605
+
9597
9606
  /**
9598
9607
  * Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
9599
9608
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 69.3.1
3
+ isaacscript-common 69.4.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -28142,6 +28142,7 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
28142
28142
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
28143
28143
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
28144
28144
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
28145
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
28145
28146
  local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
28146
28147
  local ____exports = {}
28147
28148
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
@@ -28151,8 +28152,10 @@ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
28151
28152
  local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
28152
28153
  local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSubType
28153
28154
  local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
28155
+ local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
28154
28156
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
28155
28157
  local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
28158
+ local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
28156
28159
  local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
28157
28160
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
28158
28161
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
@@ -28511,6 +28514,33 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes, includeSecretAndS
28511
28514
  function(____, roomDescriptor) return roomDescriptor.Clear end
28512
28515
  )
28513
28516
  end
28517
+ function ____exports.isRoomDangerous(self)
28518
+ local room = game:GetRoom()
28519
+ local isClear = room:IsClear()
28520
+ if not isClear then
28521
+ return true
28522
+ end
28523
+ local entities = getEntities(nil)
28524
+ if __TS__ArraySome(
28525
+ entities,
28526
+ function(____, entity) return entity:IsActiveEnemy(false) and not entity:HasEntityFlags(EntityFlag.FRIENDLY) end
28527
+ ) then
28528
+ return true
28529
+ end
28530
+ if __TS__ArraySome(
28531
+ entities,
28532
+ function(____, entity)
28533
+ local projectile = entity:ToProjectile()
28534
+ if projectile == nil then
28535
+ return false
28536
+ end
28537
+ return not projectile:HasProjectileFlags(ProjectileFlag.CANT_HIT_PLAYER)
28538
+ end
28539
+ ) then
28540
+ return true
28541
+ end
28542
+ return false
28543
+ end
28514
28544
  function ____exports.isSecretRoomType(self, roomType)
28515
28545
  return SECRET_ROOM_TYPES:has(roomType)
28516
28546
  end
@@ -28537,12 +28567,12 @@ function ____exports.setRoomCleared(self)
28537
28567
  for ____, door in ipairs(getDoors(nil)) do
28538
28568
  do
28539
28569
  if isHiddenSecretRoomDoor(nil, door) then
28540
- goto __continue84
28570
+ goto __continue91
28541
28571
  end
28542
28572
  openDoorFast(nil, door)
28543
28573
  door.ExtraVisible = false
28544
28574
  end
28545
- ::__continue84::
28575
+ ::__continue91::
28546
28576
  end
28547
28577
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
28548
28578
  game:ShakeScreen(0)
@@ -362,6 +362,14 @@ export declare function isMinibossRoomOf(roomData: RoomConfig, minibossID: Minib
362
362
  * rooms are marked with a specific sub-type.)
363
363
  */
364
364
  export declare function isMirrorRoom(roomData: RoomConfig): boolean;
365
+ /**
366
+ * Helper function to check if the room contains one or more enemies/projectiles that could damage
367
+ * the player.
368
+ *
369
+ * This is useful to check to see if it is safe to pause the game or display some informational
370
+ * text.
371
+ */
372
+ export declare function isRoomDangerous(): boolean;
365
373
  /**
366
374
  * Helper function to check if the provided room matches one of the given room shapes.
367
375
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,SAAS,EAQT,SAAS,EACT,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAuCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAcnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAChB,oBAAoB,UAAO,EAC3B,iCAAiC,UAAQ,GACxC,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAclC;AAED;;;GAGG;AACH,wBAAgB,mBAA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c,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAEpE;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"}
@@ -9,6 +9,7 @@ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
9
9
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
10
10
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
11
11
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
12
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
12
13
  local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
13
14
  local ____exports = {}
14
15
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -18,8 +19,10 @@ local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
18
19
  local DoorSlotFlag = ____isaac_2Dtypescript_2Ddefinitions.DoorSlotFlag
19
20
  local DownpourRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.DownpourRoomSubType
20
21
  local DungeonSubType = ____isaac_2Dtypescript_2Ddefinitions.DungeonSubType
22
+ local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
21
23
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
22
24
  local HomeRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.HomeRoomSubType
25
+ local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
23
26
  local RoomDescriptorFlag = ____isaac_2Dtypescript_2Ddefinitions.RoomDescriptorFlag
24
27
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
25
28
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
@@ -608,6 +611,38 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes, includeSecretAndS
608
611
  function(____, roomDescriptor) return roomDescriptor.Clear end
609
612
  )
610
613
  end
614
+ --- Helper function to check if the room contains one or more enemies/projectiles that could damage
615
+ -- the player.
616
+ --
617
+ -- This is useful to check to see if it is safe to pause the game or display some informational
618
+ -- text.
619
+ function ____exports.isRoomDangerous(self)
620
+ local room = game:GetRoom()
621
+ local isClear = room:IsClear()
622
+ if not isClear then
623
+ return true
624
+ end
625
+ local entities = getEntities(nil)
626
+ if __TS__ArraySome(
627
+ entities,
628
+ function(____, entity) return entity:IsActiveEnemy(false) and not entity:HasEntityFlags(EntityFlag.FRIENDLY) end
629
+ ) then
630
+ return true
631
+ end
632
+ if __TS__ArraySome(
633
+ entities,
634
+ function(____, entity)
635
+ local projectile = entity:ToProjectile()
636
+ if projectile == nil then
637
+ return false
638
+ end
639
+ return not projectile:HasProjectileFlags(ProjectileFlag.CANT_HIT_PLAYER)
640
+ end
641
+ ) then
642
+ return true
643
+ end
644
+ return false
645
+ end
611
646
  --- Helper function to detect if a room type is a Secret Room, a Super Secret Room, or an Ultra
612
647
  -- Secret Room.
613
648
  function ____exports.isSecretRoomType(self, roomType)
@@ -644,12 +679,12 @@ function ____exports.setRoomCleared(self)
644
679
  for ____, door in ipairs(getDoors(nil)) do
645
680
  do
646
681
  if isHiddenSecretRoomDoor(nil, door) then
647
- goto __continue84
682
+ goto __continue91
648
683
  end
649
684
  openDoorFast(nil, door)
650
685
  door.ExtraVisible = false
651
686
  end
652
- ::__continue84::
687
+ ::__continue91::
653
688
  end
654
689
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
655
690
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "69.3.1",
3
+ "version": "69.4.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -11,8 +11,10 @@ import {
11
11
  DoorSlotFlag,
12
12
  DownpourRoomSubType,
13
13
  DungeonSubType,
14
+ EntityFlag,
14
15
  GridRoom,
15
16
  HomeRoomSubType,
17
+ ProjectileFlag,
16
18
  RoomDescriptorFlag,
17
19
  RoomShape,
18
20
  RoomType,
@@ -791,6 +793,49 @@ export function isMirrorRoom(roomData: RoomConfig): boolean {
791
793
  );
792
794
  }
793
795
 
796
+ /**
797
+ * Helper function to check if the room contains one or more enemies/projectiles that could damage
798
+ * the player.
799
+ *
800
+ * This is useful to check to see if it is safe to pause the game or display some informational
801
+ * text.
802
+ */
803
+ export function isRoomDangerous(): boolean {
804
+ const room = game.GetRoom();
805
+
806
+ const isClear = room.IsClear();
807
+ if (!isClear) {
808
+ return true;
809
+ }
810
+
811
+ const entities = getEntities();
812
+
813
+ if (
814
+ entities.some(
815
+ (entity) =>
816
+ entity.IsActiveEnemy(false) &&
817
+ !entity.HasEntityFlags(EntityFlag.FRIENDLY),
818
+ )
819
+ ) {
820
+ return true;
821
+ }
822
+
823
+ if (
824
+ entities.some((entity) => {
825
+ const projectile = entity.ToProjectile();
826
+ if (projectile === undefined) {
827
+ return false;
828
+ }
829
+
830
+ return !projectile.HasProjectileFlags(ProjectileFlag.CANT_HIT_PLAYER);
831
+ })
832
+ ) {
833
+ return true;
834
+ }
835
+
836
+ return false;
837
+ }
838
+
794
839
  /**
795
840
  * Helper function to check if the provided room matches one of the given room shapes.
796
841
  *