isaacscript-common 9.20.0 → 10.0.2

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.
Files changed (95) hide show
  1. package/dist/index.d.ts +73 -24
  2. package/dist/isaacscript-common.lua +253 -138
  3. package/dist/lualib_bundle.lua +53 -37
  4. package/dist/package.lua +2 -2
  5. package/dist/src/features/deployJSONRoom.d.ts +16 -6
  6. package/dist/src/features/deployJSONRoom.d.ts.map +1 -1
  7. package/dist/src/features/deployJSONRoom.lua +16 -6
  8. package/dist/src/features/saveDataManager/load.d.ts +1 -1
  9. package/dist/src/features/saveDataManager/maps.d.ts +1 -1
  10. package/dist/src/features/saveDataManager/merge.d.ts +1 -1
  11. package/dist/src/features/saveDataManager/save.d.ts +1 -1
  12. package/dist/src/functions/bitSet128.d.ts +3 -2
  13. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  14. package/dist/src/functions/bitSet128.lua +2 -2
  15. package/dist/src/functions/color.d.ts +3 -4
  16. package/dist/src/functions/color.d.ts.map +1 -1
  17. package/dist/src/functions/color.lua +2 -2
  18. package/dist/src/functions/curses.d.ts +1 -1
  19. package/dist/src/functions/curses.lua +1 -1
  20. package/dist/src/functions/deepCopy.d.ts +2 -1
  21. package/dist/src/functions/deepCopy.d.ts.map +1 -1
  22. package/dist/src/functions/deepCopy.lua +19 -25
  23. package/dist/src/functions/deepCopyTests.lua +13 -26
  24. package/dist/src/functions/entities.d.ts +1 -1
  25. package/dist/src/functions/globals.d.ts +1 -1
  26. package/dist/src/functions/jsonHelpers.d.ts +1 -1
  27. package/dist/src/functions/kColor.d.ts +3 -4
  28. package/dist/src/functions/kColor.d.ts.map +1 -1
  29. package/dist/src/functions/kColor.lua +2 -2
  30. package/dist/src/functions/log.d.ts +2 -2
  31. package/dist/src/functions/log.d.ts.map +1 -1
  32. package/dist/src/functions/positionVelocity.d.ts +2 -0
  33. package/dist/src/functions/positionVelocity.d.ts.map +1 -1
  34. package/dist/src/functions/positionVelocity.lua +2 -0
  35. package/dist/src/functions/rng.d.ts +3 -3
  36. package/dist/src/functions/rng.d.ts.map +1 -1
  37. package/dist/src/functions/serialization.d.ts +11 -4
  38. package/dist/src/functions/serialization.d.ts.map +1 -1
  39. package/dist/src/functions/serialization.lua +15 -0
  40. package/dist/src/functions/table.d.ts +4 -4
  41. package/dist/src/functions/table.d.ts.map +1 -1
  42. package/dist/src/functions/table.lua +8 -4
  43. package/dist/src/functions/tstlClass.d.ts +1 -1
  44. package/dist/src/functions/types.d.ts +1 -1
  45. package/dist/src/functions/vector.d.ts +3 -2
  46. package/dist/src/functions/vector.d.ts.map +1 -1
  47. package/dist/src/functions/vector.lua +2 -2
  48. package/dist/src/functions/weighted.d.ts +6 -0
  49. package/dist/src/functions/weighted.d.ts.map +1 -0
  50. package/dist/src/functions/weighted.lua +35 -0
  51. package/dist/src/index.d.ts +2 -1
  52. package/dist/src/index.d.ts.map +1 -1
  53. package/dist/src/index.lua +8 -0
  54. package/dist/src/interfaces/SaveData.d.ts +3 -8
  55. package/dist/src/interfaces/SaveData.d.ts.map +1 -1
  56. package/dist/src/interfaces/private/TSTLClassMetatable.d.ts +1 -1
  57. package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts +1 -1
  58. package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts.map +1 -1
  59. package/dist/src/objects/isaacAPIClassTypeToBrand.lua +2 -2
  60. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts +36 -8
  61. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -1
  62. package/dist/src/objects/isaacAPIClassTypeToFunctions.lua +42 -7
  63. package/dist/src/types/TSTLClass.d.ts +1 -1
  64. package/dist/src/types/WeightedArray.d.ts +4 -0
  65. package/dist/src/types/WeightedArray.d.ts.map +1 -0
  66. package/dist/src/types/{SerializedIsaacAPIClass.lua → WeightedArray.lua} +0 -0
  67. package/package.json +2 -2
  68. package/src/features/deployJSONRoom.ts +16 -6
  69. package/src/features/saveDataManager/exports.ts +1 -1
  70. package/src/functions/bitSet128.ts +8 -2
  71. package/src/functions/color.ts +8 -2
  72. package/src/functions/curses.ts +1 -1
  73. package/src/functions/deepCopy.ts +25 -15
  74. package/src/functions/deepCopyTests.ts +19 -41
  75. package/src/functions/initArray.ts +1 -1
  76. package/src/functions/kColor.ts +8 -2
  77. package/src/functions/log.ts +8 -6
  78. package/src/functions/positionVelocity.ts +2 -0
  79. package/src/functions/rng.ts +2 -0
  80. package/src/functions/serialization.ts +72 -18
  81. package/src/functions/table.ts +15 -6
  82. package/src/functions/vector.ts +11 -3
  83. package/src/functions/weighted.ts +36 -0
  84. package/src/index.ts +2 -1
  85. package/src/interfaces/SaveData.ts +4 -3
  86. package/src/objects/isaacAPIClassTypeToBrand.ts +1 -1
  87. package/src/objects/isaacAPIClassTypeToFunctions.ts +58 -9
  88. package/src/types/WeightedArray.ts +2 -0
  89. package/dist/src/enums/private/CopyableIsaacAPIClassType.d.ts +0 -12
  90. package/dist/src/enums/private/CopyableIsaacAPIClassType.d.ts.map +0 -1
  91. package/dist/src/enums/private/CopyableIsaacAPIClassType.lua +0 -10
  92. package/dist/src/types/SerializedIsaacAPIClass.d.ts +0 -11
  93. package/dist/src/types/SerializedIsaacAPIClass.d.ts.map +0 -1
  94. package/src/enums/private/CopyableIsaacAPIClassType.ts +0 -11
  95. package/src/types/SerializedIsaacAPIClass.ts +0 -9
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ /// <reference types="@typescript-to-lua/language-extensions" />
1
2
  /// <reference types="isaac-typescript-definitions" />
