isaacscript-common 69.3.1 → 69.5.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
  *
@@ -17671,7 +17680,7 @@ export declare function spawnFamiliarWithSeed(familiarVariant: FamiliarVariant,
17671
17680
  export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
17672
17681
 
17673
17682
  /**
17674
- * Helper function to spawn a grid entity.
17683
+ * Helper function to spawn a grid entity with a specific type.
17675
17684
  *
17676
17685
  * This function assumes you want to give the grid entity a variant of 0. If you want to specify a
17677
17686
  * variant, use the `spawnGridEntityWithVariant` helper function instead.
@@ -17680,8 +17689,17 @@ export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
17680
17689
  * - handles giving pits collision
17681
17690
  * - removes existing grid entities on the same tile, if any
17682
17691
  * - allows you to specify either the grid index or the position
17692
+ *
17693
+ * @param gridEntityType The `GridEntityType` to use.
17694
+ * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
17695
+ * entity at. If a position is specified, the closest grid index will be
17696
+ * used.
17697
+ * @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
17698
+ * tile, if it exists. Defaults to true. If false, this function
17699
+ * will do nothing, since spawning a grid entity on top of another
17700
+ * grid entity will not replace it.
17683
17701
  */
17684
- export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndexOrPosition: int | Vector): GridEntity | undefined;
17702
+ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndexOrPosition: int | Vector, removeExistingGridEntity?: boolean): GridEntity | undefined;
17685
17703
 
17686
17704
  /**
17687
17705
  * Helper function to spawn a grid entity with a specific variant.
@@ -17690,8 +17708,18 @@ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridInde
17690
17708
  * - handles giving pits collision
17691
17709
  * - removes existing grid entities on the same tile, if any
17692
17710
  * - allows you to specify the grid index or the position
17693
- */
17694
- export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndexOrPosition: int | Vector): GridEntity | undefined;
17711
+ *
17712
+ * @param gridEntityType The `GridEntityType` to use.
17713
+ * @param variant The variant to use.
17714
+ * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
17715
+ * entity at. If a position is specified, the closest grid index will be
17716
+ * used.
17717
+ * @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
17718
+ * tile, if it exists. Defaults to true. If false, this function
17719
+ * will do nothing, since spawning a grid entity on top of another
17720
+ * grid entity will not replace it.
17721
+ */
17722
+ export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndexOrPosition: int | Vector, removeExistingGridEntity?: boolean): GridEntity | undefined;
17695
17723
 
17696
17724
  /** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.HEART` (10). */
17697
17725
  export declare function spawnHeart(heartSubType: HeartSubType, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity | undefined, seedOrRNG?: Seed | RNG | undefined): EntityPickupHeart;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 69.3.1
3
+ isaacscript-common 69.5.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)
@@ -28943,7 +28973,10 @@ function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
28943
28973
  removeEntities(nil, effectsOnTile)
28944
28974
  end
28945
28975
  end
28946
- function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndexOrPosition)
28976
+ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndexOrPosition, removeExistingGridEntity)
28977
+ if removeExistingGridEntity == nil then
28978
+ removeExistingGridEntity = true
28979
+ end
28947
28980
  local room = game:GetRoom()
28948
28981
  local ____isVector_result_3
28949
28982
  if isVector(nil, gridIndexOrPosition) then
@@ -28953,7 +28986,11 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
28953
28986
  end
28954
28987
  local existingGridEntity = ____isVector_result_3
28955
28988
  if existingGridEntity ~= nil then
28956
- ____exports.removeGridEntity(nil, existingGridEntity, true)
28989
+ if removeExistingGridEntity then
28990
+ ____exports.removeGridEntity(nil, existingGridEntity, true)
28991
+ else
28992
+ return
28993
+ end
28957
28994
  end
28958
28995
  local position = isVector(nil, gridIndexOrPosition) and gridIndexOrPosition or room:GetGridPosition(gridIndexOrPosition)
28959
28996
  local gridEntity = Isaac.GridSpawn(gridEntityType, variant, position)
@@ -29302,8 +29339,17 @@ function ____exports.spawnGiantPoop(self, topLeftGridIndex)
29302
29339
  local bottomRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_RIGHT, bottomRightGridIndex)
