isaacscript-common 69.4.0 → 70.0.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.
@@ -17680,7 +17680,7 @@ export declare function spawnFamiliarWithSeed(familiarVariant: FamiliarVariant,
17680
17680
  export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
17681
17681
 
17682
17682
  /**
17683
- * Helper function to spawn a grid entity.
17683
+ * Helper function to spawn a grid entity with a specific type.
17684
17684
  *
17685
17685
  * This function assumes you want to give the grid entity a variant of 0. If you want to specify a
17686
17686
  * variant, use the `spawnGridEntityWithVariant` helper function instead.
@@ -17689,8 +17689,17 @@ export declare function spawnGiantPoop(topLeftGridIndex: int): boolean;
17689
17689
  * - handles giving pits collision
17690
17690
  * - removes existing grid entities on the same tile, if any
17691
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.
17692
17701
  */
17693
- 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;
17694
17703
 
17695
17704
  /**
17696
17705
  * Helper function to spawn a grid entity with a specific variant.
@@ -17699,8 +17708,18 @@ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridInde
17699
17708
  * - handles giving pits collision
17700
17709
  * - removes existing grid entities on the same tile, if any
17701
17710
  * - allows you to specify the grid index or the position
17702
- */
17703
- 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;
17704
17723
 
17705
17724
  /** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.HEART` (10). */
17706
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.4.0
3
+ isaacscript-common 70.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -10787,8 +10787,8 @@ ____exports.SoundEffect.TEAR_IMPACTS = 150
10787
10787
  ____exports.SoundEffect[____exports.SoundEffect.TEAR_IMPACTS] = "TEAR_IMPACTS"
10788
10788
  ____exports.SoundEffect.TEARS_FIRE = 153
10789
10789
  ____exports.SoundEffect[____exports.SoundEffect.TEARS_FIRE] = "TEARS_FIRE"
10790
- ____exports.SoundEffect.UNLOCK = 156
10791
- ____exports.SoundEffect[____exports.SoundEffect.UNLOCK] = "UNLOCK"
10790
+ ____exports.SoundEffect.UNLOCK_DOOR = 156
10791
+ ____exports.SoundEffect[____exports.SoundEffect.UNLOCK_DOOR] = "UNLOCK_DOOR"
10792
10792
  ____exports.SoundEffect.VAMP_GULP = 157
10793
10793
  ____exports.SoundEffect[____exports.SoundEffect.VAMP_GULP] = "VAMP_GULP"
10794
10794
  ____exports.SoundEffect.WHEEZY_COUGH = 158
@@ -10821,8 +10821,8 @@ ____exports.SoundEffect.LIGHT_BOLT_CHARGE = 173
10821
10821
  ____exports.SoundEffect[____exports.SoundEffect.LIGHT_BOLT_CHARGE] = "LIGHT_BOLT_CHARGE"
10822
10822
  ____exports.SoundEffect.BLOOD_BANK_TOUCHED = 174
10823
10823
  ____exports.SoundEffect[____exports.SoundEffect.BLOOD_BANK_TOUCHED] = "BLOOD_BANK_TOUCHED"
10824
- ____exports.SoundEffect.BLOOD_BANK_SPAWN = 175
10825
- ____exports.SoundEffect[____exports.SoundEffect.BLOOD_BANK_SPAWN] = "BLOOD_BANK_SPAWN"
10824
+ ____exports.SoundEffect.PINKING_SHEARS = 175
10825
+ ____exports.SoundEffect[____exports.SoundEffect.PINKING_SHEARS] = "PINKING_SHEARS"
10826
10826
  ____exports.SoundEffect.BLOOD_SHOOT = 178
10827
10827
  ____exports.SoundEffect[____exports.SoundEffect.BLOOD_SHOOT] = "BLOOD_SHOOT"
10828
10828
  ____exports.SoundEffect.BOIL_HATCH = 181
@@ -11035,8 +11035,8 @@ ____exports.SoundEffect.BERKANO = 331
11035
11035
  ____exports.SoundEffect[____exports.SoundEffect.BERKANO] = "BERKANO"
11036
11036
  ____exports.SoundEffect.BOMBS_ARE_KEY = 332
11037
11037
  ____exports.SoundEffect[____exports.SoundEffect.BOMBS_ARE_KEY] = "BOMBS_ARE_KEY"
11038
- ____exports.SoundEffect.CARD_VS_HUMAN = 333
11039
- ____exports.SoundEffect[____exports.SoundEffect.CARD_VS_HUMAN] = "CARD_VS_HUMAN"
11038
+ ____exports.SoundEffect.CARD_AGAINST_HUMANITY = 333
11039
+ ____exports.SoundEffect[____exports.SoundEffect.CARD_AGAINST_HUMANITY] = "CARD_AGAINST_HUMANITY"
11040
11040
  ____exports.SoundEffect.CHAOS_CARD = 334
11041
11041
  ____exports.SoundEffect[____exports.SoundEffect.CHAOS_CARD] = "CHAOS_CARD"
11042
11042
  ____exports.SoundEffect.CREDIT_CARD = 335
@@ -11127,8 +11127,8 @@ ____exports.SoundEffect.HERMIT = 377
11127
11127
  ____exports.SoundEffect[____exports.SoundEffect.HERMIT] = "HERMIT"
11128
11128
  ____exports.SoundEffect.HIEROPHANT = 378
11129
11129
  ____exports.SoundEffect[____exports.SoundEffect.HIEROPHANT] = "HIEROPHANT"
11130
- ____exports.SoundEffect.HIGHT_PRIESTESS = 379
11131
- ____exports.SoundEffect[____exports.SoundEffect.HIGHT_PRIESTESS] = "HIGHT_PRIESTESS"
11130
+ ____exports.SoundEffect.HIGH_PRIESTESS = 379
11131
+ ____exports.SoundEffect[____exports.SoundEffect.HIGH_PRIESTESS] = "HIGH_PRIESTESS"
11132
11132
  ____exports.SoundEffect.LOVERS = 380
11133
11133
  ____exports.SoundEffect[____exports.SoundEffect.LOVERS] = "LOVERS"
11134
11134
  ____exports.SoundEffect.MAGICIAN = 381
@@ -11143,14 +11143,14 @@ ____exports.SoundEffect.TOWER = 385
11143
11143
  ____exports.SoundEffect[____exports.SoundEffect.TOWER] = "TOWER"
11144
11144
  ____exports.SoundEffect.WORLD = 386
11145
11145
  ____exports.SoundEffect[____exports.SoundEffect.WORLD] = "WORLD"
11146
- ____exports.SoundEffect.TWO_CLUBS = 387
11147
- ____exports.SoundEffect[____exports.SoundEffect.TWO_CLUBS] = "TWO_CLUBS"
11148
- ____exports.SoundEffect.TWO_DIAMONDS = 388
11149
- ____exports.SoundEffect[____exports.SoundEffect.TWO_DIAMONDS] = "TWO_DIAMONDS"
11150
- ____exports.SoundEffect.TWO_HEARTS = 389
11151
- ____exports.SoundEffect[____exports.SoundEffect.TWO_HEARTS] = "TWO_HEARTS"
11152
- ____exports.SoundEffect.TWO_SPADES = 390
11153
- ____exports.SoundEffect[____exports.SoundEffect.TWO_SPADES] = "TWO_SPADES"
11146
+ ____exports.SoundEffect.TWO_OF_CLUBS = 387
11147
+ ____exports.SoundEffect[____exports.SoundEffect.TWO_OF_CLUBS] = "TWO_OF_CLUBS"
11148
+ ____exports.SoundEffect.TWO_OF_DIAMONDS = 388
11149
+ ____exports.SoundEffect[____exports.SoundEffect.TWO_OF_DIAMONDS] = "TWO_OF_DIAMONDS"
11150
+ ____exports.SoundEffect.TWO_OF_HEARTS = 389
11151
+ ____exports.SoundEffect[____exports.SoundEffect.TWO_OF_HEARTS] = "TWO_OF_HEARTS"
11152
+ ____exports.SoundEffect.TWO_OF_SPADES = 390
11153
+ ____exports.SoundEffect[____exports.SoundEffect.TWO_OF_SPADES] = "TWO_OF_SPADES"
11154
11154
  ____exports.SoundEffect.WHEEL_OF_FORTUNE = 391
11155
11155
  ____exports.SoundEffect[____exports.SoundEffect.WHEEL_OF_FORTUNE] = "WHEEL_OF_FORTUNE"
11156
11156
  ____exports.SoundEffect.RAGMAN_1 = 392
@@ -11173,12 +11173,12 @@ ____exports.SoundEffect.DICE_SHARD = 400
11173
11173
  ____exports.SoundEffect[____exports.SoundEffect.DICE_SHARD] = "DICE_SHARD"
11174
11174
  ____exports.SoundEffect.EMERGENCY = 401
11175
11175
  ____exports.SoundEffect[____exports.SoundEffect.EMERGENCY] = "EMERGENCY"
11176
- ____exports.SoundEffect.INFESTED_EXCL = 402
11177
- ____exports.SoundEffect[____exports.SoundEffect.INFESTED_EXCL] = "INFESTED_EXCL"
11178
- ____exports.SoundEffect.INFESTED_QUEST = 403
11179
- ____exports.SoundEffect[____exports.SoundEffect.INFESTED_QUEST] = "INFESTED_QUEST"
11180
- ____exports.SoundEffect.JAIL_CARD = 404
11181
- ____exports.SoundEffect[____exports.SoundEffect.JAIL_CARD] = "JAIL_CARD"
11176
+ ____exports.SoundEffect.INFESTED_EXCLAMATION = 402
11177
+ ____exports.SoundEffect[____exports.SoundEffect.INFESTED_EXCLAMATION] = "INFESTED_EXCLAMATION"
11178
+ ____exports.SoundEffect.INFESTED_QUESTION = 403
11179
+ ____exports.SoundEffect[____exports.SoundEffect.INFESTED_QUESTION] = "INFESTED_QUESTION"
11180
+ ____exports.SoundEffect.GET_OUT_OF_JAIL_CARD = 404
11181
+ ____exports.SoundEffect[____exports.SoundEffect.GET_OUT_OF_JAIL_CARD] = "GET_OUT_OF_JAIL_CARD"
11182
11182
  ____exports.SoundEffect.LARGER = 405
11183
11183
  ____exports.SoundEffect[____exports.SoundEffect.LARGER] = "LARGER"
11184
11184
  ____exports.SoundEffect.PERCS = 406
@@ -11193,8 +11193,8 @@ ____exports.SoundEffect.RETRO = 410
11193
11193
  ____exports.SoundEffect[____exports.SoundEffect.RETRO] = "RETRO"
11194
11194
  ____exports.SoundEffect.SMALL = 411
11195
11195
  ____exports.SoundEffect[____exports.SoundEffect.SMALL] = "SMALL"
11196
- ____exports.SoundEffect.QQQ = 412
11197
- ____exports.SoundEffect[____exports.SoundEffect.QQQ] = "QQQ"
11196
+ ____exports.SoundEffect.QUESTION_MARKS = 412
11197
+ ____exports.SoundEffect[____exports.SoundEffect.QUESTION_MARKS] = "QUESTION_MARKS"
11198
11198
  ____exports.SoundEffect.DANGLE_WHISTLE = 413
11199
11199
  ____exports.SoundEffect[____exports.SoundEffect.DANGLE_WHISTLE] = "DANGLE_WHISTLE"
11200
11200
  ____exports.SoundEffect.LITTLE_HORN_COUGH = 414
@@ -11253,8 +11253,8 @@ ____exports.SoundEffect.ULTRA_GREED_SPINNING = 440
11253
11253
  ____exports.SoundEffect[____exports.SoundEffect.ULTRA_GREED_SPINNING] = "ULTRA_GREED_SPINNING"
11254
11254
  ____exports.SoundEffect.DOG_BARK = 441
11255
11255
  ____exports.SoundEffect[____exports.SoundEffect.DOG_BARK] = "DOG_BARK"
11256
- ____exports.SoundEffect.DOG_HOWELL = 442
11257
- ____exports.SoundEffect[____exports.SoundEffect.DOG_HOWELL] = "DOG_HOWELL"
11256
+ ____exports.SoundEffect.DOG_HOWL = 442
11257
+ ____exports.SoundEffect[____exports.SoundEffect.DOG_HOWL] = "DOG_HOWL"
11258
11258
  ____exports.SoundEffect.X_LAX = 443
11259
11259
  ____exports.SoundEffect[____exports.SoundEffect.X_LAX] = "X_LAX"
11260
11260
  ____exports.SoundEffect.WRONG = 444
@@ -11263,14 +11263,14 @@ ____exports.SoundEffect.VURP = 445
11263
11263
  ____exports.SoundEffect[____exports.SoundEffect.VURP] = "VURP"
11264
11264
  ____exports.SoundEffect.SUNSHINE = 446
11265
11265
  ____exports.SoundEffect[____exports.SoundEffect.SUNSHINE] = "SUNSHINE"
11266
- ____exports.SoundEffect.SPADES = 447
11267
- ____exports.SoundEffect[____exports.SoundEffect.SPADES] = "SPADES"
11266
+ ____exports.SoundEffect.ACE_OF_SPADES = 447
11267
+ ____exports.SoundEffect[____exports.SoundEffect.ACE_OF_SPADES] = "ACE_OF_SPADES"
11268
11268
  ____exports.SoundEffect.HORF = 448
11269
11269
  ____exports.SoundEffect[____exports.SoundEffect.HORF] = "HORF"
11270
11270
  ____exports.SoundEffect.HOLY_CARD = 449
11271
11271
  ____exports.SoundEffect[____exports.SoundEffect.HOLY_CARD] = "HOLY_CARD"
11272
- ____exports.SoundEffect.HEARTS = 450
11273
- ____exports.SoundEffect[____exports.SoundEffect.HEARTS] = "HEARTS"
11272
+ ____exports.SoundEffect.ACE_OF_HEARTS = 450
11273
+ ____exports.SoundEffect[____exports.SoundEffect.ACE_OF_HEARTS] = "ACE_OF_HEARTS"
11274
11274
  ____exports.SoundEffect.GULP = 451
11275
11275
  ____exports.SoundEffect[____exports.SoundEffect.GULP] = "GULP"
11276
11276
  ____exports.SoundEffect.FRIENDS = 452
@@ -11279,10 +11279,10 @@ ____exports.SoundEffect.EXCITED = 453
11279
11279
  ____exports.SoundEffect[____exports.SoundEffect.EXCITED] = "EXCITED"
11280
11280
  ____exports.SoundEffect.DROWSY = 454
11281
11281
  ____exports.SoundEffect[____exports.SoundEffect.DROWSY] = "DROWSY"
11282
- ____exports.SoundEffect.DIAMONDS = 455
11283
- ____exports.SoundEffect[____exports.SoundEffect.DIAMONDS] = "DIAMONDS"
11284
- ____exports.SoundEffect.CLUBS = 456
11285
- ____exports.SoundEffect[____exports.SoundEffect.CLUBS] = "CLUBS"
11282
+ ____exports.SoundEffect.ACE_OF_DIAMONDS = 455
11283
+ ____exports.SoundEffect[____exports.SoundEffect.ACE_OF_DIAMONDS] = "ACE_OF_DIAMONDS"
11284
+ ____exports.SoundEffect.ACE_OF_CLUBS = 456
11285
+ ____exports.SoundEffect[____exports.SoundEffect.ACE_OF_CLUBS] = "ACE_OF_CLUBS"
11286
11286
  ____exports.SoundEffect.BLACK_RUNE = 457
11287
11287
  ____exports.SoundEffect[____exports.SoundEffect.BLACK_RUNE] = "BLACK_RUNE"
11288
11288
  ____exports.SoundEffect.PING_PONG = 458
@@ -28973,7 +28973,10 @@ function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
28973
28973
  removeEntities(nil, effectsOnTile)
28974
28974
  end
28975
28975
  end
28976
- 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
28977
28980
  local room = game:GetRoom()
28978
28981
  local ____isVector_result_3
28979
28982
  if isVector(nil, gridIndexOrPosition) then
@@ -28983,7 +28986,11 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
28983
28986
  end
28984
28987
  local existingGridEntity = ____isVector_result_3
28985
28988
  if existingGridEntity ~= nil then
28986
- ____exports.removeGridEntity(nil, existingGridEntity, true)
28989
+ if removeExistingGridEntity then
28990
+ ____exports.removeGridEntity(nil, existingGridEntity, true)
28991
+ else
28992
+ return
28993
+ end
28987
28994
  end
28988
28995
  local position = isVector(nil, gridIndexOrPosition) and gridIndexOrPosition or room:GetGridPosition(gridIndexOrPosition)
28989
28996
  local gridEntity = Isaac.GridSpawn(gridEntityType, variant, position)
@@ -29332,8 +29339,17 @@ function ____exports.spawnGiantPoop(self, topLeftGridIndex)
29332
29339
  local bottomRight = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.POOP, PoopGridEntityVariant.GIANT_BOTTOM_RIGHT, bottomRightGridIndex)
