isaacscript-common 1.2.6 → 1.2.7
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/constants.d.ts
CHANGED
|
@@ -104,10 +104,12 @@ 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:
|
|
107
|
+
export declare const MOVEMENT_ACTIONS: ButtonAction[];
|
|
108
|
+
export declare const MOVEMENT_ACTIONS_SET: Set<ButtonAction>;
|
|
108
109
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
109
110
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: Set<CollectibleType>;
|
|
110
|
-
export declare const SHOOTING_ACTIONS:
|
|
111
|
+
export declare const SHOOTING_ACTIONS: ButtonAction[];
|
|
112
|
+
export declare const SHOOTING_ACTIONS_SET: Set<ButtonAction>;
|
|
111
113
|
export declare const STORY_BOSSES: Set<EntityType>;
|
|
112
114
|
/**
|
|
113
115
|
* 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,7 +90,8 @@ ____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 =
|
|
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)
|
|
94
95
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
95
96
|
____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
96
97
|
CollectibleType.COLLECTIBLE_FORGET_ME_NOW,
|
|
@@ -102,7 +103,8 @@ ____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
|
102
103
|
CollectibleType.COLLECTIBLE_DEATH_CERTIFICATE,
|
|
103
104
|
CollectibleType.COLLECTIBLE_R_KEY
|
|
104
105
|
})
|
|
105
|
-
____exports.SHOOTING_ACTIONS =
|
|
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)
|
|
106
108
|
____exports.STORY_BOSSES = __TS__New(Set, {
|
|
107
109
|
EntityType.ENTITY_MOM,
|
|
108
110
|
EntityType.ENTITY_MOMS_HEART,
|
|
@@ -4,8 +4,8 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local isActionPressed, isActionTriggered, getActionValue, getReturnValue, v
|
|
6
6
|
local ____constants = require("constants")
|
|
7
|
-
local
|
|
8
|
-
local
|
|
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
11
|
local ____exports = require("features.saveDataManager.exports")
|
|
@@ -85,9 +85,9 @@ function ____exports.disableAllInputsExceptFor(self, whitelist)
|
|
|
85
85
|
v.run.blacklist = nil
|
|
86
86
|
end
|
|
87
87
|
function ____exports.disableMovementInputs(self)
|
|
88
|
-
____exports.enableAllInputsExceptFor(nil,
|
|
88
|
+
____exports.enableAllInputsExceptFor(nil, MOVEMENT_ACTIONS_SET)
|
|
89
89
|
end
|
|
90
90
|
function ____exports.disableShootingInputs(self)
|
|
91
|
-
____exports.enableAllInputsExceptFor(nil,
|
|
91
|
+
____exports.enableAllInputsExceptFor(nil, SHOOTING_ACTIONS_SET)
|
|
92
92
|
end
|
|
93
93
|
return ____exports
|
package/dist/functions/input.lua
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local Set = ____lualib.Set
|
|
4
3
|
local __TS__StringReplace = ____lualib.__TS__StringReplace
|
|
5
4
|
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
6
|
-
local
|
|
5
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
7
6
|
local __TS__StringSlice = ____lualib.__TS__StringSlice
|
|
8
7
|
local ____exports = {}
|
|
9
8
|
local ____constants = require("constants")
|
|
10
9
|
local MAX_NUM_INPUTS = ____constants.MAX_NUM_INPUTS
|
|
11
10
|
local MOVEMENT_ACTIONS = ____constants.MOVEMENT_ACTIONS
|
|
12
11
|
local SHOOTING_ACTIONS = ____constants.SHOOTING_ACTIONS
|
|
12
|
+
local ____math = require("functions.math")
|
|
13
|
+
local range = ____math.range
|
|
13
14
|
local ControllerLiteral = ControllerLiteral or ({})
|
|
14
15
|
ControllerLiteral.DPAD_LEFT = 0
|
|
15
16
|
ControllerLiteral[ControllerLiteral.DPAD_LEFT] = "DPAD_LEFT"
|
|
@@ -72,63 +73,45 @@ function ____exports.controllerToString(self, controller)
|
|
|
72
73
|
return "unknown"
|
|
73
74
|
end
|
|
74
75
|
function ____exports.isActionPressedOnAnyInput(self, buttonAction)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
end
|
|
81
|
-
i = i + 1
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
return false
|
|
76
|
+
local validInputs = range(nil, 0, MAX_NUM_INPUTS - 1)
|
|
77
|
+
return __TS__ArraySome(
|
|
78
|
+
validInputs,
|
|
79
|
+
function(____, input) return Input.IsActionPressed(buttonAction, input) end
|
|
80
|
+
)
|
|
85
81
|
end
|
|
86
82
|
function ____exports.isActionTriggeredOnAnyInput(self, buttonAction)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
end
|
|
93
|
-
i = i + 1
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
return false
|
|
83
|
+
local validInputs = range(nil, 0, MAX_NUM_INPUTS - 1)
|
|
84
|
+
return __TS__ArraySome(
|
|
85
|
+
validInputs,
|
|
86
|
+
function(____, input) return Input.IsActionTriggered(buttonAction, input) end
|
|
87
|
+
)
|
|
97
88
|
end
|
|
98
89
|
function ____exports.isKeyboardPressed(self, key)
|
|
99
90
|
return Input.IsButtonPressed(key, 0)
|
|
100
91
|
end
|
|
101
92
|
function ____exports.isMoveActionPressedOnAnyInput(self)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
end
|
|
107
|
-
return false
|
|
93
|
+
return __TS__ArraySome(
|
|
94
|
+
MOVEMENT_ACTIONS,
|
|
95
|
+
function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
|
|
96
|
+
)
|
|
108
97
|
end
|
|
109
98
|
function ____exports.isMoveActionTriggeredOnAnyInput(self)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
return false
|
|
99
|
+
return __TS__ArraySome(
|
|
100
|
+
MOVEMENT_ACTIONS,
|
|
101
|
+
function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
|
|
102
|
+
)
|
|
116
103
|
end
|
|
117
104
|
function ____exports.isShootActionPressedOnAnyInput(self)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
end
|
|
123
|
-
return false
|
|
105
|
+
return __TS__ArraySome(
|
|
106
|
+
SHOOTING_ACTIONS,
|
|
107
|
+
function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
|
|
108
|
+
)
|
|
124
109
|
end
|
|
125
110
|
function ____exports.isShootActionTriggeredOnAnyInput(self)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
end
|
|
131
|
-
return false
|
|
111
|
+
return __TS__ArraySome(
|
|
112
|
+
SHOOTING_ACTIONS,
|
|
113
|
+
function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
|
|
114
|
+
)
|
|
132
115
|
end
|
|
133
116
|
function ____exports.keyboardToString(self, keyboard)
|
|
134
117
|
for ____, ____value in ipairs(__TS__ObjectEntries(Keyboard)) do
|
package/dist/functions/math.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare function isEven(num: int): boolean;
|
|
|
17
17
|
export declare function isOdd(num: int): boolean;
|
|
18
18
|
export declare function lerp(a: number, b: number, pos: float): number;
|
|
19
19
|
export declare function lerpAngleDegrees(aStart: number, aEnd: number, percent: float): number;
|
|
20
|
+
/** Helper function to return an array with the elements from start to end, inclusive. */
|
|
21
|
+
export declare function range(start: int, end: int): int[];
|
|
20
22
|
/**
|
|
21
23
|
* If rounding fails, this function returns 0.
|
|
22
24
|
* From: http://lua-users.org/wiki/SimpleRound
|
package/dist/functions/math.lua
CHANGED
|
@@ -87,6 +87,17 @@ end
|
|
|
87
87
|
function ____exports.lerpAngleDegrees(self, aStart, aEnd, percent)
|
|
88
88
|
return aStart + ____exports.getAngleDifference(nil, aStart, aEnd) * percent
|
|
89
89
|
end
|
|
90
|
+
function ____exports.range(self, start, ____end)
|
|
91
|
+
local array = {}
|
|
92
|
+
do
|
|
93
|
+
local i = start
|
|
94
|
+
while i <= ____end do
|
|
95
|
+
__TS__ArrayPush(array, i)
|
|
96
|
+
i = i + 1
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
return array
|
|
100
|
+
end
|
|
90
101
|
function ____exports.round(self, num, numDecimalPlaces)
|
|
91
102
|
if numDecimalPlaces == nil then
|
|
92
103
|
numDecimalPlaces = 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
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.335",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.11",
|