2
3
  /// <reference types="lua-types/5.3" />
3
- /// <reference types="typescript-to-lua/language-extensions" />
4
4
 
5
5
  import { ActiveSlot } from 'isaac-typescript-definitions';
6
6
  import { BackdropType } from 'isaac-typescript-definitions';
@@ -17,6 +17,7 @@ import { CollectiblePedestalType } from 'isaac-typescript-definitions';
17
17
  import { CollectibleType } from 'isaac-typescript-definitions';
18
18
  import { Controller } from 'isaac-typescript-definitions';
19
19
  import { ControllerIndex } from 'isaac-typescript-definitions';
20
+ import { CopyableIsaacAPIClassType } from 'isaac-typescript-definitions';
20
21
  import { CrawlSpaceVariant } from 'isaac-typescript-definitions';
21
22
  import { DamageFlag } from 'isaac-typescript-definitions';
22
23
  import { DiceFloorSubType } from 'isaac-typescript-definitions';
@@ -915,6 +916,9 @@ export declare function convertDecimalToBinary(number: number, minLength?: int):
915
916
  */
916
917
  export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
917
918
 
919
+ /** A type representing an Isaac API class that can be safely copied or serialized. */
920
+ declare type CopyableIsaacAPIClass = BitSet128 | Color | KColor | RNG | Vector;
921
+
918
922
  /**
919
923
  * Helper function to perform a shallow copy.
920
924
  *
@@ -936,7 +940,7 @@ export declare function copyColor(color: Color): Color;
936
940
  *
937
941
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
938
942
  */
939
- export declare function copyIsaacAPIClass(isaacAPIClass: unknown): unknown;
943
+ export declare function copyIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaacAPIClass: T): T;
940
944
 
941
945
  /** Helper function to copy a `KColor` Isaac API class. */
942
946
  export declare function copyKColor(kColor: KColor): KColor;
