isaacscript-common 27.13.0 → 28.0.1

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.
Files changed (56) hide show
  1. package/dist/index.rollup.d.ts +107 -23
  2. package/dist/isaacscript-common.lua +210 -80
  3. package/dist/src/callbackClasses.d.ts +4 -0
  4. package/dist/src/callbackClasses.d.ts.map +1 -1
  5. package/dist/src/callbackClasses.lua +20 -0
  6. package/dist/src/callbacks.d.ts +21 -17
  7. package/dist/src/callbacks.d.ts.map +1 -1
  8. package/dist/src/callbacks.lua +5 -1
  9. package/dist/src/classes/callbacks/PostItemDischarge.d.ts +1 -1
  10. package/dist/src/classes/callbacks/PostNPCStateChanged.d.ts +2 -2
  11. package/dist/src/classes/callbacks/PostTearInitFilter.d.ts +9 -0
  12. package/dist/src/classes/callbacks/PostTearInitFilter.d.ts.map +1 -0
  13. package/dist/src/classes/callbacks/PostTearInitFilter.lua +23 -0
  14. package/dist/src/classes/callbacks/PostTearRenderFilter.d.ts +9 -0
  15. package/dist/src/classes/callbacks/PostTearRenderFilter.d.ts.map +1 -0
  16. package/dist/src/classes/callbacks/PostTearRenderFilter.lua +23 -0
  17. package/dist/src/classes/callbacks/PostTearUpdateFilter.d.ts +9 -0
  18. package/dist/src/classes/callbacks/PostTearUpdateFilter.d.ts.map +1 -0
  19. package/dist/src/classes/callbacks/PostTearUpdateFilter.lua +23 -0
  20. package/dist/src/classes/callbacks/PreTearCollisionFilter.d.ts +9 -0
  21. package/dist/src/classes/callbacks/PreTearCollisionFilter.d.ts.map +1 -0
  22. package/dist/src/classes/callbacks/PreTearCollisionFilter.lua +21 -0
  23. package/dist/src/classes/features/other/customStages/v.d.ts.map +1 -1
  24. package/dist/src/classes/features/other/extraConsoleCommands/v.d.ts.map +1 -1
  25. package/dist/src/core/constants.d.ts +1 -1
  26. package/dist/src/core/constants.lua +1 -1
  27. package/dist/src/enums/ModCallbackCustom.d.ts +81 -17
  28. package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
  29. package/dist/src/enums/ModCallbackCustom.lua +25 -17
  30. package/dist/src/functions/mergeTests.lua +14 -14
  31. package/dist/src/functions/npcs.d.ts +2 -2
  32. package/dist/src/functions/npcs.lua +6 -6
  33. package/dist/src/functions/types.d.ts +3 -3
  34. package/dist/src/functions/types.lua +2 -2
  35. package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts +20 -0
  36. package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts.map +1 -1
  37. package/dist/src/shouldFire.d.ts +2 -2
  38. package/dist/src/shouldFire.d.ts.map +1 -1
  39. package/package.json +2 -2
  40. package/src/callbackClasses.ts +4 -0
  41. package/src/callbacks.ts +4 -0
  42. package/src/classes/callbacks/PostItemDischarge.ts +1 -1
  43. package/src/classes/callbacks/PostNPCStateChanged.ts +2 -2
  44. package/src/classes/callbacks/PostTearInitFilter.ts +22 -0
  45. package/src/classes/callbacks/PostTearRenderFilter.ts +22 -0
  46. package/src/classes/callbacks/PostTearUpdateFilter.ts +22 -0
  47. package/src/classes/callbacks/PreTearCollisionFilter.ts +24 -0
  48. package/src/classes/features/other/customStages/v.ts +2 -0
  49. package/src/classes/features/other/extraConsoleCommands/v.ts +2 -0
  50. package/src/core/constants.ts +1 -1
  51. package/src/enums/ModCallbackCustom.ts +68 -0
  52. package/src/functions/mergeTests.ts +14 -14
  53. package/src/functions/npcs.ts +6 -6
  54. package/src/functions/types.ts +3 -3
  55. package/src/interfaces/private/AddCallbackParametersCustom.ts +28 -0
  56. package/src/shouldFire.ts +8 -2
