isaacscript-common 10.0.0 → 10.1.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.
Files changed (88) hide show
  1. package/dist/index.d.ts +78 -22
  2. package/dist/isaacscript-common.lua +203 -102
  3. package/dist/package.lua +2 -2
  4. package/dist/src/features/deployJSONRoom.d.ts +16 -6
  5. package/dist/src/features/deployJSONRoom.d.ts.map +1 -1
  6. package/dist/src/features/deployJSONRoom.lua +16 -6
  7. package/dist/src/features/saveDataManager/load.d.ts.map +1 -1
  8. package/dist/src/features/saveDataManager/merge.d.ts.map +1 -1
  9. package/dist/src/features/saveDataManager/saveDataManagerConstants.d.ts +1 -1
  10. package/dist/src/features/saveDataManager/saveDataManagerConstants.d.ts.map +1 -1
  11. package/dist/src/functions/bitSet128.d.ts +2 -1
  12. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  13. package/dist/src/functions/bitSet128.lua +2 -2
  14. package/dist/src/functions/color.d.ts +2 -3
  15. package/dist/src/functions/color.d.ts.map +1 -1
  16. package/dist/src/functions/color.lua +2 -2
  17. package/dist/src/functions/curses.d.ts +1 -1
  18. package/dist/src/functions/curses.lua +1 -1
  19. package/dist/src/functions/deepCopy.d.ts +2 -1
  20. package/dist/src/functions/deepCopy.d.ts.map +1 -1
  21. package/dist/src/functions/deepCopy.lua +19 -25
  22. package/dist/src/functions/deepCopyTests.lua +13 -26
  23. package/dist/src/functions/doors.d.ts +9 -1
  24. package/dist/src/functions/doors.d.ts.map +1 -1
  25. package/dist/src/functions/doors.lua +8 -1
  26. package/dist/src/functions/kColor.d.ts +2 -3
  27. package/dist/src/functions/kColor.d.ts.map +1 -1
  28. package/dist/src/functions/kColor.lua +2 -2
  29. package/dist/src/functions/rng.d.ts +2 -2
  30. package/dist/src/functions/rng.d.ts.map +1 -1
  31. package/dist/src/functions/serialization.d.ts +11 -4
  32. package/dist/src/functions/serialization.d.ts.map +1 -1
  33. package/dist/src/functions/serialization.lua +15 -0
  34. package/dist/src/functions/table.d.ts +2 -2
  35. package/dist/src/functions/table.d.ts.map +1 -1
  36. package/dist/src/functions/table.lua +6 -5
  37. package/dist/src/functions/vector.d.ts +2 -1
  38. package/dist/src/functions/vector.d.ts.map +1 -1
  39. package/dist/src/functions/vector.lua +2 -2
  40. package/dist/src/functions/weighted.d.ts +6 -0
  41. package/dist/src/functions/weighted.d.ts.map +1 -0
  42. package/dist/src/functions/weighted.lua +35 -0
  43. package/dist/src/index.d.ts +2 -1
  44. package/dist/src/index.d.ts.map +1 -1
  45. package/dist/src/index.lua +8 -0
  46. package/dist/src/interfaces/SaveData.d.ts +3 -8
  47. package/dist/src/interfaces/SaveData.d.ts.map +1 -1
  48. package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts +1 -1
  49. package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts.map +1 -1
  50. package/dist/src/objects/isaacAPIClassTypeToBrand.lua +2 -2
  51. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts +36 -8
  52. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -1
  53. package/dist/src/objects/isaacAPIClassTypeToFunctions.lua +42 -7
  54. package/dist/src/types/WeightedArray.d.ts +4 -0
  55. package/dist/src/types/WeightedArray.d.ts.map +1 -0
  56. package/dist/src/types/{SerializedIsaacAPIClass.lua → WeightedArray.lua} +0 -0
  57. package/package.json +2 -2
  58. package/src/callbacks/customRevive.ts +1 -2
  59. package/src/features/deployJSONRoom.ts +16 -6
  60. package/src/features/saveDataManager/exports.ts +1 -1
  61. package/src/features/saveDataManager/load.ts +0 -2
  62. package/src/features/saveDataManager/merge.ts +0 -3
  63. package/src/features/saveDataManager/saveDataManagerConstants.ts +1 -1
  64. package/src/functions/bitSet128.ts +8 -2
  65. package/src/functions/color.ts +8 -2
  66. package/src/functions/curses.ts +1 -1
  67. package/src/functions/deepCopy.ts +25 -23
  68. package/src/functions/deepCopyTests.ts +19 -41
  69. package/src/functions/doors.ts +13 -1
  70. package/src/functions/initArray.ts +1 -1
  71. package/src/functions/kColor.ts +8 -2
  72. package/src/functions/rng.ts +2 -0
  73. package/src/functions/serialization.ts +72 -18
  74. package/src/functions/table.ts +8 -5
  75. package/src/functions/vector.ts +11 -3
  76. package/src/functions/weighted.ts +36 -0
  77. package/src/index.ts +2 -1
  78. package/src/interfaces/SaveData.ts +4 -3
  79. package/src/objects/isaacAPIClassTypeToBrand.ts +1 -1
  80. package/src/objects/isaacAPIClassTypeToFunctions.ts +58 -9
  81. package/src/types/WeightedArray.ts +2 -0
  82. package/dist/src/enums/private/CopyableIsaacAPIClassType.d.ts +0 -12
  83. package/dist/src/enums/private/CopyableIsaacAPIClassType.d.ts.map +0 -1
  84. package/dist/src/enums/private/CopyableIsaacAPIClassType.lua +0 -10
  85. package/dist/src/types/SerializedIsaacAPIClass.d.ts +0 -11
  86. package/dist/src/types/SerializedIsaacAPIClass.d.ts.map +0 -1
  87. package/src/enums/private/CopyableIsaacAPIClassType.ts +0 -11
  88. package/src/types/SerializedIsaacAPIClass.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../../src/functions/rng.ts"],"names":[],"mappings":";;;AAMA,oBAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACpD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC,CAAC;AAYF,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CASrC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,CAgBtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAEpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,M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MxE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,OAAkB,GAAG,GAAG,CAIlD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAYpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAoBjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAK1D;AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CASlD"}