@@ -950,8 +954,8 @@ export declare function copyRNG(rng: RNG): RNG;
950
954
  /** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
951
955
  export declare function copySet<T>(oldSet: Set<T> | ReadonlySet<T>): Set<T>;
952
956
 
953
- /** Helper function to copy specific values from a object to a table. */
954
- export declare function copyValuesToTable(object: unknown, keys: string[], luaMap: LuaMap<string, unknown>): void;
957
+ /** Helper function to copy specific values from a userdata object (e.g. `Vector`) to a table. */
958
+ export declare function copyUserdataValuesToTable(object: unknown, keys: string[], luaMap: LuaMap<string, unknown>): void;
955
959
 
956
960
  /** Helper function to copy a `Vector` Isaac API class. */
957
961
  export declare function copyVector(vector: Vector): Vector;
@@ -1545,7 +1549,9 @@ export declare interface CustomStageTSConfig {
1545
1549
  * @param insideMap Optional. Tracks whether or not the deep copy function is in the process of
1546
1550
  * recursively copying a TSTL Map. Default is false.
1547
1551
  */
1548
- export declare function deepCopy(value: unknown, serializationType?: SerializationType, traversalDescription?: string, insideMap?: boolean): unknown;
1552
+ export declare function deepCopy<T>(value: T, serializationType?: SerializationType.NONE, traversalDescription?: string, insideMap?: boolean): T;
1553
+
1554
+ export declare function deepCopy(value: unknown, serializationType: SerializationType, traversalDescription?: string, insideMap?: boolean): unknown;
1549
1555
 
1550
1556
  export declare const DEFAULT_BASE_STAGE = LevelStage.BASEMENT_2;
1551
1557
 
@@ -1701,16 +1707,21 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
1701
1707
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
1702
1708
  * all of the entries and grid entities in the provided JSON room.
1703
1709
  *
1710
+ * You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
1711
+ * my-rooms.xml`).
1712
+ *
1704
1713
  * This function is meant to be used in the `POST_NEW_ROOM` callback.
1705
1714
  *
1706
1715
  * For example:
1707
1716
  *
1708
1717
  * ```ts
1709
1718
  *
1710
- * import customRooms from "./customRooms";
1719
+ * import customRooms from "./customRooms.json";
1711
1720
  *
1712
- * const firstJSONRoom = customRooms.rooms.room[0];
1713
- * deployJSONRoom(firstJSONRoom);
1721
+ * export function postNewRoom(): void {
1722
+ * const firstJSONRoom = customRooms.rooms.room[0];
1723
+ * deployJSONRoom(firstJSONRoom);
1724
+ * }
1714
1725
  * ```
1715
1726
  *
1716
1727
  * @param jsonRoom The JSON room to deploy. *
@@ -1726,6 +1737,9 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom | Readonly<JSONRoom>,
1726
1737
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
1727
1738
  * all of the entries and grid entities in one of the provided JSON rooms.
1728
1739
  *
1740
+ * You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
1741
+ * my-rooms.xml`).
1742
+ *
1729
1743
  * This function is meant to be used in the `POST_NEW_ROOM` callback.
1730
1744
  *
1731
1745
  * Note that this function does not simply choose a random element in the provided array; it will
@@ -1735,10 +1749,12 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom | Readonly<JSONRoom>,
1735
1749
  * For example:
1736
1750
  *
1737
1751
  * ```ts
1738
- * import customRooms from "./customRooms";
1752
+ * import customRooms from "./customRooms.json";
1739
1753
  *
1740
- * const jsonRooms = customRooms.rooms.room;
1741
- * deployRandomJSONRoom(jsonRooms);
1754
+ * export function postNewRoom(): void {
1755
+ * const jsonRooms = customRooms.rooms.room;
1756
+ * deployRandomJSONRoom(jsonRooms);
1757
+ * }
1742
1758
  * ```
1743
1759
  *
1744
1760
  * @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
@@ -1769,7 +1785,7 @@ export declare function deserializeColor(color: SerializedColor): Color;
1769
1785
  *
1770
1786
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
1771
1787
  */
1772
- export declare function deserializeIsaacAPIClass(serializedIsaacAPIClass: unknown): unknown;
1788
+ export declare function deserializeIsaacAPIClass<SerializedT extends SerializedIsaacAPIClass>(serializedIsaacAPIClass: SerializedT): IsaacAPIClassTypeToType[SerializedT["__kind"]];
1773
1789
 
