isaacscript-common 1.2.43 → 1.2.46
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/callbacks/postBoneSwing.lua +9 -3
- package/dist/callbacks/postTransformation.lua +15 -7
- package/dist/constants.d.ts +0 -4
- package/dist/constants.lua +0 -4
- package/dist/features/disableInputs.d.ts +40 -37
- package/dist/features/disableInputs.lua +39 -31
- package/dist/functions/input.d.ts +4 -0
- package/dist/functions/input.lua +20 -2
- package/dist/functions/player.d.ts +11 -6
- package/dist/functions/player.lua +54 -41
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Map = ____lualib.Map
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local hasSubscriptions, postKnifeRenderBoneClub, boneClubAnimationChanged, BONE_SWING_ANIMATIONS, v
|
|
7
|
+
local hasSubscriptions, postKnifeRender, postKnifeRenderBoneClub, boneClubAnimationChanged, BONE_SWING_ANIMATIONS, v
|
|
8
8
|
local ____exports = require("features.saveDataManager.exports")
|
|
9
9
|
local saveDataManager = ____exports.saveDataManager
|
|
10
10
|
local ____postBoneSwing = require("callbacks.subscriptions.postBoneSwing")
|
|
@@ -13,10 +13,16 @@ local postBoneSwingHasSubscriptions = ____postBoneSwing.postBoneSwingHasSubscrip
|
|
|
13
13
|
function hasSubscriptions(self)
|
|
14
14
|
return postBoneSwingHasSubscriptions(nil)
|
|
15
15
|
end
|
|
16
|
-
function
|
|
16
|
+
function postKnifeRender(self, knife)
|
|
17
17
|
if not hasSubscriptions(nil) then
|
|
18
18
|
return
|
|
19
19
|
end
|
|
20
|
+
if knife.Variant ~= 1 then
|
|
21
|
+
return
|
|
22
|
+
end
|
|
23
|
+
postKnifeRenderBoneClub(nil, knife)
|
|
24
|
+
end
|
|
25
|
+
function postKnifeRenderBoneClub(self, boneClub)
|
|
20
26
|
local sprite = boneClub:GetSprite()
|
|
21
27
|
local animation = sprite:GetAnimation()
|
|
22
28
|
local ptrHash = GetPtrHash(boneClub)
|
|
@@ -35,6 +41,6 @@ BONE_SWING_ANIMATIONS = __TS__New(Set, {"Swing", "Swing2", "Spin"})
|
|
|
35
41
|
v = {room = {boneClubAnimations = __TS__New(Map)}}
|
|
36
42
|
function ____exports.postBoneSwingCallbackInit(self, mod)
|
|
37
43
|
saveDataManager(nil, "postBoneSwing", v, hasSubscriptions)
|
|
38
|
-
mod:AddCallback(ModCallbacks.MC_POST_KNIFE_RENDER,
|
|
44
|
+
mod:AddCallback(ModCallbacks.MC_POST_KNIFE_RENDER, postKnifeRender)
|
|
39
45
|
end
|
|
40
46
|
return ____exports
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local Map = ____lualib.Map
|
|
5
6
|
local ____exports = {}
|
|
6
|
-
local hasSubscriptions, postPEffectUpdateReordered, v
|
|
7
|
+
local hasSubscriptions, postPEffectUpdateReordered, UNUSED_TRANSFORMATIONS, v
|
|
7
8
|
local ____exports = require("features.saveDataManager.exports")
|
|
8
9
|
local saveDataManager = ____exports.saveDataManager
|
|
9
10
|
local ____array = require("functions.array")
|
|
@@ -31,16 +32,23 @@ function postPEffectUpdateReordered(self, player)
|
|
|
31
32
|
do
|
|
32
33
|
local playerForm = 0
|
|
33
34
|
while playerForm < PlayerForm.NUM_PLAYER_FORMS do
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
do
|
|
36
|
+
if UNUSED_TRANSFORMATIONS:has(playerForm) then
|
|
37
|
+
goto __continue7
|
|
38
|
+
end
|
|
39
|
+
local hasForm = player:HasPlayerForm(playerForm)
|
|
40
|
+
local storedForm = transformations[playerForm + 1]
|
|
41
|
+
if hasForm ~= storedForm then
|
|
42
|
+
transformations[playerForm + 1] = hasForm
|
|
43
|
+
postTransformationFire(nil, player, playerForm, hasForm)
|
|
44
|
+
end
|
|
39
45
|
end
|
|
46
|
+
::__continue7::
|
|
40
47
|
playerForm = playerForm + 1
|
|
41
48
|
end
|
|
42
49
|
end
|
|
43
50
|
end
|
|
51
|
+
UNUSED_TRANSFORMATIONS = __TS__New(Set, {PlayerForm.PLAYERFORM_FLIGHT})
|
|
44
52
|
v = {run = {transformations = __TS__New(Map)}}
|
|
45
53
|
function ____exports.postTransformationCallbackInit(self, mod)
|
|
46
54
|
saveDataManager(nil, "postTransformation", v, hasSubscriptions)
|
package/dist/constants.d.ts
CHANGED
|
@@ -104,12 +104,8 @@ export declare const MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B;
|
|
|
104
104
|
export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
|
|
105
105
|
export declare const SECOND_IN_MILLISECONDS = 1000;
|
|
106
106
|
export declare const MINUTE_IN_MILLISECONDS: number;
|
|
107
|
-
export declare const MOVEMENT_ACTIONS: readonly ButtonAction[];
|
|
108
|
-
export declare const MOVEMENT_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
109
107
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
110
108
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: ReadonlySet<CollectibleType>;
|
|
111
|
-
export declare const SHOOTING_ACTIONS: readonly ButtonAction[];
|
|
112
|
-
export declare const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction>;
|
|
113
109
|
export declare const STORY_BOSSES: ReadonlySet<EntityType>;
|
|
114
110
|
/**
|
|
115
111
|
* This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
package/dist/constants.lua
CHANGED
|
@@ -90,8 +90,6 @@ ____exports.MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B
|
|
|
90
90
|
____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
|
|
91
91
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
92
92
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
93
|
-
____exports.MOVEMENT_ACTIONS = {ButtonAction.ACTION_LEFT, ButtonAction.ACTION_RIGHT, ButtonAction.ACTION_UP, ButtonAction.ACTION_DOWN}
|
|
94
|
-
____exports.MOVEMENT_ACTIONS_SET = __TS__New(Set, ____exports.MOVEMENT_ACTIONS)
|
|
95
93
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
96
94
|
____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
97
95
|
CollectibleType.COLLECTIBLE_FORGET_ME_NOW,
|
|
@@ -103,8 +101,6 @@ ____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
|
103
101
|
CollectibleType.COLLECTIBLE_DEATH_CERTIFICATE,
|
|
104
102
|
CollectibleType.COLLECTIBLE_R_KEY
|
|
105
103
|
})
|
|
106
|
-
____exports.SHOOTING_ACTIONS = {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN}
|
|
107
|
-
____exports.SHOOTING_ACTIONS_SET = __TS__New(Set, ____exports.SHOOTING_ACTIONS)
|
|
108
104
|
____exports.STORY_BOSSES = __TS__New(Set, {
|
|
109
105
|
EntityType.ENTITY_MOM,
|
|
110
106
|
EntityType.ENTITY_MOMS_HEART,
|
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/** After having disabled inputs, use this function to set things back to normal. */
|
|
3
|
-
export declare function enableAllInputs(): void;
|
|
4
2
|
/**
|
|
5
|
-
* Helper function to
|
|
6
|
-
*
|
|
7
|
-
* conditions.
|
|
3
|
+
* Helper function to enable all inputs. Use this function to set things back to normal after having
|
|
4
|
+
* used one of the other helper functions to disable inputs.
|
|
8
5
|
*
|
|
9
|
-
*
|
|
6
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
7
|
+
* that multiple mod features can work in tandem.
|
|
8
|
+
*/
|
|
9
|
+
export declare function enableAllInputs(key: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to disable all inputs. This is useful because `EntityPlayer.ControlsEnabled` can
|
|
12
|
+
* be changed by the game under certain conditions.
|
|
13
|
+
*
|
|
14
|
+
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
10
15
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
16
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
17
|
+
* that multiple mod features can work in tandem.
|
|
13
18
|
*/
|
|
14
|
-
export declare function disableAllInputs(): void;
|
|
19
|
+
export declare function disableAllInputs(key: string): void;
|
|
15
20
|
/**
|
|
16
|
-
* Helper function to enable all inputs besides the ones provided.
|
|
17
|
-
*
|
|
18
|
-
* conditions.
|
|
21
|
+
* Helper function to enable all inputs besides the ones provided. This is useful because
|
|
22
|
+
* `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
19
23
|
*
|
|
20
|
-
*
|
|
24
|
+
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
21
25
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
26
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
27
|
+
* that multiple mod features can work in tandem.
|
|
28
|
+
* @param blacklist A set of ButtonActions to disallow.
|
|
24
29
|
*/
|
|
25
|
-
export declare function enableAllInputsExceptFor(blacklist: Set<ButtonAction> | ReadonlySet<ButtonAction>): void;
|
|
30
|
+
export declare function enableAllInputsExceptFor(key: string, blacklist: Set<ButtonAction> | ReadonlySet<ButtonAction>): void;
|
|
26
31
|
/**
|
|
27
|
-
* Helper function to disable all inputs besides the ones provided.
|
|
28
|
-
*
|
|
29
|
-
* conditions.
|
|
32
|
+
* Helper function to disable all inputs besides the ones provided. This is useful because
|
|
33
|
+
* `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
30
34
|
*
|
|
31
|
-
*
|
|
35
|
+
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
32
36
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
37
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
38
|
+
* that multiple mod features can work in tandem.
|
|
39
|
+
* @param whitelist A set of ButtonActions to allow.
|
|
35
40
|
*/
|
|
36
|
-
export declare function disableAllInputsExceptFor(whitelist: Set<ButtonAction>): void;
|
|
41
|
+
export declare function disableAllInputsExceptFor(key: string, whitelist: Set<ButtonAction>): void;
|
|
37
42
|
/**
|
|
38
43
|
* Helper function to disable only the inputs used for moving the character (or moving the cursor in
|
|
39
|
-
* the UI).
|
|
40
|
-
*
|
|
41
|
-
* conditions.
|
|
44
|
+
* the UI). This is useful because `EntityPlayer.ControlsEnabled` can be changed by the game under
|
|
45
|
+
* certain conditions.
|
|
42
46
|
*
|
|
43
|
-
*
|
|
47
|
+
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
44
48
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
49
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
50
|
+
* that multiple mod features can work in tandem.
|
|
47
51
|
*/
|
|
48
|
-
export declare function disableMovementInputs(): void;
|
|
52
|
+
export declare function disableMovementInputs(key: string): void;
|
|
49
53
|
/**
|
|
50
|
-
* Helper function to disable only the inputs used for shooting tears.
|
|
51
|
-
*
|
|
52
|
-
* conditions.
|
|
54
|
+
* Helper function to disable only the inputs used for shooting tears. This is useful because
|
|
55
|
+
* `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
53
56
|
*
|
|
54
|
-
*
|
|
57
|
+
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
55
58
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
59
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
60
|
+
* that multiple mod features can work in tandem.
|
|
58
61
|
*/
|
|
59
|
-
export declare function disableShootingInputs(): void;
|
|
62
|
+
export declare function disableShootingInputs(key: string): void;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
3
6
|
local Set = ____lualib.Set
|
|
4
7
|
local ____exports = {}
|
|
5
8
|
local isActionPressed, isActionTriggered, getActionValue, getReturnValue, v
|
|
6
|
-
local ____constants = require("constants")
|
|
7
|
-
local MOVEMENT_ACTIONS_SET = ____constants.MOVEMENT_ACTIONS_SET
|
|
8
|
-
local SHOOTING_ACTIONS_SET = ____constants.SHOOTING_ACTIONS_SET
|
|
9
9
|
local ____errors = require("errors")
|
|
10
10
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
11
|
+
local ____input = require("functions.input")
|
|
12
|
+
local getMoveActions = ____input.getMoveActions
|
|
13
|
+
local getShootActions = ____input.getShootActions
|
|
11
14
|
local ____exports = require("features.saveDataManager.exports")
|
|
12
15
|
local saveDataManager = ____exports.saveDataManager
|
|
13
16
|
function isActionPressed(self, _entity, _inputHook, buttonAction)
|
|
@@ -27,20 +30,24 @@ function getReturnValue(self, buttonAction, booleanCallback)
|
|
|
27
30
|
____booleanCallback_0 = 0
|
|
28
31
|
end
|
|
29
32
|
local disableValue = ____booleanCallback_0
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
for ____, whitelist in __TS__Iterator(v.run.disableInputsWithWhitelistMap:values()) do
|
|
34
|
+
if not whitelist:has(buttonAction) then
|
|
35
|
+
return disableValue
|
|
36
|
+
end
|
|
32
37
|
end
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return disableValue
|
|
38
|
+
for ____, blacklist in __TS__Iterator(v.run.enableInputsWithBlacklistMap:values()) do
|
|
39
|
+
if blacklist:has(buttonAction) then
|
|
40
|
+
return disableValue
|
|
41
|
+
end
|
|
38
42
|
end
|
|
39
43
|
return nil
|
|
40
44
|
end
|
|
41
45
|
local FEATURE_NAME = "input disabler"
|
|
42
46
|
local initialized = false
|
|
43
|
-
v = {run = {
|
|
47
|
+
v = {run = {
|
|
48
|
+
disableInputsWithWhitelistMap = __TS__New(Map),
|
|
49
|
+
enableInputsWithBlacklistMap = __TS__New(Map)
|
|
50
|
+
}}
|
|
44
51
|
function ____exports.disableInputsInit(self, mod)
|
|
45
52
|
initialized = true
|
|
46
53
|
saveDataManager(nil, "disableInputs", v)
|
|
@@ -48,46 +55,47 @@ function ____exports.disableInputsInit(self, mod)
|
|
|
48
55
|
mod:AddCallback(ModCallbacks.MC_INPUT_ACTION, isActionTriggered, InputHook.IS_ACTION_TRIGGERED)
|
|
49
56
|
mod:AddCallback(ModCallbacks.MC_INPUT_ACTION, getActionValue, InputHook.GET_ACTION_VALUE)
|
|
50
57
|
end
|
|
51
|
-
function ____exports.enableAllInputs(self)
|
|
58
|
+
function ____exports.enableAllInputs(self, key)
|
|
52
59
|
if not initialized then
|
|
53
60
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
54
61
|
error(msg)
|
|
55
62
|
end
|
|
56
|
-
v.run.
|
|
57
|
-
v.run.
|
|
58
|
-
v.run.blacklist = nil
|
|
63
|
+
v.run.disableInputsWithWhitelistMap:delete(key)
|
|
64
|
+
v.run.enableInputsWithBlacklistMap:delete(key)
|
|
59
65
|
end
|
|
60
|
-
function ____exports.disableAllInputs(self)
|
|
66
|
+
function ____exports.disableAllInputs(self, key)
|
|
61
67
|
if not initialized then
|
|
62
68
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
63
69
|
error(msg)
|
|
64
70
|
end
|
|
65
|
-
v.run.
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
v.run.disableInputsWithWhitelistMap:set(
|
|
72
|
+
key,
|
|
73
|
+
__TS__New(Set)
|
|
74
|
+
)
|
|
75
|
+
v.run.enableInputsWithBlacklistMap:delete(key)
|
|
68
76
|
end
|
|
69
|
-
function ____exports.enableAllInputsExceptFor(self, blacklist)
|
|
77
|
+
function ____exports.enableAllInputsExceptFor(self, key, blacklist)
|
|
70
78
|
if not initialized then
|
|
71
79
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
72
80
|
error(msg)
|
|
73
81
|
end
|
|
74
|
-
v.run.
|
|
75
|
-
v.run.
|
|
76
|
-
v.run.blacklist = blacklist
|
|
82
|
+
v.run.disableInputsWithWhitelistMap:delete(key)
|
|
83
|
+
v.run.enableInputsWithBlacklistMap:set(key, blacklist)
|
|
77
84
|
end
|
|
78
|
-
function ____exports.disableAllInputsExceptFor(self, whitelist)
|
|
85
|
+
function ____exports.disableAllInputsExceptFor(self, key, whitelist)
|
|
79
86
|
if not initialized then
|
|
80
87
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
81
88
|
error(msg)
|
|
82
89
|
end
|
|
83
|
-
v.run.
|
|
84
|
-
v.run.
|
|
85
|
-
v.run.blacklist = nil
|
|
90
|
+
v.run.disableInputsWithWhitelistMap:set(key, whitelist)
|
|
91
|
+
v.run.enableInputsWithBlacklistMap:delete(key)
|
|
86
92
|
end
|
|
87
|
-
function ____exports.disableMovementInputs(self)
|
|
88
|
-
|
|
93
|
+
function ____exports.disableMovementInputs(self, key)
|
|
94
|
+
local moveActions = getMoveActions(nil)
|
|
95
|
+
____exports.enableAllInputsExceptFor(nil, key, moveActions)
|
|
89
96
|
end
|
|
90
|
-
function ____exports.disableShootingInputs(self)
|
|
91
|
-
|
|
97
|
+
function ____exports.disableShootingInputs(self, key)
|
|
98
|
+
local shootActions = getShootActions(nil)
|
|
99
|
+
____exports.enableAllInputsExceptFor(nil, key, shootActions)
|
|
92
100
|
end
|
|
93
101
|
return ____exports
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/** Helper function to get the enum name for the specified `Controller` value. */
|
|
3
3
|
export declare function controllerToString(controller: Controller): string;
|
|
4
|
+
export declare function getMoveActions(): Set<ButtonAction>;
|
|
5
|
+
export declare function getShootActions(): Set<ButtonAction>;
|
|
4
6
|
/** Iterates over all inputs to determine if a particular button is pressed (i.e. held down). */
|
|
5
7
|
export declare function isActionPressedOnAnyInput(buttonAction: ButtonAction): boolean;
|
|
6
8
|
/**
|
|
@@ -9,8 +11,10 @@ export declare function isActionPressedOnAnyInput(buttonAction: ButtonAction): b
|
|
|
9
11
|
*/
|
|
10
12
|
export declare function isActionTriggeredOnAnyInput(buttonAction: ButtonAction): boolean;
|
|
11
13
|
export declare function isKeyboardPressed(key: Keyboard): boolean;
|
|
14
|
+
export declare function isMoveAction(buttonAction: ButtonAction): boolean;
|
|
12
15
|
export declare function isMoveActionPressedOnAnyInput(): boolean;
|
|
13
16
|
export declare function isMoveActionTriggeredOnAnyInput(): boolean;
|
|
17
|
+
export declare function isShootAction(buttonAction: ButtonAction): boolean;
|
|
14
18
|
export declare function isShootActionPressedOnAnyInput(): boolean;
|
|
15
19
|
export declare function isShootActionTriggeredOnAnyInput(): boolean;
|
|
16
20
|
/** Helper function to get the enum name for the specified `Keyboard` value. */
|
package/dist/functions/input.lua
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
5
|
local __TS__StringReplace = ____lualib.__TS__StringReplace
|
|
4
6
|
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
5
7
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
@@ -7,10 +9,10 @@ local __TS__StringSlice = ____lualib.__TS__StringSlice
|
|
|
7
9
|
local ____exports = {}
|
|
8
10
|
local ____constants = require("constants")
|
|
9
11
|
local MAX_NUM_INPUTS = ____constants.MAX_NUM_INPUTS
|
|
10
|
-
local MOVEMENT_ACTIONS = ____constants.MOVEMENT_ACTIONS
|
|
11
|
-
local SHOOTING_ACTIONS = ____constants.SHOOTING_ACTIONS
|
|
12
12
|
local ____math = require("functions.math")
|
|
13
13
|
local range = ____math.range
|
|
14
|
+
local ____set = require("functions.set")
|
|
15
|
+
local copySet = ____set.copySet
|
|
14
16
|
local ControllerLiteral = ControllerLiteral or ({})
|
|
15
17
|
ControllerLiteral.DPAD_LEFT = 0
|
|
16
18
|
ControllerLiteral[ControllerLiteral.DPAD_LEFT] = "DPAD_LEFT"
|
|
@@ -44,6 +46,10 @@ ControllerLiteral.BUTTON_BACK = 14
|
|
|
44
46
|
ControllerLiteral[ControllerLiteral.BUTTON_BACK] = "BUTTON_BACK"
|
|
45
47
|
ControllerLiteral.BUTTON_START = 15
|
|
46
48
|
ControllerLiteral[ControllerLiteral.BUTTON_START] = "BUTTON_START"
|
|
49
|
+
local MOVEMENT_ACTIONS = {ButtonAction.ACTION_LEFT, ButtonAction.ACTION_RIGHT, ButtonAction.ACTION_UP, ButtonAction.ACTION_DOWN}
|
|
50
|
+
local MOVEMENT_ACTIONS_SET = __TS__New(Set, MOVEMENT_ACTIONS)
|
|
51
|
+
local SHOOTING_ACTIONS = {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN}
|
|
52
|
+
local SHOOTING_ACTIONS_SET = __TS__New(Set, SHOOTING_ACTIONS)
|
|
47
53
|
function ____exports.controllerToString(self, controller)
|
|
48
54
|
for ____, ____value in ipairs(__TS__ObjectEntries(ControllerLiteral)) do
|
|
49
55
|
local key = ____value[1]
|
|
@@ -72,6 +78,12 @@ function ____exports.controllerToString(self, controller)
|
|
|
72
78
|
end
|
|
73
79
|
return "unknown"
|
|
74
80
|
end
|
|
81
|
+
function ____exports.getMoveActions(self)
|
|
82
|
+
return copySet(nil, MOVEMENT_ACTIONS_SET)
|
|
83
|
+
end
|
|
84
|
+
function ____exports.getShootActions(self)
|
|
85
|
+
return copySet(nil, SHOOTING_ACTIONS_SET)
|
|
86
|
+
end
|
|
75
87
|
function ____exports.isActionPressedOnAnyInput(self, buttonAction)
|
|
76
88
|
local validInputs = range(nil, 0, MAX_NUM_INPUTS - 1)
|
|
77
89
|
return __TS__ArraySome(
|
|
@@ -89,6 +101,9 @@ end
|
|
|
89
101
|
function ____exports.isKeyboardPressed(self, key)
|
|
90
102
|
return Input.IsButtonPressed(key, 0)
|
|
91
103
|
end
|
|
104
|
+
function ____exports.isMoveAction(self, buttonAction)
|
|
105
|
+
return MOVEMENT_ACTIONS_SET:has(buttonAction)
|
|
106
|
+
end
|
|
92
107
|
function ____exports.isMoveActionPressedOnAnyInput(self)
|
|
93
108
|
return __TS__ArraySome(
|
|
94
109
|
MOVEMENT_ACTIONS,
|
|
@@ -101,6 +116,9 @@ function ____exports.isMoveActionTriggeredOnAnyInput(self)
|
|
|
101
116
|
function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
|
|
102
117
|
)
|
|
103
118
|
end
|
|
119
|
+
function ____exports.isShootAction(self, buttonAction)
|
|
120
|
+
return SHOOTING_ACTIONS_SET:has(buttonAction)
|
|
121
|
+
end
|
|
104
122
|
function ____exports.isShootActionPressedOnAnyInput(self)
|
|
105
123
|
return __TS__ArraySome(
|
|
106
124
|
SHOOTING_ACTIONS,
|
|
@@ -60,8 +60,8 @@ export declare function getClosestPlayer(position: Vector): EntityPlayer;
|
|
|
60
60
|
*/
|
|
61
61
|
export declare function getDeathAnimationName(player: EntityPlayer): string;
|
|
62
62
|
/**
|
|
63
|
-
* Helper function to return the player with the highest
|
|
64
|
-
*
|
|
63
|
+
* Helper function to return the player with the highest ID, according to the `Isaac.GetPlayer()`
|
|
64
|
+
* method.
|
|
65
65
|
*/
|
|
66
66
|
export declare function getFinalPlayer(): EntityPlayer;
|
|
67
67
|
/**
|
|
@@ -116,12 +116,17 @@ export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlay
|
|
|
116
116
|
* continuing.
|
|
117
117
|
* - We cannot use `GetPtrHash()` as an index because it does not persist across exiting and
|
|
118
118
|
* relaunching the game.
|
|
119
|
+
* - We cannot use `EntityPlayer.InitSeed` because it is not consistent with additional players
|
|
120
|
+
* beyond the first.
|
|
119
121
|
*
|
|
120
|
-
* Instead, we use `EntityPlayer.GetCollectibleRNG()` with an arbitrary value of
|
|
121
|
-
*
|
|
122
|
+
* Instead, we use `EntityPlayer.GetCollectibleRNG()` with an arbitrary value of Sad Onion (1). This
|
|
123
|
+
* works even if the player does not have any Sad Onions.
|
|
122
124
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
+
* Since the RNG value is the same for both The Forgotten and The Soul, we revert to using the RNG
|
|
126
|
+
* of Inner Eye (2) for The Soul.
|
|
127
|
+
*
|
|
128
|
+
* Since the RNG value is the same for both Tainted Lazarus and Dead Tainted Lazarus, we revert to
|
|
129
|
+
* using the RNG of Spoon Bender (3) for Dead Tainted Lazarus.
|
|
125
130
|
*/
|
|
126
131
|
export declare function getPlayerIndex(player: EntityPlayer): PlayerIndex;
|
|
127
132
|
/**
|
|
@@ -9,7 +9,7 @@ local __TS__Iterator = ____lualib.__TS__Iterator
|
|
|
9
9
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
10
10
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
11
11
|
local ____exports = {}
|
|
12
|
-
local getAdjustedPlayerName, isTaintedModded, EXCLUDED_CHARACTERS
|
|
12
|
+
local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, EXCLUDED_CHARACTERS
|
|
13
13
|
local ____constants = require("constants")
|
|
14
14
|
local CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = ____constants.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART
|
|
15
15
|
local CHARACTERS_WITH_FREE_DEVIL_DEALS = ____constants.CHARACTERS_WITH_FREE_DEVIL_DEALS
|
|
@@ -52,11 +52,33 @@ function ____exports.getCharacters(self)
|
|
|
52
52
|
end
|
|
53
53
|
function ____exports.getPlayerIndex(self, player)
|
|
54
54
|
local character = player:GetPlayerType()
|
|
55
|
-
local
|
|
56
|
-
local collectibleRNG = player:GetCollectibleRNG(
|
|
55
|
+
local collectibleType = getPlayerIndexCollectibleType(nil, character)
|
|
56
|
+
local collectibleRNG = player:GetCollectibleRNG(collectibleType)
|
|
57
57
|
local seed = collectibleRNG:GetSeed()
|
|
58
58
|
return seed
|
|
59
59
|
end
|
|
60
|
+
function getPlayerIndexCollectibleType(self, character)
|
|
61
|
+
repeat
|
|
62
|
+
local ____switch62 = character
|
|
63
|
+
local ____cond62 = ____switch62 == PlayerType.PLAYER_THESOUL
|
|
64
|
+
if ____cond62 then
|
|
65
|
+
do
|
|
66
|
+
return CollectibleType.COLLECTIBLE_INNER_EYE
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
____cond62 = ____cond62 or ____switch62 == PlayerType.PLAYER_LAZARUS2_B
|
|
70
|
+
if ____cond62 then
|
|
71
|
+
do
|
|
72
|
+
return CollectibleType.COLLECTIBLE_SPOON_BENDER
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
do
|
|
76
|
+
do
|
|
77
|
+
return CollectibleType.COLLECTIBLE_SAD_ONION
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
until true
|
|
81
|
+
end
|
|
60
82
|
function ____exports.getPlayerMaxHeartContainers(self, player)
|
|
61
83
|
local character = player:GetPlayerType()
|
|
62
84
|
local maxHeartContainers = ____exports.getCharacterMaxHeartContainers(nil, character)
|
|
@@ -73,39 +95,39 @@ end
|
|
|
73
95
|
function getAdjustedPlayerName(self, player)
|
|
74
96
|
local character = player:GetPlayerType()
|
|
75
97
|
repeat
|
|
76
|
-
local
|
|
77
|
-
local
|
|
78
|
-
if
|
|
98
|
+
local ____switch75 = character
|
|
99
|
+
local ____cond75 = ____switch75 == PlayerType.PLAYER_BLUEBABY or ____switch75 == PlayerType.PLAYER_BLUEBABY_B
|
|
100
|
+
if ____cond75 then
|
|
79
101
|
do
|
|
80
102
|
return "Blue Baby"
|
|
81
103
|
end
|
|
82
104
|
end
|
|
83
|
-
|
|
84
|
-
if
|
|
105
|
+
____cond75 = ____cond75 or ____switch75 == PlayerType.PLAYER_LAZARUS2
|
|
106
|
+
if ____cond75 then
|
|
85
107
|
do
|
|
86
108
|
return "Lazarus II"
|
|
87
109
|
end
|
|
88
110
|
end
|
|
89
|
-
|
|
90
|
-
if
|
|
111
|
+
____cond75 = ____cond75 or ____switch75 == PlayerType.PLAYER_BLACKJUDAS
|
|
112
|
+
if ____cond75 then
|
|
91
113
|
do
|
|
92
114
|
return "Dark Judas"
|
|
93
115
|
end
|
|
94
116
|
end
|
|
95
|
-
|
|
96
|
-
if
|
|
117
|
+
____cond75 = ____cond75 or ____switch75 == PlayerType.PLAYER_JACOB
|
|
118
|
+
if ____cond75 then
|
|
97
119
|
do
|
|
98
120
|
return "Jacob & Esau"
|
|
99
121
|
end
|
|
100
122
|
end
|
|
101
|
-
|
|
102
|
-
if
|
|
123
|
+
____cond75 = ____cond75 or ____switch75 == PlayerType.PLAYER_LAZARUS2_B
|
|
124
|
+
if ____cond75 then
|
|
103
125
|
do
|
|
104
126
|
return "Dead Tainted Lazarus"
|
|
105
127
|
end
|
|
106
128
|
end
|
|
107
|
-
|
|
108
|
-
if
|
|
129
|
+
____cond75 = ____cond75 or ____switch75 == PlayerType.PLAYER_JACOB2_B
|
|
130
|
+
if ____cond75 then
|
|
109
131
|
do
|
|
110
132
|
return "Dead Tainted Jacob"
|
|
111
133
|
end
|
|
@@ -128,19 +150,16 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
128
150
|
while i < game:GetNumPlayers() do
|
|
129
151
|
do
|
|
130
152
|
local player = Isaac.GetPlayer(i)
|
|
131
|
-
if player == nil then
|
|
132
|
-
goto __continue81
|
|
133
|
-
end
|
|
134
153
|
if ____exports.isChildPlayer(nil, player) then
|
|
135
|
-
goto
|
|
154
|
+
goto __continue85
|
|
136
155
|
end
|
|
137
156
|
local character = player:GetPlayerType()
|
|
138
157
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
139
|
-
goto
|
|
158
|
+
goto __continue85
|
|
140
159
|
end
|
|
141
160
|
__TS__ArrayPush(players, player)
|
|
142
161
|
end
|
|
143
|
-
::
|
|
162
|
+
::__continue85::
|
|
144
163
|
i = i + 1
|
|
145
164
|
end
|
|
146
165
|
end
|
|
@@ -365,17 +384,11 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
365
384
|
do
|
|
366
385
|
local i = 0
|
|
367
386
|
while i < game:GetNumPlayers() do
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
end
|
|
373
|
-
local playerHash = GetPtrHash(player)
|
|
374
|
-
if playerHash == playerToFindHash then
|
|
375
|
-
return i
|
|
376
|
-
end
|
|
387
|
+
local player = Isaac.GetPlayer(i)
|
|
388
|
+
local playerHash = GetPtrHash(player)
|
|
389
|
+
if playerHash == playerToFindHash then
|
|
390
|
+
return i
|
|
377
391
|
end
|
|
378
|
-
::__continue62::
|
|
379
392
|
i = i + 1
|
|
380
393
|
end
|
|
381
394
|
end
|
|
@@ -545,9 +558,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
545
558
|
itemPool:RemoveCollectible(collectibleType)
|
|
546
559
|
end
|
|
547
560
|
repeat
|
|
548
|
-
local
|
|
549
|
-
local
|
|
550
|
-
if
|
|
561
|
+
local ____switch127 = activeSlot
|
|
562
|
+
local ____cond127 = ____switch127 == ActiveSlot.SLOT_PRIMARY
|
|
563
|
+
if ____cond127 then
|
|
551
564
|
do
|
|
552
565
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
553
566
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -556,8 +569,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
556
569
|
break
|
|
557
570
|
end
|
|
558
571
|
end
|
|
559
|
-
|
|
560
|
-
if
|
|
572
|
+
____cond127 = ____cond127 or ____switch127 == ActiveSlot.SLOT_SECONDARY
|
|
573
|
+
if ____cond127 then
|
|
561
574
|
do
|
|
562
575
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
563
576
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -572,16 +585,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
572
585
|
break
|
|
573
586
|
end
|
|
574
587
|
end
|
|
575
|
-
|
|
576
|
-
if
|
|
588
|
+
____cond127 = ____cond127 or ____switch127 == ActiveSlot.SLOT_POCKET
|
|
589
|
+
if ____cond127 then
|
|
577
590
|
do
|
|
578
591
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
579
592
|
player:SetActiveCharge(charge, activeSlot)
|
|
580
593
|
break
|
|
581
594
|
end
|
|
582
595
|
end
|
|
583
|
-
|
|
584
|
-
if
|
|
596
|
+
____cond127 = ____cond127 or ____switch127 == ActiveSlot.SLOT_POCKET2
|
|
597
|
+
if ____cond127 then
|
|
585
598
|
do
|
|
586
599
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
587
600
|
break
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.46",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.348",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.12",
|