@@ -1,11 +1,11 @@
1
- import { SerializedIsaacAPIClass } from "../types/SerializedIsaacAPIClass";
1
+ import { CopyableIsaacAPIClass, IsaacAPIClassTypeToSerializedType, IsaacAPIClassTypeToType, SerializedIsaacAPIClass } from "../objects/isaacAPIClassTypeToFunctions";
2
2
  /**
3
3
  * Helper function to generically copy an Isaac API class without knowing what specific type of
4
4
  * class it is. (This is used by the save data manager.)
5
5
  *
6
6
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
7
7
  */
8
- export declare function copyIsaacAPIClass(isaacAPIClass: unknown): unknown;
8
+ export declare function copyIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaacAPIClass: T): T;
9
9
  /**
10
10
  * Helper function to generically deserialize an Isaac API class without knowing what specific type
11
11
  * of class it is. (This is used by the save data manager when reading data from the "save#.dat"
@@ -13,7 +13,14 @@ export declare function copyIsaacAPIClass(isaacAPIClass: unknown): unknown;
13
13
  *
14
14
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
15
15
  */
16
- export declare function deserializeIsaacAPIClass(serializedIsaacAPIClass: unknown): unknown;
16
+ export declare function deserializeIsaacAPIClass<SerializedT extends SerializedIsaacAPIClass>(serializedIsaacAPIClass: SerializedT): IsaacAPIClassTypeToType[SerializedT["__kind"]];
17
+ /**
18
+ * Helper function to generically check if a given object is a copyable Isaac API class. (This is
19
+ * used by the save data manager when determining what is safe to copy.)
20
+ *
21
+ * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
22
+ */
23
+ export declare function isCopyableIsaacAPIClass(object: unknown): object is CopyableIsaacAPIClass;
17
24
  /**
18
25
  * Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
19
26
  * is used by the save data manager when reading data from the "save#.dat" file.)
@@ -27,5 +34,5 @@ export declare function isSerializedIsaacAPIClass(object: unknown): object is Se
27
34
  *
28
35
  * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
29
36
  */
30
- export declare function serializeIsaacAPIClass(isaacAPIClass: unknown): unknown;
37
+ export declare function serializeIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaacAPIClass: T): IsaacAPIClassTypeToSerializedType[T["__kind"]];
31
38
  //# sourceMappingURL=serialization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/functions/serialization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAI3E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CA0BjE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,uBAAuB,EAAE,OAAO,GAC/B,OAAO,CA0BT;AAoBD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,uBAAuB,CAQnC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CA0BtE"}