1774
1790
  /**
1775
1791
  * Helper function to convert a `SerializedKColor` object to a normal `KColor` object. (This is used
@@ -2157,6 +2173,8 @@ export declare function find<T>(array: T[], func: (value: T, index: number, arra
2157
2173
  * @param startingPosition The position to start searching from. If this position is not overlapping
2158
2174
  * with anything, then it will be returned.
2159
2175
  * @param avoidActiveEntities Optional. Default is false.
2176
+ * @param minimumDistance Optional. If specified, will ensure that the randomly generated position
2177
+ * is equal to or greater than the distance provided.
2160
2178
  */
2161
2179
  export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
2162
2180
 
@@ -2899,7 +2917,7 @@ export declare function getCrawlSpaces(crawlSpaceVariant?: CrawlSpaceVariant): G
2899
2917
  /**
2900
2918
  * Helper function to get the actual bit flag for modded curses.
2901
2919
  *
2902
- * Will throw a runtime error if the provided curse does not exist.
2920
+ * Will throw a run-time error if the provided curse does not exist.
2903
2921
  *
2904
2922
  * Use this over the `Isaac.GetCurseIdByName` method because that will return an integer instead of
2905
2923
  * a bit flag.
@@ -4451,6 +4469,9 @@ export declare function getRandomEnumValue<T>(transpiledEnum: T, seedOrRNG?: See
4451
4469
  */
4452
4470
  export declare function getRandomFloat(min: int, max: int, seedOrRNG?: Seed | RNG): float;
4453
4471
 
4472
+ /** Get a random value from a `WeightedArray`. (The second element in the array is the weight.) */
4473
+ export declare function getRandomFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG?: Seed | RNG): T;
4474
+
4454
4475
  /**
4455
4476
  * This returns a random integer between min and max. It is inclusive on both ends.
4456
4477
  *
@@ -5667,6 +5688,22 @@ export declare function irange(start: int, end?: int): int[];
5667
5688
  */
5668
5689
  export declare function isaacAPIClassEquals(object1: unknown, object2: unknown, keys: string[]): boolean;
5669
5690
 
5691
+ declare interface IsaacAPIClassTypeToSerializedType {
5692
+ [CopyableIsaacAPIClassType.BIT_SET_128]: SerializedBitSet128;
5693
+ [CopyableIsaacAPIClassType.COLOR]: SerializedColor;
5694
+ [CopyableIsaacAPIClassType.K_COLOR]: SerializedKColor;
5695
+ [CopyableIsaacAPIClassType.RNG]: SerializedRNG;
5696
+ [CopyableIsaacAPIClassType.VECTOR]: SerializedVector;
5697
+ }
5698
+
5699
+ declare interface IsaacAPIClassTypeToType {
5700
+ [CopyableIsaacAPIClassType.BIT_SET_128]: BitSet128;
5701
+ [CopyableIsaacAPIClassType.COLOR]: Color;
5702
+ [CopyableIsaacAPIClassType.K_COLOR]: KColor;
5703
+ [CopyableIsaacAPIClassType.RNG]: RNG;
5704
+ [CopyableIsaacAPIClassType.VECTOR]: Vector;
5705
+ }
5706
+
5670
5707
  /** Iterates over all inputs to determine if a particular button is pressed (i.e. held down). */
5671
5708
  export declare function isActionPressedOnAnyInput(buttonAction: ButtonAction): boolean;
5672
5709
 