29333
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
29334
29341
  end
29335
- function ____exports.spawnGridEntity(self, gridEntityType, gridIndexOrPosition)
29336
- 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
+ )
29337
29353
  end
29338
29354
  function ____exports.spawnVoidPortal(self, gridIndex)
29339
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,GAAG,eAAe,EAAE,cAAc,EAAE,GACnC,UAAU,EAAE,CAYd;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,eAAe,EAAE,cAAc,EAAE,GACnC,UAAU,EAAE,CAYd;AAgBD,uFAAuF;AACvF,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb,UAAU,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AU,GACrB,IAAI,CAON;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,aAAa,EACxD,YAAY,EAAE,CAAC,EAAE,EACjB,UAAU,EAAE,OAAO,EACnB,GAAG,CAAC,EAAE,GAAG,GACR,CAAC,EAAE,CAoBL;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,qBAAqB,EAAE,UAAU,GAAG,GAAG,EACvC,UAAU,EAAE,OAAO,GAClB,IAAI,CAqCN;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAGnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,GAC7B,IAAI,CAmBN;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAwD7D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,cAAc,EAC9B,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,wBAAwB,UAAO,GAC9B,UAAU,GAAG,SAAS,CAOxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,wBAAwB,UAAO,GAC9B,UAAU,GAAG,SAAS,CAoCxB;AAED;;;GAGG;AACH,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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "69.4.0",
3
+ "version": "70.0.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": "^35.0.0"
29
29
  }
30
30
  }
@@ -215,7 +215,7 @@ function initDecoratedCallbacks(
215
215
  );
216
216
  }
217
217
 
218
- // eslint-disable-next-line prefer-destructuring, @typescript-eslint/dot-notation
218
+ // eslint-disable-next-line @typescript-eslint/dot-notation, @typescript-eslint/prefer-destructuring
219
219
  const mod = modFeature["mod"];
220
220
 
221
221
  if (init) {
@@ -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)