29303
29340
  return topLeft ~= nil and topLeft:GetType() == GridEntityType.POOP and topLeft:GetVariant() == PoopGridEntityVariant.GIANT_TOP_LEFT and topRight ~= nil and topRight:GetType() == GridEntityType.POOP and topRight:GetVariant() == PoopGridEntityVariant.GIANT_TOP_RIGHT and bottomLeft ~= nil and bottomLeft:GetType() == GridEntityType.POOP and bottomLeft:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_LEFT and bottomRight ~= nil and bottomRight:GetType() == GridEntityType.POOP and bottomRight:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_RIGHT
29304
29341
  end
29305
- function ____exports.spawnGridEntity(self, gridEntityType, gridIndexOrPosition)
29306
- return ____exports.spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndexOrPosition)
29342
+ function ____exports.spawnGridEntity(self, gridEntityType, gridIndexOrPosition, removeExistingGridEntity)
29343
+ if removeExistingGridEntity == nil then
29344
+ removeExistingGridEntity = true
29345
+ end
29346
+ return ____exports.spawnGridEntityWithVariant(
29347
+ nil,
29348
+ gridEntityType,
29349
+ 0,
29350
+ gridIndexOrPosition,
29351
+ removeExistingGridEntity
29352
+ )
29307
29353
  end
29308
29354
  function ____exports.spawnVoidPortal(self, gridIndex)
29309
29355
  local voidPortal = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.TRAPDOOR, TrapdoorVariant.VOID_PORTAL, gridIndex)
@@ -281,7 +281,7 @@ export declare function setGridEntityType(gridEntity: GridEntity, gridEntityType
281
281
  */
282
282
  export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
283
283
  /**
284
- * Helper function to spawn a grid entity.
284
+ * Helper function to spawn a grid entity with a specific type.
285
285
  *
286
286
  * This function assumes you want to give the grid entity a variant of 0. If you want to specify a
287
287
  * variant, use the `spawnGridEntityWithVariant` helper function instead.
@@ -290,8 +290,17 @@ export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
290
290
  * - handles giving pits collision
291
291
  * - removes existing grid entities on the same tile, if any
292
292
  * - allows you to specify either the grid index or the position
293
+ *
294
+ * @param gridEntityType The `GridEntityType` to use.
295
+ * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
296
+ * entity at. If a position is specified, the closest grid index will be
297
+ * used.
298
+ * @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
299
+ * tile, if it exists. Defaults to true. If false, this function
300
+ * will do nothing, since spawning a grid entity on top of another
301
+ * grid entity will not replace it.
293
302
  */
294
- export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndexOrPosition: int | Vector): GridEntity | undefined;
303
+ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndexOrPosition: int | Vector, removeExistingGridEntity?: boolean): GridEntity | undefined;
295
304
  /**
296
305
  * Helper function to spawn a grid entity with a specific variant.
297
306
  *
@@ -299,8 +308,18 @@ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridInde
299
308
  * - handles giving pits collision
300
309
  * - removes existing grid entities on the same tile, if any
301
310
  * - allows you to specify the grid index or the position
311
+ *
312
+ * @param gridEntityType The `GridEntityType` to use.
313
+ * @param variant The variant to use.
314
+ * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
315
+ * entity at. If a position is specified, the closest grid index will be
316
+ * used.
317
+ * @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
318
+ * tile, if it exists. Defaults to true. If false, this function
319
+ * will do nothing, since spawning a grid entity on top of another
320
+ * grid entity will not replace it.
302
321
  */
