isaacscript-common 9.20.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +73 -24
- package/dist/isaacscript-common.lua +253 -138
- package/dist/lualib_bundle.lua +53 -37
- package/dist/package.lua +2 -2
- package/dist/src/features/deployJSONRoom.d.ts +16 -6
- package/dist/src/features/deployJSONRoom.d.ts.map +1 -1
- package/dist/src/features/deployJSONRoom.lua +16 -6
- package/dist/src/features/saveDataManager/load.d.ts +1 -1
- package/dist/src/features/saveDataManager/maps.d.ts +1 -1
- package/dist/src/features/saveDataManager/merge.d.ts +1 -1
- package/dist/src/features/saveDataManager/save.d.ts +1 -1
- package/dist/src/functions/bitSet128.d.ts +3 -2
- package/dist/src/functions/bitSet128.d.ts.map +1 -1
- package/dist/src/functions/bitSet128.lua +2 -2
- package/dist/src/functions/color.d.ts +3 -4
- package/dist/src/functions/color.d.ts.map +1 -1
- package/dist/src/functions/color.lua +2 -2
- package/dist/src/functions/curses.d.ts +1 -1
- package/dist/src/functions/curses.lua +1 -1
- package/dist/src/functions/deepCopy.d.ts +2 -1
- package/dist/src/functions/deepCopy.d.ts.map +1 -1
- package/dist/src/functions/deepCopy.lua +19 -25
- package/dist/src/functions/deepCopyTests.lua +13 -26
- package/dist/src/functions/entities.d.ts +1 -1
- package/dist/src/functions/globals.d.ts +1 -1
- package/dist/src/functions/jsonHelpers.d.ts +1 -1
- package/dist/src/functions/kColor.d.ts +3 -4
- package/dist/src/functions/kColor.d.ts.map +1 -1
- package/dist/src/functions/kColor.lua +2 -2
- package/dist/src/functions/log.d.ts +2 -2
- package/dist/src/functions/log.d.ts.map +1 -1
- package/dist/src/functions/positionVelocity.d.ts +2 -0
- package/dist/src/functions/positionVelocity.d.ts.map +1 -1
- package/dist/src/functions/positionVelocity.lua +2 -0
- package/dist/src/functions/rng.d.ts +3 -3
- package/dist/src/functions/rng.d.ts.map +1 -1
- package/dist/src/functions/serialization.d.ts +11 -4
- package/dist/src/functions/serialization.d.ts.map +1 -1
- package/dist/src/functions/serialization.lua +15 -0
- package/dist/src/functions/table.d.ts +4 -4
- package/dist/src/functions/table.d.ts.map +1 -1
- package/dist/src/functions/table.lua +8 -4
- package/dist/src/functions/tstlClass.d.ts +1 -1
- package/dist/src/functions/types.d.ts +1 -1
- package/dist/src/functions/vector.d.ts +3 -2
- package/dist/src/functions/vector.d.ts.map +1 -1
- package/dist/src/functions/vector.lua +2 -2
- package/dist/src/functions/weighted.d.ts +6 -0
- package/dist/src/functions/weighted.d.ts.map +1 -0
- package/dist/src/functions/weighted.lua +35 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -0
- package/dist/src/interfaces/SaveData.d.ts +3 -8
- package/dist/src/interfaces/SaveData.d.ts.map +1 -1
- package/dist/src/interfaces/private/TSTLClassMetatable.d.ts +1 -1
- 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 +2 -2
- package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts +36 -8
- package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -1
- package/dist/src/objects/isaacAPIClassTypeToFunctions.lua +42 -7
- package/dist/src/types/TSTLClass.d.ts +1 -1
- package/dist/src/types/WeightedArray.d.ts +4 -0
- package/dist/src/types/WeightedArray.d.ts.map +1 -0
- package/dist/src/types/{SerializedIsaacAPIClass.lua → WeightedArray.lua} +0 -0
- package/package.json +2 -2
- package/src/features/deployJSONRoom.ts +16 -6
- package/src/features/saveDataManager/exports.ts +1 -1
- package/src/functions/bitSet128.ts +8 -2
- package/src/functions/color.ts +8 -2
- package/src/functions/curses.ts +1 -1
- package/src/functions/deepCopy.ts +25 -15
- package/src/functions/deepCopyTests.ts +19 -41
- package/src/functions/initArray.ts +1 -1
- package/src/functions/kColor.ts +8 -2
- package/src/functions/log.ts +8 -6
- package/src/functions/positionVelocity.ts +2 -0
- package/src/functions/rng.ts +2 -0
- package/src/functions/serialization.ts +72 -18
- package/src/functions/table.ts +15 -6
- package/src/functions/vector.ts +11 -3
- package/src/functions/weighted.ts +36 -0
- package/src/index.ts +2 -1
- package/src/interfaces/SaveData.ts +4 -3
- package/src/objects/isaacAPIClassTypeToBrand.ts +1 -1
- package/src/objects/isaacAPIClassTypeToFunctions.ts +58 -9
- package/src/types/WeightedArray.ts +2 -0
- package/dist/src/enums/private/CopyableIsaacAPIClassType.d.ts +0 -12
- package/dist/src/enums/private/CopyableIsaacAPIClassType.d.ts.map +0 -1
- package/dist/src/enums/private/CopyableIsaacAPIClassType.lua +0 -10
- package/dist/src/types/SerializedIsaacAPIClass.d.ts +0 -11
- package/dist/src/types/SerializedIsaacAPIClass.d.ts.map +0 -1
- package/src/enums/private/CopyableIsaacAPIClassType.ts +0 -11
- package/src/types/SerializedIsaacAPIClass.ts +0 -9
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to get a set containing all of the global variable names that are contained
|
|
4
4
|
* within the Isaac environment by default.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
|
|
3
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
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":"
|
|
1
|
+
{"version":3,"file":"kColor.d.ts","sourceRoot":"","sources":["../../../src/functions/kColor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAYzE,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC;CACpD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA+BlE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,KAAK,SAAI,GACR,MAAM,CAQR;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,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
|
|
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
|
-
|
|
99
|
+
copyUserdataValuesToTable(nil, kColor, KEYS, kColorTable)
|
|
100
100
|
kColorTable[SerializationBrand.K_COLOR] = ""
|
|
101
101
|
return kColorTable
|
|
102
102
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
import { CollectibleType, DamageFlag, EntityFlag, ProjectileFlag, TearFlag, UseFlag } from "isaac-typescript-definitions";
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to prefix the name of the function and the line number before a debug message.
|
|
@@ -66,7 +66,7 @@ export declare function logTable(luaTable: unknown, parentTables?: number): void
|
|
|
66
66
|
* Helper function to print out the differences between the entries of two tables. Note that this
|
|
67
67
|
* will only do a shallow comparison.
|
|
68
68
|
*/
|
|
69
|
-
export declare function logTableDifferences<K, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
|
|
69
|
+
export declare function logTableDifferences<K extends AnyNotNil, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
|
|
70
70
|
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
71
71
|
export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
|
|
72
72
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/functions/log.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,UAAU,EAKV,cAAc,EAGd,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAkBtC;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EAKX,kBAAkB,SAAI,GACrB,MAAM,CAiBR;AAED;;;;;GAKG;AACH,wBAAg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IAAI,CAUzE;AAED,gFAAgF;AAChF,wBAAgB,SAAS,IAAI,IAAI,CAQhC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,SAAI,GAAG,IAAI,CA2ClE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,EACxD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,IAAI,CA8BN;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAEvE;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAEpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAoBnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI,CAG7D"}
|
|
@@ -20,6 +20,8 @@ export declare function anyPlayerCloserThan(position: Vector, distance: float):
|
|
|
20
20
|
* @param startingPosition The position to start searching from. If this position is not overlapping
|
|
21
21
|
* with anything, then it will be returned.
|
|
22
22
|
* @param avoidActiveEntities Optional. Default is false.
|
|
23
|
+
* @param minimumDistance Optional. If specified, will ensure that the randomly generated position
|
|
24
|
+
* is equal to or greater than the distance provided.
|
|
23
25
|
*/
|
|
24
26
|
export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
|
|
25
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,m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,GAClB,IAAI,CAYN"}
|
|
@@ -45,6 +45,8 @@ end
|
|
|
45
45
|
-- @param startingPosition The position to start searching from. If this position is not overlapping
|
|
46
46
|
-- with anything, then it will be returned.
|
|
47
47
|
-- @param avoidActiveEntities Optional. Default is false.
|
|
48
|
+
-- @param minimumDistance Optional. If specified, will ensure that the randomly generated position
|
|
49
|
+
-- is equal to or greater than the distance provided.
|
|
48
50
|
function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities, minimumDistance)
|
|
49
51
|
if avoidActiveEntities == nil then
|
|
50
52
|
avoidActiveEntities = false
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
|
|
3
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../../src/functions/rng.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../../src/functions/rng.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAOzE,oBAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACpD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC;CAChD,CAAC;AAYF,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CASrC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,CAgBtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAEpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,aAAa,CAMxE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,OAAkB,GAAG,GAAG,CAIlD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAYpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAoBjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAK1D;AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CASlD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { SerializedIsaacAPIClass } from "../
|
|
1
|
+
import { CopyableIsaacAPIClass, IsaacAPIClassTypeToSerializedType, IsaacAPIClassTypeToType, SerializedIsaacAPIClass } from "../objects/isaacAPIClassTypeToFunctions";
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to generically copy an Isaac API class without knowing what specific type of
|
|
4
4
|
* class it is. (This is used by the save data manager.)
|
|
5
5
|
*
|
|
6
6
|
* For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
|
|
7
7
|
*/
|
|
8
|
-
export declare function copyIsaacAPIClass(isaacAPIClass:
|
|
8
|
+
export declare function copyIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaacAPIClass: T): T;
|
|
9
9
|
/**
|
|
10
10
|
* Helper function to generically deserialize an Isaac API class without knowing what specific type
|
|
11
11
|
* of class it is. (This is used by the save data manager when reading data from the "save#.dat"
|
|
@@ -13,7 +13,14 @@ export declare function copyIsaacAPIClass(isaacAPIClass: unknown): unknown;
|
|
|
13
13
|
*
|
|
14
14
|
* For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
|
|
15
15
|
*/
|
|
16
|
-
export declare function deserializeIsaacAPIClass(serializedIsaacAPIClass:
|
|
16
|
+
export declare function deserializeIsaacAPIClass<SerializedT extends SerializedIsaacAPIClass>(serializedIsaacAPIClass: SerializedT): IsaacAPIClassTypeToType[SerializedT["__kind"]];
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to generically check if a given object is a copyable Isaac API class. (This is
|
|
19
|
+
* used by the save data manager when determining what is safe to copy.)
|
|
20
|
+
*
|
|
21
|
+
* For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isCopyableIsaacAPIClass(object: unknown): object is CopyableIsaacAPIClass;
|
|
17
24
|
/**
|
|
18
25
|
* Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
|
|
19
26
|
* is used by the save data manager when reading data from the "save#.dat" file.)
|
|
@@ -27,5 +34,5 @@ export declare function isSerializedIsaacAPIClass(object: unknown): object is Se
|
|
|
27
34
|
*
|
|
28
35
|
* For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
|
|
29
36
|
*/
|
|
30
|
-
export declare function serializeIsaacAPIClass(isaacAPIClass:
|
|
37
|
+
export declare function serializeIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaacAPIClass: T): IsaacAPIClassTypeToSerializedType[T["__kind"]];
|
|
31
38
|
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/functions/serialization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/functions/serialization.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EAErB,iCAAiC,EACjC,uBAAuB,EAEvB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AAIjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,EAC/D,aAAa,EAAE,CAAC,GACf,CAAC,CAoCH;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,SAAS,uBAAuB,EAE3C,uBAAuB,EAAE,WAAW,GACnC,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAkChD;AAoBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,qBAAqB,CAIjC;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,uBAAuB,CAQnC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,EACpE,aAAa,EAAE,CAAC,GACf,iCAAiC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAoChD"}
|
|
@@ -63,6 +63,21 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
|
|
|
63
63
|
end
|
|
64
64
|
return functions:deserialize(serializedIsaacAPIClass)
|
|
65
65
|
end
|
|
66
|
+
--- Helper function to generically check if a given object is a copyable Isaac API class. (This is
|
|
67
|
+
-- used by the save data manager when determining what is safe to copy.)
|
|
68
|
+
--
|
|
69
|
+
-- For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
|
|
70
|
+
function ____exports.isCopyableIsaacAPIClass(self, object)
|
|
71
|
+
local allFunctions = __TS__ObjectValues(ISAAC_API_CLASS_TYPE_TO_FUNCTIONS)
|
|
72
|
+
local isFunctions = __TS__ArrayMap(
|
|
73
|
+
allFunctions,
|
|
74
|
+
function(____, functions) return functions.is end
|
|
75
|
+
)
|
|
76
|
+
return __TS__ArraySome(
|
|
77
|
+
isFunctions,
|
|
78
|
+
function(____, identityFunction) return identityFunction(nil, object) end
|
|
79
|
+
)
|
|
80
|
+
end
|
|
66
81
|
--- Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
|
|
67
82
|
-- is used by the save data manager when reading data from the "save#.dat" file.)
|
|
68
83
|
--
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/**
|
|
3
3
|
* In a `Map`, you can use the `clear` method to delete every element. However, in a `LuaMap`, the
|
|
4
4
|
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
|
5
5
|
*/
|
|
6
6
|
export declare function clearTable(luaMap: LuaMap<AnyNotNil, unknown>): void;
|
|
7
|
-
/** Helper function to copy specific values from a object to a table. */
|
|
8
|
-
export declare function
|
|
7
|
+
/** Helper function to copy specific values from a userdata object (e.g. `Vector`) to a table. */
|
|
8
|
+
export declare function copyUserdataValuesToTable(object: unknown, keys: string[], luaMap: LuaMap<string, unknown>): void;
|
|
9
9
|
/**
|
|
10
10
|
* Helper function to safely get boolean values from a Lua table. Will throw an error if the
|
|
11
11
|
* specific value does not exist on the table.
|
|
@@ -42,7 +42,7 @@ export declare function getStringsFromTable(luaMap: LuaMap<string, unknown>, obj
|
|
|
42
42
|
* false in situations where iterating randomly would not matter and you need the
|
|
43
43
|
* extra performance.
|
|
44
44
|
*/
|
|
45
|
-
export declare function iterateTableInOrder<K, V>(luaMap: LuaMap<K, V>, func: (key: K, value: V) => void, inOrder?: boolean): void;
|
|
45
|
+
export declare function iterateTableInOrder<K extends AnyNotNil, V>(luaMap: LuaMap<K, V>, func: (key: K, value: V) => void, inOrder?: boolean): void;
|
|
46
46
|
/**
|
|
47
47
|
* Helper function to check if a Lua table has all of the provided keys.
|
|
48
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/functions/table.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,IAAI,CAInE;AAED,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/functions/table.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,IAAI,CAInE;AAED,iGAAiG;AACjG,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CAgBN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,OAAO,EAAE,CAoBX;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CA4BV;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CAmBV;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,EACxD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,EAChC,OAAO,UAAO,GACb,IAAI,CA6BN;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EAClC,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,OAAO,CAET"}
|
|
@@ -8,6 +8,7 @@ local ____types = require("src.functions.types")
|
|
|
8
8
|
local isBoolean = ____types.isBoolean
|
|
9
9
|
local isNumber = ____types.isNumber
|
|
10
10
|
local isString = ____types.isString
|
|
11
|
+
local isUserdata = ____types.isUserdata
|
|
11
12
|
--- In a `Map`, you can use the `clear` method to delete every element. However, in a `LuaMap`, the
|
|
12
13
|
-- `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
|
13
14
|
function ____exports.clearTable(self, luaMap)
|
|
@@ -15,11 +16,14 @@ function ____exports.clearTable(self, luaMap)
|
|
|
15
16
|
luaMap[key] = nil
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
|
-
--- Helper function to copy specific values from a object to a table.
|
|
19
|
-
function ____exports.
|
|
20
|
-
|
|
19
|
+
--- Helper function to copy specific values from a userdata object (e.g. `Vector`) to a table.
|
|
20
|
+
function ____exports.copyUserdataValuesToTable(self, object, keys, luaMap)
|
|
21
|
+
if not isUserdata(nil, object) then
|
|
22
|
+
error("Failed to copy an object values to a table, since the object was of type: " .. type(object))
|
|
23
|
+
end
|
|
24
|
+
local userdata = object
|
|
21
25
|
for ____, key in ipairs(keys) do
|
|
22
|
-
local value =
|
|
26
|
+
local value = userdata[key]
|
|
23
27
|
luaMap[key] = value
|
|
24
28
|
end
|
|
25
29
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="lua-types/5.3" />
|
|
3
3
|
import { CardType, CollectibleType, LevelStage, NpcState, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
4
4
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
import { Direction } from "isaac-typescript-definitions";
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
|
+
import { CopyableIsaacAPIClassType, Direction } from "isaac-typescript-definitions";
|
|
3
3
|
export declare type SerializedVector = LuaMap<string, unknown> & {
|
|
4
4
|
readonly __serializedVectorBrand: symbol;
|
|
5
|
+
readonly __kind: CopyableIsaacAPIClassType.VECTOR;
|
|
5
6
|
};
|
|
6
7
|
/** Helper function to copy a `Vector` Isaac API class. */
|
|
7
8
|
export declare function copyVector(vector: Vector): Vector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AAatC,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
|
|
@@ -14,7 +14,7 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
14
14
|
local isRNG = ____rng.isRNG
|
|
15
15
|
local newRNG = ____rng.newRNG
|
|
16
16
|
local ____table = require("src.functions.table")
|
|
17
|
-
local
|
|
17
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
18
18
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
19
19
|
local tableHasKeys = ____table.tableHasKeys
|
|
20
20
|
local ____types = require("src.functions.types")
|
|
@@ -88,7 +88,7 @@ function ____exports.serializeVector(self, vector)
|
|
|
88
88
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
89
89
|
end
|
|
90
90
|
local vectorTable = {}
|
|
91
|
-
|
|
91
|
+
copyUserdataValuesToTable(nil, vector, KEYS, vectorTable)
|
|
92
92
|
vectorTable[SerializationBrand.VECTOR] = ""
|
|
93
93
|
return vectorTable
|
|
94
94
|
end
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
import { WeightedArray } from "../types/WeightedArray";
|
|
4
|
+
/** Get a random value from a `WeightedArray`. (The second element in the array is the weight.) */
|
|
5
|
+
export declare function getRandomFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG?: Seed | RNG): T;
|
|
6
|
+
//# sourceMappingURL=weighted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weighted.d.ts","sourceRoot":"","sources":["../../../src/functions/weighted.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD,kGAAkG;AAClG,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAC/B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,CAAC,CA0BH"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____array = require("src.functions.array")
|
|
5
|
+
local arrayToString = ____array.arrayToString
|
|
6
|
+
local sumArray = ____array.sumArray
|
|
7
|
+
local ____random = require("src.functions.random")
|
|
8
|
+
local getRandomFloat = ____random.getRandomFloat
|
|
9
|
+
local ____rng = require("src.functions.rng")
|
|
10
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
11
|
+
--- Get a random value from a `WeightedArray`. (The second element in the array is the weight.)
|
|
12
|
+
function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
13
|
+
if seedOrRNG == nil then
|
|
14
|
+
seedOrRNG = getRandomSeed(nil)
|
|
15
|
+
end
|
|
16
|
+
if #weightedArray == 0 then
|
|
17
|
+
error("Failed to get a random element from a weighted array since the provided array was empty.")
|
|
18
|
+
end
|
|
19
|
+
local weights = __TS__ArrayMap(
|
|
20
|
+
weightedArray,
|
|
21
|
+
function(____, tuple) return tuple[2] end
|
|
22
|
+
)
|
|
23
|
+
local totalWeight = sumArray(nil, weights)
|
|
24
|
+
local randomWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
25
|
+
local weightAccumulator = 0
|
|
26
|
+
for ____, tuple in ipairs(weightedArray) do
|
|
27
|
+
local element, weight = table.unpack(tuple)
|
|
28
|
+
weightAccumulator = weightAccumulator + weight
|
|
29
|
+
if weightAccumulator >= randomWeight then
|
|
30
|
+
return element
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
error("Failed to get a random element from a weighted array: " .. arrayToString(nil, weightedArray))
|
|
34
|
+
end
|
|
35
|
+
return ____exports
|
package/dist/src/index.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ export * from "./functions/types";
|
|
|
149
149
|
export * from "./functions/ui";
|
|
150
150
|
export * from "./functions/utils";
|
|
151
151
|
export * from "./functions/vector";
|
|
152
|
+
export * from "./functions/weighted";
|
|
152
153
|
export * from "./interfaces/ChargeBarSprites";
|
|
153
154
|
export * from "./interfaces/Corner";
|
|
154
155
|
export * from "./interfaces/CustomStageTSConfig";
|
|
@@ -174,6 +175,6 @@ export * from "./types/PickingUpItem";
|
|
|
174
175
|
export * from "./types/PickupIndex";
|
|
175
176
|
export * from "./types/PlayerIndex";
|
|
176
177
|
export * from "./types/PossibleStatType";
|
|
177
|
-
export * from "./types/SerializedIsaacAPIClass";
|
|
178
178
|
export * from "./types/TSTLClass";
|
|
179
|
+
export * from "./types/WeightedArray";
|
|
179
180
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cA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AAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
package/dist/src/index.lua
CHANGED
|
@@ -1207,6 +1207,14 @@ do
|
|
|
1207
1207
|
end
|
|
1208
1208
|
end
|
|
1209
1209
|
end
|
|
1210
|
+
do
|
|
1211
|
+
local ____export = require("src.functions.weighted")
|
|
1212
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
1213
|
+
if ____exportKey ~= "default" then
|
|
1214
|
+
____exports[____exportKey] = ____exportValue
|
|
1215
|
+
end
|
|
1216
|
+
end
|
|
1217
|
+
end
|
|
1210
1218
|
do
|
|
1211
1219
|
local ____export = require("src.maps.cardNameToTypeMap")
|
|
1212
1220
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
|
|
3
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
5
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
6
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { CopyableIsaacAPIClass } from "../objects/isaacAPIClassTypeToFunctions";
|
|
7
3
|
/**
|
|
8
4
|
* This is the format of the object that you give to the save data manager. It will contains all of
|
|
9
5
|
* the variables for the particular mod feature.
|
|
@@ -39,12 +35,12 @@ export interface SaveData<Persistent = unknown, Run = unknown, Level = unknown>
|
|
|
39
35
|
* The recursive nature of this type is based on the `Immutable` type:
|
|
40
36
|
* https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
|
|
41
37
|
*/
|
|
42
|
-
declare type Serializable<T> = T extends SerializablePrimitive ? T : T extends
|
|
38
|
+
declare type Serializable<T> = T extends SerializablePrimitive ? T : T extends CopyableIsaacAPIClass ? T : T extends IsaacAPIClass ? ErrorIsaacAPIClassIsNotSerializable : T extends Array<infer U> ? SerializableArray<U> : T extends ReadonlyArray<infer U> ? SerializableReadonlyArray<U> : T extends Map<infer K, infer V> ? SerializableMap<K, V> : T extends ReadonlyMap<infer K, infer V> ? SerializableReadonlyMap<K, V> : T extends Set<infer V> ? SerializableSet<V> : T extends ReadonlySet<infer V> ? SerializableReadonlySet<V> : SerializableObject<T>;
|
|
43
39
|
/**
|
|
44
40
|
* This is mostly copied from the `Serializable` type. The difference is that we want to disallow
|
|
45
41
|
* classes with methods.
|
|
46
42
|
*/
|
|
47
|
-
declare type SerializableInsideArrayOrMap<T> = T extends SerializablePrimitive ? T : T extends
|
|
43
|
+
declare type SerializableInsideArrayOrMap<T> = T extends SerializablePrimitive ? T : T extends CopyableIsaacAPIClass ? T : T extends IsaacAPIClass ? ErrorIsaacAPIClassIsNotSerializable : T extends Array<infer U> ? SerializableArray<U> : T extends ReadonlyArray<infer U> ? SerializableReadonlyArray<U> : T extends Map<infer K, infer V> ? SerializableMap<K, V> : T extends ReadonlyMap<infer K, infer V> ? SerializableReadonlyMap<K, V> : T extends Set<infer V> ? SerializableSet<V> : T extends ReadonlySet<infer V> ? SerializableReadonlySet<V> : T extends HasMethods<T> ? ErrorCustomClassNotSerializable : T extends Function ? FunctionIsNotSerializable : SerializableObject<T>;
|
|
48
44
|
declare type SerializablePrimitive = boolean | string | number | undefined | null;
|
|
49
45
|
declare type SerializableArray<T> = Array<SerializableInsideArrayOrMap<T>>;
|
|
50
46
|
declare type SerializableReadonlyArray<T> = ReadonlyArray<SerializableInsideArrayOrMap<T>>;
|
|
@@ -55,7 +51,6 @@ declare type SerializableReadonlySet<T> = ReadonlySet<SerializableInsideArrayOrM
|
|
|
55
51
|
declare type SerializableObject<T> = {
|
|
56
52
|
[K in keyof T]: Serializable<T[K]>;
|
|
57
53
|
};
|
|
58
|
-
declare type SerializableIsaacAPIClass = BitSet128 | Color | KColor | RNG | Vector;
|
|
59
54
|
declare type HasMethods<T> = {} extends {
|
|
60
55
|
[K in keyof T as T[K] extends Function ? K : never]-?: 1;
|
|
61
56
|
} ? never : T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveData.d.ts","sourceRoot":"","sources":["../../../src/interfaces/SaveData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SaveData.d.ts","sourceRoot":"","sources":["../../../src/interfaces/SaveData.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,QAAQ,CACvB,UAAU,GAAG,OAAO,EACpB,GAAG,GAAG,OAAO,EACb,KAAK,GAAG,OAAO;IAEf,UAAU,CAAC,EAAE,Y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