isaacscript-common 7.16.3 → 7.17.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/features/disableInputs.d.ts +11 -0
- package/dist/features/disableInputs.d.ts.map +1 -1
- package/dist/features/disableInputs.lua +31 -12
- package/dist/features/pause.d.ts.map +1 -1
- package/dist/lualib_bundle.lua +11 -0
- package/package.json +1 -1
- package/src/features/disableInputs.ts +47 -12
- package/src/features/pause.ts +2 -1
|
@@ -8,6 +8,17 @@ export declare function disableInputsInit(mod: Mod): void;
|
|
|
8
8
|
* that multiple mod features can work in tandem.
|
|
9
9
|
*/
|
|
10
10
|
export declare function enableAllInputs(key: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to disable specific inputs, like opening the console. (To disable all inputs, see
|
|
13
|
+
* the `disableAllInputs` function.)
|
|
14
|
+
*
|
|
15
|
+
* Use the `enableAllInputs` helper function to set things back to normal.
|
|
16
|
+
*
|
|
17
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
18
|
+
* that multiple mod features can work in tandem.
|
|
19
|
+
* @param buttonActions An array of the actions to action.
|
|
20
|
+
*/
|
|
21
|
+
export declare function disableInputs(key: string, buttonActions: ButtonAction[]): void;
|
|
11
22
|
/**
|
|
12
23
|
* Helper function to disable all inputs. This is useful because `EntityPlayer.ControlsEnabled` can
|
|
13
24
|
* be changed by the game under certain conditions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disableInputs.d.ts","sourceRoot":"","sources":["../../src/features/disableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"disableInputs.d.ts","sourceRoot":"","sources":["../../src/features/disableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;AA0BtC,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAoBhD;AAqDD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAKjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,YAAY,EAAE,GAC5B,IAAI,CAKN;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAKlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI,CAKN;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI,CAKN;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGvD"}
|
|
@@ -32,12 +32,17 @@ function getReturnValue(self, buttonAction, booleanCallback)
|
|
|
32
32
|
____booleanCallback_0 = 0
|
|
33
33
|
end
|
|
34
34
|
local disableValue = ____booleanCallback_0
|
|
35
|
-
for ____,
|
|
35
|
+
for ____, blacklist in __TS__Iterator(v.run.disableInputs:values()) do
|
|
36
|
+
if blacklist:has(buttonAction) then
|
|
37
|
+
return disableValue
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
for ____, whitelist in __TS__Iterator(v.run.disableAllInputsWithWhitelistMap:values()) do
|
|
36
41
|
if not whitelist:has(buttonAction) then
|
|
37
42
|
return disableValue
|
|
38
43
|
end
|
|
39
44
|
end
|
|
40
|
-
for ____, blacklist in __TS__Iterator(v.run.
|
|
45
|
+
for ____, blacklist in __TS__Iterator(v.run.enableAllInputsWithBlacklistMap:values()) do
|
|
41
46
|
if blacklist:has(buttonAction) then
|
|
42
47
|
return disableValue
|
|
43
48
|
end
|
|
@@ -46,8 +51,9 @@ function getReturnValue(self, buttonAction, booleanCallback)
|
|
|
46
51
|
end
|
|
47
52
|
local FEATURE_NAME = "disableInputs"
|
|
48
53
|
v = {run = {
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
disableInputs = __TS__New(Map),
|
|
55
|
+
enableAllInputsWithBlacklistMap = __TS__New(Map),
|
|
56
|
+
disableAllInputsWithWhitelistMap = __TS__New(Map)
|
|
51
57
|
}}
|
|
52
58
|
function ____exports.disableInputsInit(self, mod)
|
|
53
59
|
saveDataManager(nil, FEATURE_NAME, v)
|
|
@@ -62,8 +68,21 @@ end
|
|
|
62
68
|
-- that multiple mod features can work in tandem.
|
|
63
69
|
function ____exports.enableAllInputs(self, key)
|
|
64
70
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
65
|
-
v.run.
|
|
66
|
-
v.run.
|
|
71
|
+
v.run.disableAllInputsWithWhitelistMap:delete(key)
|
|
72
|
+
v.run.enableAllInputsWithBlacklistMap:delete(key)
|
|
73
|
+
end
|
|
74
|
+
--- Helper function to disable specific inputs, like opening the console. (To disable all inputs, see
|
|
75
|
+
-- the `disableAllInputs` function.)
|
|
76
|
+
--
|
|
77
|
+
-- Use the `enableAllInputs` helper function to set things back to normal.
|
|
78
|
+
--
|
|
79
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
80
|
+
-- that multiple mod features can work in tandem.
|
|
81
|
+
-- @param buttonActions An array of the actions to action.
|
|
82
|
+
function ____exports.disableInputs(self, key, buttonActions)
|
|
83
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
84
|
+
local buttonActionsSet = __TS__New(Set, buttonActions)
|
|
85
|
+
v.run.disableInputs:set(key, buttonActionsSet)
|
|
67
86
|
end
|
|
68
87
|
--- Helper function to disable all inputs. This is useful because `EntityPlayer.ControlsEnabled` can
|
|
69
88
|
-- be changed by the game under certain conditions.
|
|
@@ -74,11 +93,11 @@ end
|
|
|
74
93
|
-- that multiple mod features can work in tandem.
|
|
75
94
|
function ____exports.disableAllInputs(self, key)
|
|
76
95
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
77
|
-
v.run.
|
|
96
|
+
v.run.disableAllInputsWithWhitelistMap:set(
|
|
78
97
|
key,
|
|
79
98
|
__TS__New(Set)
|
|
80
99
|
)
|
|
81
|
-
v.run.
|
|
100
|
+
v.run.enableAllInputsWithBlacklistMap:delete(key)
|
|
82
101
|
end
|
|
83
102
|
--- Helper function to enable all inputs besides the ones provided. This is useful because
|
|
84
103
|
-- `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
@@ -90,8 +109,8 @@ end
|
|
|
90
109
|
-- @param blacklist A set of ButtonActions to disallow.
|
|
91
110
|
function ____exports.enableAllInputsExceptFor(self, key, blacklist)
|
|
92
111
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
93
|
-
v.run.
|
|
94
|
-
v.run.
|
|
112
|
+
v.run.disableAllInputsWithWhitelistMap:delete(key)
|
|
113
|
+
v.run.enableAllInputsWithBlacklistMap:set(key, blacklist)
|
|
95
114
|
end
|
|
96
115
|
--- Helper function to disable all inputs besides the ones provided. This is useful because
|
|
97
116
|
-- `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
@@ -103,8 +122,8 @@ end
|
|
|
103
122
|
-- @param whitelist A set of ButtonActions to allow.
|
|
104
123
|
function ____exports.disableAllInputsExceptFor(self, key, whitelist)
|
|
105
124
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
106
|
-
v.run.
|
|
107
|
-
v.run.
|
|
125
|
+
v.run.disableAllInputsWithWhitelistMap:set(key, whitelist)
|
|
126
|
+
v.run.enableAllInputsWithBlacklistMap:delete(key)
|
|
108
127
|
end
|
|
109
128
|
--- Helper function to disable only the inputs used for moving the character (or moving the cursor in
|
|
110
129
|
-- the UI). This is useful because `EntityPlayer.ControlsEnabled` can be changed by the game under
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pause.d.ts","sourceRoot":"","sources":["../../src/features/pause.ts"],"names":[],"mappings":";AAuCA,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAUxC;AA2DD;;;;;;;GAOG;AACH,wBAAgB,KAAK,IAAI,IAAI,CA8C5B;AAED,wFAAwF;AACxF,wBAAgB,OAAO,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"pause.d.ts","sourceRoot":"","sources":["../../src/features/pause.ts"],"names":[],"mappings":";AAuCA,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAUxC;AA2DD;;;;;;;GAOG;AACH,wBAAgB,KAAK,IAAI,IAAI,CA8C5B;AAED,wFAAwF;AACxF,wBAAgB,OAAO,IAAI,IAAI,CAsB9B"}
|
package/dist/lualib_bundle.lua
CHANGED
|
@@ -1207,6 +1207,16 @@ local function __TS__InstanceOfObject(value)
|
|
|
1207
1207
|
return valueType == "table" or valueType == "function"
|
|
1208
1208
|
end
|
|
1209
1209
|
|
|
1210
|
+
local function __TS__LuaIteratorSpread(self, state, firstKey)
|
|
1211
|
+
local results = {}
|
|
1212
|
+
local key, value = self(state, firstKey)
|
|
1213
|
+
while key do
|
|
1214
|
+
results[#results + 1] = {key, value}
|
|
1215
|
+
key, value = self(state, key)
|
|
1216
|
+
end
|
|
1217
|
+
return __TS__Unpack(results)
|
|
1218
|
+
end
|
|
1219
|
+
|
|
1210
1220
|
local Map
|
|
1211
1221
|
do
|
|
1212
1222
|
Map = __TS__Class()
|
|
@@ -2448,6 +2458,7 @@ return {
|
|
|
2448
2458
|
__TS__InstanceOf = __TS__InstanceOf,
|
|
2449
2459
|
__TS__InstanceOfObject = __TS__InstanceOfObject,
|
|
2450
2460
|
__TS__Iterator = __TS__Iterator,
|
|
2461
|
+
__TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
|
|
2451
2462
|
Map = Map,
|
|
2452
2463
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2453
2464
|
__TS__MathSign = __TS__MathSign,
|
package/package.json
CHANGED
|
@@ -12,10 +12,19 @@ const FEATURE_NAME = "disableInputs";
|
|
|
12
12
|
const v = {
|
|
13
13
|
run: {
|
|
14
14
|
/** Indexed by the requesting feature key. */
|
|
15
|
-
|
|
15
|
+
disableInputs: new Map<string, ReadonlySet<ButtonAction>>(),
|
|
16
16
|
|
|
17
17
|
/** Indexed by the requesting feature key. */
|
|
18
|
-
|
|
18
|
+
enableAllInputsWithBlacklistMap: new Map<
|
|
19
|
+
string,
|
|
20
|
+
ReadonlySet<ButtonAction>
|
|
21
|
+
>(),
|
|
22
|
+
|
|
23
|
+
/** Indexed by the requesting feature key. */
|
|
24
|
+
disableAllInputsWithWhitelistMap: new Map<
|
|
25
|
+
string,
|
|
26
|
+
ReadonlySet<ButtonAction>
|
|
27
|
+
>(),
|
|
19
28
|
},
|
|
20
29
|
};
|
|
21
30
|
|
|
@@ -71,13 +80,19 @@ function getActionValue(
|
|
|
71
80
|
function getReturnValue(buttonAction: ButtonAction, booleanCallback: boolean) {
|
|
72
81
|
const disableValue = booleanCallback ? false : 0;
|
|
73
82
|
|
|
74
|
-
for (const
|
|
83
|
+
for (const blacklist of v.run.disableInputs.values()) {
|
|
84
|
+
if (blacklist.has(buttonAction)) {
|
|
85
|
+
return disableValue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
for (const whitelist of v.run.disableAllInputsWithWhitelistMap.values()) {
|
|
75
90
|
if (!whitelist.has(buttonAction)) {
|
|
76
91
|
return disableValue;
|
|
77
92
|
}
|
|
78
93
|
}
|
|
79
94
|
|
|
80
|
-
for (const blacklist of v.run.
|
|
95
|
+
for (const blacklist of v.run.enableAllInputsWithBlacklistMap.values()) {
|
|
81
96
|
if (blacklist.has(buttonAction)) {
|
|
82
97
|
return disableValue;
|
|
83
98
|
}
|
|
@@ -96,8 +111,28 @@ function getReturnValue(buttonAction: ButtonAction, booleanCallback: boolean) {
|
|
|
96
111
|
export function enableAllInputs(key: string): void {
|
|
97
112
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
98
113
|
|
|
99
|
-
v.run.
|
|
100
|
-
v.run.
|
|
114
|
+
v.run.disableAllInputsWithWhitelistMap.delete(key);
|
|
115
|
+
v.run.enableAllInputsWithBlacklistMap.delete(key);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Helper function to disable specific inputs, like opening the console. (To disable all inputs, see
|
|
120
|
+
* the `disableAllInputs` function.)
|
|
121
|
+
*
|
|
122
|
+
* Use the `enableAllInputs` helper function to set things back to normal.
|
|
123
|
+
*
|
|
124
|
+
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
125
|
+
* that multiple mod features can work in tandem.
|
|
126
|
+
* @param buttonActions An array of the actions to action.
|
|
127
|
+
*/
|
|
128
|
+
export function disableInputs(
|
|
129
|
+
key: string,
|
|
130
|
+
buttonActions: ButtonAction[],
|
|
131
|
+
): void {
|
|
132
|
+
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
133
|
+
|
|
134
|
+
const buttonActionsSet = new Set(buttonActions);
|
|
135
|
+
v.run.disableInputs.set(key, buttonActionsSet);
|
|
101
136
|
}
|
|
102
137
|
|
|
103
138
|
/**
|
|
@@ -112,8 +147,8 @@ export function enableAllInputs(key: string): void {
|
|
|
112
147
|
export function disableAllInputs(key: string): void {
|
|
113
148
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
114
149
|
|
|
115
|
-
v.run.
|
|
116
|
-
v.run.
|
|
150
|
+
v.run.disableAllInputsWithWhitelistMap.set(key, new Set());
|
|
151
|
+
v.run.enableAllInputsWithBlacklistMap.delete(key);
|
|
117
152
|
}
|
|
118
153
|
|
|
119
154
|
/**
|
|
@@ -132,8 +167,8 @@ export function enableAllInputsExceptFor(
|
|
|
132
167
|
): void {
|
|
133
168
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
134
169
|
|
|
135
|
-
v.run.
|
|
136
|
-
v.run.
|
|
170
|
+
v.run.disableAllInputsWithWhitelistMap.delete(key);
|
|
171
|
+
v.run.enableAllInputsWithBlacklistMap.set(key, blacklist);
|
|
137
172
|
}
|
|
138
173
|
|
|
139
174
|
/**
|
|
@@ -152,8 +187,8 @@ export function disableAllInputsExceptFor(
|
|
|
152
187
|
): void {
|
|
153
188
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
154
189
|
|
|
155
|
-
v.run.
|
|
156
|
-
v.run.
|
|
190
|
+
v.run.disableAllInputsWithWhitelistMap.set(key, whitelist);
|
|
191
|
+
v.run.enableAllInputsWithBlacklistMap.delete(key);
|
|
157
192
|
}
|
|
158
193
|
|
|
159
194
|
/**
|
package/src/features/pause.ts
CHANGED
|
@@ -181,7 +181,8 @@ export function unpause(): void {
|
|
|
181
181
|
// After a vanilla pause, the tears will not resume their normal velocity and will "stick" to the
|
|
182
182
|
// air. Even if we try to help the tears along by explicitly resetting all of the velocity-related
|
|
183
183
|
// variables to their initial values, this will not make a difference. Thus, revert to removing
|
|
184
|
-
// all of the tears and projectiles in the room.
|
|
184
|
+
// all of the tears and projectiles in the room. (If a Ludovico tear is removed, it will
|
|
185
|
+
// automatically be respawned on the next frame.)
|
|
185
186
|
removeAllTears();
|
|
186
187
|
removeAllProjectiles();
|
|
187
188
|
}
|