303
- export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndexOrPosition: int | Vector): GridEntity | undefined;
322
+ export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndexOrPosition: int | Vector, removeExistingGridEntity?: boolean): GridEntity | undefined;
304
323
  /**
305
324
  * Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
306
325
  * with the appropriate variant, as the game does not give it the correct sprite automatically.
@@ -1 +1 @@
1
- {"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAIL,cAAc,EAIf,MAAM,8BAA8B,CAAC;AAYtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA0C1D;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,GAAG,GACxB,CAAC,cAAc,EAAE,GAAG,CAAC,GAAG,SAAS,CAenC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,OAAO,SAAK,GACX,OAAO,CAiBT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,EAAE,CAKzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,UAAU,GACrB,MAAM,EAAE,CAoBV;AAED,qFAAqF;AACrF,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE,YAAY,GACzB,CAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,CAuBhD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAC7B,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wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAkBtE"}
@@ -417,7 +417,20 @@ end
417
417
  -- - handles giving pits collision
418
418
  -- - removes existing grid entities on the same tile, if any
419
419
  -- - allows you to specify the grid index or the position
420
- function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndexOrPosition)
420
+ --
421
+ -- @param gridEntityType The `GridEntityType` to use.
422
+ -- @param variant The variant to use.
423
+ -- @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
424
+ -- entity at. If a position is specified, the closest grid index will be
425
+ -- used.
426
+ -- @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
427
+ -- tile, if it exists. Defaults to true. If false, this function
428
+ -- will do nothing, since spawning a grid entity on top of another
429
+ -- grid entity will not replace it.
430
+ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, gridIndexOrPosition, removeExistingGridEntity)
431
+ if removeExistingGridEntity == nil then
432
+ removeExistingGridEntity = true
433
+ end
421
434
  local room = game:GetRoom()
422
435
  local ____isVector_result_3
423
436
  if isVector(nil, gridIndexOrPosition) then
@@ -427,7 +440,11 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
427
440
  end
428
441
  local existingGridEntity = ____isVector_result_3
429
442
  if existingGridEntity ~= nil then
430
- ____exports.removeGridEntity(nil, existingGridEntity, true)
443
+ if removeExistingGridEntity then
444
+ ____exports.removeGridEntity(nil, existingGridEntity, true)
445
+ else
446
+ return
447
+ end
431
448
  end
432
449
  local position = isVector(nil, gridIndexOrPosition) and gridIndexOrPosition or room:GetGridPosition(gridIndexOrPosition)
433
450
  local gridEntity = Isaac.GridSpawn(gridEntityType, variant, position)
@@ -932,7 +949,7 @@ function ____exports.spawnGiantPoop(self, topLeftGridIndex)
932
949
  local bottomRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_RIGHT, bottomRightGridIndex)
933
950
  return topLeft ~= nil and topLeft:GetType() == GridEntityType.POOP and topLeft:GetVariant() == PoopGridEntityVariant.GIANT_TOP_LEFT and topRight ~= nil and topRight:GetType() == GridEntityType.POOP and topRight:GetVariant() == PoopGridEntityVariant.GIANT_TOP_RIGHT and bottomLeft ~= nil and bottomLeft:GetType() == GridEntityType.POOP and bottomLeft:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_LEFT and bottomRight ~= nil and bottomRight:GetType() == GridEntityType.POOP and bottomRight:GetVariant() == PoopGridEntityVariant.GIANT_BOTTOM_RIGHT
934
951
  end
935
- --- Helper function to spawn a grid entity.
952
+ --- Helper function to spawn a grid entity with a specific type.
936
953
  --
937
954
  -- This function assumes you want to give the grid entity a variant of 0. If you want to specify a
938
955
  -- variant, use the `spawnGridEntityWithVariant` helper function instead.
@@ -941,8 +958,26 @@ end
941
958
  -- - handles giving pits collision
942
959
  -- - removes existing grid entities on the same tile, if any
943
960
  -- - allows you to specify either the grid index or the position
944
- function ____exports.spawnGridEntity(self, gridEntityType, gridIndexOrPosition)
945
- return ____exports.spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndexOrPosition)
961
+ --
962
+ -- @param gridEntityType The `GridEntityType` to use.
963
+ -- @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
964
+ -- entity at. If a position is specified, the closest grid index will be
965
+ -- used.
966
+ -- @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
967
+ -- tile, if it exists. Defaults to true. If false, this function
968
+ -- will do nothing, since spawning a grid entity on top of another
969
+ -- grid entity will not replace it.
970
+ function ____exports.spawnGridEntity(self, gridEntityType, gridIndexOrPosition, removeExistingGridEntity)
971
+ if removeExistingGridEntity == nil then
972
+ removeExistingGridEntity = true
973
+ end
974
+ return ____exports.spawnGridEntityWithVariant(
975
+ nil,
976
+ gridEntityType,
977
+ 0,
978
+ gridIndexOrPosition,
979
+ removeExistingGridEntity
980
+ )
946
981
  end
947
982
  --- Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
948
983
  -- with the appropriate variant, as the game does not give it the correct sprite automatically.
@@ -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,mBAAmB,IAAI,YAAY,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;G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ACH,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.5.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,6 +25,6 @@
25
25
  "main": "dist/src/index",
26
26
  "types": "dist/index.rollup.d.ts",
27
27
  "dependencies": {
28
- "isaac-typescript-definitions": "^33.2.0"
28
+ "isaac-typescript-definitions": "^33.2.1"
29
29
  }
30
30
  }
@@ -1151,7 +1151,7 @@ export function spawnGiantPoop(topLeftGridIndex: int): boolean {
1151
1151
  }
1152
1152
 
1153
1153
  /**
1154
- * Helper function to spawn a grid entity.
1154
+ * Helper function to spawn a grid entity with a specific type.
1155
1155
  *
1156
1156
  * This function assumes you want to give the grid entity a variant of 0. If you want to specify a
1157
1157
  * variant, use the `spawnGridEntityWithVariant` helper function instead.
@@ -1160,12 +1160,27 @@ export function spawnGiantPoop(topLeftGridIndex: int): boolean {
1160
1160
  * - handles giving pits collision
1161
1161
  * - removes existing grid entities on the same tile, if any
1162
1162
  * - allows you to specify either the grid index or the position
1163
+ *
1164
+ * @param gridEntityType The `GridEntityType` to use.
1165
+ * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
1166
+ * entity at. If a position is specified, the closest grid index will be
1167
+ * used.
1168
+ * @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
1169
+ * tile, if it exists. Defaults to true. If false, this function
1170
+ * will do nothing, since spawning a grid entity on top of another
1171
+ * grid entity will not replace it.
1163
1172
  */