1
+ {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/functions/serialization.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EAErB,iCAAiC,EACjC,uBAAuB,EAEvB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AAIjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,EAC/D,aAAa,EAAE,CAAC,GACf,CAAC,CAoCH;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,SAAS,uBAAuB,EAE3C,uBAAuB,EAAE,WAAW,GACnC,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAkChD;AAoBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,qBAAqB,CAIjC;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,uBAAuB,CAQnC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,EACpE,aAAa,EAAE,CAAC,GACf,iCAAiC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAoChD"}
@@ -63,6 +63,21 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
63
63
  end
64
64
  return functions:deserialize(serializedIsaacAPIClass)
65
65
  end
66
+ --- Helper function to generically check if a given object is a copyable Isaac API class. (This is
67
+ -- used by the save data manager when determining what is safe to copy.)
68
+ --
69
+ -- For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
70
+ function ____exports.isCopyableIsaacAPIClass(self, object)
71
+ local allFunctions = __TS__ObjectValues(ISAAC_API_CLASS_TYPE_TO_FUNCTIONS)
72
+ local isFunctions = __TS__ArrayMap(
73
+ allFunctions,
74
+ function(____, functions) return functions.is end
75
+ )
76
+ return __TS__ArraySome(
77
+ isFunctions,
78
+ function(____, identityFunction) return identityFunction(nil, object) end
79
+ )
80
+ end
66
81
  --- Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
67
82
  -- is used by the save data manager when reading data from the "save#.dat" file.)
68
83
  --
@@ -4,8 +4,8 @@
4
4
  * `clear` method does not exist. Use this helper function as a drop-in replacement for this.
5
5
  */
6
6
  export declare function clearTable(luaMap: LuaMap<AnyNotNil, unknown>): void;
7
- /** Helper function to copy specific values from a object to a table. */
8
- export declare function copyValuesToTable(object: unknown, keys: string[], luaMap: LuaMap<string, unknown>): void;
7
+ /** Helper function to copy specific values from a userdata object (e.g. `Vector`) to a table. */
8
+ export declare function copyUserdataValuesToTable(object: unknown, keys: string[], luaMap: LuaMap<string, unknown>): void;
9
9
  /**
10
10
  * Helper function to safely get boolean values from a Lua table. Will throw an error if the
11
11
  * specific value does not exist on the table.
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/functions/table.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,IAAI,CAInE;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CAaN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,OAAO,EAAE,CAoBX;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CA4BV;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,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M,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CAmBV;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,EACxD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,EAChC,OAAO,UAAO,GACb,IAAI,CA6BN;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EAClC,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,OAAO,CAET"}
@@ -8,7 +8,7 @@ local ____types = require("src.functions.types")
8
8
  local isBoolean = ____types.isBoolean
9
9
  local isNumber = ____types.isNumber
10
10
  local isString = ____types.isString
11
- local isTable = ____types.isTable
11
+ local isUserdata = ____types.isUserdata
12
12
  --- In a `Map`, you can use the `clear` method to delete every element. However, in a `LuaMap`, the
13
13
  -- `clear` method does not exist. Use this helper function as a drop-in replacement for this.
14
14
  function ____exports.clearTable(self, luaMap)
@@ -16,13 +16,14 @@ function ____exports.clearTable(self, luaMap)
16
16
  luaMap[key] = nil
17
17
  end
18
18
  end
19
- --- Helper function to copy specific values from a object to a table.
20
- function ____exports.copyValuesToTable(self, object, keys, luaMap)
21
- if not isTable(nil, object) then
19
+ --- Helper function to copy specific values from a userdata object (e.g. `Vector`) to a table.
20
+ function ____exports.copyUserdataValuesToTable(self, object, keys, luaMap)
21
+ if not isUserdata(nil, object) then
22
22
  error("Failed to copy an object values to a table, since the object was of type: " .. type(object))
23
23
  end
24
+ local userdata = object
24
25
  for ____, key in ipairs(keys) do
25
- local value = object[key]
26
+ local value = userdata[key]
26
27
  luaMap[key] = value
27
28
  end
28
29
  end
@@ -1,7 +1,8 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
- import { Direction } from "isaac-typescript-definitions";
2
+ import { CopyableIsaacAPIClassType, Direction } from "isaac-typescript-definitions";
3
3
  export declare type SerializedVector = LuaMap<string, unknown> & {
4
4
  readonly __serializedVectorBrand: symbol;
5
+ readonly __kind: CopyableIsaacAPIClassType.VECTOR;
5
6
  };
6
7
  /** Helper function to copy a `Vector` Isaac API class. */
