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
package/dist/package.lua CHANGED
@@ -1,6 +1,6 @@
1
1
  return {
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 = {"isaac", "rebirth", "afterbirth", "repentance"},
6
6
  homepage = "https://isaacscript.github.io/",
@@ -11,5 +11,5 @@ return {
11
11
  type = "commonjs",
12
12
  main = "dist/src/index",
13
13
  types = "dist/src/index.d.ts",
14
- dependencies = {["isaac-typescript-definitions"] = "^7.0.0"}
14
+ dependencies = {["isaac-typescript-definitions"] = "^7.2.1"}
15
15
  }
@@ -6,16 +6,21 @@ import { JSONRoom } from "../interfaces/JSONRoomsFile";
6
6
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
7
7
  * all of the entries and grid entities in the provided JSON room.
8
8
  *
9
+ * You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
10
+ * my-rooms.xml`).
11
+ *
9
12
  * This function is meant to be used in the `POST_NEW_ROOM` callback.
10
13
  *
11
14
  * For example:
12
15
  *
13
16
  * ```ts
14
17
  *
15
- * import customRooms from "./customRooms";
18
+ * import customRooms from "./customRooms.json";
16
19
  *
17
- * const firstJSONRoom = customRooms.rooms.room[0];
18
- * deployJSONRoom(firstJSONRoom);
20
+ * export function postNewRoom(): void {
21
+ * const firstJSONRoom = customRooms.rooms.room[0];
22
+ * deployJSONRoom(firstJSONRoom);
23
+ * }
19
24
  * ```
20
25
  *
21
26
  * @param jsonRoom The JSON room to deploy. *
@@ -30,6 +35,9 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom | Readonly<JSONRoom>,
30
35
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
31
36
  * all of the entries and grid entities in one of the provided JSON rooms.
32
37
  *
38
+ * You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
39
+ * my-rooms.xml`).
40
+ *
33
41
  * This function is meant to be used in the `POST_NEW_ROOM` callback.
34
42
  *
35
43
  * Note that this function does not simply choose a random element in the provided array; it will
@@ -39,10 +47,12 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom | Readonly<JSONRoom>,
39
47
  * For example:
40
48
  *
41
49
  * ```ts
42
- * import customRooms from "./customRooms";
50
+ * import customRooms from "./customRooms.json";
43
51
  *
44
- * const jsonRooms = customRooms.rooms.room;
45
- * deployRandomJSONRoom(jsonRooms);
52
+ * export function postNewRoom(): void {
53
+ * const jsonRooms = customRooms.rooms.room;
54
+ * deployRandomJSONRoom(jsonRooms);
55
+ * }
46
56
  * ```
47
57
  *
48
58
  * @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
@@ -1 +1 @@
1
- {"version":3,"file":"deployJSONRoom.d.ts","sourceRoot":"","sources":["../../../src/features/deployJSONRoom.ts"],"names":[],"mappings":";;AAuDA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAuKvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,EACvC,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,IAAI,CAuBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,EAC3C,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,IAAI,CAaN;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,mBAAmB,EAAE,OAAO,GAAG,IAAI,CAwB5D"}
1
+ {"version":3,"file":"deployJSONRoom.d.ts","sourceRoot":"","sources":["../../../src/features/deployJSONRoom.ts"],"names":[],"mappings":";;AAuDA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAuKvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,EACvC,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,IAAI,CAuBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,EAC3C,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,GACd,IAAI,CAaN;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,mBAAmB,EAAE,OAAO,GAAG,IAAI,CAwB5D"}
@@ -490,16 +490,21 @@ end
490
490
  -- Specifically, this will clear the current room of all entities and grid entities, and then spawn
491
491
  -- all of the entries and grid entities in the provided JSON room.
492
492
  --
493
+ -- You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
494
+ -- my-rooms.xml`).
495
+ --
493
496
  -- This function is meant to be used in the `POST_NEW_ROOM` callback.
494
497
  --
495
498
  -- For example:
496
499
  --
497
500
  -- ```ts
498
501
  --
499
- -- import customRooms from "./customRooms";
502
+ -- import customRooms from "./customRooms.json";
500
503
  --
