isaacscript-common 87.3.0 → 87.4.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/cachedEnumValues.d.ts +15 -3
- package/dist/cachedEnumValues.d.ts.map +1 -1
- package/dist/core/constants.d.ts +5 -1
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/functions/string.d.ts +1 -1
- package/dist/functions/string.js +1 -1
- package/dist/functions/string.lua +1 -1
- package/dist/functions/utils.d.ts +11 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +20 -1
- package/dist/functions/utils.lua +16 -0
- package/dist/index.rollup.d.ts +18 -2
- package/dist/isaacscript-common.lua +152 -1444
- package/dist/lualib_bundle.lua +39 -4
- package/dist/maps/defaultPlayerStatMap.d.ts +5 -1
- package/dist/maps/defaultPlayerStatMap.d.ts.map +1 -1
- package/dist/objects/doorSlotToDoorSlotFlag.d.ts +45 -9
- package/dist/objects/doorSlotToDoorSlotFlag.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +2 -2
- package/src/functions/string.ts +1 -1
- package/src/functions/utils.ts +29 -0
package/dist/lualib_bundle.lua
CHANGED
|
@@ -773,10 +773,11 @@ end
|
|
|
773
773
|
|
|
774
774
|
local __TS__AsyncAwaiter, __TS__Await
|
|
775
775
|
do
|
|
776
|
-
local
|
|
777
|
-
local
|
|
778
|
-
local
|
|
779
|
-
local
|
|
776
|
+
local ____coroutine = _G.coroutine or ({})
|
|
777
|
+
local cocreate = ____coroutine.create
|
|
778
|
+
local coresume = ____coroutine.resume
|
|
779
|
+
local costatus = ____coroutine.status
|
|
780
|
+
local coyield = ____coroutine.yield
|
|
780
781
|
function __TS__AsyncAwaiter(generator)
|
|
781
782
|
return __TS__New(
|
|
782
783
|
__TS__Promise,
|
|
@@ -1417,6 +1418,22 @@ do
|
|
|
1417
1418
|
Map[Symbol.species] = Map
|
|
1418
1419
|
end
|
|
1419
1420
|
|
|
1421
|
+
local function __TS__MapGroupBy(items, keySelector)
|
|
1422
|
+
local result = __TS__New(Map)
|
|
1423
|
+
local i = 0
|
|
1424
|
+
for ____, item in __TS__Iterator(items) do
|
|
1425
|
+
local key = keySelector(nil, item, i)
|
|
1426
|
+
if result:has(key) then
|
|
1427
|
+
local ____temp_0 = result:get(key)
|
|
1428
|
+
____temp_0[#____temp_0 + 1] = item
|
|
1429
|
+
else
|
|
1430
|
+
result:set(key, {item})
|
|
1431
|
+
end
|
|
1432
|
+
i = i + 1
|
|
1433
|
+
end
|
|
1434
|
+
return result
|
|
1435
|
+
end
|
|
1436
|
+
|
|
1420
1437
|
local __TS__Match = string.match
|
|
1421
1438
|
|
|
1422
1439
|
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
@@ -1671,6 +1688,22 @@ local function __TS__ObjectFromEntries(entries)
|
|
|
1671
1688
|
return obj
|
|
1672
1689
|
end
|
|
1673
1690
|
|
|
1691
|
+
local function __TS__ObjectGroupBy(items, keySelector)
|
|
1692
|
+
local result = {}
|
|
1693
|
+
local i = 0
|
|
1694
|
+
for ____, item in __TS__Iterator(items) do
|
|
1695
|
+
local key = keySelector(nil, item, i)
|
|
1696
|
+
if result[key] ~= nil then
|
|
1697
|
+
local ____result_key_0 = result[key]
|
|
1698
|
+
____result_key_0[#____result_key_0 + 1] = item
|
|
1699
|
+
else
|
|
1700
|
+
result[key] = {item}
|
|
1701
|
+
end
|
|
1702
|
+
i = i + 1
|
|
1703
|
+
end
|
|
1704
|
+
return result
|
|
1705
|
+
end
|
|
1706
|
+
|
|
1674
1707
|
local function __TS__ObjectKeys(obj)
|
|
1675
1708
|
local result = {}
|
|
1676
1709
|
local len = 0
|
|
@@ -2563,6 +2596,7 @@ return {
|
|
|
2563
2596
|
__TS__Iterator = __TS__Iterator,
|
|
2564
2597
|
__TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
|
|
2565
2598
|
Map = Map,
|
|
2599
|
+
__TS__MapGroupBy = __TS__MapGroupBy,
|
|
2566
2600
|
__TS__Match = __TS__Match,
|
|
2567
2601
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2568
2602
|
__TS__MathModf = __TS__MathModf,
|
|
@@ -2582,6 +2616,7 @@ return {
|
|
|
2582
2616
|
__TS__ObjectFromEntries = __TS__ObjectFromEntries,
|
|
2583
2617
|
__TS__ObjectGetOwnPropertyDescriptor = __TS__ObjectGetOwnPropertyDescriptor,
|
|
2584
2618
|
__TS__ObjectGetOwnPropertyDescriptors = __TS__ObjectGetOwnPropertyDescriptors,
|
|
2619
|
+
__TS__ObjectGroupBy = __TS__ObjectGroupBy,
|
|
2585
2620
|
__TS__ObjectKeys = __TS__ObjectKeys,
|
|
2586
2621
|
__TS__ObjectRest = __TS__ObjectRest,
|
|
2587
2622
|
__TS__ObjectValues = __TS__ObjectValues,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
/** The default fire delay is represented in the tear stat, not the `MaxFireDelay` value. */
|
|
2
|
-
export declare const DEFAULT_PLAYER_STAT_MAP: ReadonlyMap<
|
|
2
|
+
export declare const DEFAULT_PLAYER_STAT_MAP: ReadonlyMap<number & {
|
|
3
|
+
readonly __bitFlagBrand: symbol;
|
|
4
|
+
} & {
|
|
5
|
+
readonly __cacheFlagBrand: symbol;
|
|
6
|
+
}, number>;
|
|
3
7
|
//# sourceMappingURL=defaultPlayerStatMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPlayerStatMap.d.ts","sourceRoot":"","sources":["../../src/maps/defaultPlayerStatMap.ts"],"names":[],"mappings":"AAMA,4FAA4F;AAC5F,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"defaultPlayerStatMap.d.ts","sourceRoot":"","sources":["../../src/maps/defaultPlayerStatMap.ts"],"names":[],"mappings":"AAMA,4FAA4F;AAC5F,eAAO,MAAM,uBAAuB;;;;UAUlC,CAAC"}
|
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare const DOOR_SLOT_TO_DOOR_SLOT_FLAG: {
|
|
3
|
-
readonly [-1]: BitFlags<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
readonly [-1]: BitFlags<number & {
|
|
4
|
+
readonly __bitFlagBrand: symbol;
|
|
5
|
+
} & {
|
|
6
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
7
|
+
}>;
|
|
8
|
+
readonly 0: number & {
|
|
9
|
+
readonly __bitFlagBrand: symbol;
|
|
10
|
+
} & {
|
|
11
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
12
|
+
};
|
|
13
|
+
readonly 1: number & {
|
|
14
|
+
readonly __bitFlagBrand: symbol;
|
|
15
|
+
} & {
|
|
16
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
17
|
+
};
|
|
18
|
+
readonly 2: number & {
|
|
19
|
+
readonly __bitFlagBrand: symbol;
|
|
20
|
+
} & {
|
|
21
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
22
|
+
};
|
|
23
|
+
readonly 3: number & {
|
|
24
|
+
readonly __bitFlagBrand: symbol;
|
|
25
|
+
} & {
|
|
26
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
27
|
+
};
|
|
28
|
+
readonly 4: number & {
|
|
29
|
+
readonly __bitFlagBrand: symbol;
|
|
30
|
+
} & {
|
|
31
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
32
|
+
};
|
|
33
|
+
readonly 5: number & {
|
|
34
|
+
readonly __bitFlagBrand: symbol;
|
|
35
|
+
} & {
|
|
36
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
37
|
+
};
|
|
38
|
+
readonly 6: number & {
|
|
39
|
+
readonly __bitFlagBrand: symbol;
|
|
40
|
+
} & {
|
|
41
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
42
|
+
};
|
|
43
|
+
readonly 7: number & {
|
|
44
|
+
readonly __bitFlagBrand: symbol;
|
|
45
|
+
} & {
|
|
46
|
+
readonly __doorSlotFlagBrand: symbol;
|
|
47
|
+
};
|
|
12
48
|
};
|
|
13
49
|
//# sourceMappingURL=doorSlotToDoorSlotFlag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doorSlotToDoorSlotFlag.d.ts","sourceRoot":"","sources":["../../src/objects/doorSlotToDoorSlotFlag.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"doorSlotToDoorSlotFlag.d.ts","sourceRoot":"","sources":["../../src/objects/doorSlotToDoorSlotFlag.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUW,CAAC"}
|
package/dist/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "87.
|
|
3
|
+
"version": "87.4.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"lint": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/lint.mts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"isaac-typescript-definitions": "^
|
|
40
|
+
"isaac-typescript-definitions": "^42.0.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/functions/string.ts
CHANGED
|
@@ -140,7 +140,7 @@ export function getPartialMatch(
|
|
|
140
140
|
* Helper function to parse a Semantic Versioning string into its individual constituents. Returns
|
|
141
141
|
* undefined if the submitted string was not a proper Semantic Version string.
|
|
142
142
|
*
|
|
143
|
-
* https://semver.org/
|
|
143
|
+
* @see https://semver.org/
|
|
144
144
|
*/
|
|
145
145
|
export function parseSemanticVersion(versionString: string):
|
|
146
146
|
| {
|
package/src/functions/utils.ts
CHANGED
|
@@ -181,6 +181,35 @@ export function isRepentance(): boolean {
|
|
|
181
181
|
return isFunction(getAnimation);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
186
|
+
* API.
|
|
187
|
+
*
|
|
188
|
+
* Although REPENTOGON has a `REPENTOGON` global to check if it's present, it is not safe to use as
|
|
189
|
+
* it can be overwritten by other mods.
|
|
190
|
+
*
|
|
191
|
+
* Specifically, this function checks for the `Sprite.Continue` method:
|
|
192
|
+
* https://repentogon.com/Sprite.html#continue
|
|
193
|
+
*/
|
|
194
|
+
export function isRepentogon(): boolean {
|
|
195
|
+
const metatable = getmetatable(Sprite) as LuaMap<string, unknown> | undefined;
|
|
196
|
+
assertDefined(
|
|
197
|
+
metatable,
|
|
198
|
+
"Failed to get the metatable of the Sprite global table.",
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const classTable = metatable.get("__class") as
|
|
202
|
+
| LuaMap<string, unknown>
|
|
203
|
+
| undefined;
|
|
204
|
+
assertDefined(
|
|
205
|
+
classTable,
|
|
206
|
+
'Failed to get the "__class" key of the Sprite metatable.',
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const getAnimation = classTable.get("Continue");
|
|
210
|
+
return isFunction(getAnimation);
|
|
211
|
+
}
|
|
212
|
+
|
|
184
213
|
/**
|
|
185
214
|
* Helper function to repeat code N times. This is faster to type and cleaner than using a for loop.
|
|
186
215
|
*
|