isaacscript-common 18.2.1 → 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.
@@ -65,6 +65,50 @@ export enum ModCallbackCustom {
65
65
  */
66
66
  ENTITY_TAKE_DMG_PLAYER,
67
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
+
68
112
  /**
69
113
  * Fires from the `POST_UPDATE` callback when a Challenge Room or Boss Rush is started.
70
114
  * Specifically, this happens on the first frame that `Room.IsAmbushDone` is true.
@@ -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,