isaacscript-common 1.2.247 → 1.2.250
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/enums/private/CopyableIsaacAPIClassType.d.ts +7 -0
- package/dist/enums/private/CopyableIsaacAPIClassType.lua +8 -0
- package/dist/enums/private/SerializationBrand.d.ts +30 -10
- package/dist/enums/private/SerializationBrand.lua +2 -3
- package/dist/features/saveDataManager/exports.lua +1 -2
- package/dist/features/saveDataManager/main.lua +2 -3
- package/dist/features/saveDataManager/merge.d.ts +1 -1
- package/dist/functions/deepCopy.d.ts +9 -6
- package/dist/functions/deepCopy.lua +262 -175
- package/dist/functions/easing.d.ts +30 -0
- package/dist/functions/easing.lua +116 -0
- package/dist/functions/log.d.ts +1 -1
- package/dist/functions/serialization.d.ts +5 -6
- package/dist/functions/serialization.lua +11 -28
- package/dist/functions/table.d.ts +1 -1
- package/dist/functions/tstlClass.d.ts +20 -0
- package/dist/functions/tstlClass.lua +56 -0
- package/dist/functions/utils.d.ts +3 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +16 -0
- package/dist/objects/isaacAPIClassTypeToBrand.d.ts +2 -2
- package/dist/objects/isaacAPIClassTypeToBrand.lua +3 -3
- package/dist/objects/isaacAPIClassTypeToCopyFunction.d.ts +2 -2
- package/dist/objects/isaacAPIClassTypeToCopyFunction.lua +3 -3
- package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.d.ts +2 -2
- package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.lua +3 -3
- package/dist/types/private/SaveData.d.ts +4 -0
- package/dist/types/private/TSTLClass.d.ts +4 -0
- package/dist/types/private/TSTLClass.lua +3 -0
- package/dist/types/private/TSTLClassMetatable.d.ts +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.CopyableIsaacAPIClassType = CopyableIsaacAPIClassType or ({})
|
|
4
|
+
____exports.CopyableIsaacAPIClassType.COLOR = "Color"
|
|
5
|
+
____exports.CopyableIsaacAPIClassType.KCOLOR = "KColor"
|
|
6
|
+
____exports.CopyableIsaacAPIClassType.RNG = "RNG"
|
|
7
|
+
____exports.CopyableIsaacAPIClassType.VECTOR = "Vector"
|
|
8
|
+
return ____exports
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* During serialization, we write an arbitrary string key to the object with a value of an empty
|
|
3
|
+
* string. This is used during deserialization to instantiate the correct type of object.
|
|
4
|
+
*
|
|
5
|
+
* Note that we do not bother branding TSTL classes because we have no way to invoke the proper
|
|
6
|
+
* constructor during deserialization.
|
|
7
|
+
*/
|
|
2
8
|
export declare enum SerializationBrand {
|
|
3
9
|
DEFAULT_MAP = "__TSTL_DEFAULT_MAP",
|
|
4
|
-
/**
|
|
5
|
-
* This is set to the value that represents the default value (instead of an empty string like the
|
|
6
|
-
* other brands are).
|
|
7
|
-
*/
|
|
8
|
-
DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE",
|
|
9
10
|
MAP = "__TSTL_MAP",
|
|
10
11
|
SET = "__TSTL_SET",
|
|
11
|
-
CLASS = "__TSTL_CLASS",
|
|
12
|
-
OBJECT_WITH_NUMBER_KEYS = "__TSTL_OBJECT_WITH_NUMBER_KEYS",
|
|
13
12
|
COLOR = "__COLOR",
|
|
14
13
|
KCOLOR = "__KCOLOR",
|
|
15
14
|
RNG = "__RNG",
|
|
16
|
-
VECTOR = "__VECTOR"
|
|
15
|
+
VECTOR = "__VECTOR",
|
|
16
|
+
/**
|
|
17
|
+
* This is set to the value that represents the default value (instead of an empty string like the
|
|
18
|
+
* other brands are).
|
|
19
|
+
*
|
|
20
|
+
* Default maps that use a factory function are unserializable, but do not throw runtime errors
|
|
21
|
+
* because the merge function can derive the factory function from the already-instantiated
|
|
22
|
+
* object.
|
|
23
|
+
*/
|
|
24
|
+
DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE",
|
|
25
|
+
/**
|
|
26
|
+
* The JSON library is unable to distinguish between a maps with number keys and an array. It will
|
|
27
|
+
* assume that both of these are an array. Thus, in the case of a map with number keys, it will
|
|
28
|
+
* insert null in every empty spot, leading to crashes.
|
|
29
|
+
*
|
|
30
|
+
* For example, a map with keys of 5 and 10 would be converted to the following array:
|
|
31
|
+
* `[null, null, null, null, "myValueForKey5", null, null, null, null, "myValueForKey10"]`
|
|
32
|
+
*
|
|
33
|
+
* The deep copier works around this by converting number keys to strings. It inserts this brand
|
|
34
|
+
* to keep track of the mutation.
|
|
35
|
+
*/
|
|
36
|
+
OBJECT_WITH_NUMBER_KEYS = "__TSTL_OBJECT_WITH_NUMBER_KEYS"
|
|
17
37
|
}
|
|
18
|
-
export declare function isSerializationBrand(key:
|
|
38
|
+
export declare function isSerializationBrand(key: unknown): boolean;
|
|
@@ -6,15 +6,14 @@ local ____utils = require("functions.utils")
|
|
|
6
6
|
local getEnumValues = ____utils.getEnumValues
|
|
7
7
|
____exports.SerializationBrand = SerializationBrand or ({})
|
|
8
8
|
____exports.SerializationBrand.DEFAULT_MAP = "__TSTL_DEFAULT_MAP"
|
|
9
|
-
____exports.SerializationBrand.DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE"
|
|
10
9
|
____exports.SerializationBrand.MAP = "__TSTL_MAP"
|
|
11
10
|
____exports.SerializationBrand.SET = "__TSTL_SET"
|
|
12
|
-
____exports.SerializationBrand.CLASS = "__TSTL_CLASS"
|
|
13
|
-
____exports.SerializationBrand.OBJECT_WITH_NUMBER_KEYS = "__TSTL_OBJECT_WITH_NUMBER_KEYS"
|
|
14
11
|
____exports.SerializationBrand.COLOR = "__COLOR"
|
|
15
12
|
____exports.SerializationBrand.KCOLOR = "__KCOLOR"
|
|
16
13
|
____exports.SerializationBrand.RNG = "__RNG"
|
|
17
14
|
____exports.SerializationBrand.VECTOR = "__VECTOR"
|
|
15
|
+
____exports.SerializationBrand.DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE"
|
|
16
|
+
____exports.SerializationBrand.OBJECT_WITH_NUMBER_KEYS = "__TSTL_OBJECT_WITH_NUMBER_KEYS"
|
|
18
17
|
local SERIALIZATION_BRANDS = getEnumValues(nil, ____exports.SerializationBrand)
|
|
19
18
|
local SERIALIZATION_BRAND_SET = __TS__New(Set, SERIALIZATION_BRANDS)
|
|
20
19
|
function ____exports.isSerializationBrand(self, key)
|
|
@@ -32,8 +32,7 @@ function ____exports.saveDataManager(self, key, v, conditionalFunc)
|
|
|
32
32
|
conditionalFunc = function() return false end
|
|
33
33
|
end
|
|
34
34
|
local saveDataTable = v
|
|
35
|
-
local
|
|
36
|
-
local saveDataCopy = saveDataTableCopy
|
|
35
|
+
local saveDataCopy = deepCopy(nil, saveDataTable, SerializationType.NONE, key)
|
|
37
36
|
saveDataDefaultsMap[key] = saveDataCopy
|
|
38
37
|
if conditionalFunc ~= nil then
|
|
39
38
|
saveDataConditionalFuncMap:set(key, conditionalFunc)
|
|
@@ -80,9 +80,8 @@ function restoreDefaults(self, childTableName)
|
|
|
80
80
|
logError(((("Failed to find the default copy of the child table \"" .. childTableName) .. "\" for subscriber \"") .. subscriberName) .. "\". This error usually means that your save data is out of date. You can try purging all of your save data by deleting the following directory: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\data")
|
|
81
81
|
goto __continue14
|
|
82
82
|
end
|
|
83
|
-
local
|
|
84
|
-
|
|
85
|
-
clearAndCopyAllElements(nil, childTable, childTableDefaultsTableCopy)
|
|
83
|
+
local childTableDefaultsCopy = deepCopy(nil, childTableDefaults, SerializationType.NONE, (subscriberName .. " --> ") .. childTableName)
|
|
84
|
+
clearAndCopyAllElements(nil, childTable, childTableDefaultsCopy)
|
|
86
85
|
end
|
|
87
86
|
::__continue14::
|
|
88
87
|
end
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
* are no longer used in the code, or copy over old variables of a different type, which can cause
|
|
22
22
|
* run-time errors. In such cases, users will have to manually delete their save data.
|
|
23
23
|
*/
|
|
24
|
-
export declare function merge(oldObject: LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>, newTable: LuaTable, traversalDescription: string): void;
|
|
24
|
+
export declare function merge(oldObject: LuaTable<AnyNotNil, unknown> | Map<AnyNotNil, unknown> | Set<AnyNotNil>, newTable: LuaTable<AnyNotNil, unknown>, traversalDescription: string): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
1
|
import { SerializationType } from "../enums/SerializationType";
|
|
3
2
|
/**
|
|
4
3
|
* deepCopy is a semi-generic deep cloner. It will recursively copy all of the values so that none
|
|
@@ -6,6 +5,7 @@ import { SerializationType } from "../enums/SerializationType";
|
|
|
6
5
|
*
|
|
7
6
|
* It supports the following object types:
|
|
8
7
|
*
|
|
8
|
+
* - Primitives (i.e. strings, numbers, and booleans)
|
|
9
9
|
* - `LuaTable` / basic TSTL objects
|
|
10
10
|
* - TSTL `Map`
|
|
11
11
|
* - TSTL `Set`
|
|
@@ -16,10 +16,13 @@ import { SerializationType } from "../enums/SerializationType";
|
|
|
16
16
|
* - Isaac `RNG` objects
|
|
17
17
|
* - Isaac `Vector` objects
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* It does not support:
|
|
20
|
+
* - objects with values of `null` (since that transpiles to `nil`)
|
|
21
|
+
* - other Isaac API objects (that have a type of "userdata")
|
|
22
|
+
*
|
|
23
|
+
* @param value The primitive or object to copy.
|
|
24
|
+
* @param serializationType Has 3 possible values. Can leave objects as-is, or can serialize objects
|
|
25
|
+
* to Lua tables, or can deserialize Lua tables to objects. Default is `SerializationType.NONE`.
|
|
23
26
|
* @param traversalDescription Used to track the current key that we are operating on.
|
|
24
27
|
*/
|
|
25
|
-
export declare function deepCopy(
|
|
28
|
+
export declare function deepCopy(value: unknown, serializationType?: SerializationType, traversalDescription?: string): unknown;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local Map = ____lualib.Map
|
|
5
4
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
|
+
local Map = ____lualib.Map
|
|
6
|
+
local WeakMap = ____lualib.WeakMap
|
|
7
|
+
local WeakSet = ____lualib.WeakSet
|
|
8
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
9
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
10
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
7
11
|
local ____exports = {}
|
|
8
|
-
local
|
|
12
|
+
local deepCopyTable, deepCopyDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, getCopiedEntries, checkMetatable, deepCopyUserdata, COPYABLE_ISAAC_API_CLASS_TYPES_SET
|
|
9
13
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
10
14
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
15
|
+
local ____CopyableIsaacAPIClassType = require("enums.private.CopyableIsaacAPIClassType")
|
|
16
|
+
local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
|
|
11
17
|
local ____SerializationBrand = require("enums.private.SerializationBrand")
|
|
12
18
|
local isSerializationBrand = ____SerializationBrand.isSerializationBrand
|
|
13
19
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
@@ -15,16 +21,22 @@ local ____SerializationType = require("enums.SerializationType")
|
|
|
15
21
|
local SerializationType = ____SerializationType.SerializationType
|
|
16
22
|
local ____constants = require("features.saveDataManager.constants")
|
|
17
23
|
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
24
|
+
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
25
|
+
local getIsaacAPIClassType = ____isaacAPIClass.getIsaacAPIClassType
|
|
18
26
|
local ____log = require("functions.log")
|
|
19
27
|
local log = ____log.log
|
|
20
28
|
local ____serialization = require("functions.serialization")
|
|
21
29
|
local copyIsaacAPIClass = ____serialization.copyIsaacAPIClass
|
|
22
30
|
local deserializeIsaacAPIClass = ____serialization.deserializeIsaacAPIClass
|
|
23
|
-
local isSerializableIsaacAPIClass = ____serialization.isSerializableIsaacAPIClass
|
|
24
31
|
local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
|
|
32
|
+
local ____tstlClass = require("functions.tstlClass")
|
|
33
|
+
local isUserDefinedTSTLClass = ____tstlClass.isUserDefinedTSTLClass
|
|
34
|
+
local newTSTLClass = ____tstlClass.newTSTLClass
|
|
25
35
|
local ____utils = require("functions.utils")
|
|
36
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
37
|
+
local getEnumValues = ____utils.getEnumValues
|
|
26
38
|
local getTraversalDescription = ____utils.getTraversalDescription
|
|
27
|
-
function ____exports.deepCopy(self,
|
|
39
|
+
function ____exports.deepCopy(self, value, serializationType, traversalDescription)
|
|
28
40
|
if serializationType == nil then
|
|
29
41
|
serializationType = SerializationType.NONE
|
|
30
42
|
end
|
|
@@ -38,216 +50,291 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
|
|
|
38
50
|
elseif serializationType == SerializationType.DESERIALIZE then
|
|
39
51
|
logString = logString .. " (deserializing)"
|
|
40
52
|
end
|
|
53
|
+
logString = logString .. ": " .. tostring(value)
|
|
41
54
|
log(logString)
|
|
42
55
|
end
|
|
43
|
-
local
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
local valueType = type(value)
|
|
57
|
+
repeat
|
|
58
|
+
local ____switch6 = valueType
|
|
59
|
+
local ____cond6 = ____switch6 == "nil" or ____switch6 == "boolean" or ____switch6 == "number" or ____switch6 == "string"
|
|
60
|
+
if ____cond6 then
|
|
61
|
+
do
|
|
62
|
+
return value
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
____cond6 = ____cond6 or (____switch6 == "function" or ____switch6 == "thread")
|
|
66
|
+
if ____cond6 then
|
|
67
|
+
do
|
|
68
|
+
if serializationType == SerializationType.SERIALIZE then
|
|
69
|
+
error((("The deep copy function does not support serialization of \"" .. traversalDescription) .. "\", since it is type: ") .. valueType)
|
|
70
|
+
end
|
|
71
|
+
return value
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
____cond6 = ____cond6 or ____switch6 == "table"
|
|
75
|
+
if ____cond6 then
|
|
76
|
+
do
|
|
77
|
+
local valueTable = value
|
|
78
|
+
return deepCopyTable(nil, valueTable, serializationType, traversalDescription)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
____cond6 = ____cond6 or ____switch6 == "userdata"
|
|
82
|
+
if ____cond6 then
|
|
83
|
+
do
|
|
84
|
+
return deepCopyUserdata(nil, value, serializationType, traversalDescription)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
do
|
|
88
|
+
do
|
|
89
|
+
return ensureAllCases(nil, valueType)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
until true
|
|
93
|
+
end
|
|
94
|
+
function deepCopyTable(self, ____table, serializationType, traversalDescription)
|
|
95
|
+
if __TS__InstanceOf(____table, DefaultMap) or ____table[SerializationBrand.DEFAULT_MAP] ~= nil then
|
|
96
|
+
return deepCopyDefaultMap(nil, ____table, serializationType, traversalDescription)
|
|
97
|
+
end
|
|
98
|
+
if __TS__InstanceOf(____table, Map) or ____table[SerializationBrand.MAP] ~= nil then
|
|
99
|
+
return deepCopyMap(nil, ____table, serializationType, traversalDescription)
|
|
100
|
+
end
|
|
101
|
+
if __TS__InstanceOf(____table, Set) or ____table[SerializationBrand.SET] ~= nil then
|
|
102
|
+
return deepCopySet(nil, ____table, serializationType, traversalDescription)
|
|
103
|
+
end
|
|
104
|
+
if __TS__InstanceOf(____table, WeakMap) then
|
|
105
|
+
error("The deep copy function does not support copying the \"WeakMap\" class: " .. traversalDescription)
|
|
106
|
+
end
|
|
107
|
+
if __TS__InstanceOf(____table, WeakSet) then
|
|
108
|
+
error("The deep copy function does not support copying the \"WeakSet\" class: " .. traversalDescription)
|
|
109
|
+
end
|
|
110
|
+
if isUserDefinedTSTLClass(nil, ____table) then
|
|
111
|
+
return deepCopyTSTLClass(nil, ____table, serializationType, traversalDescription)
|
|
112
|
+
end
|
|
113
|
+
checkMetatable(nil, ____table, traversalDescription)
|
|
114
|
+
if isSerializedIsaacAPIClass(nil, ____table) and serializationType == SerializationType.DESERIALIZE then
|
|
115
|
+
return deserializeIsaacAPIClass(nil, ____table)
|
|
116
|
+
end
|
|
117
|
+
local newTable = {}
|
|
118
|
+
local ____getCopiedEntries_result_0 = getCopiedEntries(nil, ____table, serializationType, traversalDescription)
|
|
119
|
+
local entries = ____getCopiedEntries_result_0.entries
|
|
120
|
+
local convertedNumberKeysToStrings = ____getCopiedEntries_result_0.convertedNumberKeysToStrings
|
|
121
|
+
if convertedNumberKeysToStrings then
|
|
122
|
+
newTable[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
123
|
+
end
|
|
124
|
+
for ____, ____value in ipairs(entries) do
|
|
125
|
+
local key = ____value[1]
|
|
126
|
+
local value = ____value[2]
|
|
127
|
+
newTable[key] = value
|
|
128
|
+
end
|
|
129
|
+
return newTable
|
|
130
|
+
end
|
|
131
|
+
function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescription)
|
|
132
|
+
local ____temp_1
|
|
133
|
+
if __TS__InstanceOf(defaultMap, DefaultMap) then
|
|
134
|
+
____temp_1 = defaultMap:getConstructorArg()
|
|
78
135
|
else
|
|
79
|
-
|
|
136
|
+
____temp_1 = nil
|
|
80
137
|
end
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
138
|
+
local constructorArg = ____temp_1
|
|
139
|
+
local newDefaultMap
|
|
140
|
+
repeat
|
|
141
|
+
local ____switch25 = serializationType
|
|
142
|
+
local ____cond25 = ____switch25 == SerializationType.NONE
|
|
143
|
+
if ____cond25 then
|
|
144
|
+
do
|
|
145
|
+
newDefaultMap = __TS__New(DefaultMap, constructorArg)
|
|
146
|
+
break
|
|
89
147
|
end
|
|
90
|
-
elseif __TS__InstanceOf(oldObject, Map) then
|
|
91
|
-
newTable[SerializationBrand.MAP] = ""
|
|
92
|
-
elseif __TS__InstanceOf(oldObject, Set) then
|
|
93
|
-
newTable[SerializationBrand.SET] = ""
|
|
94
|
-
elseif isClass then
|
|
95
|
-
newTable[SerializationBrand.CLASS] = ""
|
|
96
148
|
end
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
for ____, ____value in __TS__Iterator(oldObject:entries()) do
|
|
100
|
-
local key = ____value[1]
|
|
101
|
-
local value = ____value[2]
|
|
149
|
+
____cond25 = ____cond25 or ____switch25 == SerializationType.SERIALIZE
|
|
150
|
+
if ____cond25 then
|
|
102
151
|
do
|
|
103
|
-
if
|
|
104
|
-
|
|
152
|
+
if type(constructorArg) ~= "boolean" and type(constructorArg) ~= "number" and type(constructorArg) ~= "string" then
|
|
153
|
+
return deepCopyMap(nil, defaultMap, serializationType, traversalDescription)
|
|
105
154
|
end
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
key,
|
|
111
|
-
value,
|
|
112
|
-
traversalDescription,
|
|
113
|
-
serializationType
|
|
114
|
-
)
|
|
155
|
+
newDefaultMap = {}
|
|
156
|
+
newDefaultMap[SerializationBrand.DEFAULT_MAP] = ""
|
|
157
|
+
newDefaultMap[SerializationBrand.DEFAULT_MAP_VALUE] = constructorArg
|
|
158
|
+
break
|
|
115
159
|
end
|
|
116
|
-
::__continue23::
|
|
117
160
|
end
|
|
118
|
-
|
|
119
|
-
|
|
161
|
+
____cond25 = ____cond25 or ____switch25 == SerializationType.DESERIALIZE
|
|
162
|
+
if ____cond25 then
|
|
120
163
|
do
|
|
121
|
-
if
|
|
122
|
-
|
|
164
|
+
if __TS__InstanceOf(defaultMap, DefaultMap) then
|
|
165
|
+
error(("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
|
|
123
166
|
end
|
|
124
|
-
local
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
value,
|
|
131
|
-
traversalDescription,
|
|
132
|
-
serializationType
|
|
133
|
-
)
|
|
167
|
+
local defaultMapValue = defaultMap[SerializationBrand.DEFAULT_MAP_VALUE]
|
|
168
|
+
if defaultMapValue == nil then
|
|
169
|
+
error((("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since there was no serialization brand of: ") .. SerializationBrand.DEFAULT_MAP_VALUE)
|
|
170
|
+
end
|
|
171
|
+
newDefaultMap = __TS__New(DefaultMap, defaultMapValue)
|
|
172
|
+
break
|
|
134
173
|
end
|
|
135
|
-
::__continue27::
|
|
136
174
|
end
|
|
137
|
-
|
|
138
|
-
for key, value in pairs(oldObject) do
|
|
175
|
+
do
|
|
139
176
|
do
|
|
140
|
-
|
|
141
|
-
goto __continue31
|
|
142
|
-
end
|
|
143
|
-
deepCopyValue(
|
|
144
|
-
nil,
|
|
145
|
-
oldObject,
|
|
146
|
-
newObject,
|
|
147
|
-
key,
|
|
148
|
-
value,
|
|
149
|
-
traversalDescription,
|
|
150
|
-
serializationType
|
|
151
|
-
)
|
|
177
|
+
return ensureAllCases(nil, serializationType)
|
|
152
178
|
end
|
|
153
|
-
|
|
179
|
+
end
|
|
180
|
+
until true
|
|
181
|
+
local ____getCopiedEntries_result_2 = getCopiedEntries(nil, defaultMap, serializationType, traversalDescription)
|
|
182
|
+
local entries = ____getCopiedEntries_result_2.entries
|
|
183
|
+
local convertedNumberKeysToStrings = ____getCopiedEntries_result_2.convertedNumberKeysToStrings
|
|
184
|
+
if convertedNumberKeysToStrings then
|
|
185
|
+
if __TS__InstanceOf(newDefaultMap, DefaultMap) then
|
|
186
|
+
newDefaultMap:set(SerializationBrand.OBJECT_WITH_NUMBER_KEYS, "")
|
|
187
|
+
else
|
|
188
|
+
newDefaultMap[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
154
189
|
end
|
|
155
190
|
end
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
191
|
+
for ____, ____value in ipairs(entries) do
|
|
192
|
+
local key = ____value[1]
|
|
193
|
+
local value = ____value[2]
|
|
194
|
+
if __TS__InstanceOf(newDefaultMap, DefaultMap) then
|
|
195
|
+
newDefaultMap:set(key, value)
|
|
196
|
+
else
|
|
197
|
+
newDefaultMap[key] = value
|
|
198
|
+
end
|
|
162
199
|
end
|
|
163
|
-
|
|
164
|
-
|
|
200
|
+
return newDefaultMap
|
|
201
|
+
end
|
|
202
|
+
function deepCopyMap(self, map, serializationType, traversalDescription)
|
|
203
|
+
local newMap
|
|
204
|
+
if serializationType == SerializationType.SERIALIZE then
|
|
205
|
+
newMap = {}
|
|
206
|
+
newMap[SerializationBrand.MAP] = ""
|
|
207
|
+
else
|
|
208
|
+
newMap = __TS__New(Map)
|
|
165
209
|
end
|
|
166
|
-
local
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
210
|
+
local ____getCopiedEntries_result_3 = getCopiedEntries(nil, map, serializationType, traversalDescription)
|
|
211
|
+
local entries = ____getCopiedEntries_result_3.entries
|
|
212
|
+
local convertedNumberKeysToStrings = ____getCopiedEntries_result_3.convertedNumberKeysToStrings
|
|
213
|
+
if convertedNumberKeysToStrings then
|
|
214
|
+
if __TS__InstanceOf(newMap, Map) then
|
|
215
|
+
newMap:set(SerializationBrand.OBJECT_WITH_NUMBER_KEYS, "")
|
|
216
|
+
else
|
|
217
|
+
newMap[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
171
218
|
end
|
|
172
|
-
|
|
173
|
-
|
|
219
|
+
end
|
|
220
|
+
for ____, ____value in ipairs(entries) do
|
|
221
|
+
local key = ____value[1]
|
|
222
|
+
local value = ____value[2]
|
|
223
|
+
if __TS__InstanceOf(newMap, Map) then
|
|
224
|
+
newMap:set(key, value)
|
|
225
|
+
else
|
|
226
|
+
newMap[key] = value
|
|
174
227
|
end
|
|
175
228
|
end
|
|
176
|
-
return
|
|
229
|
+
return newMap
|
|
177
230
|
end
|
|
178
|
-
function
|
|
179
|
-
local
|
|
180
|
-
if
|
|
181
|
-
|
|
231
|
+
function deepCopySet(self, set, serializationType, traversalDescription)
|
|
232
|
+
local newSet
|
|
233
|
+
if serializationType == SerializationType.SERIALIZE then
|
|
234
|
+
newSet = {}
|
|
235
|
+
newSet[SerializationBrand.SET] = ""
|
|
236
|
+
else
|
|
237
|
+
newSet = __TS__New(Set)
|
|
182
238
|
end
|
|
183
|
-
local
|
|
184
|
-
|
|
239
|
+
local ____getCopiedEntries_result_4 = getCopiedEntries(nil, set, serializationType, traversalDescription)
|
|
240
|
+
local entries = ____getCopiedEntries_result_4.entries
|
|
241
|
+
local convertedNumberKeysToStrings = ____getCopiedEntries_result_4.convertedNumberKeysToStrings
|
|
242
|
+
if convertedNumberKeysToStrings then
|
|
243
|
+
if __TS__InstanceOf(newSet, Set) then
|
|
244
|
+
error("The deep copy function cannot convert number keys to strings for a Set.")
|
|
245
|
+
else
|
|
246
|
+
newSet[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
for ____, ____value in ipairs(entries) do
|
|
250
|
+
local key = ____value[1]
|
|
251
|
+
if __TS__InstanceOf(newSet, Set) then
|
|
252
|
+
newSet:add(key)
|
|
253
|
+
else
|
|
254
|
+
newSet[key] = ""
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
return newSet
|
|
185
258
|
end
|
|
186
|
-
function
|
|
187
|
-
local
|
|
188
|
-
|
|
189
|
-
|
|
259
|
+
function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescription)
|
|
260
|
+
local newClass
|
|
261
|
+
if serializationType == SerializationType.SERIALIZE then
|
|
262
|
+
newClass = {}
|
|
263
|
+
else
|
|
264
|
+
newClass = newTSTLClass(nil, tstlClass)
|
|
265
|
+
end
|
|
266
|
+
local ____getCopiedEntries_result_5 = getCopiedEntries(nil, tstlClass, serializationType, traversalDescription)
|
|
267
|
+
local entries = ____getCopiedEntries_result_5.entries
|
|
268
|
+
local convertedNumberKeysToStrings = ____getCopiedEntries_result_5.convertedNumberKeysToStrings
|
|
269
|
+
if convertedNumberKeysToStrings then
|
|
270
|
+
newClass[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
271
|
+
end
|
|
272
|
+
for ____, ____value in ipairs(entries) do
|
|
273
|
+
local key = ____value[1]
|
|
274
|
+
local value = ____value[2]
|
|
190
275
|
newClass[key] = value
|
|
191
276
|
end
|
|
192
277
|
return newClass
|
|
193
278
|
end
|
|
194
|
-
function
|
|
195
|
-
local
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
local keyType = type(key)
|
|
206
|
-
if serializationType == SerializationType.SERIALIZE and isTSTLObject and keyType == "number" then
|
|
207
|
-
convertNumberKeysToString = true
|
|
208
|
-
local newTable = newObject
|
|
209
|
-
newTable[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
210
|
-
if SAVE_DATA_MANAGER_DEBUG then
|
|
211
|
-
log("deepCopy is converting a TSTL map with number keys to strings.")
|
|
279
|
+
function getCopiedEntries(self, object, serializationType, traversalDescription)
|
|
280
|
+
local entries = {}
|
|
281
|
+
if __TS__InstanceOf(object, Map) or __TS__InstanceOf(object, Set) then
|
|
282
|
+
for ____, ____value in __TS__Iterator(object:entries()) do
|
|
283
|
+
local key = ____value[1]
|
|
284
|
+
local value = ____value[2]
|
|
285
|
+
__TS__ArrayPush(entries, {key, value})
|
|
286
|
+
end
|
|
287
|
+
else
|
|
288
|
+
for key, value in pairs(object) do
|
|
289
|
+
__TS__ArrayPush(entries, {key, value})
|
|
212
290
|
end
|
|
213
291
|
end
|
|
214
|
-
local
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
292
|
+
local hasNumberKeys = __TS__ArraySome(
|
|
293
|
+
entries,
|
|
294
|
+
function(____, ____bindingPattern0)
|
|
295
|
+
local key
|
|
296
|
+
key = ____bindingPattern0[1]
|
|
297
|
+
return type(key) == "number"
|
|
298
|
+
end
|
|
220
299
|
)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
300
|
+
local convertNumberKeysToStrings = serializationType == SerializationType.SERIALIZE and hasNumberKeys
|
|
301
|
+
local copiedEntries = {}
|
|
302
|
+
for ____, ____value in ipairs(entries) do
|
|
303
|
+
local key = ____value[1]
|
|
304
|
+
local value = ____value[2]
|
|
305
|
+
do
|
|
306
|
+
if isSerializationBrand(nil, key) then
|
|
307
|
+
goto __continue73
|
|
308
|
+
end
|
|
309
|
+
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
310
|
+
local newValue = ____exports.deepCopy(nil, value, serializationType, traversalDescription)
|
|
311
|
+
local keyToUse = convertNumberKeysToStrings and tostring(key) or key
|
|
312
|
+
__TS__ArrayPush(copiedEntries, {keyToUse, newValue})
|
|
313
|
+
end
|
|
314
|
+
::__continue73::
|
|
228
315
|
end
|
|
316
|
+
return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
|
|
229
317
|
end
|
|
230
|
-
function
|
|
231
|
-
|
|
318
|
+
function checkMetatable(self, ____table, traversalDescription)
|
|
319
|
+
local metatable = getmetatable(____table)
|
|
320
|
+
if metatable == nil then
|
|
232
321
|
return
|
|
233
322
|
end
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
end
|
|
323
|
+
local tableDescription = traversalDescription == "" and "the table to copy" or ("\"" .. traversalDescription) .. "\""
|
|
324
|
+
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.)")
|
|
237
325
|
end
|
|
238
|
-
function
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if isSerializedIsaacAPIClass(nil, value) and serializationType == SerializationType.DESERIALIZE then
|
|
243
|
-
return deserializeIsaacAPIClass(nil, value)
|
|
326
|
+
function deepCopyUserdata(self, value, serializationType, traversalDescription)
|
|
327
|
+
local classType = getIsaacAPIClassType(nil, value)
|
|
328
|
+
if classType == nil then
|
|
329
|
+
error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
|
|
244
330
|
end
|
|
245
|
-
if
|
|
246
|
-
|
|
247
|
-
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
248
|
-
return ____exports.deepCopy(nil, ____table, serializationType, traversalDescription)
|
|
331
|
+
if not COPYABLE_ISAAC_API_CLASS_TYPES_SET:has(classType) then
|
|
332
|
+
error((("The deep copy function does not support copying \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. classType)
|
|
249
333
|
end
|
|
250
|
-
return value
|
|
334
|
+
return copyIsaacAPIClass(nil, value, serializationType)
|
|
251
335
|
end
|
|
252
|
-
|
|
336
|
+
COPYABLE_ISAAC_API_CLASS_TYPES_SET = __TS__New(
|
|
337
|
+
Set,
|
|
338
|
+
getEnumValues(nil, CopyableIsaacAPIClassType)
|
|
339
|
+
)
|
|
253
340
|
return ____exports
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare function easeInSine(x: number): number;
|
|
2
|
+
export declare function easeOutSine(x: number): number;
|
|
3
|
+
export declare function easeInOutSine(x: number): number;
|
|
4
|
+
export declare function easeInCubic(x: number): number;
|
|
5
|
+
export declare function easeOutCubic(x: number): number;
|
|
6
|
+
export declare function easeInOutCubic(x: number): number;
|
|
7
|
+
export declare function easeInQuint(x: number): number;
|
|
8
|
+
export declare function easeOutQuint(x: number): number;
|
|
9
|
+
export declare function easeInOutQuint(x: number): number;
|
|
10
|
+
export declare function easeInCirc(x: number): number;
|
|
11
|
+
export declare function easeOutCirc(x: number): number;
|
|
12
|
+
export declare function easeInOutCirc(x: number): number;
|
|
13
|
+
export declare function easeInElastic(x: number): number;
|
|
14
|
+
export declare function easeOutElastic(x: number): number;
|
|
15
|
+
export declare function easeInOutElastic(x: number): number;
|
|
16
|
+
export declare function easeInQuad(x: number): number;
|
|
17
|
+
export declare function easeOutQuad(x: number): number;
|
|
18
|
+
export declare function easeInOutQuad(x: number): number;
|
|
19
|
+
export declare function easeInQuart(x: number): number;
|
|
20
|
+
export declare function easeOutQuart(x: number): number;
|
|
21
|
+
export declare function easeInOutQuart(x: number): number;
|
|
22
|
+
export declare function easeInExpo(x: number): number;
|
|
23
|
+
export declare function easeOutExpo(x: number): number;
|
|
24
|
+
export declare function easeInOutExpo(x: number): number;
|
|
25
|
+
export declare function easeInBack(x: number): number;
|
|
26
|
+
export declare function easeOutBack(x: number): number;
|
|
27
|
+
export declare function easeInOutBack(x: number): number;
|
|
28
|
+
export declare function easeInBounce(x: number): number;
|
|
29
|
+
export declare function easeOutBounce(x: number): number;
|
|
30
|
+
export declare function easeInOutBounce(x: number): number;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
function ____exports.easeOutBounce(self, x)
|
|
4
|
+
local n1 = 7.5625
|
|
5
|
+
local d1 = 2.75
|
|
6
|
+
if x < 1 / d1 then
|
|
7
|
+
return n1 * x * x
|
|
8
|
+
end
|
|
9
|
+
if x < 2 / d1 then
|
|
10
|
+
x = x - 1.5 / d1
|
|
11
|
+
return n1 * x * x + 0.75
|
|
12
|
+
end
|
|
13
|
+
if x < 2.5 / d1 then
|
|
14
|
+
x = x - 2.25 / d1
|
|
15
|
+
return n1 * x * x + 0.9375
|
|
16
|
+
end
|
|
17
|
+
x = x - 2.625 / d1
|
|
18
|
+
return n1 * x * x + 0.984375
|
|
19
|
+
end
|
|
20
|
+
function ____exports.easeInSine(self, x)
|
|
21
|
+
return 1 - math.cos(x * math.pi / 2)
|
|
22
|
+
end
|
|
23
|
+
function ____exports.easeOutSine(self, x)
|
|
24
|
+
return math.sin(x * math.pi / 2)
|
|
25
|
+
end
|
|
26
|
+
function ____exports.easeInOutSine(self, x)
|
|
27
|
+
return -(math.cos(math.pi * x) - 1) / 2
|
|
28
|
+
end
|
|
29
|
+
function ____exports.easeInCubic(self, x)
|
|
30
|
+
return x * x * x
|
|
31
|
+
end
|
|
32
|
+
function ____exports.easeOutCubic(self, x)
|
|
33
|
+
return 1 - (1 - x) ^ 3
|
|
34
|
+
end
|
|
35
|
+
function ____exports.easeInOutCubic(self, x)
|
|
36
|
+
return x < 0.5 and 4 * x * x * x or 1 - (-2 * x + 2) ^ 3 / 2
|
|
37
|
+
end
|
|
38
|
+
function ____exports.easeInQuint(self, x)
|
|
39
|
+
return x * x * x * x * x
|
|
40
|
+
end
|
|
41
|
+
function ____exports.easeOutQuint(self, x)
|
|
42
|
+
return 1 - (1 - x) ^ 5
|
|
43
|
+
end
|
|
44
|
+
function ____exports.easeInOutQuint(self, x)
|
|
45
|
+
return x < 0.5 and 16 * x * x * x * x * x or 1 - (-2 * x + 2) ^ 5 / 2
|
|
46
|
+
end
|
|
47
|
+
function ____exports.easeInCirc(self, x)
|
|
48
|
+
return 1 - math.sqrt(1 - x ^ 2)
|
|
49
|
+
end
|
|
50
|
+
function ____exports.easeOutCirc(self, x)
|
|
51
|
+
return math.sqrt(1 - (x - 1) ^ 2)
|
|
52
|
+
end
|
|
53
|
+
function ____exports.easeInOutCirc(self, x)
|
|
54
|
+
return x < 0.5 and (1 - math.sqrt(1 - (2 * x) ^ 2)) / 2 or (math.sqrt(1 - (-2 * x + 2) ^ 2) + 1) / 2
|
|
55
|
+
end
|
|
56
|
+
function ____exports.easeInElastic(self, x)
|
|
57
|
+
local c4 = 2 * math.pi / 3
|
|
58
|
+
return x == 0 and 0 or (x == 1 and 1 or -2 ^ (10 * x - 10) * math.sin((x * 10 - 10.75) * c4))
|
|
59
|
+
end
|
|
60
|
+
function ____exports.easeOutElastic(self, x)
|
|
61
|
+
local c4 = 2 * math.pi / 3
|
|
62
|
+
return x == 0 and 0 or (x == 1 and 1 or 2 ^ (-10 * x) * math.sin((x * 10 - 0.75) * c4) + 1)
|
|
63
|
+
end
|
|
64
|
+
function ____exports.easeInOutElastic(self, x)
|
|
65
|
+
local c5 = 2 * math.pi / 4.5
|
|
66
|
+
return x == 0 and 0 or (x == 1 and 1 or (x < 0.5 and -(2 ^ (20 * x - 10) * math.sin((20 * x - 11.125) * c5)) / 2 or 2 ^ (-20 * x + 10) * math.sin((20 * x - 11.125) * c5) / 2 + 1))
|
|
67
|
+
end
|
|
68
|
+
function ____exports.easeInQuad(self, x)
|
|
69
|
+
return x * x
|
|
70
|
+
end
|
|
71
|
+
function ____exports.easeOutQuad(self, x)
|
|
72
|
+
return 1 - (1 - x) * (1 - x)
|
|
73
|
+
end
|
|
74
|
+
function ____exports.easeInOutQuad(self, x)
|
|
75
|
+
return x < 0.5 and 2 * x * x or 1 - (-2 * x + 2) ^ 2 / 2
|
|
76
|
+
end
|
|
77
|
+
function ____exports.easeInQuart(self, x)
|
|
78
|
+
return x * x * x * x
|
|
79
|
+
end
|
|
80
|
+
function ____exports.easeOutQuart(self, x)
|
|
81
|
+
return 1 - (1 - x) ^ 4
|
|
82
|
+
end
|
|
83
|
+
function ____exports.easeInOutQuart(self, x)
|
|
84
|
+
return x < 0.5 and 8 * x * x * x * x or 1 - (-2 * x + 2) ^ 4 / 2
|
|
85
|
+
end
|
|
86
|
+
function ____exports.easeInExpo(self, x)
|
|
87
|
+
return x == 0 and 0 or 2 ^ (10 * x - 10)
|
|
88
|
+
end
|
|
89
|
+
function ____exports.easeOutExpo(self, x)
|
|
90
|
+
return x == 1 and 1 or 1 - 2 ^ (-10 * x)
|
|
91
|
+
end
|
|
92
|
+
function ____exports.easeInOutExpo(self, x)
|
|
93
|
+
return x == 0 and 0 or (x == 1 and 1 or (x < 0.5 and 2 ^ (20 * x - 10) / 2 or (2 - 2 ^ (-20 * x + 10)) / 2))
|
|
94
|
+
end
|
|
95
|
+
function ____exports.easeInBack(self, x)
|
|
96
|
+
local c1 = 1.70158
|
|
97
|
+
local c3 = c1 + 1
|
|
98
|
+
return c3 * x * x * x - c1 * x * x
|
|
99
|
+
end
|
|
100
|
+
function ____exports.easeOutBack(self, x)
|
|
101
|
+
local c1 = 1.70158
|
|
102
|
+
local c3 = c1 + 1
|
|
103
|
+
return 1 + c3 * (x - 1) ^ 3 + c1 * (x - 1) ^ 2
|
|
104
|
+
end
|
|
105
|
+
function ____exports.easeInOutBack(self, x)
|
|
106
|
+
local c1 = 1.70158
|
|
107
|
+
local c2 = c1 * 1.525
|
|
108
|
+
return x < 0.5 and (2 * x) ^ 2 * ((c2 + 1) * 2 * x - c2) / 2 or ((2 * x - 2) ^ 2 * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2
|
|
109
|
+
end
|
|
110
|
+
function ____exports.easeInBounce(self, x)
|
|
111
|
+
return 1 - ____exports.easeOutBounce(nil, 1 - x)
|
|
112
|
+
end
|
|
113
|
+
function ____exports.easeInOutBounce(self, x)
|
|
114
|
+
return x < 0.5 and (1 - ____exports.easeOutBounce(nil, 1 - 2 * x)) / 2 or (1 + ____exports.easeOutBounce(nil, 2 * x - 1)) / 2
|
|
115
|
+
end
|
|
116
|
+
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare function logEntityID(this: void, entity: Entity): void;
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function logError(this: void, msg: string): void;
|
|
29
29
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
30
|
-
export declare function logFlags(this: void, flags: int, flagEnum?: LuaTable, description?: string): void;
|
|
30
|
+
export declare function logFlags(this: void, flags: int, flagEnum?: LuaTable<AnyNotNil, unknown>, description?: string): void;
|
|
31
31
|
/**
|
|
32
32
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
33
33
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SerializationType } from "../enums/SerializationType";
|
|
2
|
-
import { SerializableIsaacAPIClass } from "../types/private/SerializableIsaacAPIClass";
|
|
3
2
|
import { SerializedIsaacAPIClass } from "../types/private/SerializedIsaacAPIClass";
|
|
4
|
-
export declare function copyIsaacAPIClass(isaacAPIClass:
|
|
3
|
+
export declare function copyIsaacAPIClass(isaacAPIClass: unknown, serializationType: SerializationType): unknown;
|
|
5
4
|
/**
|
|
6
|
-
* Deserialization is a special case, so we make a dedicated function for this.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Deserialization is a special case, so we make a dedicated function for this.
|
|
6
|
+
*
|
|
7
|
+
* There is no need for a corresponding "serializeIsaacAPIClass" function because the
|
|
8
|
+
* "copyIsaacAPIClass" function can handles all serialization types.
|
|
9
9
|
*/
|
|
10
10
|
export declare function deserializeIsaacAPIClass(serializedIsaacAPIClass: SerializedIsaacAPIClass): unknown;
|
|
11
|
-
export declare function isSerializableIsaacAPIClass(object: unknown): object is SerializableIsaacAPIClass;
|
|
12
11
|
export declare function isSerializedIsaacAPIClass(object: unknown): object is SerializedIsaacAPIClass;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Set = ____lualib.Set
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
2
|
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
5
3
|
local __TS__ObjectValues = ____lualib.__TS__ObjectValues
|
|
6
4
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
7
5
|
local ____exports = {}
|
|
8
6
|
local getSerializedTableType
|
|
9
|
-
local ____SerializableIsaacAPIClassType = require("enums.private.SerializableIsaacAPIClassType")
|
|
10
|
-
local SerializableIsaacAPIClassType = ____SerializableIsaacAPIClassType.SerializableIsaacAPIClassType
|
|
11
7
|
local ____SerializationType = require("enums.SerializationType")
|
|
12
8
|
local SerializationType = ____SerializationType.SerializationType
|
|
13
9
|
local ____isaacAPIClassTypeToBrand = require("objects.isaacAPIClassTypeToBrand")
|
|
@@ -18,35 +14,29 @@ local ____serializedIsaacAPIClassTypeToIdentityFunction = require("objects.seria
|
|
|
18
14
|
local SERIALIZED_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION = ____serializedIsaacAPIClassTypeToIdentityFunction.SERIALIZED_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION
|
|
19
15
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
20
16
|
local getIsaacAPIClassType = ____isaacAPIClass.getIsaacAPIClassType
|
|
21
|
-
local ____utils = require("functions.utils")
|
|
22
|
-
local getEnumValues = ____utils.getEnumValues
|
|
23
17
|
function getSerializedTableType(self, serializedIsaacAPIClass)
|
|
24
18
|
for ____, ____value in ipairs(__TS__ObjectEntries(ISAAC_API_CLASS_TYPE_TO_BRAND)) do
|
|
25
|
-
local
|
|
19
|
+
local copyableIsaacAPIClassType = ____value[1]
|
|
26
20
|
local serializationBrand = ____value[2]
|
|
27
21
|
if serializedIsaacAPIClass[serializationBrand] ~= nil then
|
|
28
|
-
return
|
|
22
|
+
return copyableIsaacAPIClassType
|
|
29
23
|
end
|
|
30
24
|
end
|
|
31
25
|
return nil
|
|
32
26
|
end
|
|
33
|
-
local SERIALIZABLE_ISAAC_API_CLASS_TYPES_SET = __TS__New(
|
|
34
|
-
Set,
|
|
35
|
-
getEnumValues(nil, SerializableIsaacAPIClassType)
|
|
36
|
-
)
|
|
37
27
|
function ____exports.copyIsaacAPIClass(self, isaacAPIClass, serializationType)
|
|
38
28
|
local objectType = type(isaacAPIClass)
|
|
39
29
|
if objectType ~= "userdata" then
|
|
40
|
-
error("Failed to
|
|
30
|
+
error("Failed to copy an Isaac API class since the provided object was of type: " .. objectType)
|
|
41
31
|
end
|
|
42
32
|
local isaacAPIClassType = getIsaacAPIClassType(nil, isaacAPIClass)
|
|
43
33
|
if isaacAPIClassType == nil then
|
|
44
|
-
error("Failed to
|
|
34
|
+
error("Failed to copy an Isaac API class due to it not having a class type.")
|
|
45
35
|
end
|
|
46
|
-
local
|
|
47
|
-
local copyFunction = ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION[
|
|
36
|
+
local copyableIsaacAPIClassType = isaacAPIClassType
|
|
37
|
+
local copyFunction = ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION[copyableIsaacAPIClassType]
|
|
48
38
|
if copyFunction == nil then
|
|
49
|
-
error(("Failed to copy Isaac API class \"" ..
|
|
39
|
+
error(("Failed to copy Isaac API class \"" .. copyableIsaacAPIClassType) .. "\" since there is not a defined copy function for this class type.")
|
|
50
40
|
end
|
|
51
41
|
return copyFunction(nil, isaacAPIClass, serializationType)
|
|
52
42
|
end
|
|
@@ -55,23 +45,16 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
|
|
|
55
45
|
if objectType ~= "table" then
|
|
56
46
|
error("Failed to deserialize an Isaac API class since the provided object was of type: " .. objectType)
|
|
57
47
|
end
|
|
58
|
-
local
|
|
59
|
-
if
|
|
48
|
+
local copyableIsaacAPIClassType = getSerializedTableType(nil, serializedIsaacAPIClass)
|
|
49
|
+
if copyableIsaacAPIClassType == nil then
|
|
60
50
|
error("Failed to deserialize an API class since a valid class type brand was not found.")
|
|
61
51
|
end
|
|
62
|
-
local copyFunction = ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION[
|
|
52
|
+
local copyFunction = ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION[copyableIsaacAPIClassType]
|
|
63
53
|
if copyFunction == nil then
|
|
64
|
-
error(("Failed to deserialize Isaac API class \"" ..
|
|
54
|
+
error(("Failed to deserialize Isaac API class \"" .. copyableIsaacAPIClassType) .. "\" since there is not a defined copy function for this class type.")
|
|
65
55
|
end
|
|
66
56
|
return copyFunction(nil, serializedIsaacAPIClass, SerializationType.DESERIALIZE)
|
|
67
57
|
end
|
|
68
|
-
function ____exports.isSerializableIsaacAPIClass(self, object)
|
|
69
|
-
local classType = getIsaacAPIClassType(nil, object)
|
|
70
|
-
if classType == nil then
|
|
71
|
-
return false
|
|
72
|
-
end
|
|
73
|
-
return SERIALIZABLE_ISAAC_API_CLASS_TYPES_SET:has(classType)
|
|
74
|
-
end
|
|
75
58
|
function ____exports.isSerializedIsaacAPIClass(self, object)
|
|
76
59
|
local identityFunctions = __TS__ObjectValues(SERIALIZED_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION)
|
|
77
60
|
return __TS__ArraySome(
|
|
@@ -33,4 +33,4 @@ export declare function getStringsFromTable(table: LuaTable<string, unknown>, ob
|
|
|
33
33
|
* This function is variadic, meaning that you can specify as many arguments as you want to check
|
|
34
34
|
* for.
|
|
35
35
|
*/
|
|
36
|
-
export declare function tableHasKeys(table: LuaTable, ...keys: string[]): boolean;
|
|
36
|
+
export declare function tableHasKeys(table: LuaTable<AnyNotNil, unknown>, ...keys: string[]): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TSTLClass } from "../types/private/TSTLClass";
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether or not this is a class that is provided by the `isaacscript-common` library, such
|
|
4
|
+
* as a `DefaultMap`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isIsaacScriptCommonClass(object: unknown): boolean;
|
|
7
|
+
/** TypeScriptToLua classes are Lua tables that have a metatable with a certain amount of keys. */
|
|
8
|
+
export declare function isUserDefinedTSTLClass(object: unknown): object is TSTLClass;
|
|
9
|
+
/**
|
|
10
|
+
* Returns whether or not this is a class that is provided as part of the TypeScriptToLua
|
|
11
|
+
* transpiler, such as a `Map` or a `Set`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isVanillaTSTLClass(object: unknown): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
16
|
+
* it is. This function requires that you provide an instantiated class of the same type, as it will
|
|
17
|
+
* use the class constructor that is present on the other object's metatable to initialize the new
|
|
18
|
+
* class.
|
|
19
|
+
*/
|
|
20
|
+
export declare function newTSTLClass(oldClass: TSTLClass): TSTLClass;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
|
+
local Map = ____lualib.Map
|
|
6
|
+
local WeakMap = ____lualib.WeakMap
|
|
7
|
+
local WeakSet = ____lualib.WeakSet
|
|
8
|
+
local ____exports = {}
|
|
9
|
+
local newTSTLClassFromMetatable
|
|
10
|
+
local ____DefaultMap = require("classes.DefaultMap")
|
|
11
|
+
local DefaultMap = ____DefaultMap.DefaultMap
|
|
12
|
+
function ____exports.isVanillaTSTLClass(self, object)
|
|
13
|
+
return __TS__InstanceOf(object, Map) or __TS__InstanceOf(object, Set) or __TS__InstanceOf(object, WeakMap) or __TS__InstanceOf(object, WeakSet)
|
|
14
|
+
end
|
|
15
|
+
function newTSTLClassFromMetatable(self, metatable)
|
|
16
|
+
local newClass = {}
|
|
17
|
+
local newClassMetatable = setmetatable(newClass, metatable.constructor.prototype)
|
|
18
|
+
newClassMetatable:____constructor()
|
|
19
|
+
return newClass
|
|
20
|
+
end
|
|
21
|
+
local TSTL_CLASS_METATABLE_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
|
|
22
|
+
function ____exports.isIsaacScriptCommonClass(self, object)
|
|
23
|
+
return __TS__InstanceOf(object, DefaultMap)
|
|
24
|
+
end
|
|
25
|
+
function ____exports.isUserDefinedTSTLClass(self, object)
|
|
26
|
+
if ____exports.isVanillaTSTLClass(nil, object) or ____exports.isIsaacScriptCommonClass(nil, object) then
|
|
27
|
+
return false
|
|
28
|
+
end
|
|
29
|
+
local objectType = type(object)
|
|
30
|
+
if objectType ~= "table" then
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
local metatable = getmetatable(object)
|
|
34
|
+
if metatable == nil then
|
|
35
|
+
return false
|
|
36
|
+
end
|
|
37
|
+
local numKeys = 0
|
|
38
|
+
for key in pairs(metatable) do
|
|
39
|
+
numKeys = numKeys + 1
|
|
40
|
+
if type(key) ~= "string" then
|
|
41
|
+
return false
|
|
42
|
+
end
|
|
43
|
+
if not TSTL_CLASS_METATABLE_KEYS:has(key) then
|
|
44
|
+
return false
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
return numKeys == TSTL_CLASS_METATABLE_KEYS.size
|
|
48
|
+
end
|
|
49
|
+
function ____exports.newTSTLClass(self, oldClass)
|
|
50
|
+
local metatable = getmetatable(oldClass)
|
|
51
|
+
if metatable == nil then
|
|
52
|
+
error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable.")
|
|
53
|
+
end
|
|
54
|
+
return newTSTLClassFromMetatable(nil, metatable)
|
|
55
|
+
end
|
|
56
|
+
return ____exports
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
2
|
/**
|
|
4
3
|
* Helper function to get type safety on a switch statement.
|
|
5
4
|
*
|
|
@@ -7,14 +6,14 @@
|
|
|
7
6
|
*
|
|
8
7
|
* Example:
|
|
9
8
|
* ```ts
|
|
10
|
-
* enum
|
|
9
|
+
* enum Situation {
|
|
11
10
|
* ONE,
|
|
12
11
|
* TWO,
|
|
13
12
|
* THREE,
|
|
14
13
|
* // FOUR, // If we uncomment this line, the program will no longer compile
|
|
15
14
|
* }
|
|
16
15
|
*
|
|
17
|
-
* function
|
|
16
|
+
* function handleSituation(situation: Situation) {
|
|
18
17
|
* switch (situation) {
|
|
19
18
|
* case Situation.ONE: {
|
|
20
19
|
* return 41;
|
|
@@ -74,7 +73,7 @@ export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
|
|
|
74
73
|
* Helper function to log what is happening in functions that recursively move through nested data
|
|
75
74
|
* structures.
|
|
76
75
|
*/
|
|
77
|
-
export declare function getTraversalDescription(key:
|
|
76
|
+
export declare function getTraversalDescription(key: unknown, traversalDescription: string): string;
|
|
78
77
|
/**
|
|
79
78
|
* Converts a hex string like "#33aa33" to a KColor object.
|
|
80
79
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from "./functions/debug";
|
|
|
45
45
|
export { deepCopy } from "./functions/deepCopy";
|
|
46
46
|
export { deepCopyTests } from "./functions/deepCopyTests";
|
|
47
47
|
export * from "./functions/doors";
|
|
48
|
+
export * from "./functions/easing";
|
|
48
49
|
export * from "./functions/entity";
|
|
49
50
|
export * from "./functions/entitySpecific";
|
|
50
51
|
export * from "./functions/familiars";
|
|
@@ -94,6 +95,7 @@ export * from "./functions/trinketCacheFlag";
|
|
|
94
95
|
export * from "./functions/trinketGive";
|
|
95
96
|
export * from "./functions/trinkets";
|
|
96
97
|
export * from "./functions/trinketSet";
|
|
98
|
+
export * from "./functions/tstlClass";
|
|
97
99
|
export * from "./functions/ui";
|
|
98
100
|
export * from "./functions/utils";
|
|
99
101
|
export * from "./functions/vector";
|
package/dist/index.lua
CHANGED
|
@@ -363,6 +363,14 @@ do
|
|
|
363
363
|
end
|
|
364
364
|
end
|
|
365
365
|
end
|
|
366
|
+
do
|
|
367
|
+
local ____export = require("functions.easing")
|
|
368
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
369
|
+
if ____exportKey ~= "default" then
|
|
370
|
+
____exports[____exportKey] = ____exportValue
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
end
|
|
366
374
|
do
|
|
367
375
|
local ____export = require("functions.entity")
|
|
368
376
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -752,6 +760,14 @@ do
|
|
|
752
760
|
end
|
|
753
761
|
end
|
|
754
762
|
end
|
|
763
|
+
do
|
|
764
|
+
local ____export = require("functions.tstlClass")
|
|
765
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
766
|
+
if ____exportKey ~= "default" then
|
|
767
|
+
____exports[____exportKey] = ____exportValue
|
|
768
|
+
end
|
|
769
|
+
end
|
|
770
|
+
end
|
|
755
771
|
do
|
|
756
772
|
local ____export = require("functions.ui")
|
|
757
773
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CopyableIsaacAPIClassType } from "../enums/private/CopyableIsaacAPIClassType";
|
|
2
2
|
import { SerializationBrand } from "../enums/private/SerializationBrand";
|
|
3
3
|
export declare const ISAAC_API_CLASS_TYPE_TO_BRAND: {
|
|
4
|
-
readonly [key in
|
|
4
|
+
readonly [key in CopyableIsaacAPIClassType]: SerializationBrand;
|
|
5
5
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local
|
|
4
|
-
local
|
|
3
|
+
local ____CopyableIsaacAPIClassType = require("enums.private.CopyableIsaacAPIClassType")
|
|
4
|
+
local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
|
|
5
5
|
local ____SerializationBrand = require("enums.private.SerializationBrand")
|
|
6
6
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
7
|
-
____exports.ISAAC_API_CLASS_TYPE_TO_BRAND = {[
|
|
7
|
+
____exports.ISAAC_API_CLASS_TYPE_TO_BRAND = {[CopyableIsaacAPIClassType.COLOR] = SerializationBrand.COLOR, [CopyableIsaacAPIClassType.KCOLOR] = SerializationBrand.KCOLOR, [CopyableIsaacAPIClassType.RNG] = SerializationBrand.RNG, [CopyableIsaacAPIClassType.VECTOR] = SerializationBrand.VECTOR}
|
|
8
8
|
return ____exports
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CopyableIsaacAPIClassType } from "../enums/private/CopyableIsaacAPIClassType";
|
|
2
2
|
import { SerializationType } from "../enums/SerializationType";
|
|
3
3
|
export declare const ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION: {
|
|
4
|
-
readonly [key in
|
|
4
|
+
readonly [key in CopyableIsaacAPIClassType]: (object: unknown, serializationType: SerializationType) => boolean;
|
|
5
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local
|
|
4
|
-
local
|
|
3
|
+
local ____CopyableIsaacAPIClassType = require("enums.private.CopyableIsaacAPIClassType")
|
|
4
|
+
local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
|
|
5
5
|
local ____color = require("functions.color")
|
|
6
6
|
local copyColor = ____color.copyColor
|
|
7
7
|
local ____kColor = require("functions.kColor")
|
|
@@ -10,5 +10,5 @@ local ____rng = require("functions.rng")
|
|
|
10
10
|
local copyRNG = ____rng.copyRNG
|
|
11
11
|
local ____vector = require("functions.vector")
|
|
12
12
|
local copyVector = ____vector.copyVector
|
|
13
|
-
____exports.ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION = {[
|
|
13
|
+
____exports.ISAAC_API_CLASS_TYPE_TO_COPY_FUNCTION = {[CopyableIsaacAPIClassType.COLOR] = copyColor, [CopyableIsaacAPIClassType.KCOLOR] = copyKColor, [CopyableIsaacAPIClassType.RNG] = copyRNG, [CopyableIsaacAPIClassType.VECTOR] = copyVector}
|
|
14
14
|
return ____exports
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CopyableIsaacAPIClassType } from "../enums/private/CopyableIsaacAPIClassType";
|
|
2
2
|
export declare const SERIALIZED_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION: {
|
|
3
|
-
readonly [key in
|
|
3
|
+
readonly [key in CopyableIsaacAPIClassType]: (object: unknown) => boolean;
|
|
4
4
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local
|
|
4
|
-
local
|
|
3
|
+
local ____CopyableIsaacAPIClassType = require("enums.private.CopyableIsaacAPIClassType")
|
|
4
|
+
local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
|
|
5
5
|
local ____color = require("functions.color")
|
|
6
6
|
local isSerializedColor = ____color.isSerializedColor
|
|
7
7
|
local ____kColor = require("functions.kColor")
|
|
@@ -10,5 +10,5 @@ local ____rng = require("functions.rng")
|
|
|
10
10
|
local isSerializedRNG = ____rng.isSerializedRNG
|
|
11
11
|
local ____vector = require("functions.vector")
|
|
12
12
|
local isSerializedVector = ____vector.isSerializedVector
|
|
13
|
-
____exports.SERIALIZED_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION = {[
|
|
13
|
+
____exports.SERIALIZED_ISAAC_API_CLASS_TYPE_TO_IDENTITY_FUNCTION = {[CopyableIsaacAPIClassType.COLOR] = isSerializedColor, [CopyableIsaacAPIClassType.KCOLOR] = isSerializedKColor, [CopyableIsaacAPIClassType.RNG] = isSerializedRNG, [CopyableIsaacAPIClassType.VECTOR] = isSerializedVector}
|
|
14
14
|
return ____exports
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Primitive } from "../Primitive";
|
|
2
|
+
/**
|
|
3
|
+
* I don't know how to create a recursive type definition for only primitive values. For now, this
|
|
4
|
+
* is typed as "unknown", which provides no type safety.
|
|
5
|
+
*/
|
|
2
6
|
declare type Serializable = Primitive | unknown;
|
|
3
7
|
/**
|
|
4
8
|
* Each sub-object of save data has a string as a key, without arbitrary data as a value. However,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/// <reference types="lua-types/5.3" />
|
|
2
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
3
|
export interface TSTLClassMetatable {
|
|
2
4
|
____constructor: () => void;
|
|
3
5
|
__index: unknown;
|
|
4
6
|
constructor: {
|
|
5
|
-
prototype: unknown
|
|
7
|
+
prototype: LuaMetatable<LuaTable<AnyNotNil, unknown>>;
|
|
6
8
|
name: string;
|
|
7
9
|
};
|
|
8
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.250",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"isaac-typescript-definitions": "^1.0.388",
|
|
29
|
-
"isaacscript-lint": "^1.0.
|
|
29
|
+
"isaacscript-lint": "^1.0.99",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.8",
|
|
31
31
|
"typedoc": "^0.22.13",
|
|
32
32
|
"typescript": "4.6.3",
|