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.
@@ -773,10 +773,11 @@ end
773
773
 
774
774
  local __TS__AsyncAwaiter, __TS__Await
775
775
  do
776
- local cocreate = coroutine.create
777
- local coresume = coroutine.resume
778
- local costatus = coroutine.status
779
- local coyield = coroutine.yield
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<import("isaac-typescript-definitions").CacheFlag, number>;
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,uEAUlC,CAAC"}
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<import("isaac-typescript-definitions").DoorSlotFlag>;
4
- readonly 0: import("isaac-typescript-definitions").DoorSlotFlag;
5
- readonly 1: import("isaac-typescript-definitions").DoorSlotFlag;
6
- readonly 2: import("isaac-typescript-definitions").DoorSlotFlag;
7
- readonly 3: import("isaac-typescript-definitions").DoorSlotFlag;
8
- readonly 4: import("isaac-typescript-definitions").DoorSlotFlag;
9
- readonly 5: import("isaac-typescript-definitions").DoorSlotFlag;
10
- readonly 6: import("isaac-typescript-definitions").DoorSlotFlag;
11
- readonly 7: import("isaac-typescript-definitions").DoorSlotFlag;
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;;;;;;;;;;CAUW,CAAC"}
1
+ {"version":3,"file":"doorSlotToDoorSlotFlag.d.ts","sourceRoot":"","sources":["../../src/objects/doorSlotToDoorSlotFlag.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUW,CAAC"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.42.3"
8
+ "packageVersion": "7.43.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "87.3.0",
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": "^41.1.0"
40
+ "isaac-typescript-definitions": "^42.0.2"
41
41
  }
42
42
  }
@@ -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
  | {
@@ -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
  *