@@ -5834,6 +5871,14 @@ export declare function isCollectibleUnlocked(collectibleType: CollectibleType,
5834
5871
  /** Helper function to check if something is an instantiated `Color` object. */
5835
5872
  export declare function isColor(object: unknown): object is Color;
5836
5873
 
5874
+ /**
5875
+ * Helper function to generically check if a given object is a copyable Isaac API class. (This is
5876
+ * used by the save data manager when determining what is safe to copy.)
5877
+ *
5878
+ * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
5879
+ */
5880
+ export declare function isCopyableIsaacAPIClass(object: unknown): object is CopyableIsaacAPIClass;
5881
+
5837
5882
  /**
5838
5883
  * Helper function to check if a `GridEntity` is a custom grid entity or if a grid index has a
5839
5884
  * custom grid entity.
@@ -6475,7 +6520,7 @@ export declare const itemConfig: ItemConfig;
6475
6520
  * false in situations where iterating randomly would not matter and you need the
6476
6521
  * extra performance.
6477
6522
  */
6478
- export declare function iterateTableInOrder<K, V>(luaMap: LuaMap<K, V>, func: (key: K, value: V) => void, inOrder?: boolean): void;
6523
+ export declare function iterateTableInOrder<K extends AnyNotNil, V>(luaMap: LuaMap<K, V>, func: (key: K, value: V) => void, inOrder?: boolean): void;
6479
6524
 
6480
6525
  /**
6481
6526
  * Helper function for non-TypeScript users to convert an array to a string with the specified
@@ -6824,7 +6869,7 @@ export declare function logTable(luaTable: unknown, parentTables?: number): void
6824
6869
  * Helper function to print out the differences between the entries of two tables. Note that this
6825
6870
  * will only do a shallow comparison.
6826
6871
  */
6827
- export declare function logTableDifferences<K, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
6872
+ export declare function logTableDifferences<K extends AnyNotNil, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
6828
6873
 
6829
6874
  /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
6830
6875
  export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
@@ -10387,7 +10432,7 @@ export declare const SECOND_IN_MILLISECONDS = 1000;
10387
10432
  * The recursive nature of this type is based on the `Immutable` type:
10388
10433
  * https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
10389
10434
  */
10390
- declare type Serializable<T> = T extends SerializablePrimitive ? T : T extends SerializableIsaacAPIClass ? T : T extends IsaacAPIClass ? ErrorIsaacAPIClassIsNotSerializable : T extends Array<infer U> ? SerializableArray<U> : T extends ReadonlyArray<infer U> ? SerializableReadonlyArray<U> : T extends Map<infer K, infer V> ? SerializableMap<K, V> : T extends ReadonlyMap<infer K, infer V> ? SerializableReadonlyMap<K, V> : T extends Set<infer V> ? SerializableSet<V> : T extends ReadonlySet<infer V> ? SerializableReadonlySet<V> : SerializableObject<T>;
10435
+ declare type Serializable<T> = T extends SerializablePrimitive ? T : T extends CopyableIsaacAPIClass ? T : T extends IsaacAPIClass ? ErrorIsaacAPIClassIsNotSerializable : T extends Array<infer U> ? SerializableArray<U> : T extends ReadonlyArray<infer U> ? SerializableReadonlyArray<U> : T extends Map<infer K, infer V> ? SerializableMap<K, V> : T extends ReadonlyMap<infer K, infer V> ? SerializableReadonlyMap<K, V> : T extends Set<infer V> ? SerializableSet<V> : T extends ReadonlySet<infer V> ? SerializableReadonlySet<V> : SerializableObject<T>;
10391
10436
 
10392
10437
  declare type SerializableArray<T> = Array<SerializableInsideArrayOrMap<T>>;
10393
10438
 
@@ -10395,9 +10440,7 @@ declare type SerializableArray<T> = Array<SerializableInsideArrayOrMap<T>>;
10395
10440
  * This is mostly copied from the `Serializable` type. The difference is that we want to disallow
10396
10441
  * classes with methods.
10397
10442
  */
10398
- declare type SerializableInsideArrayOrMap<T> = T extends SerializablePrimitive ? T : T extends SerializableIsaacAPIClass ? T : T extends IsaacAPIClass ? ErrorIsaacAPIClassIsNotSerializable : T extends Array<infer U> ? SerializableArray<U> : T extends ReadonlyArray<infer U> ? SerializableReadonlyArray<U> : T extends Map<infer K, infer V> ? SerializableMap<K, V> : T extends ReadonlyMap<infer K, infer V> ? SerializableReadonlyMap<K, V> : T extends Set<infer V> ? SerializableSet<V> : T extends ReadonlySet<infer V> ? SerializableReadonlySet<V> : T extends HasMethods<T> ? ErrorCustomClassNotSerializable : T extends Function ? FunctionIsNotSerializable : SerializableObject<T>;
10399
-
10400
- declare type SerializableIsaacAPIClass = BitSet128 | Color | KColor | RNG | Vector;
10443
+ declare type SerializableInsideArrayOrMap<T> = T extends SerializablePrimitive ? T : T extends CopyableIsaacAPIClass ? T : T extends IsaacAPIClass ? ErrorIsaacAPIClassIsNotSerializable : T extends Array<infer U> ? SerializableArray<U> : T extends ReadonlyArray<infer U> ? SerializableReadonlyArray<U> : T extends Map<infer K, infer V> ? SerializableMap<K, V> : T extends ReadonlyMap<infer K, infer V> ? SerializableReadonlyMap<K, V> : T extends Set<infer V> ? SerializableSet<V> : T extends ReadonlySet<infer V> ? SerializableReadonlySet<V> : T extends HasMethods<T> ? ErrorCustomClassNotSerializable : T extends Function ? FunctionIsNotSerializable : SerializableObject<T>;
10401
10444
 
10402
10445
  declare type SerializableMap<K, V> = Map<SerializableInsideArrayOrMap<K>, SerializableInsideArrayOrMap<V>>;
10403
10446
 
@@ -10436,32 +10479,35 @@ export declare function serializeColor(color: Color): SerializedColor;
10436
10479
 
10437
10480
  export declare type SerializedBitSet128 = LuaMap<string, unknown> & {
10438
10481
  readonly __serializedBitSet128Brand: symbol;
10482
+ readonly __kind: CopyableIsaacAPIClassType.BIT_SET_128;
10439
10483
  };
10440
10484
 
10441
10485
  export declare type SerializedColor = LuaMap<string, unknown> & {
10442
10486
  readonly __serializedColorBrand: symbol;
10487
+ readonly __kind: CopyableIsaacAPIClassType.COLOR;
10443
10488
  };
10444
10489
 
10445
10490
  /**
10446
- * This is a type representing an Isaac API class like `Color` or `RNG` that has been written to the
10491
+ * A type representing an Isaac API class like `Color` or `RNG` that has been written to the
10447
10492
  * "save#.dat" file. It is used by the save data manager when reading and writing to that file.
10448
10493
  *
10449
10494
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
10450
10495
  */
10451
- export declare type SerializedIsaacAPIClass = LuaMap<string, unknown> & {
10452
- readonly __serializedIsaacAPIClassBrand: symbol;
10453
- };
10496
+ declare type SerializedIsaacAPIClass = SerializedBitSet128 | SerializedColor | SerializedKColor | SerializedRNG | SerializedVector;
10454
10497
 
10455
10498
  export declare type SerializedKColor = LuaMap<string, unknown> & {
10456
10499
  readonly __serializedKColorBrand: symbol;
10500
+ readonly __kind: CopyableIsaacAPIClassType.K_COLOR;
10457
10501
  };
10458
10502
 
10459
10503
  export declare type SerializedRNG = LuaMap<string, unknown> & {
10460
10504
  readonly __serializedRNGBrand: symbol;
10505
+ readonly __kind: CopyableIsaacAPIClassType.RNG;
10461
10506
  };
10462
10507
 
10463
10508
  export declare type SerializedVector = LuaMap<string, unknown> & {
10464
10509
  readonly __serializedVectorBrand: symbol;
10510
+ readonly __kind: CopyableIsaacAPIClassType.VECTOR;
10465
10511
  };
10466
10512
 
10467
10513
  /**
@@ -10470,7 +10516,7 @@ export declare type SerializedVector = LuaMap<string, unknown> & {
10470
10516
  *
10471
10517
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
10472
10518
  */
10473
- export declare function serializeIsaacAPIClass(isaacAPIClass: unknown): unknown;
10519
+ export declare function serializeIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaacAPIClass: T): IsaacAPIClassTypeToSerializedType[T["__kind"]];
10474
10520
 
10475
10521
  /**
10476
10522
  * Helper function to convert a `KColor` object to a `SerializedKColor` object. (This is used by the
@@ -12030,6 +12076,9 @@ export declare function vectorToString(vector: Vector, round?: boolean): string;
12030
12076
  */
12031
12077
  export declare const VectorZero: Readonly<Vector>;
12032
12078
 
12079
+ /** An array where each element is paired with a number indicating that elements 'weight'. */
12080
+ export declare type WeightedArray<T> = Array<[T, float]>;
12081
+
12033
12082
  /**
12034
12083
  * Assuming that we are on the frame of fatal damage, this function returns whether or not
12035
12084
  * Mysterious Paper would rotate to Missing Poster on the frame that the "Game Over" screen would