1164
1173
  export function spawnGridEntity(
1165
1174
  gridEntityType: GridEntityType,
1166
1175
  gridIndexOrPosition: int | Vector,
1176
+ removeExistingGridEntity = true,
1167
1177
  ): GridEntity | undefined {
1168
- return spawnGridEntityWithVariant(gridEntityType, 0, gridIndexOrPosition);
1178
+ return spawnGridEntityWithVariant(
1179
+ gridEntityType,
1180
+ 0,
1181
+ gridIndexOrPosition,
1182
+ removeExistingGridEntity,
1183
+ );
1169
1184
  }
1170
1185
 
1171
1186
  /**
@@ -1175,11 +1190,22 @@ export function spawnGridEntity(
1175
1190
  * - handles giving pits collision
1176
1191
  * - removes existing grid entities on the same tile, if any
1177
1192
  * - allows you to specify the grid index or the position
1193
+ *
1194
+ * @param gridEntityType The `GridEntityType` to use.
1195
+ * @param variant The variant to use.
1196
+ * @param gridIndexOrPosition The grid index or position in the room that you want to spawn the grid
1197
+ * entity at. If a position is specified, the closest grid index will be
1198
+ * used.
1199
+ * @param removeExistingGridEntity Optional. Whether to remove the existing grid entity on the same
1200
+ * tile, if it exists. Defaults to true. If false, this function
1201
+ * will do nothing, since spawning a grid entity on top of another
1202
+ * grid entity will not replace it.
1178
1203
  */
1179
1204
  export function spawnGridEntityWithVariant(
1180
1205
  gridEntityType: GridEntityType,
1181
1206
  variant: int,
1182
1207
  gridIndexOrPosition: int | Vector,
1208
+ removeExistingGridEntity = true,
1183
1209
  ): GridEntity | undefined {
1184
1210
  const room = game.GetRoom();
1185
1211
 
@@ -1187,7 +1213,11 @@ export function spawnGridEntityWithVariant(
1187
1213
  ? room.GetGridEntityFromPos(gridIndexOrPosition)
1188
1214
  : room.GetGridEntity(gridIndexOrPosition);
1189
1215
  if (existingGridEntity !== undefined) {
1190
- removeGridEntity(existingGridEntity, true);
1216
+ if (removeExistingGridEntity) {
1217
+ removeGridEntity(existingGridEntity, true);
1218
+ } else {
1219
+ return;
1220
+ }
1191
1221
  }
1192
1222
 
1193
1223
  const position = isVector(gridIndexOrPosition)
@@ -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
  *