isaacscript-common 60.0.0 → 61.0.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.rollup.d.ts +6 -6
- package/dist/isaacscript-common.lua +23 -23
- package/dist/src/classes/features/other/DisableInputs.lua +4 -4
- package/dist/src/functions/input.d.ts +6 -6
- package/dist/src/functions/input.d.ts.map +1 -1
- package/dist/src/functions/input.lua +18 -18
- package/package.json +1 -1
- package/src/classes/features/other/DisableInputs.ts +4 -4
- package/src/functions/input.ts +20 -20
package/dist/index.rollup.d.ts
CHANGED
|
@@ -6128,7 +6128,7 @@ export declare function getMegaSatanDoor(): GridEntityDoor | undefined;
|
|
|
6128
6128
|
* pressing down. This returns an array because a player can be holding down more than one movement
|
|
6129
6129
|
* key at a time.
|
|
6130
6130
|
*/
|
|
6131
|
-
export declare function
|
|
6131
|
+
export declare function getMoveButtonActions(controllerIndex: ControllerIndex): ButtonAction[];
|
|
6132
6132
|
|
|
6133
6133
|
/**
|
|
6134
6134
|
* Helper function to get the corresponding music value for a stage and stage type combination.
|
|
@@ -7542,7 +7542,7 @@ export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>, incl
|
|
|
7542
7542
|
* pressing down. This returns an array because a player can be holding down more than one shooting
|
|
7543
7543
|
* key at a time.
|
|
7544
7544
|
*/
|
|
7545
|
-
export declare function
|
|
7545
|
+
export declare function getShootButtonActions(controllerIndex: ControllerIndex): ButtonAction[];
|
|
7546
7546
|
|
|
7547
7547
|
/**
|
|
7548
7548
|
* Helper function to get the corresponding "Siren Helper" entity for a stolen familiar.
|
|
@@ -14183,9 +14183,9 @@ export declare class ModUpgraded implements Mod {
|
|
|
14183
14183
|
*/
|
|
14184
14184
|
declare type ModUpgradedWithFeatures<T extends readonly ISCFeature[] = []> = ModUpgraded & ISCFeaturesToKeys<T>;
|
|
14185
14185
|
|
|
14186
|
-
export declare const
|
|
14186
|
+
export declare const MOVEMENT_BUTTON_ACTIONS: readonly [ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN];
|
|
14187
14187
|
|
|
14188
|
-
export declare const
|
|
14188
|
+
export declare const MOVEMENT_BUTTON_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
14189
14189
|
|
|
14190
14190
|
/**
|
|
14191
14191
|
* Helper function to move all of the players to where they would normally go when arriving at a new
|
|
@@ -17243,9 +17243,9 @@ export declare function setUnseeded(): void;
|
|
|
17243
17243
|
*/
|
|
17244
17244
|
export declare const sfxManager: SFXManager;
|
|
17245
17245
|
|
|
17246
|
-
export declare const
|
|
17246
|
+
export declare const SHOOTING_BUTTON_ACTIONS: readonly [ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN];
|
|
17247
17247
|
|
|
17248
|
-
export declare const
|
|
17248
|
+
export declare const SHOOTING_BUTTON_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
17249
17249
|
|
|
17250
17250
|
declare function shouldFireCollectibleType(fireArgs: [player: EntityPlayer, collectibleType: CollectibleType], optionalArgs: [collectibleType?: CollectibleType]): boolean;
|
|
17251
17251
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 61.0.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -26549,10 +26549,10 @@ ____exports.MODIFIER_KEYS = {
|
|
|
26549
26549
|
Keyboard.RIGHT_ALT,
|
|
26550
26550
|
Keyboard.RIGHT_SUPER
|
|
26551
26551
|
}
|
|
26552
|
-
____exports.
|
|
26553
|
-
____exports.
|
|
26554
|
-
____exports.
|
|
26555
|
-
____exports.
|
|
26552
|
+
____exports.MOVEMENT_BUTTON_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
|
|
26553
|
+
____exports.MOVEMENT_BUTTON_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.MOVEMENT_BUTTON_ACTIONS)
|
|
26554
|
+
____exports.SHOOTING_BUTTON_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
|
|
26555
|
+
____exports.SHOOTING_BUTTON_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.SHOOTING_BUTTON_ACTIONS)
|
|
26556
26556
|
function ____exports.controllerToString(self, controller)
|
|
26557
26557
|
local key = Controller[controller]
|
|
26558
26558
|
if key == nil then
|
|
@@ -26560,15 +26560,15 @@ function ____exports.controllerToString(self, controller)
|
|
|
26560
26560
|
end
|
|
26561
26561
|
return trimPrefix(nil, key, "BUTTON_")
|
|
26562
26562
|
end
|
|
26563
|
-
function ____exports.
|
|
26563
|
+
function ____exports.getMoveButtonActions(self, controllerIndex)
|
|
26564
26564
|
return __TS__ArrayFilter(
|
|
26565
|
-
____exports.
|
|
26565
|
+
____exports.MOVEMENT_BUTTON_ACTIONS,
|
|
26566
26566
|
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
26567
26567
|
)
|
|
26568
26568
|
end
|
|
26569
|
-
function ____exports.
|
|
26569
|
+
function ____exports.getShootButtonActions(self, controllerIndex)
|
|
26570
26570
|
return __TS__ArrayFilter(
|
|
26571
|
-
____exports.
|
|
26571
|
+
____exports.SHOOTING_BUTTON_ACTIONS,
|
|
26572
26572
|
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
26573
26573
|
)
|
|
26574
26574
|
end
|
|
@@ -26622,18 +26622,18 @@ function ____exports.isModifierKeyPressed(self)
|
|
|
26622
26622
|
)
|
|
26623
26623
|
end
|
|
26624
26624
|
function ____exports.isMoveAction(self, buttonAction)
|
|
26625
|
-
return ____exports.
|
|
26625
|
+
return ____exports.MOVEMENT_BUTTON_ACTIONS_SET:has(buttonAction)
|
|
26626
26626
|
end
|
|
26627
26627
|
function ____exports.isMoveActionPressed(self, controllerIndex)
|
|
26628
26628
|
return ____exports.isActionPressed(
|
|
26629
26629
|
nil,
|
|
26630
26630
|
controllerIndex,
|
|
26631
|
-
table.unpack(____exports.
|
|
26631
|
+
table.unpack(____exports.MOVEMENT_BUTTON_ACTIONS)
|
|
26632
26632
|
)
|
|
26633
26633
|
end
|
|
26634
26634
|
function ____exports.isMoveActionPressedOnAnyInput(self)
|
|
26635
26635
|
return __TS__ArraySome(
|
|
26636
|
-
____exports.
|
|
26636
|
+
____exports.MOVEMENT_BUTTON_ACTIONS,
|
|
26637
26637
|
function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
|
|
26638
26638
|
)
|
|
26639
26639
|
end
|
|
@@ -26641,28 +26641,28 @@ function ____exports.isMoveActionTriggered(self, controllerIndex)
|
|
|
26641
26641
|
return ____exports.isActionTriggered(
|
|
26642
26642
|
nil,
|
|
26643
26643
|
controllerIndex,
|
|
26644
|
-
table.unpack(____exports.
|
|
26644
|
+
table.unpack(____exports.MOVEMENT_BUTTON_ACTIONS)
|
|
26645
26645
|
)
|
|
26646
26646
|
end
|
|
26647
26647
|
function ____exports.isMoveActionTriggeredOnAnyInput(self)
|
|
26648
26648
|
return __TS__ArraySome(
|
|
26649
|
-
____exports.
|
|
26649
|
+
____exports.MOVEMENT_BUTTON_ACTIONS,
|
|
26650
26650
|
function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
|
|
26651
26651
|
)
|
|
26652
26652
|
end
|
|
26653
26653
|
function ____exports.isShootAction(self, buttonAction)
|
|
26654
|
-
return ____exports.
|
|
26654
|
+
return ____exports.SHOOTING_BUTTON_ACTIONS_SET:has(buttonAction)
|
|
26655
26655
|
end
|
|
26656
26656
|
function ____exports.isShootActionPressed(self, controllerIndex)
|
|
26657
26657
|
return ____exports.isActionPressed(
|
|
26658
26658
|
nil,
|
|
26659
26659
|
controllerIndex,
|
|
26660
|
-
table.unpack(____exports.
|
|
26660
|
+
table.unpack(____exports.SHOOTING_BUTTON_ACTIONS)
|
|
26661
26661
|
)
|
|
26662
26662
|
end
|
|
26663
26663
|
function ____exports.isShootActionPressedOnAnyInput(self)
|
|
26664
26664
|
return __TS__ArraySome(
|
|
26665
|
-
____exports.
|
|
26665
|
+
____exports.SHOOTING_BUTTON_ACTIONS,
|
|
26666
26666
|
function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
|
|
26667
26667
|
)
|
|
26668
26668
|
end
|
|
@@ -26670,12 +26670,12 @@ function ____exports.isShootActionTriggered(self, controllerIndex)
|
|
|
26670
26670
|
return ____exports.isActionTriggered(
|
|
26671
26671
|
nil,
|
|
26672
26672
|
controllerIndex,
|
|
26673
|
-
table.unpack(____exports.
|
|
26673
|
+
table.unpack(____exports.SHOOTING_BUTTON_ACTIONS)
|
|
26674
26674
|
)
|
|
26675
26675
|
end
|
|
26676
26676
|
function ____exports.isShootActionTriggeredOnAnyInput(self)
|
|
26677
26677
|
return __TS__ArraySome(
|
|
26678
|
-
____exports.
|
|
26678
|
+
____exports.SHOOTING_BUTTON_ACTIONS,
|
|
26679
26679
|
function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
|
|
26680
26680
|
)
|
|
26681
26681
|
end
|
|
@@ -41875,8 +41875,8 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
|
41875
41875
|
local ____decorators = require("src.decorators")
|
|
41876
41876
|
local Exported = ____decorators.Exported
|
|
41877
41877
|
local ____input = require("src.functions.input")
|
|
41878
|
-
local
|
|
41879
|
-
local
|
|
41878
|
+
local MOVEMENT_BUTTON_ACTIONS_SET = ____input.MOVEMENT_BUTTON_ACTIONS_SET
|
|
41879
|
+
local SHOOTING_BUTTON_ACTIONS_SET = ____input.SHOOTING_BUTTON_ACTIONS_SET
|
|
41880
41880
|
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
41881
41881
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
41882
41882
|
local ____Feature = require("src.classes.private.Feature")
|
|
@@ -41958,11 +41958,11 @@ function DisableInputs.prototype.disableAllInputsExceptFor(self, key, whitelist)
|
|
|
41958
41958
|
end
|
|
41959
41959
|
__TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableAllInputsExceptFor", true)
|
|
41960
41960
|
function DisableInputs.prototype.disableMovementInputs(self, key)
|
|
41961
|
-
self:enableAllInputsExceptFor(key,
|
|
41961
|
+
self:enableAllInputsExceptFor(key, MOVEMENT_BUTTON_ACTIONS_SET)
|
|
41962
41962
|
end
|
|
41963
41963
|
__TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableMovementInputs", true)
|
|
41964
41964
|
function DisableInputs.prototype.disableShootingInputs(self, key)
|
|
41965
|
-
self:enableAllInputsExceptFor(key,
|
|
41965
|
+
self:enableAllInputsExceptFor(key, SHOOTING_BUTTON_ACTIONS_SET)
|
|
41966
41966
|
end
|
|
41967
41967
|
__TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableShootingInputs", true)
|
|
41968
41968
|
return ____exports
|
|
@@ -12,8 +12,8 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
|
12
12
|
local ____decorators = require("src.decorators")
|
|
13
13
|
local Exported = ____decorators.Exported
|
|
14
14
|
local ____input = require("src.functions.input")
|
|
15
|
-
local
|
|
16
|
-
local
|
|
15
|
+
local MOVEMENT_BUTTON_ACTIONS_SET = ____input.MOVEMENT_BUTTON_ACTIONS_SET
|
|
16
|
+
local SHOOTING_BUTTON_ACTIONS_SET = ____input.SHOOTING_BUTTON_ACTIONS_SET
|
|
17
17
|
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
18
18
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
19
19
|
local ____Feature = require("src.classes.private.Feature")
|
|
@@ -95,11 +95,11 @@ function DisableInputs.prototype.disableAllInputsExceptFor(self, key, whitelist)
|
|
|
95
95
|
end
|
|
96
96
|
__TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableAllInputsExceptFor", true)
|
|
97
97
|
function DisableInputs.prototype.disableMovementInputs(self, key)
|
|
98
|
-
self:enableAllInputsExceptFor(key,
|
|
98
|
+
self:enableAllInputsExceptFor(key, MOVEMENT_BUTTON_ACTIONS_SET)
|
|
99
99
|
end
|
|
100
100
|
__TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableMovementInputs", true)
|
|
101
101
|
function DisableInputs.prototype.disableShootingInputs(self, key)
|
|
102
|
-
self:enableAllInputsExceptFor(key,
|
|
102
|
+
self:enableAllInputsExceptFor(key, SHOOTING_BUTTON_ACTIONS_SET)
|
|
103
103
|
end
|
|
104
104
|
__TS__DecorateLegacy({Exported}, DisableInputs.prototype, "disableShootingInputs", true)
|
|
105
105
|
return ____exports
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ButtonAction, Controller, ControllerIndex, Keyboard } from "isaac-typescript-definitions";
|
|
2
2
|
export declare const MODIFIER_KEYS: readonly [Keyboard.LEFT_SHIFT, Keyboard.LEFT_CONTROL, Keyboard.LEFT_ALT, Keyboard.LEFT_SUPER, Keyboard.RIGHT_SHIFT, Keyboard.RIGHT_CONTROL, Keyboard.RIGHT_ALT, Keyboard.RIGHT_SUPER];
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
3
|
+
export declare const MOVEMENT_BUTTON_ACTIONS: readonly [ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN];
|
|
4
|
+
export declare const MOVEMENT_BUTTON_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
5
|
+
export declare const SHOOTING_BUTTON_ACTIONS: readonly [ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN];
|
|
6
|
+
export declare const SHOOTING_BUTTON_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
7
7
|
/**
|
|
8
8
|
* Helper function to get the enum name for the specified `Controller` value. Note that this will
|
|
9
9
|
* trim off the "BUTTON_" prefix.
|
|
@@ -16,13 +16,13 @@ export declare function controllerToString(controller: Controller): string | und
|
|
|
16
16
|
* pressing down. This returns an array because a player can be holding down more than one movement
|
|
17
17
|
* key at a time.
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function getMoveButtonActions(controllerIndex: ControllerIndex): ButtonAction[];
|
|
20
20
|
/**
|
|
21
21
|
* Helper function to get the shooting actions that the specified `ControllerIndex` is currently
|
|
22
22
|
* pressing down. This returns an array because a player can be holding down more than one shooting
|
|
23
23
|
* key at a time.
|
|
24
24
|
*/
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function getShootButtonActions(controllerIndex: ControllerIndex): ButtonAction[];
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to check if a player is pressing a specific button (i.e. holding it down).
|
|
28
28
|
*
|
|
@@ -1 +1 @@
|
|
|
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;AAMtC,eAAO,MAAM,aAAa,uLAShB,CAAC;AAEX,eAAO,MAAM,
|
|
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;AAMtC,eAAO,MAAM,aAAa,uLAShB,CAAC;AAEX,eAAO,MAAM,uBAAuB,sFAK1B,CAAC;AAEX,eAAO,MAAM,2BAA2B,2BAEvC,CAAC;AAEF,eAAO,MAAM,uBAAuB,8GAK1B,CAAC;AAEX,eAAO,MAAM,2BAA2B,2BAEvC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAQ7E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,eAAe,GAC/B,YAAY,EAAE,CAIhB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,eAAe,GAC/B,YAAY,EAAE,CAIhB;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,CAIT;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,CAIT;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,mBAAmB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAE7E;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAIvD;AAED,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAET;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAIzD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEjE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAET;AAED,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAED,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAET;AAED,wBAAgB,gCAAgC,IAAI,OAAO,CAI1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -26,10 +26,10 @@ ____exports.MODIFIER_KEYS = {
|
|
|
26
26
|
Keyboard.RIGHT_ALT,
|
|
27
27
|
Keyboard.RIGHT_SUPER
|
|
28
28
|
}
|
|
29
|
-
____exports.
|
|
30
|
-
____exports.
|
|
31
|
-
____exports.
|
|
32
|
-
____exports.
|
|
29
|
+
____exports.MOVEMENT_BUTTON_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
|
|
30
|
+
____exports.MOVEMENT_BUTTON_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.MOVEMENT_BUTTON_ACTIONS)
|
|
31
|
+
____exports.SHOOTING_BUTTON_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
|
|
32
|
+
____exports.SHOOTING_BUTTON_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.SHOOTING_BUTTON_ACTIONS)
|
|
33
33
|
--- Helper function to get the enum name for the specified `Controller` value. Note that this will
|
|
34
34
|
-- trim off the "BUTTON_" prefix.
|
|
35
35
|
--
|
|
@@ -44,18 +44,18 @@ end
|
|
|
44
44
|
--- Helper function to get the movement actions that the specified `ControllerIndex` is currently
|
|
45
45
|
-- pressing down. This returns an array because a player can be holding down more than one movement
|
|
46
46
|
-- key at a time.
|
|
47
|
-
function ____exports.
|
|
47
|
+
function ____exports.getMoveButtonActions(self, controllerIndex)
|
|
48
48
|
return __TS__ArrayFilter(
|
|
49
|
-
____exports.
|
|
49
|
+
____exports.MOVEMENT_BUTTON_ACTIONS,
|
|
50
50
|
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
51
51
|
)
|
|
52
52
|
end
|
|
53
53
|
--- Helper function to get the shooting actions that the specified `ControllerIndex` is currently
|
|
54
54
|
-- pressing down. This returns an array because a player can be holding down more than one shooting
|
|
55
55
|
-- key at a time.
|
|
56
|
-
function ____exports.
|
|
56
|
+
function ____exports.getShootButtonActions(self, controllerIndex)
|
|
57
57
|
return __TS__ArrayFilter(
|
|
58
|
-
____exports.
|
|
58
|
+
____exports.SHOOTING_BUTTON_ACTIONS,
|
|
59
59
|
function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
|
|
60
60
|
)
|
|
61
61
|
end
|
|
@@ -136,18 +136,18 @@ function ____exports.isModifierKeyPressed(self)
|
|
|
136
136
|
)
|
|
137
137
|
end
|
|
138
138
|
function ____exports.isMoveAction(self, buttonAction)
|
|
139
|
-
return ____exports.
|
|
139
|
+
return ____exports.MOVEMENT_BUTTON_ACTIONS_SET:has(buttonAction)
|
|
140
140
|
end
|
|
141
141
|
function ____exports.isMoveActionPressed(self, controllerIndex)
|
|
142
142
|
return ____exports.isActionPressed(
|
|
143
143
|
nil,
|
|
144
144
|
controllerIndex,
|
|
145
|
-
table.unpack(____exports.
|
|
145
|
+
table.unpack(____exports.MOVEMENT_BUTTON_ACTIONS)
|
|
146
146
|
)
|
|
147
147
|
end
|
|
148
148
|
function ____exports.isMoveActionPressedOnAnyInput(self)
|
|
149
149
|
return __TS__ArraySome(
|
|
150
|
-
____exports.
|
|
150
|
+
____exports.MOVEMENT_BUTTON_ACTIONS,
|
|
151
151
|
function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
|
|
152
152
|
)
|
|
153
153
|
end
|
|
@@ -155,28 +155,28 @@ function ____exports.isMoveActionTriggered(self, controllerIndex)
|
|
|
155
155
|
return ____exports.isActionTriggered(
|
|
156
156
|
nil,
|
|
157
157
|
controllerIndex,
|
|
158
|
-
table.unpack(____exports.
|
|
158
|
+
table.unpack(____exports.MOVEMENT_BUTTON_ACTIONS)
|
|
159
159
|
)
|
|
160
160
|
end
|
|
161
161
|
function ____exports.isMoveActionTriggeredOnAnyInput(self)
|
|
162
162
|
return __TS__ArraySome(
|
|
163
|
-
____exports.
|
|
163
|
+
____exports.MOVEMENT_BUTTON_ACTIONS,
|
|
164
164
|
function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
|
|
165
165
|
)
|
|
166
166
|
end
|
|
167
167
|
function ____exports.isShootAction(self, buttonAction)
|
|
168
|
-
return ____exports.
|
|
168
|
+
return ____exports.SHOOTING_BUTTON_ACTIONS_SET:has(buttonAction)
|
|
169
169
|
end
|
|
170
170
|
function ____exports.isShootActionPressed(self, controllerIndex)
|
|
171
171
|
return ____exports.isActionPressed(
|
|
172
172
|
nil,
|
|
173
173
|
controllerIndex,
|
|
174
|
-
table.unpack(____exports.
|
|
174
|
+
table.unpack(____exports.SHOOTING_BUTTON_ACTIONS)
|
|
175
175
|
)
|
|
176
176
|
end
|
|
177
177
|
function ____exports.isShootActionPressedOnAnyInput(self)
|
|
178
178
|
return __TS__ArraySome(
|
|
179
|
-
____exports.
|
|
179
|
+
____exports.SHOOTING_BUTTON_ACTIONS,
|
|
180
180
|
function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
|
|
181
181
|
)
|
|
182
182
|
end
|
|
@@ -184,12 +184,12 @@ function ____exports.isShootActionTriggered(self, controllerIndex)
|
|
|
184
184
|
return ____exports.isActionTriggered(
|
|
185
185
|
nil,
|
|
186
186
|
controllerIndex,
|
|
187
|
-
table.unpack(____exports.
|
|
187
|
+
table.unpack(____exports.SHOOTING_BUTTON_ACTIONS)
|
|
188
188
|
)
|
|
189
189
|
end
|
|
190
190
|
function ____exports.isShootActionTriggeredOnAnyInput(self)
|
|
191
191
|
return __TS__ArraySome(
|
|
192
|
-
____exports.
|
|
192
|
+
____exports.SHOOTING_BUTTON_ACTIONS,
|
|
193
193
|
function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
|
|
194
194
|
)
|
|
195
195
|
end
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@ import type { ButtonAction } from "isaac-typescript-definitions";
|
|
|
2
2
|
import { InputHook, ModCallback } from "isaac-typescript-definitions";
|
|
3
3
|
import { Exported } from "../../../decorators";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
MOVEMENT_BUTTON_ACTIONS_SET,
|
|
6
|
+
SHOOTING_BUTTON_ACTIONS_SET,
|
|
7
7
|
} from "../../../functions/input";
|
|
8
8
|
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
9
9
|
import { Feature } from "../../private/Feature";
|
|
@@ -246,7 +246,7 @@ export class DisableInputs extends Feature {
|
|
|
246
246
|
*/
|
|
247
247
|
@Exported
|
|
248
248
|
public disableMovementInputs(key: string): void {
|
|
249
|
-
this.enableAllInputsExceptFor(key,
|
|
249
|
+
this.enableAllInputsExceptFor(key, MOVEMENT_BUTTON_ACTIONS_SET);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
/**
|
|
@@ -264,6 +264,6 @@ export class DisableInputs extends Feature {
|
|
|
264
264
|
*/
|
|
265
265
|
@Exported
|
|
266
266
|
public disableShootingInputs(key: string): void {
|
|
267
|
-
this.enableAllInputsExceptFor(key,
|
|
267
|
+
this.enableAllInputsExceptFor(key, SHOOTING_BUTTON_ACTIONS_SET);
|
|
268
268
|
}
|
|
269
269
|
}
|
package/src/functions/input.ts
CHANGED
|
@@ -20,26 +20,26 @@ export const MODIFIER_KEYS = [
|
|
|
20
20
|
Keyboard.RIGHT_SUPER, // 347
|
|
21
21
|
] as const;
|
|
22
22
|
|
|
23
|
-
export const
|
|
23
|
+
export const MOVEMENT_BUTTON_ACTIONS = [
|
|
24
24
|
ButtonAction.LEFT, // 0
|
|
25
25
|
ButtonAction.RIGHT, // 1
|
|
26
26
|
ButtonAction.UP, // 2
|
|
27
27
|
ButtonAction.DOWN, // 3
|
|
28
28
|
] as const;
|
|
29
29
|
|
|
30
|
-
export const
|
|
31
|
-
|
|
30
|
+
export const MOVEMENT_BUTTON_ACTIONS_SET = new ReadonlySet<ButtonAction>(
|
|
31
|
+
MOVEMENT_BUTTON_ACTIONS,
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
export const
|
|
34
|
+
export const SHOOTING_BUTTON_ACTIONS = [
|
|
35
35
|
ButtonAction.SHOOT_LEFT, // 4
|
|
36
36
|
ButtonAction.SHOOT_RIGHT, // 5
|
|
37
37
|
ButtonAction.SHOOT_UP, // 6
|
|
38
38
|
ButtonAction.SHOOT_DOWN, // 7
|
|
39
39
|
] as const;
|
|
40
40
|
|
|
41
|
-
export const
|
|
42
|
-
|
|
41
|
+
export const SHOOTING_BUTTON_ACTIONS_SET = new ReadonlySet<ButtonAction>(
|
|
42
|
+
SHOOTING_BUTTON_ACTIONS,
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -63,10 +63,10 @@ export function controllerToString(controller: Controller): string | undefined {
|
|
|
63
63
|
* pressing down. This returns an array because a player can be holding down more than one movement
|
|
64
64
|
* key at a time.
|
|
65
65
|
*/
|
|
66
|
-
export function
|
|
66
|
+
export function getMoveButtonActions(
|
|
67
67
|
controllerIndex: ControllerIndex,
|
|
68
68
|
): ButtonAction[] {
|
|
69
|
-
return
|
|
69
|
+
return MOVEMENT_BUTTON_ACTIONS.filter((buttonAction) =>
|
|
70
70
|
Input.IsActionPressed(buttonAction, controllerIndex),
|
|
71
71
|
);
|
|
72
72
|
}
|
|
@@ -76,10 +76,10 @@ export function getMoveActions(
|
|
|
76
76
|
* pressing down. This returns an array because a player can be holding down more than one shooting
|
|
77
77
|
* key at a time.
|
|
78
78
|
*/
|
|
79
|
-
export function
|
|
79
|
+
export function getShootButtonActions(
|
|
80
80
|
controllerIndex: ControllerIndex,
|
|
81
81
|
): ButtonAction[] {
|
|
82
|
-
return
|
|
82
|
+
return SHOOTING_BUTTON_ACTIONS.filter((buttonAction) =>
|
|
83
83
|
Input.IsActionPressed(buttonAction, controllerIndex),
|
|
84
84
|
);
|
|
85
85
|
}
|
|
@@ -168,15 +168,15 @@ export function isModifierKeyPressed(): boolean {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
export function isMoveAction(buttonAction: ButtonAction): boolean {
|
|
171
|
-
return
|
|
171
|
+
return MOVEMENT_BUTTON_ACTIONS_SET.has(buttonAction);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
export function isMoveActionPressed(controllerIndex: ControllerIndex): boolean {
|
|
175
|
-
return isActionPressed(controllerIndex, ...
|
|
175
|
+
return isActionPressed(controllerIndex, ...MOVEMENT_BUTTON_ACTIONS);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
export function isMoveActionPressedOnAnyInput(): boolean {
|
|
179
|
-
return
|
|
179
|
+
return MOVEMENT_BUTTON_ACTIONS.some((moveAction) =>
|
|
180
180
|
isActionPressedOnAnyInput(moveAction),
|
|
181
181
|
);
|
|
182
182
|
}
|
|
@@ -184,27 +184,27 @@ export function isMoveActionPressedOnAnyInput(): boolean {
|
|
|
184
184
|
export function isMoveActionTriggered(
|
|
185
185
|
controllerIndex: ControllerIndex,
|
|
186
186
|
): boolean {
|
|
187
|
-
return isActionTriggered(controllerIndex, ...
|
|
187
|
+
return isActionTriggered(controllerIndex, ...MOVEMENT_BUTTON_ACTIONS);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
export function isMoveActionTriggeredOnAnyInput(): boolean {
|
|
191
|
-
return
|
|
191
|
+
return MOVEMENT_BUTTON_ACTIONS.some((moveAction) =>
|
|
192
192
|
isActionTriggeredOnAnyInput(moveAction),
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
export function isShootAction(buttonAction: ButtonAction): boolean {
|
|
197
|
-
return
|
|
197
|
+
return SHOOTING_BUTTON_ACTIONS_SET.has(buttonAction);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
export function isShootActionPressed(
|
|
201
201
|
controllerIndex: ControllerIndex,
|
|
202
202
|
): boolean {
|
|
203
|
-
return isActionPressed(controllerIndex, ...
|
|
203
|
+
return isActionPressed(controllerIndex, ...SHOOTING_BUTTON_ACTIONS);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
export function isShootActionPressedOnAnyInput(): boolean {
|
|
207
|
-
return
|
|
207
|
+
return SHOOTING_BUTTON_ACTIONS.some((shootAction) =>
|
|
208
208
|
isActionPressedOnAnyInput(shootAction),
|
|
209
209
|
);
|
|
210
210
|
}
|
|
@@ -212,11 +212,11 @@ export function isShootActionPressedOnAnyInput(): boolean {
|
|
|
212
212
|
export function isShootActionTriggered(
|
|
213
213
|
controllerIndex: ControllerIndex,
|
|
214
214
|
): boolean {
|
|
215
|
-
return isActionTriggered(controllerIndex, ...
|
|
215
|
+
return isActionTriggered(controllerIndex, ...SHOOTING_BUTTON_ACTIONS);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
export function isShootActionTriggeredOnAnyInput(): boolean {
|
|
219
|
-
return
|
|
219
|
+
return SHOOTING_BUTTON_ACTIONS.some((shootAction) =>
|
|
220
220
|
isActionTriggeredOnAnyInput(shootAction),
|
|
221
221
|
);
|
|
222
222
|
}
|