7
8
  export declare function copyVector(vector: Vector): Vector;
@@ -1 +1 @@
1
- {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AASzD,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
1
+ {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AAatC,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
@@ -14,7 +14,7 @@ local getRandomSeed = ____rng.getRandomSeed
14
14
  local isRNG = ____rng.isRNG
15
15
  local newRNG = ____rng.newRNG
16
16
  local ____table = require("src.functions.table")
17
- local copyValuesToTable = ____table.copyValuesToTable
17
+ local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
18
18
  local getNumbersFromTable = ____table.getNumbersFromTable
19
19
  local tableHasKeys = ____table.tableHasKeys
20
20
  local ____types = require("src.functions.types")
@@ -88,7 +88,7 @@ function ____exports.serializeVector(self, vector)
88
88
  error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
89
89
  end
90
90
  local vectorTable = {}
91
- copyValuesToTable(nil, vector, KEYS, vectorTable)
91
+ copyUserdataValuesToTable(nil, vector, KEYS, vectorTable)
92
92
  vectorTable[SerializationBrand.VECTOR] = ""
93
93
  return vectorTable
94
94
  end
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
3
+ import { WeightedArray } from "../types/WeightedArray";
4
+ /** Get a random value from a `WeightedArray`. (The second element in the array is the weight.) */
5
+ export declare function getRandomFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG?: Seed | RNG): T;
6
+ //# sourceMappingURL=weighted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weighted.d.ts","sourceRoot":"","sources":["../../../src/functions/weighted.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD,kGAAkG;AAClG,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAC/B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,CAAC,CA0BH"}
@@ -0,0 +1,35 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
+ local ____exports = {}
4
+ local ____array = require("src.functions.array")
5
+ local arrayToString = ____array.arrayToString
6
+ local sumArray = ____array.sumArray
7
+ local ____random = require("src.functions.random")
8
+ local getRandomFloat = ____random.getRandomFloat
9
+ local ____rng = require("src.functions.rng")
10
+ local getRandomSeed = ____rng.getRandomSeed
11
+ --- Get a random value from a `WeightedArray`. (The second element in the array is the weight.)
12
+ function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
13
+ if seedOrRNG == nil then
14
+ seedOrRNG = getRandomSeed(nil)
15
+ end
16
+ if #weightedArray == 0 then
17
+ error("Failed to get a random element from a weighted array since the provided array was empty.")
18
+ end
19
+ local weights = __TS__ArrayMap(
20
+ weightedArray,
21
+ function(____, tuple) return tuple[2] end
22
+ )
23
+ local totalWeight = sumArray(nil, weights)
24
+ local randomWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
25
+ local weightAccumulator = 0
26
+ for ____, tuple in ipairs(weightedArray) do
27
+ local element, weight = table.unpack(tuple)
28
+ weightAccumulator = weightAccumulator + weight
29
+ if weightAccumulator >= randomWeight then
30
+ return element
31
+ end
32
+ end
33
+ error("Failed to get a random element from a weighted array: " .. arrayToString(nil, weightedArray))
34
+ end
35
+ return ____exports
@@ -149,6 +149,7 @@ export * from "./functions/types";
149
149
  export * from "./functions/ui";
150
150
  export * from "./functions/utils";
151
151
  export * from "./functions/vector";
152
+ export * from "./functions/weighted";
152
153
  export * from "./interfaces/ChargeBarSprites";
153
154
  export * from "./interfaces/Corner";
154
155
  export * from "./interfaces/CustomStageTSConfig";
@@ -174,6 +175,6 @@ export * from "./types/PickingUpItem";
174
175
  export * from "./types/PickupIndex";
175
176
  export * from "./types/PlayerIndex";
176
177
  export * from "./types/PossibleStatType";
177
- export * from "./types/SerializedIsaacAPIClass";
178
178
  export * from "./types/TSTLClass";
179
+ export * from "./types/WeightedArray";
179
180
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,C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AC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
@@ -1207,6 +1207,14 @@ do
1207
1207
  end
1208
1208
  end
1209
1209
  end
1210
+ do
1211
+ local ____export = require("src.functions.weighted")
1212
+ for ____exportKey, ____exportValue in pairs(____export) do
1213
+ if ____exportKey ~= "default" then
1214
+ ____exports[____exportKey] = ____exportValue
1215
+ end
1216
+ end
1217
+ end
1210
1218
  do
1211
1219
  local ____export = require("src.maps.cardNameToTypeMap")
1212
1220
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -1,9 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /// <reference types="isaac-typescript-definitions" />
4
- /// <reference types="isaac-typescript-definitions" />
5
- /// <reference types="isaac-typescript-definitions" />
6
- /// <reference types="isaac-typescript-definitions" />
2
+ import { CopyableIsaacAPIClass } from "../objects/isaacAPIClassTypeToFunctions";
7
3
  /**
8
4
  * This is the format of the object that you give to the save data manager. It will contains all of
9
5
  * the variables for the particular mod feature.
@@ -39,12 +35,12 @@ export interface SaveData<Persistent = unknown, Run = unknown, Level = unknown>
39
35
  * The recursive nature of this type is based on the `Immutable` type:
40
36
  * https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
41
37
  */
42
- 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>;
38
+ 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>;
43
39
  /**
44
40
  * This is mostly copied from the `Serializable` type. The difference is that we want to disallow
45
41
  * classes with methods.
46
42
  */
47
- 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>;
43
+ 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>;
48
44
  declare type SerializablePrimitive = boolean | string | number | undefined | null;
49
45
  declare type SerializableArray<T> = Array<SerializableInsideArrayOrMap<T>>;
50
46
  declare type SerializableReadonlyArray<T> = ReadonlyArray<SerializableInsideArrayOrMap<T>>;
@@ -55,7 +51,6 @@ declare type SerializableReadonlySet<T> = ReadonlySet<SerializableInsideArrayOrM
55
51
  declare type SerializableObject<T> = {
56
52
  [K in keyof T]: Serializable<T[K]>;
57
53
  };
58
- declare type SerializableIsaacAPIClass = BitSet128 | Color | KColor | RNG | Vector;
59
54
  declare type HasMethods<T> = {} extends {
60
55
  [K in keyof T as T[K] extends Function ? K : never]-?: 1;
61
56
  } ? never : T;
@@ -1 +1 @@
1
- {"version":3,"file":"Sa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AAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAGpE,aAAK,UAAU,CAAC,CAAC,IAAI,EAAE,SAAS;KAE7B,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC;CACzD,GACG,KAAK,GACL,CAAC,CAAC;AAEN,aAAK,yBAAyB,GAC5B,6IAA6I,CAAC;AAEhJ,aAAK,mCAAmC,GACtC,qMAAqM,CAAC;AAExM,aAAK,+BAA+B,GAClC,qNAAqN,CAAC"}
@@ -1,4 +1,4 @@
1
- import { CopyableIsaacAPIClassType } from "../enums/private/CopyableIsaacAPIClassType";
1
+ import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
2
2
  import { SerializationBrand } from "../enums/private/SerializationBrand";
3
3
  export declare const ISAAC_API_CLASS_TYPE_TO_BRAND: {
4
4
  readonly [key in CopyableIsaacAPIClassType]: SerializationBrand;
@@ -1 +1 @@
1
- {"version":3,"file":"isaacAPIClassTypeToBrand.d.ts","sourceRoot":"","sources":["../../../src/objects/isaacAPIClassTypeToBrand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,eAAO,MAAM,6BAA6B,EAAE;IAC1C,QAAQ,EAAE,GAAG,IAAI,yBAAyB,GAAG,kBAAkB;CAOvD,CAAC"}
1
+ {"version":3,"file":"isaacAPIClassTypeToBrand.d.ts","sourceRoot":"","sources":["../../../src/objects/isaacAPIClassTypeToBrand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,eAAO,MAAM,6BAA6B,EAAE;IAC1C,QAAQ,EAAE,GAAG,IAAI,yBAAyB,GAAG,kBAAkB;CAOvD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  local ____exports = {}
2
- local ____CopyableIsaacAPIClassType = require("src.enums.private.CopyableIsaacAPIClassType")
3
- local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local CopyableIsaacAPIClassType = ____isaac_2Dtypescript_2Ddefinitions.CopyableIsaacAPIClassType
4
4
  local ____SerializationBrand = require("src.enums.private.SerializationBrand")
5
5
  local SerializationBrand = ____SerializationBrand.SerializationBrand
6
6
  ____exports.ISAAC_API_CLASS_TYPE_TO_BRAND = {
@@ -1,12 +1,40 @@
1
- import { CopyableIsaacAPIClassType } from "../enums/private/CopyableIsaacAPIClassType";
2
- interface IsaacAPIClassTypeFunctions {
3
- isSerialized: (object: unknown) => object is unknown;
4
- copy: (object: any) => any;
5
- serialize: (object: any) => any;
6
- deserialize: (object: any) => any;
1
+ import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
2
+ import { SerializedBitSet128 } from "../functions/bitSet128";
3
+ import { SerializedColor } from "../functions/color";
4
+ import { SerializedKColor } from "../functions/kColor";
5
+ import { SerializedRNG } from "../functions/rng";
6
+ import { SerializedVector } from "../functions/vector";
7
+ /** A type representing an Isaac API class that can be safely copied or serialized. */
8
+ export declare type CopyableIsaacAPIClass = BitSet128 | Color | KColor | RNG | Vector;
9
+ /**
10
+ * A type representing an Isaac API class like `Color` or `RNG` that has been written to the
11
+ * "save#.dat" file. It is used by the save data manager when reading and writing to that file.
12
+ *
13
+ * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
14
+ */
15
+ export declare type SerializedIsaacAPIClass = SerializedBitSet128 | SerializedColor | SerializedKColor | SerializedRNG | SerializedVector;
16
+ export interface IsaacAPIClassTypeToType {
17
+ [CopyableIsaacAPIClassType.BIT_SET_128]: BitSet128;
18
+ [CopyableIsaacAPIClassType.COLOR]: Color;
19
+ [CopyableIsaacAPIClassType.K_COLOR]: KColor;
20
+ [CopyableIsaacAPIClassType.RNG]: RNG;
21
+ [CopyableIsaacAPIClassType.VECTOR]: Vector;
22
+ }
23
+ export interface IsaacAPIClassTypeToSerializedType {
24
+ [CopyableIsaacAPIClassType.BIT_SET_128]: SerializedBitSet128;
25
+ [CopyableIsaacAPIClassType.COLOR]: SerializedColor;
26
+ [CopyableIsaacAPIClassType.K_COLOR]: SerializedKColor;
27
+ [CopyableIsaacAPIClassType.RNG]: SerializedRNG;
28
+ [CopyableIsaacAPIClassType.VECTOR]: SerializedVector;
29
+ }
30
+ export interface IsaacAPIClassTypeFunctions<T, SerializedT> {
31
+ is: (object: unknown) => object is T;
32
+ isSerialized: (object: unknown) => object is SerializedT;
33
+ copy: (object: T) => T;
34
+ serialize: (object: T) => SerializedT;
35
+ deserialize: (object: SerializedT) => T;
7
36
  }
8
37
  export declare const ISAAC_API_CLASS_TYPE_TO_FUNCTIONS: {
9
- readonly [key in CopyableIsaacAPIClassType]: IsaacAPIClassTypeFunctions;
38
+ readonly [key in CopyableIsaacAPIClassType]: IsaacAPIClassTypeFunctions<IsaacAPIClassTypeToType[key], IsaacAPIClassTypeToSerializedType[key]>;
10
39
  };
11
- export {};
12
40
  //# sourceMappingURL=isaacAPIClassTypeToFunctions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isaacAPIClassTypeToFunctions.d.ts","sourceRoot":"","sources":["../../../src/objects/isaacAPIClassTypeToFunctions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAgCvF,UAAU,0BAA0B;IAClC,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,IAAI,OAAO,CAAC;IACrD,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,KA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CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACnD,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACtD,CAAC,yBAAyB,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC;IAC/C,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CACtD;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,EAAE,WAAW;IACxD,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC;IACrC,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,IAAI,WAAW,CAAC;IACzD,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;IACvB,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,WAAW,CAAC;IACtC,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC;CACzC;AAED,eAAO,MAAM,iCAAiC,EAAE;IAC9C,QAAQ,EAAE,GAAG,IAAI,yBAAyB,GAAG,0BAA0B,CACrE,uBAAuB,CAAC,GAAG,CAAC,EAC5B,iCAAiC,CAAC,GAAG,CAAC,CACvC;CAqCO,CAAC"}
@@ -1,36 +1,71 @@
1
1
  local ____exports = {}
2
- local ____CopyableIsaacAPIClassType = require("src.enums.private.CopyableIsaacAPIClassType")
3
- local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local CopyableIsaacAPIClassType = ____isaac_2Dtypescript_2Ddefinitions.CopyableIsaacAPIClassType
4
4
  local ____bitSet128 = require("src.functions.bitSet128")
5
5
  local copyBitSet128 = ____bitSet128.copyBitSet128
6
6
  local deserializeBitSet128 = ____bitSet128.deserializeBitSet128
7
+ local isBitSet128 = ____bitSet128.isBitSet128
7
8
  local isSerializedBitSet128 = ____bitSet128.isSerializedBitSet128
8
9
  local serializeBitSet128 = ____bitSet128.serializeBitSet128
9
10
  local ____color = require("src.functions.color")
10
11
  local copyColor = ____color.copyColor
11
12
  local deserializeColor = ____color.deserializeColor
13
+ local isColor = ____color.isColor
12
14
  local isSerializedColor = ____color.isSerializedColor
13
15
  local serializeColor = ____color.serializeColor
14
16
  local ____kColor = require("src.functions.kColor")
15
17
  local copyKColor = ____kColor.copyKColor
16
18
  local deserializeKColor = ____kColor.deserializeKColor
19
+ local isKColor = ____kColor.isKColor
17
20
  local isSerializedKColor = ____kColor.isSerializedKColor
18
21
  local serializeKColor = ____kColor.serializeKColor
19
22
  local ____rng = require("src.functions.rng")
20
23
  local copyRNG = ____rng.copyRNG
21
24
  local deserializeRNG = ____rng.deserializeRNG
25
+ local isRNG = ____rng.isRNG
22
26
  local isSerializedRNG = ____rng.isSerializedRNG
23
27
  local serializeRNG = ____rng.serializeRNG
24
28
  local ____vector = require("src.functions.vector")
25
29
  local copyVector = ____vector.copyVector
26
30
  local deserializeVector = ____vector.deserializeVector
27
31
  local isSerializedVector = ____vector.isSerializedVector
32
+ local isVector = ____vector.isVector
28
33
  local serializeVector = ____vector.serializeVector
29
34
  ____exports.ISAAC_API_CLASS_TYPE_TO_FUNCTIONS = {
30
- [CopyableIsaacAPIClassType.BIT_SET_128] = {isSerialized = isSerializedBitSet128, copy = copyBitSet128, serialize = serializeBitSet128, deserialize = deserializeBitSet128},
31
- [CopyableIsaacAPIClassType.COLOR] = {isSerialized = isSerializedColor, copy = copyColor, serialize = serializeColor, deserialize = deserializeColor},
32
- [CopyableIsaacAPIClassType.K_COLOR] = {isSerialized = isSerializedKColor, copy = copyKColor, serialize = serializeKColor, deserialize = deserializeKColor},
33
- [CopyableIsaacAPIClassType.RNG] = {isSerialized = isSerializedRNG, copy = copyRNG, serialize = serializeRNG, deserialize = deserializeRNG},
34
- [CopyableIsaacAPIClassType.VECTOR] = {isSerialized = isSerializedVector, copy = copyVector, serialize = serializeVector, deserialize = deserializeVector}
35
+ [CopyableIsaacAPIClassType.BIT_SET_128] = {
36
+ is = isBitSet128,
37
+ isSerialized = isSerializedBitSet128,
38
+ copy = copyBitSet128,
39
+ serialize = serializeBitSet128,
40
+ deserialize = deserializeBitSet128
41
+ },
42
+ [CopyableIsaacAPIClassType.COLOR] = {
43
+ is = isColor,
44
+ isSerialized = isSerializedColor,
45
+ copy = copyColor,
46
+ serialize = serializeColor,
47
+ deserialize = deserializeColor
48
+ },
49
+ [CopyableIsaacAPIClassType.K_COLOR] = {
50
+ is = isKColor,
51
+ isSerialized = isSerializedKColor,
52
+ copy = copyKColor,
53
+ serialize = serializeKColor,
54
+ deserialize = deserializeKColor
55
+ },
56
+ [CopyableIsaacAPIClassType.RNG] = {
57
+ is = isRNG,
58
+ isSerialized = isSerializedRNG,
59
+ copy = copyRNG,
60
+ serialize = serializeRNG,
61
+ deserialize = deserializeRNG
62
+ },
63
+ [CopyableIsaacAPIClassType.VECTOR] = {
64
+ is = isVector,
65
+ isSerialized = isSerializedVector,
66
+ copy = copyVector,
67
+ serialize = serializeVector,
68
+ deserialize = deserializeVector
69
+ }
35
70
  }
36
71
  return ____exports
@@ -0,0 +1,4 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /** An array where each element is paired with a number indicating that elements 'weight'. */
3
+ export declare type WeightedArray<T> = Array<[T, float]>;
4
+ //# sourceMappingURL=WeightedArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WeightedArray.d.ts","sourceRoot":"","sources":["../../../src/types/WeightedArray.ts"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,oBAAY,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^7.0.0"
25
+ "isaac-typescript-definitions": "^7.2.1"
26
26
  }
27
27
  }
@@ -29,7 +29,7 @@ import {
29
29
  preCustomReviveHasSubscriptions,
30
30
  } from "./subscriptions/preCustomRevive";
31
31
 
32
- const DEBUG = false;
32
+ const DEBUG = false as boolean;
33
33
 
34
34
  enum CustomReviveState {
35
35
  DISABLED,
@@ -203,7 +203,6 @@ function playerIsAboutToDie(player: EntityPlayer) {
203
203
  }
204
204
 
205
205
  function logStateChanged() {
206
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
207
206
  if (DEBUG) {
208
207
  log(
209
208
  `Custom revive state changed: ${CustomReviveState[v.run.state]} (${
@@ -225,16 +225,21 @@ function respawnPersistentEntities() {
225
225
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
226
226
  * all of the entries and grid entities in the provided JSON room.
227
227
  *
228
+ * You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
229
+ * my-rooms.xml`).
230
+ *
228
231
  * This function is meant to be used in the `POST_NEW_ROOM` callback.
229
232
  *
230
233
  * For example:
231
234
  *
232
235
  * ```ts
233
236
  *
234
- * import customRooms from "./customRooms";
237
+ * import customRooms from "./customRooms.json";
235
238
  *
236
- * const firstJSONRoom = customRooms.rooms.room[0];
237
- * deployJSONRoom(firstJSONRoom);
239
+ * export function postNewRoom(): void {
240
+ * const firstJSONRoom = customRooms.rooms.room[0];
241
+ * deployJSONRoom(firstJSONRoom);
242
+ * }
238
243
  * ```
239
244
  *
240
245
  * @param jsonRoom The JSON room to deploy. *
@@ -277,6 +282,9 @@ export function deployJSONRoom(
277
282
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
278
283
  * all of the entries and grid entities in one of the provided JSON rooms.
279
284
  *
285
+ * You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
286
+ * my-rooms.xml`).
287
+ *
280
288
  * This function is meant to be used in the `POST_NEW_ROOM` callback.
281
289
  *
282
290
  * Note that this function does not simply choose a random element in the provided array; it will
@@ -286,10 +294,12 @@ export function deployJSONRoom(
286
294
  * For example:
287
295
  *
288
296
  * ```ts
289
- * import customRooms from "./customRooms";
297
+ * import customRooms from "./customRooms.json";
290
298
  *
291
- * const jsonRooms = customRooms.rooms.room;
292
- * deployRandomJSONRoom(jsonRooms);
299
+ * export function postNewRoom(): void {
300
+ * const jsonRooms = customRooms.rooms.room;
301
+ * deployRandomJSONRoom(jsonRooms);
302
+ * }
293
303
  * ```
294
304
  *
295
305
  * @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
@@ -153,7 +153,7 @@ export function saveDataManager<Persistent, Run, Level>(
153
153
 
154
154
  // Make a copy of the initial save data so that we can use it to restore the default values later
155
155
  // on.
156
- const saveDataCopy = deepCopy(v, SerializationType.NONE, key) as typeof v;
156
+ const saveDataCopy = deepCopy(v, SerializationType.NONE, key);
157
157
  saveDataDefaultsMap.set(key, saveDataCopy);
158
158
 
159
159
  // Store the conditional function for later, if present.
@@ -24,7 +24,6 @@ export function loadFromDisk(
24
24
  const jsonString = readSaveDatFile(mod);
25
25
  const newSaveData = jsonDecode(jsonString);
26
26
 
27
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
28
27
  if (SAVE_DATA_MANAGER_DEBUG) {
29
28
  log('Converted data from the "save#.dat" to a Lua table.');
30
29
  }
@@ -51,7 +50,6 @@ export function loadFromDisk(
51
50
  return;
52
51
  }
53
52
 
54
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
55
53
  if (SAVE_DATA_MANAGER_DEBUG) {
56
54
  log(`Merging in stored data for feature: ${key}`);
57
55
  }