isaacscript-common 27.12.0 → 27.13.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.
Files changed (39) hide show
  1. package/dist/index.rollup.d.ts +154 -70
  2. package/dist/isaacscript-common.lua +201 -71
  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 +74 -70
  7. package/dist/src/callbacks.d.ts.map +1 -1
  8. package/dist/src/callbacks.lua +4 -0
  9. package/dist/src/classes/callbacks/PostKnifeInitFilter.d.ts +9 -0
  10. package/dist/src/classes/callbacks/PostKnifeInitFilter.d.ts.map +1 -0
  11. package/dist/src/classes/callbacks/PostKnifeInitFilter.lua +23 -0
  12. package/dist/src/classes/callbacks/PostKnifeRenderFilter.d.ts +9 -0
  13. package/dist/src/classes/callbacks/PostKnifeRenderFilter.d.ts.map +1 -0
  14. package/dist/src/classes/callbacks/PostKnifeRenderFilter.lua +23 -0
  15. package/dist/src/classes/callbacks/PostKnifeUpdateFilter.d.ts +9 -0
  16. package/dist/src/classes/callbacks/PostKnifeUpdateFilter.d.ts.map +1 -0
  17. package/dist/src/classes/callbacks/PostKnifeUpdateFilter.lua +23 -0
  18. package/dist/src/classes/callbacks/PreKnifeCollisionFilter.d.ts +9 -0
  19. package/dist/src/classes/callbacks/PreKnifeCollisionFilter.d.ts.map +1 -0
  20. package/dist/src/classes/callbacks/PreKnifeCollisionFilter.lua +21 -0
  21. package/dist/src/classes/private/CustomCallback.d.ts.map +1 -1
  22. package/dist/src/enums/ModCallbackCustom.d.ts +134 -70
  23. package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
  24. package/dist/src/enums/ModCallbackCustom.lua +78 -70
  25. package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts +20 -0
  26. package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts.map +1 -1
  27. package/dist/src/shouldFire.d.ts +1 -1
  28. package/dist/src/shouldFire.d.ts.map +1 -1
  29. package/package.json +2 -2
  30. package/src/callbackClasses.ts +4 -0
  31. package/src/callbacks.ts +4 -0
  32. package/src/classes/callbacks/PostKnifeInitFilter.ts +22 -0
  33. package/src/classes/callbacks/PostKnifeRenderFilter.ts +22 -0
  34. package/src/classes/callbacks/PostKnifeUpdateFilter.ts +22 -0
  35. package/src/classes/callbacks/PreKnifeCollisionFilter.ts +24 -0
  36. package/src/classes/private/CustomCallback.ts +4 -0
  37. package/src/enums/ModCallbackCustom.ts +68 -0
  38. package/src/interfaces/private/AddCallbackParametersCustom.ts +28 -0
  39. package/src/shouldFire.ts +4 -1
