isaacscript-common 25.0.0 → 25.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/isaacscript-common.lua +35 -43
- package/dist/src/arrays/cachedEnumValues.d.ts +1 -1
- package/dist/src/arrays/cachedEnumValues.d.ts.map +1 -1
- package/dist/src/arrays/cachedEnumValues.lua +1 -1
- package/dist/src/enums/{SerializationBrand.d.ts → private/SerializationBrand.d.ts} +0 -0
- package/dist/src/enums/private/SerializationBrand.d.ts.map +1 -0
- package/dist/src/enums/{SerializationBrand.lua → private/SerializationBrand.lua} +0 -0
- package/dist/src/functions/bitSet128.lua +1 -1
- package/dist/src/functions/color.lua +1 -1
- package/dist/src/functions/deepCopy.d.ts.map +1 -1
- package/dist/src/functions/deepCopy.lua +3 -2
- package/dist/src/functions/deepCopyTests.lua +1 -1
- package/dist/src/functions/kColor.lua +1 -1
- package/dist/src/functions/merge.d.ts.map +1 -1
- package/dist/src/functions/merge.lua +3 -2
- package/dist/src/functions/rng.lua +1 -1
- package/dist/src/functions/serialization.d.ts.map +1 -1
- package/dist/src/functions/serialization.lua +0 -20
- package/dist/src/functions/vector.lua +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +0 -8
- package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts +1 -1
- package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts.map +1 -1
- package/dist/src/objects/isaacAPIClassTypeToBrand.lua +1 -1
- package/dist/src/serialization.d.ts +9 -0
- package/dist/src/serialization.d.ts.map +1 -0
- package/dist/src/serialization.lua +22 -0
- package/package.json +1 -1
- package/src/arrays/cachedEnumValues.ts +1 -1
- package/src/enums/{SerializationBrand.ts → private/SerializationBrand.ts} +0 -0
- package/src/functions/bitSet128.ts +1 -1
- package/src/functions/color.ts +1 -1
- package/src/functions/deepCopy.ts +2 -2
- package/src/functions/deepCopyTests.ts +1 -1
- package/src/functions/kColor.ts +1 -1
- package/src/functions/merge.ts +2 -2
- package/src/functions/rng.ts +1 -1
- package/src/functions/serialization.ts +1 -24
- package/src/functions/vector.ts +1 -1
- package/src/index.ts +0 -1
- package/src/objects/isaacAPIClassTypeToBrand.ts +1 -1
- package/src/serialization.ts +22 -0
- package/dist/index.rollup.d.ts +0 -15715
- package/dist/src/enums/SerializationBrand.d.ts.map +0 -1
package/src/functions/merge.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SAVE_DATA_MANAGER_DEBUG } from "../classes/features/other/saveDataManager/constants";
|
|
2
|
-
import { SerializationBrand } from "../enums/SerializationBrand";
|
|
2
|
+
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
3
3
|
import { SerializationType } from "../enums/SerializationType";
|
|
4
|
+
import { isSerializationBrand } from "../serialization";
|
|
4
5
|
import { AnyClass } from "../types/AnyClass";
|
|
5
6
|
import { isArray } from "./array";
|
|
6
7
|
import { deepCopy } from "./deepCopy";
|
|
7
8
|
import { log } from "./log";
|
|
8
9
|
import {
|
|
9
10
|
deserializeIsaacAPIClass,
|
|
10
|
-
isSerializationBrand,
|
|
11
11
|
isSerializedIsaacAPIClass,
|
|
12
12
|
} from "./serialization";
|
|
13
13
|
import { clearTable, iterateTableInOrder } from "./table";
|
package/src/functions/rng.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
|
-
import { SerializationBrand } from "../enums/SerializationBrand";
|
|
3
|
+
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
4
4
|
import { isaacAPIClassEquals, isIsaacAPIClassOfType } from "./isaacAPIClass";
|
|
5
5
|
import { getNumbersFromTable, tableHasKeys } from "./table";
|
|
6
6
|
import { isTable } from "./types";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
|
|
2
|
-
import { SERIALIZATION_BRAND_VALUES } from "../arrays/cachedEnumValues";
|
|
3
2
|
import { ISAAC_API_CLASS_TYPE_TO_BRAND } from "../objects/isaacAPIClassTypeToBrand";
|
|
4
3
|
import {
|
|
5
4
|
CopyableIsaacAPIClass,
|
|
@@ -9,13 +8,8 @@ import {
|
|
|
9
8
|
ISAAC_API_CLASS_TYPE_TO_FUNCTIONS,
|
|
10
9
|
SerializedIsaacAPIClass,
|
|
11
10
|
} from "../objects/isaacAPIClassTypeToFunctions";
|
|
12
|
-
import { ReadonlySet } from "../types/ReadonlySet";
|
|
13
11
|
import { getIsaacAPIClassName } from "./isaacAPIClass";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
const SERIALIZATION_BRAND_SET = new ReadonlySet<string>(
|
|
17
|
-
SERIALIZATION_BRAND_VALUES,
|
|
18
|
-
);
|
|
12
|
+
import { isTable, isUserdata } from "./types";
|
|
19
13
|
|
|
20
14
|
/**
|
|
21
15
|
* Helper function to generically copy an Isaac API class without knowing what specific type of
|
|
@@ -142,23 +136,6 @@ export function isCopyableIsaacAPIClass(
|
|
|
142
136
|
return isFunctions.some((identityFunction) => identityFunction(object));
|
|
143
137
|
}
|
|
144
138
|
|
|
145
|
-
/**
|
|
146
|
-
* Helper function to check if a key of a table in the "save#.dat" file is a serialization brand
|
|
147
|
-
* inserted by the save data manager (i.e. the `deepCopy` function).
|
|
148
|
-
*
|
|
149
|
-
* This is marked internal because end-users would not normally be iterating through a serialized
|
|
150
|
-
* object directly.
|
|
151
|
-
*
|
|
152
|
-
* @internal
|
|
153
|
-
*/
|
|
154
|
-
export function isSerializationBrand(key: unknown): boolean {
|
|
155
|
-
if (!isString(key)) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return SERIALIZATION_BRAND_SET.has(key);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
139
|
/**
|
|
163
140
|
* Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
|
|
164
141
|
* is used by the save data manager when reading data from the "save#.dat" file.)
|
package/src/functions/vector.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CopyableIsaacAPIClassType,
|
|
3
3
|
Direction,
|
|
4
4
|
} from "isaac-typescript-definitions";
|
|
5
|
-
import { SerializationBrand } from "../enums/SerializationBrand";
|
|
5
|
+
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
6
6
|
import { angleToDirection } from "./direction";
|
|
7
7
|
import { isaacAPIClassEquals, isIsaacAPIClassOfType } from "./isaacAPIClass";
|
|
8
8
|
import { getRandomFloat } from "./random";
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,6 @@ export * from "./enums/MysteriousPaperEffect";
|
|
|
15
15
|
export * from "./enums/PocketItemType";
|
|
16
16
|
export * from "./enums/RockAltType";
|
|
17
17
|
export * from "./enums/SaveDataKey";
|
|
18
|
-
export * from "./enums/SerializationBrand";
|
|
19
18
|
export * from "./enums/SerializationType";
|
|
20
19
|
export * from "./enums/SlotDestructionType";
|
|
21
20
|
export * from "./enums/StatType";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CopyableIsaacAPIClassType } from "isaac-typescript-definitions";
|
|
2
|
-
import { SerializationBrand } from "../enums/SerializationBrand";
|
|
2
|
+
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
3
3
|
|
|
4
4
|
export const ISAAC_API_CLASS_TYPE_TO_BRAND = {
|
|
5
5
|
[CopyableIsaacAPIClassType.BIT_SET_128]: SerializationBrand.BIT_SET_128,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SERIALIZATION_BRAND_VALUES } from "./arrays/cachedEnumValues";
|
|
2
|
+
import { isString } from "./functions/types";
|
|
3
|
+
import { ReadonlySet } from "./types/ReadonlySet";
|
|
4
|
+
|
|
5
|
+
const SERIALIZATION_BRAND_SET = new ReadonlySet<string>(
|
|
6
|
+
SERIALIZATION_BRAND_VALUES,
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to check if a key of a table in the "save#.dat" file is a serialization brand
|
|
11
|
+
* inserted by the save data manager (i.e. the `deepCopy` function).
|
|
12
|
+
*
|
|
13
|
+
* This is separated from the other serialization functions because end-users would not normally be
|
|
14
|
+
* iterating through a serialized object directly.
|
|
15
|
+
*/
|
|
16
|
+
export function isSerializationBrand(key: unknown): boolean {
|
|
17
|
+
if (!isString(key)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return SERIALIZATION_BRAND_SET.has(key);
|
|
22
|
+
}
|