isaacscript-common 17.5.0 → 17.6.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.
package/dist/index.d.ts
CHANGED
|
@@ -6965,7 +6965,16 @@ declare interface IsaacAPIClassTypeToType {
|
|
|
6965
6965
|
}
|
|
6966
6966
|
|
|
6967
6967
|
/**
|
|
6968
|
-
*
|
|
6968
|
+
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
6969
|
+
*
|
|
6970
|
+
* This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
6971
|
+
* as you want to check for. This function will return true if any of the buttons are pressed.
|
|
6972
|
+
*/
|
|
6973
|
+
export declare function isActionPressed(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
6974
|
+
|
|
6975
|
+
/**
|
|
6976
|
+
* Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
6977
|
+
* being held down).
|
|
6969
6978
|
*
|
|
6970
6979
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
6971
6980
|
* function will return true if any of the buttons are pressed.
|
|
@@ -6973,8 +6982,18 @@ declare interface IsaacAPIClassTypeToType {
|
|
|
6973
6982
|
export declare function isActionPressedOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
6974
6983
|
|
|
6975
6984
|
/**
|
|
6976
|
-
*
|
|
6977
|
-
*
|
|
6985
|
+
* Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
6986
|
+
* it).
|
|
6987
|
+
*
|
|
6988
|
+
* This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
6989
|
+
* buttons as you want to check for. This function will return true if any of the buttons are
|
|
6990
|
+
* triggered.
|
|
6991
|
+
*/
|
|
6992
|
+
export declare function isActionTriggered(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
6993
|
+
|
|
6994
|
+
/**
|
|
6995
|
+
* Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
6996
|
+
* released).
|
|
6978
6997
|
*
|
|
6979
6998
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
6980
6999
|
* function will return true if any of the buttons are pressed.
|
|
@@ -7507,7 +7526,7 @@ export declare function isKeeper(player: EntityPlayer): boolean;
|
|
|
7507
7526
|
export declare function isKey(pickup: EntityPickup): pickup is EntityPickupKey;
|
|
7508
7527
|
|
|
7509
7528
|
/**
|
|
7510
|
-
* Helper function to see if a
|
|
7529
|
+
* Helper function to see if a specific keyboard key is being held down by the player.
|
|
7511
7530
|
*
|
|
7512
7531
|
* This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
7513
7532
|
* This function will return true if any of the values are pressed.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 17.
|
|
3
|
+
isaacscript-common 17.6.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -34863,25 +34863,41 @@ end
|
|
|
34863
34863
|
function ____exports.getShootActions(self)
|
|
34864
34864
|
return ____exports.SHOOTING_ACTIONS_SET
|
|
34865
34865
|
end
|
|
34866
|
+
function ____exports.isActionPressed(self, controllerIndex, ...)
|
|
34867
|
+
local buttonActions = {...}
|
|
34868
|
+
return __TS__ArraySome(
|
|
34869
|
+
buttonActions,
|
|
34870
|
+
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
34871
|
+
)
|
|
34872
|
+
end
|
|
34866
34873
|
function ____exports.isActionPressedOnAnyInput(self, ...)
|
|
34867
34874
|
local buttonActions = {...}
|
|
34868
34875
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
34869
34876
|
return __TS__ArraySome(
|
|
34870
34877
|
controllerIndexes,
|
|
34871
|
-
function(____, controllerIndex) return
|
|
34872
|
-
|
|
34873
|
-
|
|
34878
|
+
function(____, controllerIndex) return ____exports.isActionPressed(
|
|
34879
|
+
nil,
|
|
34880
|
+
controllerIndex,
|
|
34881
|
+
table.unpack(buttonActions)
|
|
34874
34882
|
) end
|
|
34875
34883
|
)
|
|
34876
34884
|
end
|
|
34885
|
+
function ____exports.isActionTriggered(self, controllerIndex, ...)
|
|
34886
|
+
local buttonActions = {...}
|
|
34887
|
+
return __TS__ArraySome(
|
|
34888
|
+
buttonActions,
|
|
34889
|
+
function(____, buttonAction) return Input.IsActionTriggered(buttonAction, controllerIndex) end
|
|
34890
|
+
)
|
|
34891
|
+
end
|
|
34877
34892
|
function ____exports.isActionTriggeredOnAnyInput(self, ...)
|
|
34878
34893
|
local buttonActions = {...}
|
|
34879
34894
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
34880
34895
|
return __TS__ArraySome(
|
|
34881
34896
|
controllerIndexes,
|
|
34882
|
-
function(____, controllerIndex) return
|
|
34883
|
-
|
|
34884
|
-
|
|
34897
|
+
function(____, controllerIndex) return ____exports.isActionTriggered(
|
|
34898
|
+
nil,
|
|
34899
|
+
controllerIndex,
|
|
34900
|
+
table.unpack(buttonActions)
|
|
34885
34901
|
) end
|
|
34886
34902
|
)
|
|
34887
34903
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonAction, Controller, Keyboard } from "isaac-typescript-definitions";
|
|
1
|
+
import { ButtonAction, Controller, ControllerIndex, Keyboard } from "isaac-typescript-definitions";
|
|
2
2
|
export declare const MOVEMENT_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
3
3
|
export declare const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
4
4
|
/**
|
|
@@ -11,22 +11,39 @@ export declare function controllerToString(controller: Controller): string | und
|
|
|
11
11
|
export declare function getMoveActions(): ReadonlySet<ButtonAction>;
|
|
12
12
|
export declare function getShootActions(): ReadonlySet<ButtonAction>;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
15
|
+
*
|
|
16
|
+
* This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
17
|
+
* as you want to check for. This function will return true if any of the buttons are pressed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isActionPressed(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
22
|
+
* being held down).
|
|
15
23
|
*
|
|
16
24
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
17
25
|
* function will return true if any of the buttons are pressed.
|
|
18
26
|
*/
|
|
19
27
|
export declare function isActionPressedOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
20
28
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
29
|
+
* Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
30
|
+
* it).
|
|
31
|
+
*
|
|
32
|
+
* This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
33
|
+
* buttons as you want to check for. This function will return true if any of the buttons are
|
|
34
|
+
* triggered.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isActionTriggered(controllerIndex: ControllerIndex, ...buttonActions: ButtonAction[]): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
39
|
+
* released).
|
|
23
40
|
*
|
|
24
41
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
25
42
|
* function will return true if any of the buttons are pressed.
|
|
26
43
|
*/
|
|
27
44
|
export declare function isActionTriggeredOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
28
45
|
/**
|
|
29
|
-
* Helper function to see if a
|
|
46
|
+
* Helper function to see if a specific keyboard key is being held down by the player.
|
|
30
47
|
*
|
|
31
48
|
* This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
32
49
|
* This function will return true if any of the values are pressed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAuBtC,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAE1D,CAAC;AASF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,YAAY,CAE1D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAQ7E;AAED,wBAAgB,cAAc,IAAI,WAAW,CAAC,YAAY,CAAC,CAE1D;AAED,wBAAgB,eAAe,IAAI,WAAW,CAAC,YAAY,CAAC,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,eAAe,EAChC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAKT;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,eAAe,EAChC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,aAAa,EAAE,YAAY,EAAE,GAC/B,OAAO,CAKT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAIvD;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAIzD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEjE;AAED,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAED,wBAAgB,gCAAgC,IAAI,OAAO,CAI1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -45,7 +45,19 @@ end
|
|
|
45
45
|
function ____exports.getShootActions(self)
|
|
46
46
|
return ____exports.SHOOTING_ACTIONS_SET
|
|
47
47
|
end
|
|
48
|
-
---
|
|
48
|
+
--- Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
49
|
+
--
|
|
50
|
+
-- This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
51
|
+
-- as you want to check for. This function will return true if any of the buttons are pressed.
|
|
52
|
+
function ____exports.isActionPressed(self, controllerIndex, ...)
|
|
53
|
+
local buttonActions = {...}
|
|
54
|
+
return __TS__ArraySome(
|
|
55
|
+
buttonActions,
|
|
56
|
+
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
--- Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
60
|
+
-- being held down).
|
|
49
61
|
--
|
|
50
62
|
-- This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
51
63
|
-- function will return true if any of the buttons are pressed.
|
|
@@ -54,14 +66,28 @@ function ____exports.isActionPressedOnAnyInput(self, ...)
|
|
|
54
66
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
55
67
|
return __TS__ArraySome(
|
|
56
68
|
controllerIndexes,
|
|
57
|
-
function(____, controllerIndex) return
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
function(____, controllerIndex) return ____exports.isActionPressed(
|
|
70
|
+
nil,
|
|
71
|
+
controllerIndex,
|
|
72
|
+
table.unpack(buttonActions)
|
|
60
73
|
) end
|
|
61
74
|
)
|
|
62
75
|
end
|
|
63
|
-
---
|
|
64
|
-
--
|
|
76
|
+
--- Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
77
|
+
-- it).
|
|
78
|
+
--
|
|
79
|
+
-- This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
80
|
+
-- buttons as you want to check for. This function will return true if any of the buttons are
|
|
81
|
+
-- triggered.
|
|
82
|
+
function ____exports.isActionTriggered(self, controllerIndex, ...)
|
|
83
|
+
local buttonActions = {...}
|
|
84
|
+
return __TS__ArraySome(
|
|
85
|
+
buttonActions,
|
|
86
|
+
function(____, buttonAction) return Input.IsActionTriggered(buttonAction, controllerIndex) end
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
--- Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
90
|
+
-- released).
|
|
65
91
|
--
|
|
66
92
|
-- This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
67
93
|
-- function will return true if any of the buttons are pressed.
|
|
@@ -70,13 +96,14 @@ function ____exports.isActionTriggeredOnAnyInput(self, ...)
|
|
|
70
96
|
local controllerIndexes = getEnumValues(nil, ControllerIndex)
|
|
71
97
|
return __TS__ArraySome(
|
|
72
98
|
controllerIndexes,
|
|
73
|
-
function(____, controllerIndex) return
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
function(____, controllerIndex) return ____exports.isActionTriggered(
|
|
100
|
+
nil,
|
|
101
|
+
controllerIndex,
|
|
102
|
+
table.unpack(buttonActions)
|
|
76
103
|
) end
|
|
77
104
|
)
|
|
78
105
|
end
|
|
79
|
-
--- Helper function to see if a
|
|
106
|
+
--- Helper function to see if a specific keyboard key is being held down by the player.
|
|
80
107
|
--
|
|
81
108
|
-- This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
82
109
|
-- This function will return true if any of the values are pressed.
|
package/package.json
CHANGED
package/src/functions/input.ts
CHANGED
|
@@ -66,7 +66,23 @@ export function getShootActions(): ReadonlySet<ButtonAction> {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
70
|
+
*
|
|
71
|
+
* This is a variadic version of `Input.IsActionPressed`, meaning that you can pass as many buttons
|
|
72
|
+
* as you want to check for. This function will return true if any of the buttons are pressed.
|
|
73
|
+
*/
|
|
74
|
+
export function isActionPressed(
|
|
75
|
+
controllerIndex: ControllerIndex,
|
|
76
|
+
...buttonActions: ButtonAction[]
|
|
77
|
+
): boolean {
|
|
78
|
+
return buttonActions.some((buttonAction) =>
|
|
79
|
+
Input.IsActionPressed(buttonAction, controllerIndex),
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Helper function to iterate over all inputs to determine if a specific button is pressed (i.e.
|
|
85
|
+
* being held down).
|
|
70
86
|
*
|
|
71
87
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
72
88
|
* function will return true if any of the buttons are pressed.
|
|
@@ -76,15 +92,30 @@ export function isActionPressedOnAnyInput(
|
|
|
76
92
|
): boolean {
|
|
77
93
|
const controllerIndexes = getEnumValues(ControllerIndex);
|
|
78
94
|
return controllerIndexes.some((controllerIndex) =>
|
|
79
|
-
buttonActions
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
isActionPressed(controllerIndex, ...buttonActions),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to check if a player is triggering a specific button (i.e. pressing and releasing
|
|
101
|
+
* it).
|
|
102
|
+
*
|
|
103
|
+
* This is a variadic version of `Input.IsActionTriggered`, meaning that you can pass as many
|
|
104
|
+
* buttons as you want to check for. This function will return true if any of the buttons are
|
|
105
|
+
* triggered.
|
|
106
|
+
*/
|
|
107
|
+
export function isActionTriggered(
|
|
108
|
+
controllerIndex: ControllerIndex,
|
|
109
|
+
...buttonActions: ButtonAction[]
|
|
110
|
+
): boolean {
|
|
111
|
+
return buttonActions.some((buttonAction) =>
|
|
112
|
+
Input.IsActionTriggered(buttonAction, controllerIndex),
|
|
82
113
|
);
|
|
83
114
|
}
|
|
84
115
|
|
|
85
116
|
/**
|
|
86
|
-
* Iterates over all inputs to determine if a
|
|
87
|
-
*
|
|
117
|
+
* Iterates over all inputs to determine if a specific button is triggered (i.e. held down and then
|
|
118
|
+
* released).
|
|
88
119
|
*
|
|
89
120
|
* This function is variadic, meaning you can pass as many buttons as you want to check for. This
|
|
90
121
|
* function will return true if any of the buttons are pressed.
|
|
@@ -94,14 +125,12 @@ export function isActionTriggeredOnAnyInput(
|
|
|
94
125
|
): boolean {
|
|
95
126
|
const controllerIndexes = getEnumValues(ControllerIndex);
|
|
96
127
|
return controllerIndexes.some((controllerIndex) =>
|
|
97
|
-
buttonActions
|
|
98
|
-
Input.IsActionTriggered(buttonAction, controllerIndex),
|
|
99
|
-
),
|
|
128
|
+
isActionTriggered(controllerIndex, ...buttonActions),
|
|
100
129
|
);
|
|
101
130
|
}
|
|
102
131
|
|
|
103
132
|
/**
|
|
104
|
-
* Helper function to see if a
|
|
133
|
+
* Helper function to see if a specific keyboard key is being held down by the player.
|
|
105
134
|
*
|
|
106
135
|
* This function is variadic, meaning you can pass as many keyboard values as you want to check for.
|
|
107
136
|
* This function will return true if any of the values are pressed.
|