501
- -- const firstJSONRoom = customRooms.rooms.room[0];
502
- -- deployJSONRoom(firstJSONRoom);
504
+ -- export function postNewRoom(): void {
505
+ -- const firstJSONRoom = customRooms.rooms.room[0];
506
+ -- deployJSONRoom(firstJSONRoom);
507
+ -- }
503
508
  -- ```
504
509
  --
505
510
  -- @param jsonRoom The JSON room to deploy. *
@@ -537,6 +542,9 @@ end
537
542
  -- Specifically, this will clear the current room of all entities and grid entities, and then spawn
538
543
  -- all of the entries and grid entities in one of the provided JSON rooms.
539
544
  --
545
+ -- You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
546
+ -- my-rooms.xml`).
547
+ --
540
548
  -- This function is meant to be used in the `POST_NEW_ROOM` callback.
541
549
  --
542
550
  -- Note that this function does not simply choose a random element in the provided array; it will
@@ -546,10 +554,12 @@ end
546
554
  -- For example:
547
555
  --
548
556
  -- ```ts
549
- -- import customRooms from "./customRooms";
557
+ -- import customRooms from "./customRooms.json";
550
558
  --
551
- -- const jsonRooms = customRooms.rooms.room;
552
- -- deployRandomJSONRoom(jsonRooms);
559
+ -- export function postNewRoom(): void {
560
+ -- const jsonRooms = customRooms.rooms.room;
561
+ -- deployRandomJSONRoom(jsonRooms);
562
+ -- }
553
563
  -- ```
554
564
  --
555
565
  -- @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/load.ts"],"names":[],"mappings":";;AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AASrD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GACpC,IAAI,CAqDN"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/load.ts"],"names":[],"mappings":";;AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AASrD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GACpC,IAAI,CAmDN"}
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/merge.ts"],"names":[],"mappings":";AAgBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CACnB,SAAS,EACL,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAC1B,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,GACvB,GAAG,CAAC,SAAS,CAAC,EAClB,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EACpC,oBAAoB,EAAE,MAAM,GAC3B,IAAI,CA2BN"}
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/merge.ts"],"names":[],"mappings":";AAgBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CACnB,SAAS,EACL,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAC1B,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,GACvB,GAAG,CAAC,SAAS,CAAC,EAClB,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EACpC,oBAAoB,EAAE,MAAM,GAC3B,IAAI,CA0BN"}
@@ -1,4 +1,4 @@
1
1
  /** Set this to true to enable more verbosity in the save data manger. */
2
- export declare const SAVE_DATA_MANAGER_DEBUG = false;
2
+ export declare const SAVE_DATA_MANAGER_DEBUG: boolean;
3
3
  export declare const SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager";
4
4
  //# sourceMappingURL=saveDataManagerConstants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"saveDataManagerConstants.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/saveDataManagerConstants.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,eAAO,MAAM,8BAA8B,sBAAsB,CAAC"}