@@ -53,7 +53,7 @@ import { LevelStage } from 'isaac-typescript-definitions';
53
53
  import { MinibossID } from 'isaac-typescript-definitions';
54
54
  import { ModCallback } from 'isaac-typescript-definitions';
55
55
  import { Music } from 'isaac-typescript-definitions';
56
- import { NpcState } from 'isaac-typescript-definitions';
56
+ import { NPCState } from 'isaac-typescript-definitions';
57
57
  import { PickupPrice } from 'isaac-typescript-definitions';
58
58
  import { PickupVariant } from 'isaac-typescript-definitions';
59
59
  import { PillColor } from 'isaac-typescript-definitions';
@@ -599,6 +599,11 @@ declare interface AddCallbackParametersCustom {
599
599
  callback: (spikes: GridEntitySpikes) => void,
600
600
  variant?: int
601
601
  ];
602
+ [ModCallbackCustom.POST_TEAR_INIT_FILTER]: [
603
+ callback: (tear: EntityTear) => void,
604
+ tearVariant?: TearVariant,
605
+ subType?: int
606
+ ];
602
607
  [ModCallbackCustom.POST_TEAR_INIT_LATE]: [
603
608
  callback: (tear: EntityTear) => void,
604
609
  tearVariant?: TearVariant,
@@ -609,6 +614,16 @@ declare interface AddCallbackParametersCustom {
609
614
  tearVariant?: TearVariant,
610
615
  subType?: int
611
616
  ];
617
+ [ModCallbackCustom.POST_TEAR_RENDER_FILTER]: [
618
+ callback: (tear: EntityTear, renderOffset: Vector) => void,
619
+ tearVariant?: TearVariant,
620
+ subType?: int
621
+ ];
622
+ [ModCallbackCustom.POST_TEAR_UPDATE_FILTER]: [
623
+ callback: (tear: EntityTear) => void,
624
+ tearVariant?: TearVariant,
625
+ subType?: int
626
+ ];
612
627
  [ModCallbackCustom.POST_TNT_RENDER]: [
613
628
  callback: (tnt: GridEntityTNT) => void,
614
629
  variant?: int
@@ -684,6 +699,11 @@ declare interface AddCallbackParametersCustom {
684
699
  variant?: int,
685
700
  subType?: int
686
701
  ];
702
+ [ModCallbackCustom.PRE_TEAR_COLLISION_FILTER]: [
703
+ callback: (tear: EntityTear, collider: Entity, low: boolean) => boolean | undefined,
704
+ tearVariant?: TearVariant,
705
+ subtype?: int
706
+ ];
687
707
  }
688
708
 
689
709
  /**
@@ -1048,12 +1068,12 @@ export declare function asCollectibleType(num: number): CollectibleType;
1048
1068
  export declare function asLevelStage(num: number): LevelStage;
1049
1069
 
1050
1070
  /**
1051
- * Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
1071
+ * Helper function to safely cast a `number` to a `NPCState`. (This is better than using the `as`
1052
1072
  * TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
1053
1073
  *
1054
1074
  * This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
1055
1075
  */
1056
- export declare function asNpcState(num: number): NpcState;
1076
+ export declare function asNPCState(num: number): NPCState;
1057
1077
 
1058
1078
  /**
1059
1079
  * Helper function to safely cast an enum to a `number`. (This is better than using the `as`
@@ -3764,7 +3784,7 @@ export declare function easeOutQuint(time: number): number;
3764
3784
  export declare function easeOutSine(time: number): number;
3765
3785
 
3766
3786
  /**
3767
- * When Eggies take fatal damage, they go into NpcState.STATE_SUICIDE and spawn 14 Swarm Spiders
3787
+ * When Eggies take fatal damage, they go into NPCState.STATE_SUICIDE and spawn 14 Swarm Spiders
3768
3788
  * while their StateFrame ticks upwards. The 14th spider appears when the StateFrame is at this
3769
3789
  * value.
3770
3790
  */
@@ -7848,14 +7868,14 @@ export declare function isDoorToMomsHeart(door: GridEntityDoor): boolean;
7848
7868
 
7849
7869
  /**
7850
7870
  * Helper function to detect the custom death state of a Dump. When Dumps die, they go to
7851
- * `NpcState.SPECIAL`, spit out their head, and then slowly fade away while shooting a burst of
7871
+ * `NPCState.SPECIAL`, spit out their head, and then slowly fade away while shooting a burst of
7852
7872
  * tears.
7853
7873
  */
7854
7874
  export declare function isDyingDump(npc: EntityNPC): boolean;
7855
7875
 
7856
7876
  /**
7857
7877
  * Helper function to detect the custom death state of an Eggy. Eggies are never actually marked
7858
- * dead by the game. Instead, when Eggies take fatal damage, they go into NpcState.STATE_SUICIDE and
7878
+ * dead by the game. Instead, when Eggies take fatal damage, they go into NPCState.STATE_SUICIDE and
7859
7879
  * spawn 14 Swarm Spiders while their StateFrame ticks upwards.
7860
7880
  */
7861
7881
  export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
@@ -11101,6 +11121,21 @@ export declare enum ModCallbackCustom {
11101
11121
  * ```
11102
11122
  */
11103
11123
  POST_SPIKES_UPDATE = 108,
11124
+ /**
11125
+ * The exact same thing as the vanilla `POST_TEAR_INIT` callback, except this callback allows you
11126
+ * to specify extra arguments for additional filtration.
11127
+ *
11128
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
11129
+ * - You can provide an optional third argument that will make the callback only fire if it
11130
+ * matches the `TearVariant` provided.
11131
+ * - You can provide an optional fourth argument that will make the callback only fire if it
11132
+ * matches the sub-type provided.
11133
+ *
11134
+ * ```ts
11135
+ * function postTearInitFilter(tear: EntityTear): void {}
11136
+ * ```
11137
+ */
11138
+ POST_TEAR_INIT_FILTER = 109,
11104
11139
  /**
11105
11140
  * Fires on the first `POST_TEAR_UPDATE` frame for each tear (which is when
11106
11141
  * `EntityTear.FrameCount` is equal to 0).
@@ -11118,7 +11153,7 @@ export declare enum ModCallbackCustom {
11118
11153
  * function postTearInitLate(tear: EntityTear): void {}
11119
11154
  * ```
11120
11155
  */
11121
- POST_TEAR_INIT_LATE = 109,
11156
+ POST_TEAR_INIT_LATE = 110,
11122
11157
  /**
11123
11158
  * Fires on the second `POST_TEAR_UPDATE` frame for each tear (which is when
11124
11159
  * `EntityTear.FrameCount` is equal to 1).
@@ -11135,7 +11170,37 @@ export declare enum ModCallbackCustom {
11135
11170
  * function postTearInitVeryLate(tear: EntityTear): void {}
11136
11171
  * ```
11137
11172
  */
11138
- POST_TEAR_INIT_VERY_LATE = 110,
11173
+ POST_TEAR_INIT_VERY_LATE = 111,
11174
+ /**
11175
+ * The exact same thing as the vanilla `POST_TEAR_RENDER` callback, except this callback allows
11176
+ * you to specify extra arguments for additional filtration.
11177
+ *
11178
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
11179
+ * - You can provide an optional third argument that will make the callback only fire if it
11180
+ * matches the `TearVariant` provided.
11181
+ * - You can provide an optional fourth argument that will make the callback only fire if it
11182
+ * matches the sub-type provided.
11183
+ *
11184
+ * ```ts
11185
+ * function postTearRenderFilter(tear: EntityTear, renderOffset: Vector): void {}
11186
+ * ```
11187
+ */
11188
+ POST_TEAR_RENDER_FILTER = 112,
11189
+ /**
11190
+ * The exact same thing as the vanilla `POST_TEAR_INIT` callback, except this callback allows you
11191
+ * to specify extra arguments for additional filtration.
11192
+ *
11193
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
11194
+ * - You can provide an optional third argument that will make the callback only fire if it
11195
+ * matches the `TearVariant` provided.
11196
+ * - You can provide an optional fourth argument that will make the callback only fire if it
11197
+ * matches the sub-type provided.
11198
+ *
11199
+ * ```ts
11200
+ * function postTearUpdateFilter(tear: EntityTear): void {}
11201
+ * ```
11202
+ */
11203
+ POST_TEAR_UPDATE_FILTER = 113,
11139
11204
  /**
11140
11205
  * Fires from the `POST_RENDER` callback on every frame that a TNT exists.
11141
11206
  *
@@ -11147,7 +11212,7 @@ export declare enum ModCallbackCustom {
11147
11212
  * function postTNTRender(tnt: GridEntityTNT): void {}
11148
11213
  * ```
11149
11214
  */
11150
- POST_TNT_RENDER = 111,
11215
+ POST_TNT_RENDER = 114,
11151
11216
  /**
11152
11217
  * Fires from the `POST_UPDATE` callback on every frame that a TNT exists.
11153
11218
  *
@@ -11159,7 +11224,7 @@ export declare enum ModCallbackCustom {
11159
11224
  * function postTNTUpdate(tnt: GridEntityTNT): void {}
11160
11225
  * ```
11161
11226
  */
11162
- POST_TNT_UPDATE = 112,
11227
+ POST_TNT_UPDATE = 115,
11163
11228
  /**
11164
11229
  * Fires from the `POST_PEFFECT_UPDATE_REORDERED` callback when a player gains or loses a new
11165
11230
  * transformation.
@@ -11178,7 +11243,7 @@ export declare enum ModCallbackCustom {
11178
11243
  * ): void {}
11179
11244
  * ```
11180
11245
  */
11181
- POST_TRANSFORMATION = 113,
11246
+ POST_TRANSFORMATION = 116,
11182
11247
  /**
11183
11248
  * Fires from `ENTITY_TAKE_DMG` callback when a Wishbone or a Walnut breaks.
11184
11249
  *
@@ -11193,7 +11258,7 @@ export declare enum ModCallbackCustom {
11193
11258
  * ): void {}
11194
11259
  * ```
11195
11260
  */
11196
- POST_TRINKET_BREAK = 114,
11261
+ POST_TRINKET_BREAK = 117,
11197
11262
  /**
11198
11263
  * Fires from the `POST_PEFFECT_UPDATE_REORDERED` callback on the frame before a Berserk effect
11199
11264
  * ends when the player is predicted to die (e.g. they currently have no health left or they took
@@ -11209,7 +11274,7 @@ export declare enum ModCallbackCustom {
11209
11274
  * function preBerserkDeath(player: EntityPlayer): void {}
11210
11275
  * ```
11211
11276
  */
11212
- PRE_BERSERK_DEATH = 115,
11277
+ PRE_BERSERK_DEATH = 118,
11213
11278
  /**
11214
11279
  * Fires from the `POST_PLAYER_FATAL_DAMAGE` callback when a player is about to die. If you want
11215
11280
  * to initiate a custom revival, return an integer that corresponds to the item or type of revival
@@ -11228,7 +11293,7 @@ export declare enum ModCallbackCustom {
11228
11293
  * function preCustomRevive(player: EntityPlayer): int | undefined {}
11229
11294
  * ```
11230
11295
  */
11231
- PRE_CUSTOM_REVIVE = 116,
11296
+ PRE_CUSTOM_REVIVE = 119,
11232
11297
  /**
11233
11298
  * The exact same thing as the vanilla `PRE_ENTITY_SPAWN` callback, except this callback allows
11234
11299
  * you to specify extra arguments for additional filtration.
@@ -11253,7 +11318,7 @@ export declare enum ModCallbackCustom {
11253
11318
  * ): [EntityType, int, int, int] | undefined {}
11254
11319
  * ```
11255
11320
  */
11256
- PRE_ENTITY_SPAWN_FILTER = 117,
11321
+ PRE_ENTITY_SPAWN_FILTER = 120,
11257
11322
  /**
11258
11323
  * The exact same thing as the vanilla `PRE_FAMILIAR_COLLISION` callback, except this callback
11259
11324
  * allows you to specify extra arguments for additional filtration.
@@ -11272,7 +11337,7 @@ export declare enum ModCallbackCustom {
11272
11337
  * ): void {}
11273
11338
  * ```
11274
11339
  */
11275
- PRE_FAMILIAR_COLLISION_FILTER = 118,
11340
+ PRE_FAMILIAR_COLLISION_FILTER = 121,
11276
11341
  /**
11277
11342
  * Fires from the `PRE_PICKUP_COLLISION` callback when a player touches a collectible pedestal and
11278
11343
  * meets all of the conditions to pick it up.
@@ -11292,7 +11357,7 @@ export declare enum ModCallbackCustom {
11292
11357
  * function preGetPedestal(player: EntityPlayer, collectible: EntityPickupCollectible): void {}
11293
11358
  * ```
11294
11359
  */
11295
- PRE_GET_PEDESTAL = 119,
11360
+ PRE_GET_PEDESTAL = 122,
11296
11361
  /**
11297
11362
  * Fires from the `POST_PEFFECT_UPDATE_REORDERED` callback when an item becomes queued (i.e. when
11298
11363
  * the player begins to hold the item above their head).
@@ -11312,7 +11377,7 @@ export declare enum ModCallbackCustom {
11312
11377
  * ): void {}
11313
11378
  * ```
11314
11379
  */
11315
- PRE_ITEM_PICKUP = 120,
11380
+ PRE_ITEM_PICKUP = 123,
11316
11381
  /**
11317
11382
  * The exact same thing as the vanilla `PRE_KNIFE_COLLISION` callback, except this callback allows
11318
11383
  * you to specify extra arguments for additional filtration.
@@ -11331,7 +11396,7 @@ export declare enum ModCallbackCustom {
11331
11396
  * ): void {}
11332
11397
  * ```
11333
11398
  */
11334
- PRE_KNIFE_COLLISION_FILTER = 121,
11399
+ PRE_KNIFE_COLLISION_FILTER = 124,
11335
11400
  /**
11336
11401
  * Fires on the `POST_RENDER` frame before the player is taken to a new floor. Only fires when a
11337
11402
  * player jumps into a trapdoor or enters a heaven door (beam of light). Does not fire on the
@@ -11345,7 +11410,7 @@ export declare enum ModCallbackCustom {
11345
11410
  * function preNewLevel(player: EntityPlayer): void {}
11346
11411
  * ```
11347
11412
  */
11348
- PRE_NEW_LEVEL = 122,
11413
+ PRE_NEW_LEVEL = 125,
11349
11414
  /**
11350
11415
  * The exact same thing as the vanilla `PRE_NPC_COLLISION` callback, except this callback allows
11351
11416
  * you to specify extra arguments for additional filtration.
@@ -11366,7 +11431,7 @@ export declare enum ModCallbackCustom {
11366
11431
  * ): boolean | undefined {}
11367
11432
  * ```
11368
11433
  */
11369
- PRE_NPC_COLLISION_FILTER = 123,
11434
+ PRE_NPC_COLLISION_FILTER = 126,
11370
11435
  /**
11371
11436
  * The exact same thing as the vanilla `PRE_NPC_UPDATE` callback, except this callback allows you
11372
11437
  * to specify extra arguments for additional filtration.
@@ -11383,7 +11448,7 @@ export declare enum ModCallbackCustom {
11383
11448
  * function preNPCUpdateFilter(entity: Entity): boolean | undefined {}
11384
11449
  * ```
11385
11450
  */
11386
- PRE_NPC_UPDATE_FILTER = 124,
11451
+ PRE_NPC_UPDATE_FILTER = 127,
11387
11452
  /**
11388
11453
  * The exact same thing as the vanilla `PRE_ROOM_ENTITY_SPAWN` callback, except this callback
11389
11454
  * allows you to specify extra arguments for additional filtration.
@@ -11406,7 +11471,26 @@ export declare enum ModCallbackCustom {
11406
11471
  * ): [EntityType | GridEntityXMLType, int, int] | undefined {}
11407
11472
  * ```
11408
11473
  */
11409
- PRE_ROOM_ENTITY_SPAWN_FILTER = 125
11474
+ PRE_ROOM_ENTITY_SPAWN_FILTER = 128,
11475
+ /**
11476
+ * The exact same thing as the vanilla `PRE_TEAR_COLLISION` callback, except this callback allows
11477
+ * you to specify extra arguments for additional filtration.
11478
+ *
11479
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
11480
+ * - You can provide an optional third argument that will make the callback only fire if it
11481
+ * matches the `TearVariant` provided.
11482
+ * - You can provide an optional fourth argument that will make the callback only fire if it
11483
+ * matches the sub-type provided.
11484
+ *
11485
+ * ```ts
11486
+ * function preTearCollisionFilter(
11487
+ * tear: EntityTear,
11488
+ * collider: Entity,
11489
+ * low: boolean,
11490
+ * ): void {}
11491
+ * ```
11492
+ */
11493
+ PRE_TEAR_COLLISION_FILTER = 129
11410
11494
  }
11411
11495
 
11412
11496
  /**