@@ -964,6 +964,22 @@ export enum ModCallbackCustom {
964
964
  */
965
965
  POST_KEYBOARD_CHANGED,
966
966
 
967
+ /**
968
+ * The exact same thing as the vanilla `POST_KNIFE_INIT` callback, except this callback allows you
969
+ * to specify extra arguments for additional filtration.
970
+ *
971
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
972
+ * - You can provide an optional third argument that will make the callback only fire if it
973
+ * matches the `KnifeVariant` provided.
974
+ * - You can provide an optional fourth argument that will make the callback only fire if it
975
+ * matches the sub-type provided.
976
+ *
977
+ * ```ts
978
+ * function postKnifeInitFilter(knife: EntityKnife): void {}
979
+ * ```
980
+ */
981
+ POST_KNIFE_INIT_FILTER,
982
+
967
983
  /**
968
984
  * Fires on the first `POST_KNIFE_UPDATE` frame for each knife.
969
985
  *
@@ -982,6 +998,38 @@ export enum ModCallbackCustom {
982
998
  */
983
999
  POST_KNIFE_INIT_LATE,
984
1000
 
1001
+ /**
1002
+ * The exact same thing as the vanilla `POST_KNIFE_RENDER` callback, except this callback allows
1003
+ * you to specify extra arguments for additional filtration.
1004
+ *
1005
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
1006
+ * - You can provide an optional third argument that will make the callback only fire if it
1007
+ * matches the `KnifeVariant` provided.
1008
+ * - You can provide an optional fourth argument that will make the callback only fire if it
1009
+ * matches the sub-type provided.
1010
+ *
1011
+ * ```ts
1012
+ * function postKnifeRenderFilter(knife: EntityKnife, renderOffset: Vector): void {}
1013
+ * ```
1014
+ */
1015
+ POST_KNIFE_RENDER_FILTER,
1016
+
1017
+ /**
1018
+ * The exact same thing as the vanilla `POST_KNIFE_UPDATE` callback, except this callback allows
1019
+ * you to specify extra arguments for additional filtration.
1020
+ *
1021
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
1022
+ * - You can provide an optional third argument that will make the callback only fire if it
1023
+ * matches the `KnifeVariant` provided.
1024
+ * - You can provide an optional fourth argument that will make the callback only fire if it
1025
+ * matches the sub-type provided.
1026
+ *
1027
+ * ```ts
1028
+ * function postKnifeUpdateFilter(knife: EntityKnife): void {}
1029
+ * ```
1030
+ */
1031
+ POST_KNIFE_UPDATE_FILTER,
1032
+
985
1033
  /**
986
1034
  * The exact same thing as the vanilla `POST_LASER_INIT` callback, except this callback allows you
987
1035
  * to specify extra arguments for additional filtration.
@@ -2216,6 +2264,26 @@ export enum ModCallbackCustom {
2216
2264
  */
2217
2265
  PRE_ITEM_PICKUP,
2218
2266
 
2267
+ /**
2268
+ * The exact same thing as the vanilla `PRE_KNIFE_COLLISION` callback, except this callback allows
2269
+ * you to specify extra arguments for additional filtration.
2270
+ *
2271
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
2272
+ * - You can provide an optional third argument that will make the callback only fire if it
2273
+ * matches the `KnifeVariant` provided.
2274
+ * - You can provide an optional fourth argument that will make the callback only fire if it
2275
+ * matches the sub-type provided.
2276
+ *
2277
+ * ```ts
2278
+ * function preKnifeCollisionFilter(
2279
+ * knife: EntityKnife,
2280
+ * collider: Entity,
2281
+ * low: boolean,
2282
+ * ): void {}
2283
+ * ```
2284
+ */
2285
+ PRE_KNIFE_COLLISION_FILTER,
2286
+
2219
2287
  /**
2220
2288
  * Fires on the `POST_RENDER` frame before the player is taken to a new floor. Only fires when a
2221
2289
  * player jumps into a trapdoor or enters a heaven door (beam of light). Does not fire on the
@@ -423,12 +423,30 @@ export interface AddCallbackParametersCustom {
423
423
  pressed?: boolean,
424
424
  ];
425
425
 
426
+ [ModCallbackCustom.POST_KNIFE_INIT_FILTER]: [
427
+ callback: (knife: EntityKnife) => void,
428
+ knifeVariant?: KnifeVariant,
429
+ subType?: int,
430
+ ];
431
+
426
432
  [ModCallbackCustom.POST_KNIFE_INIT_LATE]: [
427
433
  callback: (knife: EntityKnife) => void,
428
434
  knifeVariant?: KnifeVariant,
429
435
  subType?: int,
430
436
  ];
431
437
 
438
+ [ModCallbackCustom.POST_KNIFE_RENDER_FILTER]: [
439
+ callback: (knife: EntityKnife, renderOffset: Vector) => void,
440
+ knifeVariant?: KnifeVariant,
441
+ subType?: int,
442
+ ];
443
+
444
+ [ModCallbackCustom.POST_KNIFE_UPDATE_FILTER]: [
445
+ callback: (knife: EntityKnife) => void,
446
+ knifeVariant?: KnifeVariant,
447
+ subType?: int,
448
+ ];
449
+
432
450
  [ModCallbackCustom.POST_LASER_INIT_FILTER]: [
433
451
  callback: (laser: EntityLaser) => void,
434
452
  laserVariant?: LaserVariant,
@@ -882,6 +900,16 @@ export interface AddCallbackParametersCustom {
882
900
  trinketType?: TrinketType,
883
901
  ];
884
902
 
903
+ [ModCallbackCustom.PRE_KNIFE_COLLISION_FILTER]: [
904
+ callback: (
905
+ knife: EntityKnife,
906
+ collider: Entity,
907
+ low: boolean,
908
+ ) => boolean | undefined,
909
+ knifeVariant?: KnifeVariant,
910
+ subtype?: int,
911
+ ];
912
+
885
913
  [ModCallbackCustom.PRE_NEW_LEVEL]: [callback: (player: EntityPlayer) => void];
886
914
 
887
915
  [ModCallbackCustom.PRE_NPC_COLLISION_FILTER]: [
package/src/shouldFire.ts CHANGED
@@ -231,7 +231,10 @@ export function shouldFireItemPickup(
231
231
  }
232
232
 
233
233
  export function shouldFireKnife(
234
- fireArgs: [knife: EntityKnife],
234
+ fireArgs:
235
+ | [knife: EntityKnife]
236
+ | [knife: EntityKnife, renderOffset: Vector]
237
+ | [knife: EntityKnife, collider: Entity, low: boolean],
235
238
  optionalArgs: [knifeVariant?: KnifeVariant, subType?: int],
236
239
  ): boolean {
237
240
  const [knife] = fireArgs;