1
+ {"version":3,"file":"saveDataManagerConstants.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/saveDataManagerConstants.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,SAAmB,CAAC;AAExD,eAAO,MAAM,8BAA8B,sBAAsB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
- /// <reference types="isaac-typescript-definitions" />
2
+ import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
3
3
  export declare type SerializedBitSet128 = LuaMap<string, unknown> & {
4
4
  readonly __serializedBitSet128Brand: symbol;
5
+ readonly __kind: CopyableIsaacAPIClassType.BIT_SET_128;
5
6
  };
6
7
  /** Helper function to copy a `BitSet128` Isaac API class. */
7
8
  export declare function copyBitSet128(bitSet128: BitSet128): BitSet128;
@@ -1 +1 @@
1
- {"version":3,"file":"bitSet128.d.ts","sourceRoot":"","sources":["../../../src/functions/bitSet128.ts"],"names":[],"mappings":";;AAKA,oBAAY,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC1D,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;CAC7C,CAAC;AAKF,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAW7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,mBAAmB,GAC7B,SAAS,CAqBX;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,SAAS,CAEhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,mBAAmB,CAQ/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,mBAAmB,CAW5E"}
1
+ {"version":3,"file":"bitSet128.d.ts","sourceRoot":"","sources":["../../../src/functions/bitSet128.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAUzE,oBAAY,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC1D,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,WAAW,CAAC;CACxD,CAAC;AAKF,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAW7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,mBAAmB,GAC7B,SAAS,CAqBX;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,SAAS,CAEhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,mBAAmB,CAQ/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,mBAAmB,CAW5E"}
@@ -5,7 +5,7 @@ local SerializationBrand = ____SerializationBrand.SerializationBrand
5
5
  local ____isaacAPIClass = require("src.functions.isaacAPIClass")
6
6
  local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
7
7
  local ____table = require("src.functions.table")
8
- local copyValuesToTable = ____table.copyValuesToTable
8
+ local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
9
9
  local getNumbersFromTable = ____table.getNumbersFromTable
10
10
  local tableHasKeys = ____table.tableHasKeys
11
11
  local ____types = require("src.functions.types")
@@ -64,7 +64,7 @@ function ____exports.serializeBitSet128(self, bitSet128)
64
64
  error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
65
65
  end
66
66
  local bitSet128Table = {}
67
- copyValuesToTable(nil, bitSet128, KEYS, bitSet128Table)
67
+ copyUserdataValuesToTable(nil, bitSet128, KEYS, bitSet128Table)
68
68
  bitSet128Table[SerializationBrand.BIT_SET_128] = ""
69
69
  return bitSet128Table
70
70
  end
@@ -1,9 +1,8 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /// <reference types="isaac-typescript-definitions" />
4
- /// <reference types="isaac-typescript-definitions" />
2
+ import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
5
3
  export declare type SerializedColor = LuaMap<string, unknown> & {
6
4
  readonly __serializedColorBrand: symbol;
5
+ readonly __kind: CopyableIsaacAPIClassType.COLOR;
7
6
  };
8
7
  export declare function colorEquals(color1: Color, color2: Color): boolean;
9
8
  /** Helper function to copy a `Color` Isaac API class. */
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/functions/color.ts"],"names":[],"mappings":";;;;AAOA,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACtD,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;CACzC,CAAC;AAKF,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAEjE;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAgB7C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CA8B9D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AgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CAW5D"}
@@ -12,7 +12,7 @@ local getRandomSeed = ____rng.getRandomSeed
12
12
  local isRNG = ____rng.isRNG
13
13
  local newRNG = ____rng.newRNG
14
14
  local ____table = require("src.functions.table")
15
- local copyValuesToTable = ____table.copyValuesToTable
15
+ local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
16
16
  local getNumbersFromTable = ____table.getNumbersFromTable
17
17
  local tableHasKeys = ____table.tableHasKeys
18
18
  local ____types = require("src.functions.types")
@@ -117,7 +117,7 @@ function ____exports.serializeColor(self, color)
117
117
  error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
118
118
  end
119
119
  local colorTable = {}
120
- copyValuesToTable(nil, color, KEYS, colorTable)
120
+ copyUserdataValuesToTable(nil, color, KEYS, colorTable)
121
121
  colorTable[SerializationBrand.COLOR] = ""
122
122
  return colorTable
123
123
  end
@@ -2,7 +2,7 @@ import { LevelCurse } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function to get the actual bit flag for modded curses.
4
4
  *
5
- * Will throw a runtime error if the provided curse does not exist.
5
+ * Will throw a run-time error if the provided curse does not exist.
6
6
  *
7
7
  * Use this over the `Isaac.GetCurseIdByName` method because that will return an integer instead of
8
8
  * a bit flag.
@@ -5,7 +5,7 @@ local ____flag = require("src.functions.flag")
5
5
  local hasFlag = ____flag.hasFlag
6
6
  --- Helper function to get the actual bit flag for modded curses.
7
7
  --
8
- -- Will throw a runtime error if the provided curse does not exist.
8
+ -- Will throw a run-time error if the provided curse does not exist.
9
9
  --
10
10
  -- Use this over the `Isaac.GetCurseIdByName` method because that will return an integer instead of
11
11
  -- a bit flag.
@@ -33,5 +33,6 @@ import { SerializationType } from "../enums/SerializationType";
33
33
  * @param insideMap Optional. Tracks whether or not the deep copy function is in the process of
34
34
  * recursively copying a TSTL Map. Default is false.
35
35
  */
36
- export declare function deepCopy(value: unknown, serializationType?: SerializationType, traversalDescription?: string, insideMap?: boolean): unknown;
36
+ export declare function deepCopy<T>(value: T, serializationType?: SerializationType.NONE, traversalDescription?: string, insideMap?: boolean): T;
37
+ export declare function deepCopy(value: unknown, serializationType: SerializationType, traversalDescription?: string, insideMap?: boolean): unknown;
37
38
  //# sourceMappingURL=deepCopy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepCopy.d.ts","sourceRoot":"","sources":["../../../src/functions/deepCopy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA6B/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,iBAAiB,oBAAyB,EAC1C,oBAAoB,SAAK,EACzB,SAAS,UAAQ,GAChB,OAAO,CAkDT"}
1
+ {"version":3,"file":"deepCopy.d.ts","sourceRoot":"","sources":["../../../src/functions/deepCopy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAyB/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,KAAK,EAAE,CAAC,EACR,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,IAAI,EAC1C,oBAAoB,CAAC,EAAE,MAAM,EAC7B,SAAS,CAAC,EAAE,OAAO,GAClB,CAAC,CAAC;AACL,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,CAAC,EAAE,MAAM,EAC7B,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC"}
@@ -1,16 +1,14 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Set = ____lualib.Set
3
2
  local __TS__New = ____lualib.__TS__New
4
3
  local Map = ____lualib.Map
4
+ local Set = ____lualib.Set
5
5
  local __TS__Iterator = ____lualib.__TS__Iterator
6
6
  local __TS__ArraySort = ____lualib.__TS__ArraySort
7
7
  local __TS__ArraySome = ____lualib.__TS__ArraySome
8
8
  local ____exports = {}
9
- local deepCopyTable, deepCopyDefaultMap, getNewDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, deepCopyArray, deepCopyNormalLuaTable, getCopiedEntries, checkMetatable, deepCopyUserdata, COPYABLE_ISAAC_API_CLASS_TYPES_SET
9
+ local deepCopyTable, deepCopyDefaultMap, getNewDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, deepCopyArray, deepCopyNormalLuaTable, getCopiedEntries, checkMetatable, deepCopyUserdata
10
10
  local ____DefaultMap = require("src.classes.DefaultMap")
11
11
  local DefaultMap = ____DefaultMap.DefaultMap
12
- local ____CopyableIsaacAPIClassType = require("src.enums.private.CopyableIsaacAPIClassType")
13
- local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
14
12
  local ____SerializationBrand = require("src.enums.private.SerializationBrand")
15
13
  local SerializationBrand = ____SerializationBrand.SerializationBrand
16
14
  local ____SerializationType = require("src.enums.SerializationType")
@@ -21,8 +19,6 @@ local ____serializationBrands = require("src.features.saveDataManager.serializat
21
19
  local isSerializationBrand = ____serializationBrands.isSerializationBrand
22
20
  local ____array = require("src.functions.array")
23
21
  local isArray = ____array.isArray
24
- local ____enums = require("src.functions.enums")
25
- local getEnumValues = ____enums.getEnumValues
26
22
  local ____isaacAPIClass = require("src.functions.isaacAPIClass")
27
23
  local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
28
24
  local ____log = require("src.functions.log")
@@ -30,6 +26,7 @@ local log = ____log.log
30
26
  local ____serialization = require("src.functions.serialization")
31
27
  local copyIsaacAPIClass = ____serialization.copyIsaacAPIClass
32
28
  local deserializeIsaacAPIClass = ____serialization.deserializeIsaacAPIClass
29
+ local isCopyableIsaacAPIClass = ____serialization.isCopyableIsaacAPIClass
33
30
  local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
34
31
  local serializeIsaacAPIClass = ____serialization.serializeIsaacAPIClass
35
32
  local ____tstlClass = require("src.functions.tstlClass")
@@ -113,6 +110,9 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
113
110
  if serializationType == SerializationType.SERIALIZE then
114
111
  error((("The deep copy function does not support serialization of \"" .. traversalDescription) .. "\", since it is type: ") .. valueType)
115
112
  end
113
+ if serializationType == SerializationType.DESERIALIZE then
114
+ error((("The deep copy function does not support deserialization of \"" .. traversalDescription) .. "\", since it is type: ") .. valueType)
115
+ end
116
116
  return value
117
117
  end
118
118
  end
@@ -264,15 +264,15 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
264
264
  end
265
265
  function getNewDefaultMap(self, defaultMap, serializationType, traversalDescription, constructorArg)
266
266
  repeat
267
- local ____switch34 = serializationType
268
- local ____cond34 = ____switch34 == SerializationType.NONE
269
- if ____cond34 then
267
+ local ____switch35 = serializationType
268
+ local ____cond35 = ____switch35 == SerializationType.NONE
269
+ if ____cond35 then
270
270
  do
271
271
  return __TS__New(DefaultMap, constructorArg)
272
272
  end
273
273
  end
274
- ____cond34 = ____cond34 or ____switch34 == SerializationType.SERIALIZE
275
- if ____cond34 then
274
+ ____cond35 = ____cond35 or ____switch35 == SerializationType.SERIALIZE
275
+ if ____cond35 then
276
276
  do
277
277
  local newDefaultMap = {}
278
278
  newDefaultMap[SerializationBrand.DEFAULT_MAP] = ""
@@ -280,8 +280,8 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
280
280
  return newDefaultMap
281
281
  end
282
282
  end
283
- ____cond34 = ____cond34 or ____switch34 == SerializationType.DESERIALIZE
284
- if ____cond34 then
283
+ ____cond35 = ____cond35 or ____switch35 == SerializationType.DESERIALIZE
284
+ if ____cond35 then
285
285
  do
286
286
  if isDefaultMap(nil, defaultMap) then
287
287
  error(("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
@@ -481,7 +481,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
481
481
  local value = ____value[2]
482
482
  do
483
483
  if isSerializationBrand(nil, key) then
484
- goto __continue87
484
+ goto __continue88
485
485
  end
486
486
  traversalDescription = getTraversalDescription(nil, key, traversalDescription)
487
487
  local newValue = ____exports.deepCopy(
@@ -503,7 +503,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
503
503
  end
504
504
  copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
505
505
  end
506
- ::__continue87::
506
+ ::__continue88::
507
507
  end
508
508
  return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
509
509
  end
@@ -516,15 +516,12 @@ function checkMetatable(self, luaMap, traversalDescription)
516
516
  error(("The deepCopy function detected that " .. tableDescription) .. " has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. TypeScriptToLua Maps, TypeScriptToLua Sets, etc.)")
517
517
  end
518
518
  function deepCopyUserdata(self, value, serializationType, traversalDescription)
519
- if SAVE_DATA_MANAGER_DEBUG then
520
- log(nil, "deepCopy is copying userdata.")
521
- end
522
519
  local classType = getIsaacAPIClassName(nil, value)
523
520
  if classType == nil then
524
521
  error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
525
522
  end
526
- if not COPYABLE_ISAAC_API_CLASS_TYPES_SET:has(classType) then
527
- error((("The deep copy function does not support copying \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. classType)
523
+ if not isCopyableIsaacAPIClass(nil, value) then
524
+ error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. classType)
528
525
  end
529
526
  repeat
530
527
  local ____switch99 = serializationType
@@ -543,13 +540,10 @@ function deepCopyUserdata(self, value, serializationType, traversalDescription)
543
540
  ____cond99 = ____cond99 or ____switch99 == SerializationType.DESERIALIZE
544
541
  if ____cond99 then
545
542
  do
546
- return deserializeIsaacAPIClass(nil, value)
543
+ error(("The deep copy function can not deserialize \"" .. traversalDescription) .. "\", since it is userdata.")
547
544
  end
545
+ break
548
546
  end
549
547
  until true
550
548
  end
551
- COPYABLE_ISAAC_API_CLASS_TYPES_SET = __TS__New(
552
- Set,
553
- getEnumValues(nil, CopyableIsaacAPIClassType)
554
- )
555
549
  return ____exports
@@ -38,8 +38,7 @@ function copiedObjectHasKeyAndValueString(self)
38
38
  local keyToLookFor = "abc"
39
39
  local valueToLookFor = "def"
40
40
  local oldObject = {abc = valueToLookFor}
41
- local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasKeyAndValueString")
42
- local newObject = newTable
41
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasKeyAndValueString")
43
42
  local value = newObject[keyToLookFor]
44
43
  if value == nil then
45
44
  error("The copied object did not have a key of: " .. keyToLookFor)
@@ -56,8 +55,7 @@ function copiedTableHasKeyAndValueNumber(self)
56
55
  local valueToLookFor = 456
57
56
  local oldTable = {}
58
57
  oldTable[keyToLookFor] = valueToLookFor
59
- local newObject = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableHasKeyAndValueNumber")
60
- local newTable = newObject
58
+ local newTable = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableHasKeyAndValueNumber")
61
59
  local value = newTable[keyToLookFor]
62
60
  if value == nil then
63
61
  error("The copied object did not have a key of: " .. tostring(keyToLookFor))
@@ -74,8 +72,7 @@ function copiedTableDoesNotCoerceTypes(self)
74
72
  local valueToLookFor = 456
75
73
  local oldTable = {}
76
74
  oldTable[keyToLookFor] = valueToLookFor
77
- local newObject = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableDoesNotCoerceTypes")
78
- local newTable = newObject
75
+ local newTable = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableDoesNotCoerceTypes")
79
76
  local keyString = tostring(keyToLookFor)
80
77
  local valueString = tostring(valueToLookFor)
81
78
  local valueFromString = newTable[keyString]
@@ -91,8 +88,7 @@ function copiedObjectHasNoReferencesForPrimitivesForward(self)
91
88
  local originalStringValue = "abcdef"
92
89
  local originalNumberValue = 123
93
90
  local oldObject = {abc = originalStringValue, def = originalNumberValue}
94
- local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesForward")
95
- local newObject = newTable
91
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesForward")
96
92
  oldObject.abc = "newValue"
97
93
  if oldObject.abc == newObject.abc then
98
94
  error("The copied object has a string reference going forward.")
@@ -106,8 +102,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
106
102
  local originalStringValue = "abcdef"
107
103
  local originalNumberValue = 123
108
104
  local oldObject = {abc = originalStringValue, def = originalNumberValue}
109
- local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesBackward")
110
- local newObject = newTable
105
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesBackward")
111
106
  newObject.abc = "newValue"
112
107
  if newObject.abc == oldObject.abc then
113
108
  error("The copied object has a string reference going backward.")
@@ -119,8 +114,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
119
114
  end
120
115
  function copiedObjectHasNoReferencesForArray(self)
121
116
  local oldObject = {abc = {1, 2, 3}}
122
- local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForArray")
123
- local newObject = newTable
117
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForArray")
124
118
  if oldObject.abc == newObject.abc then
125
119
  error("The copied object has the same point to the child array.")
126
120
  end
@@ -147,8 +141,7 @@ function copiedObjectHasChildObject(self)
147
141
  local keyToLookFor = "def"
148
142
  local valueToLookFor = "ghi"
149
143
  local oldObject = {abc = {def = valueToLookFor}}
150
- local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasChildObject")
151
- local newObject = newTable
144
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasChildObject")
152
145
  local childObject = newObject[childObjectIndex]
153
146
  if childObject == nil then
154
147
  error("Failed to find the child object at index: " .. childObjectIndex)
@@ -172,8 +165,7 @@ function copiedMapIsMap(self)
172
165
  local valueToLookFor = "def"
173
166
  local oldMap = __TS__New(Map)
174
167
  oldMap:set(keyToLookFor, valueToLookFor)
175
- local newObject = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapIsMap")
176
- local newMap = newObject
168
+ local newMap = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapIsMap")
177
169
  if not isTSTLMap(nil, newMap) then
178
170
  error("The copied Map was not a Map and has a type of: " .. __TS__TypeOf(newMap))
179
171
  end
@@ -183,8 +175,7 @@ function copiedMapHasValue(self)
183
175
  local valueToLookFor = "def"
184
176
  local oldMap = __TS__New(Map)
185
177
  oldMap:set(keyToLookFor, valueToLookFor)
186
- local newTable = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasValue")
187
- local newMap = newTable
178
+ local newMap = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasValue")
188
179
  if not isTSTLMap(nil, newMap) then
189
180
  error("The copied Map was not a Map and has a type of: " .. __TS__TypeOf(newMap))
190
181
  end
@@ -200,8 +191,7 @@ function copiedSetIsSet(self)
200
191
  local valueToLookFor = "abc"
201
192
  local oldSet = __TS__New(Set)
202
193
  oldSet:add(valueToLookFor)
203
- local newTable = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetIsSet")
204
- local newSet = newTable
194
+ local newSet = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetIsSet")
205
195
  if not isTSTLSet(nil, newSet) then
206
196
  error("The copied Set was not a Set and has a type of: " .. __TS__TypeOf(newSet))
207
197
  end
@@ -210,8 +200,7 @@ function copiedSetHasValue(self)
210
200
  local valueToLookFor = "abc"
211
201
  local oldSet = __TS__New(Set)
212
202
  oldSet:add(valueToLookFor)
213
- local newTable = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetHasValue")
214
- local newSet = newTable
203
+ local newSet = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetHasValue")
215
204
  if not isTSTLSet(nil, newSet) then
216
205
  error("The copied Set was not a Set and has a type of: " .. __TS__TypeOf(newSet))
217
206
  end
@@ -228,8 +217,7 @@ function copiedMapHasChildMap(self)
228
217
  local keyToLookFor = "childMap"
229
218
  local oldMap = __TS__New(Map)
230
219
  oldMap:set(keyToLookFor, oldChildMap)
231
- local newTable = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasChildMap")
232
- local newMap = newTable
220
+ local newMap = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasChildMap")
233
221
  if not isTSTLMap(nil, newMap) then
234
222
  error("The copied Map was not a Map and had a type of: " .. __TS__TypeOf(newMap))
235
223
  end
@@ -261,8 +249,7 @@ function copiedDefaultMapHasChildDefaultMap(self)
261
249
  local oldChildMap = oldParentMap:getAndSetDefault(parentMapKey)
262
250
  oldChildMap:getAndSetDefault(childMapKey1)
263
251
  oldChildMap:set(childMapKey2, childMapCustomValue)
264
- local newTable = deepCopy(nil, oldParentMap, SerializationType.NONE, "copiedDefaultMapHasChildDefaultMap")
265
- local newParentMap = newTable
252
+ local newParentMap = deepCopy(nil, oldParentMap, SerializationType.NONE, "copiedDefaultMapHasChildDefaultMap")
266
253
  if not isDefaultMap(nil, newParentMap) then
267
254
  error("The copied parent DefaultMap was not a DefaultMap and had a type of: " .. __TS__TypeOf(newParentMap))
268
255
  end
@@ -85,8 +85,16 @@ export declare function getRoomShapeDoorSlot(roomShape: RoomShape, x: int, y: in
85
85
  * combination.
86
86
  */
87
87
  export declare function getRoomShapeDoorSlotCoordinates(roomShape: RoomShape, doorSlot: DoorSlot): readonly [x: int, y: int] | undefined;
88
- /** Helper function to find unused door slots in the room that can be used to make custom doors. */
88
+ /**
89
+ * Helper function to find unused door slots in the current room that can be used to make custom
90
+ * doors.
91
+ */
89
92
  export declare function getUnusedDoorSlots(): DoorSlot[];
93
+ /**
94
+ * Helper function to check if the current room has one or more open door slots that can be used to
95
+ * make custom doors.
96
+ */
97
+ export declare function hasUnusedDoorSlot(): boolean;
90
98
  export declare function isAngelRoomDoor(door: GridEntityDoor): boolean;
91
99
  export declare function isBlueWombDoor(door: GridEntityDoor): boolean;
92
100
  export declare function isDevilRoomDoor(door: GridEntityDoor): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"doors.d.ts","sourceRoot":"","sources":["../../../src/functions/doors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,YAAY,EAIZ,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAmBtC,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAKxD;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,QAAQ,CAG3E;AAED,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,QAAQ,CAAC,YAAY,CAAC,GACpC,QAAQ,EAAE,CAWZ;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAEvE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EACL,QAAQ,EAAE,GACV,SAAS,QAAQ,EAAE,GACnB,GAAG,CAAC,QAAQ,CAAC,GACb,WAAW,CAAC,QAAQ,CAAC,GACxB,QAAQ,CAAC,YAAY,CAAC,CASxB;AAED,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,cAAc,GAAG,SAAS,CAG5D;AAED,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAG7D;AAED;;;GAGG;AACH,wBAAgB,2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Slot)
263
263
  local coordinatesMap = ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES[roomShape]
264
264
  return coordinatesMap:get(doorSlot)
265
265
  end
266
- --- Helper function to find unused door slots in the room that can be used to make custom doors.
266
+ --- Helper function to find unused door slots in the current room that can be used to make custom
267
+ -- doors.
267
268
  function ____exports.getUnusedDoorSlots(self)
268
269
  local room = game:GetRoom()
269
270
  local doorSlots = getEnumValues(nil, DoorSlot)
@@ -272,6 +273,12 @@ function ____exports.getUnusedDoorSlots(self)
272
273
  function(____, doorSlot) return room:IsDoorSlotAllowed(doorSlot) and room:GetDoor(doorSlot) == nil end
273
274
  )
274
275
  end
276
+ --- Helper function to check if the current room has one or more open door slots that can be used to
277
+ -- make custom doors.
278
+ function ____exports.hasUnusedDoorSlot(self)
279
+ local unusedDoorSlots = ____exports.getUnusedDoorSlots(nil)
280
+ return #unusedDoorSlots > 0
281
+ end
275
282
  function ____exports.isAngelRoomDoor(self, door)
276
283
  return door.TargetRoomType == RoomType.ANGEL
277
284
  end
@@ -1,9 +1,8 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /// <reference types="isaac-typescript-definitions" />
4
- /// <reference types="isaac-typescript-definitions" />
2
+ import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
5
3
  export declare type SerializedKColor = LuaMap<string, unknown> & {
6
4
  readonly __serializedKColorBrand: symbol;
5
+ readonly __kind: CopyableIsaacAPIClassType.K_COLOR;
7
6
  };
8
7
  /** Helper function to copy a `KColor` Isaac API class. */
9
8
  export declare function copyKColor(kColor: KColor): KColor;
@@ -1 +1 @@
1
- {"version":3,"file":"kColor.d.ts","sourceRoot":"","sources":["../../../src/functions/kColor.ts"],"names":[],"mappings":";;;;AAOA,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAK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AAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAQ5B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE"}
@@ -12,7 +12,7 @@ local getRandomSeed = ____rng.getRandomSeed
12
12
  local isRNG = ____rng.isRNG
13
13
  local newRNG = ____rng.newRNG
14
14
  local ____table = require("src.functions.table")
15
- local copyValuesToTable = ____table.copyValuesToTable
15
+ local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
16
16
  local getNumbersFromTable = ____table.getNumbersFromTable
17
17
  local tableHasKeys = ____table.tableHasKeys
18
18
  local ____types = require("src.functions.types")
@@ -96,7 +96,7 @@ function ____exports.serializeKColor(self, kColor)
96
96
  error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
97
97
  end
98
98
  local kColorTable = {}
99
- copyValuesToTable(nil, kColor, KEYS, kColorTable)
99
+ copyUserdataValuesToTable(nil, kColor, KEYS, kColorTable)
100
100
  kColorTable[SerializationBrand.K_COLOR] = ""
101
101
  return kColorTable
102
102
  end
@@ -1,8 +1,8 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /// <reference types="isaac-typescript-definitions" />
2
+ import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
4
3
  export declare type SerializedRNG = LuaMap<string, unknown> & {
5
4
  readonly __serializedRNGBrand: symbol;
5
+ readonly __kind: CopyableIsaacAPIClassType.RNG;
6
6
  };
7
7
  /** Helper function to copy an `RNG` Isaac API class. */
8
8
  export declare function copyRNG(rng: RNG): RNG;