isaacscript-common 18.2.0 → 18.3.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.
@@ -30,6 +30,16 @@ export enum ModCallbackCustom {
30
30
  * matches the variant provided.
31
31
  * - You can provide an optional fifth argument that will make the callback only fire if it
32
32
  * matches the sub-type provided.
33
+ *
34
+ * ```ts
35
+ * function entityTakeDmgFilter(
36
+ * entity: Entity,
37
+ * amount: float,
38
+ * damageFlags: BitFlags<DamageFlag>,
39
+ * source: EntityRef,
40
+ * countdownFrames: int,
41
+ * ): boolean | undefined {}
42
+ * ```
33
43
  */
34
44
  ENTITY_TAKE_DMG_FILTER,
35
45
 
@@ -42,9 +52,63 @@ export enum ModCallbackCustom {
42
52
  * matches the `PlayerVariant` provided.
43
53
  * - You can provide an optional fourth argument that will make the callback only fire if it
44
54
  * matches the `PlayerType` provided.
55
+ *
56
+ * ```ts
57
+ * function entityTakeDmgPlayer(
58
+ * player: EntityPlayer,
59
+ * amount: float,
60
+ * damageFlags: BitFlags<DamageFlag>,
61
+ * source: EntityRef,
62
+ * countdownFrames: int,
63
+ * ): boolean | undefined {}
64
+ * ```
45
65
  */
46
66
  ENTITY_TAKE_DMG_PLAYER,
47
67
 
68
+ /**
69
+ * The exact same thing as the vanilla `INPUT_ACTION` callback, except this callback allows you to
70
+ * specify extra arguments for additional filtration.
71
+ *
72
+ * When registering the callback with the `ModUpgraded.AddCallbackCustom` method:
73
+ * - You can provide an optional third argument that will make the callback only fire if it
74
+ * matches the `InputHook` provided.
75
+ * - You can provide an optional fourth argument that will make the callback only fire if it
76
+ * matches the `ButtonAction` provided.
77
+ *
78
+ * ```ts
79
+ * function inputActionFilter(
80
+ * entity: Entity | undefined,
81
+ * inputHook: InputHook,
82
+ * buttonAction: ButtonAction,
83
+ * ): boolean | undefined {}
84
+ * ```
85
+ */
86
+ INPUT_ACTION_FILTER,
87
+
88
+ /**
89
+ * The exact same thing as the vanilla `INPUT_ACTION` callback, except this callback automatically
90
+ * filters for `EntityType.ENTITY_PLAYER` and casts the `Entity` object to a `EntityPlayer`. It
91
+ * also allows you to specify extra arguments for additional filtration.
92
+ *
93
+ * - You can provide an optional third argument that will make the callback only fire if it
94
+ * matches the `PlayerVariant` provided.
95
+ * - You can provide an optional fourth argument that will make the callback only fire if it
96
+ * matches the `PlayerType` provided.
97
+ * - You can provide an optional fifth argument that will make the callback only fire if it
98
+ * matches the `InputHook` provided.
99
+ * - You can provide an optional sixth argument that will make the callback only fire if it
100
+ * matches the `ButtonAction` provided.
101
+ *
102
+ * ```ts
103
+ * function inputActionPlayer(
104
+ * player: EntityPlayer,
105
+ * inputHook: InputHook,
106
+ * buttonAction: ButtonAction,
107
+ * ): boolean | undefined {}
108
+ * ```
109
+ */
110
+ INPUT_ACTION_PLAYER,
111
+
48
112
  /**
49
113
  * Fires from the `POST_UPDATE` callback when a Challenge Room or Boss Rush is started.
50
114
  * Specifically, this happens on the first frame that `Room.IsAmbushDone` is true.
@@ -848,6 +912,10 @@ export enum ModCallbackCustom {
848
912
  * matches the variant provided.
849
913
  * - You can provide an optional fifth argument that will make the callback only fire if it
850
914
  * matches the sub-type provided.
915
+ *
916
+ * ```ts
917
+ * function postNPCDeathFilter(npc: EntityNPC): void {}
918
+ * ```
851
919
  */
852
920
  POST_NPC_DEATH_FILTER,
853
921
 
@@ -862,6 +930,10 @@ export enum ModCallbackCustom {
862
930
  * matches the variant provided.
863
931
  * - You can provide an optional fifth argument that will make the callback only fire if it
864
932
  * matches the sub-type provided.
933
+ *
934
+ * ```ts
935
+ * function postNPCInitFilter(npc: EntityNPC): void {}
936
+ * ```
865
937
  */
866
938
  POST_NPC_INIT_FILTER,
867
939
 
@@ -896,6 +968,10 @@ export enum ModCallbackCustom {
896
968
  * matches the variant provided.
897
969
  * - You can provide an optional fifth argument that will make the callback only fire if it
898
970
  * matches the sub-type provided.
971
+ *
972
+ * ```ts
973
+ * function postNPCRenderFilter(npc: EntityNPC, renderOffset: Vector): void {}
974
+ * ```
899
975
  */
900
976
  POST_NPC_RENDER_FILTER,
901
977
 
@@ -932,6 +1008,10 @@ export enum ModCallbackCustom {
932
1008
  * matches the variant provided.
933
1009
  * - You can provide an optional fifth argument that will make the callback only fire if it
934
1010
  * matches the sub-type provided.
1011
+ *
1012
+ * ```ts
1013
+ * function postNPCUpdateFilter(npc: EntityNPC): void {}
1014
+ * ```
935
1015
  */
936
1016
  POST_NPC_UPDATE_FILTER,
937
1017
 
@@ -1779,6 +1859,14 @@ export enum ModCallbackCustom {
1779
1859
  * matches the variant provided.
1780
1860
  * - You can provide an optional fifth argument that will make the callback only fire if it
1781
1861
  * matches the sub-type provided.
1862
+ *
1863
+ * ```ts
1864
+ * function preNPCCollisionFilter(
1865
+ * npc: EntityNPC,
1866
+ * collider: Entity,
1867
+ * low: boolean,
1868
+ * ): boolean | undefined {}
1869
+ * ```
1782
1870
  */
1783
1871
  PRE_NPC_COLLISION_FILTER,
1784
1872
 
@@ -1793,6 +1881,10 @@ export enum ModCallbackCustom {
1793
1881
  * matches the variant provided.
1794
1882
  * - You can provide an optional fifth argument that will make the callback only fire if it
1795
1883
  * matches the sub-type provided.
1884
+ *
1885
+ * ```ts
1886
+ * function preNPCUpdateFilter(entity: Entity): boolean | undefined {}
1887
+ * ```
1796
1888
  */
1797
1889
  PRE_NPC_UPDATE_FILTER,
1798
1890
  }
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ActiveSlot,
3
3
  BombVariant,
4
+ ButtonAction,
4
5
  CollectibleType,
5
6
  DamageFlag,
6
7
  DiceFloorSubType,
@@ -9,6 +10,7 @@ import {
9
10
  EntityType,
10
11
  FamiliarVariant,
11
12
  GridEntityType,
13
+ InputHook,
12
14
  ItemType,
13
15
  KnifeVariant,
14
16
  LaserVariant,
@@ -63,6 +65,28 @@ export interface AddCallbackParametersCustom {
63
65
  character?: PlayerType,
64
66
  ];
65
67
 
68
+ [ModCallbackCustom.INPUT_ACTION_FILTER]: [
69
+ callback: (
70
+ entity: Entity | undefined,
71
+ inputHook: InputHook,
72
+ buttonAction: ButtonAction,
73
+ ) => boolean | float | undefined,
74
+ inputHook?: InputHook,
75
+ buttonAction?: ButtonAction,
76
+ ];
77
+
78
+ [ModCallbackCustom.INPUT_ACTION_PLAYER]: [
79
+ callback: (
80
+ player: EntityPlayer,
81
+ inputHook: InputHook,
82
+ buttonAction: ButtonAction,
83
+ ) => boolean | float | undefined,
84
+ playerVariant?: PlayerVariant,
85
+ character?: PlayerType,
86
+ inputHook?: InputHook,
87
+ buttonAction?: ButtonAction,
88
+ ];
89
+
66
90
  [ModCallbackCustom.POST_AMBUSH_FINISHED]: [
67
91
  callback: (ambushType: AmbushType) => void,
68
92
  ambushType?: AmbushType,