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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 10.0.2
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -304,11 +304,15 @@ local function __TS__ArrayPushArray(self, items)
|
|
|
304
304
|
return len
|
|
305
305
|
end
|
|
306
306
|
|
|
307
|
+
local function __TS__CountVarargs(...)
|
|
308
|
+
return select("#", ...)
|
|
309
|
+
end
|
|
310
|
+
|
|
307
311
|
local function __TS__ArrayReduce(self, callbackFn, ...)
|
|
308
312
|
local len = #self
|
|
309
313
|
local k = 0
|
|
310
314
|
local accumulator = nil
|
|
311
|
-
if
|
|
315
|
+
if __TS__CountVarargs(...) ~= 0 then
|
|
312
316
|
accumulator = ...
|
|
313
317
|
elseif len > 0 then
|
|
314
318
|
accumulator = self[1]
|
|
@@ -332,7 +336,7 @@ local function __TS__ArrayReduceRight(self, callbackFn, ...)
|
|
|
332
336
|
local len = #self
|
|
333
337
|
local k = len - 1
|
|
334
338
|
local accumulator = nil
|
|
335
|
-
if
|
|
339
|
+
if __TS__CountVarargs(...) ~= 0 then
|
|
336
340
|
accumulator = ...
|
|
337
341
|
elseif len > 0 then
|
|
338
342
|
accumulator = self[k + 1]
|
|
@@ -448,7 +452,7 @@ end
|
|
|
448
452
|
local function __TS__ArraySplice(self, ...)
|
|
449
453
|
local args = {...}
|
|
450
454
|
local len = #self
|
|
451
|
-
local actualArgumentCount =
|
|
455
|
+
local actualArgumentCount = __TS__CountVarargs(...)
|
|
452
456
|
local start = args[1]
|
|
453
457
|
local deleteCount = args[2]
|
|
454
458
|
if start < 0 then
|
|
@@ -1065,6 +1069,16 @@ local function __TS__DecorateParam(paramIndex, decorator)
|
|
|
1065
1069
|
return function(____, target, key) return decorator(nil, target, key, paramIndex) end
|
|
1066
1070
|
end
|
|
1067
1071
|
|
|
1072
|
+
local function __TS__StringIncludes(self, searchString, position)
|
|
1073
|
+
if not position then
|
|
1074
|
+
position = 1
|
|
1075
|
+
else
|
|
1076
|
+
position = position + 1
|
|
1077
|
+
end
|
|
1078
|
+
local index = string.find(self, searchString, position, true)
|
|
1079
|
+
return index ~= nil
|
|
1080
|
+
end
|
|
1081
|
+
|
|
1068
1082
|
local Error, RangeError, ReferenceError, SyntaxError, TypeError, URIError
|
|
1069
1083
|
do
|
|
1070
1084
|
local function getErrorStack(self, constructor)
|
|
@@ -1079,13 +1093,18 @@ do
|
|
|
1079
1093
|
break
|
|
1080
1094
|
end
|
|
1081
1095
|
end
|
|
1082
|
-
|
|
1096
|
+
if __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
1097
|
+
return debug.traceback(("[Level " .. tostring(level)) .. "]")
|
|
1098
|
+
else
|
|
1099
|
+
return debug.traceback(nil, level)
|
|
1100
|
+
end
|
|
1083
1101
|
end
|
|
1084
1102
|
local function wrapErrorToString(self, getDescription)
|
|
1085
1103
|
return function(self)
|
|
1086
1104
|
local description = getDescription(self)
|
|
1087
1105
|
local caller = debug.getinfo(3, "f")
|
|
1088
|
-
|
|
1106
|
+
local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0") or _VERSION == "Lua 5.1"
|
|
1107
|
+
if isClassicLua or caller and caller.func ~= error then
|
|
1089
1108
|
return description
|
|
1090
1109
|
else
|
|
1091
1110
|
return (tostring(description) .. "\n") .. self.stack
|
|
@@ -1234,16 +1253,9 @@ do
|
|
|
1234
1253
|
function __TS__Generator(fn)
|
|
1235
1254
|
return function(...)
|
|
1236
1255
|
local args = {...}
|
|
1237
|
-
local argsLength =
|
|
1256
|
+
local argsLength = __TS__CountVarargs(...)
|
|
1238
1257
|
return {
|
|
1239
|
-
____coroutine = coroutine.create(function()
|
|
1240
|
-
local ____fn_1 = fn
|
|
1241
|
-
local ____unpack_0 = unpack
|
|
1242
|
-
if ____unpack_0 == nil then
|
|
1243
|
-
____unpack_0 = table.unpack
|
|
1244
|
-
end
|
|
1245
|
-
return ____fn_1(____unpack_0(args, 1, argsLength))
|
|
1246
|
-
end),
|
|
1258
|
+
____coroutine = coroutine.create(function() return fn(__TS__Unpack(args, 1, argsLength)) end),
|
|
1247
1259
|
[Symbol.iterator] = generatorIterator,
|
|
1248
1260
|
next = generatorNext
|
|
1249
1261
|
}
|
|
@@ -1407,8 +1419,12 @@ do
|
|
|
1407
1419
|
Map[Symbol.species] = Map
|
|
1408
1420
|
end
|
|
1409
1421
|
|
|
1422
|
+
local __TS__Match = string.match
|
|
1423
|
+
|
|
1410
1424
|
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
1411
1425
|
|
|
1426
|
+
local __TS__MathModf = math.modf
|
|
1427
|
+
|
|
1412
1428
|
local function __TS__MathSign(val)
|
|
1413
1429
|
if val > 0 then
|
|
1414
1430
|
return 1
|
|
@@ -1418,6 +1434,10 @@ local function __TS__MathSign(val)
|
|
|
1418
1434
|
return 0
|
|
1419
1435
|
end
|
|
1420
1436
|
|
|
1437
|
+
local function __TS__Modulo50(a, b)
|
|
1438
|
+
return a - math.floor(a / b) * b
|
|
1439
|
+
end
|
|
1440
|
+
|
|
1421
1441
|
local function __TS__Number(value)
|
|
1422
1442
|
local valueType = type(value)
|
|
1423
1443
|
if valueType == "number" then
|
|
@@ -1464,7 +1484,7 @@ do
|
|
|
1464
1484
|
if radix < 2 or radix > 36 then
|
|
1465
1485
|
error("toString() radix argument must be between 2 and 36", 0)
|
|
1466
1486
|
end
|
|
1467
|
-
local integer, fraction =
|
|
1487
|
+
local integer, fraction = __TS__MathModf(math.abs(self))
|
|
1468
1488
|
local result = ""
|
|
1469
1489
|
if radix == 8 then
|
|
1470
1490
|
result = string.format("%o", integer)
|
|
@@ -1620,7 +1640,7 @@ local function __TS__ObjectValues(obj)
|
|
|
1620
1640
|
end
|
|
1621
1641
|
|
|
1622
1642
|
local function __TS__ParseFloat(numberString)
|
|
1623
|
-
local infinityMatch =
|
|
1643
|
+
local infinityMatch = __TS__Match(numberString, "^%s*(-?Infinity)")
|
|
1624
1644
|
if infinityMatch then
|
|
1625
1645
|
local ____temp_0
|
|
1626
1646
|
if __TS__StringAccess(infinityMatch, 0) == "-" then
|
|
@@ -1630,7 +1650,7 @@ local function __TS__ParseFloat(numberString)
|
|
|
1630
1650
|
end
|
|
1631
1651
|
return ____temp_0
|
|
1632
1652
|
end
|
|
1633
|
-
local number = tonumber(
|
|
1653
|
+
local number = tonumber(__TS__Match(numberString, "^%s*(-?%d+%.?%d*)"))
|
|
1634
1654
|
local ____number_1 = number
|
|
1635
1655
|
if ____number_1 == nil then
|
|
1636
1656
|
____number_1 = 0 / 0
|
|
@@ -1678,16 +1698,16 @@ do
|
|
|
1678
1698
|
function __TS__ParseInt(numberString, base)
|
|
1679
1699
|
if base == nil then
|
|
1680
1700
|
base = 10
|
|
1681
|
-
local hexMatch =
|
|
1701
|
+
local hexMatch = __TS__Match(numberString, "^%s*-?0[xX]")
|
|
1682
1702
|
if hexMatch then
|
|
1683
1703
|
base = 16
|
|
1684
|
-
local
|
|
1685
|
-
if
|
|
1686
|
-
|
|
1704
|
+
local ____TS__Match_result__0_0
|
|
1705
|
+
if __TS__Match(hexMatch, "-") then
|
|
1706
|
+
____TS__Match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
|
|
1687
1707
|
else
|
|
1688
|
-
|
|
1708
|
+
____TS__Match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
|
|
1689
1709
|
end
|
|
1690
|
-
numberString =
|
|
1710
|
+
numberString = ____TS__Match_result__0_0
|
|
1691
1711
|
end
|
|
1692
1712
|
end
|
|
1693
1713
|
if base < 2 or base > 36 then
|
|
@@ -1702,7 +1722,7 @@ do
|
|
|
1702
1722
|
local allowedDigits = ____temp_1
|
|
1703
1723
|
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
1704
1724
|
local number = tonumber(
|
|
1705
|
-
|
|
1725
|
+
__TS__Match(numberString, pattern),
|
|
1706
1726
|
base
|
|
1707
1727
|
)
|
|
1708
1728
|
if number == nil then
|
|
@@ -2014,13 +2034,13 @@ end
|
|
|
2014
2034
|
|
|
2015
2035
|
local function __TS__SparseArrayNew(...)
|
|
2016
2036
|
local sparseArray = {...}
|
|
2017
|
-
sparseArray.sparseLength =
|
|
2037
|
+
sparseArray.sparseLength = __TS__CountVarargs(...)
|
|
2018
2038
|
return sparseArray
|
|
2019
2039
|
end
|
|
2020
2040
|
|
|
2021
2041
|
local function __TS__SparseArrayPush(sparseArray, ...)
|
|
2022
2042
|
local args = {...}
|
|
2023
|
-
local argsLen =
|
|
2043
|
+
local argsLen = __TS__CountVarargs(...)
|
|
2024
2044
|
local listLen = sparseArray.sparseLength
|
|
2025
2045
|
for i = 1, argsLen do
|
|
2026
2046
|
sparseArray[listLen + i] = args[i]
|
|
@@ -2135,6 +2155,8 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2135
2155
|
local trace
|
|
2136
2156
|
if thread == nil and message == nil and level == nil then
|
|
2137
2157
|
trace = originalTraceback()
|
|
2158
|
+
elseif __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
2159
|
+
trace = originalTraceback((("[Level " .. tostring(level)) .. "] ") .. message)
|
|
2138
2160
|
else
|
|
2139
2161
|
trace = originalTraceback(thread, message, level)
|
|
2140
2162
|
end
|
|
@@ -2160,7 +2182,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2160
2182
|
local function stringReplacer(____, file, line)
|
|
2161
2183
|
local fileSourceMap = _G.__TS__sourcemap[file]
|
|
2162
2184
|
if fileSourceMap and fileSourceMap[line] then
|
|
2163
|
-
local chunkName =
|
|
2185
|
+
local chunkName = __TS__Match(file, "%[string \"([^\"]+)\"%]")
|
|
2164
2186
|
local sourceName = string.gsub(chunkName, ".lua$", ".ts")
|
|
2165
2187
|
local data = fileSourceMap[line]
|
|
2166
2188
|
if type(data) == "number" then
|
|
@@ -2227,16 +2249,6 @@ local function __TS__StringEndsWith(self, searchString, endPosition)
|
|
|
2227
2249
|
return string.sub(self, endPosition - #searchString + 1, endPosition) == searchString
|
|
2228
2250
|
end
|
|
2229
2251
|
|
|
2230
|
-
local function __TS__StringIncludes(self, searchString, position)
|
|
2231
|
-
if not position then
|
|
2232
|
-
position = 1
|
|
2233
|
-
else
|
|
2234
|
-
position = position + 1
|
|
2235
|
-
end
|
|
2236
|
-
local index = string.find(self, searchString, position, true)
|
|
2237
|
-
return index ~= nil
|
|
2238
|
-
end
|
|
2239
|
-
|
|
2240
2252
|
local function __TS__StringPadEnd(self, maxLength, fillString)
|
|
2241
2253
|
if fillString == nil then
|
|
2242
2254
|
fillString = " "
|
|
@@ -2492,6 +2504,7 @@ return {
|
|
|
2492
2504
|
__TS__Class = __TS__Class,
|
|
2493
2505
|
__TS__ClassExtends = __TS__ClassExtends,
|
|
2494
2506
|
__TS__CloneDescriptor = __TS__CloneDescriptor,
|
|
2507
|
+
__TS__CountVarargs = __TS__CountVarargs,
|
|
2495
2508
|
__TS__Decorate = __TS__Decorate,
|
|
2496
2509
|
__TS__DecorateParam = __TS__DecorateParam,
|
|
2497
2510
|
__TS__Delete = __TS__Delete,
|
|
@@ -2509,8 +2522,11 @@ return {
|
|
|
2509
2522
|
__TS__Iterator = __TS__Iterator,
|
|
2510
2523
|
__TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
|
|
2511
2524
|
Map = Map,
|
|
2525
|
+
__TS__Match = __TS__Match,
|
|
2512
2526
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2527
|
+
__TS__MathModf = __TS__MathModf,
|
|
2513
2528
|
__TS__MathSign = __TS__MathSign,
|
|
2529
|
+
__TS__Modulo50 = __TS__Modulo50,
|
|
2514
2530
|
__TS__New = __TS__New,
|
|
2515
2531
|
__TS__Number = __TS__Number,
|
|
2516
2532
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -4252,6 +4268,14 @@ do
|
|
|
4252
4268
|
end
|
|
4253
4269
|
end
|
|
4254
4270
|
end
|
|
4271
|
+
do
|
|
4272
|
+
local ____export = require("lua_modules.isaac-typescript-definitions.dist.src.enums.CopyableIsaacAPIClassType")
|
|
4273
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
4274
|
+
if ____exportKey ~= "default" then
|
|
4275
|
+
____exports[____exportKey] = ____exportValue
|
|
4276
|
+
end
|
|
4277
|
+
end
|
|
4278
|
+
end
|
|
4255
4279
|
do
|
|
4256
4280
|
local ____export = require("lua_modules.isaac-typescript-definitions.dist.src.enums.CurseID")
|
|
4257
4281
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -4837,7 +4861,7 @@ return ____exports
|
|
|
4837
4861
|
["lua_modules.isaac-typescript-definitions.dist.package"] = function(...)
|
|
4838
4862
|
return {
|
|
4839
4863
|
name = "isaac-typescript-definitions",
|
|
4840
|
-
version = "
|
|
4864
|
+
version = "7.2.0",
|
|
4841
4865
|
description = "TypeScript definitions for The Binding of Isaac: Repentance.",
|
|
4842
4866
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
4843
4867
|
homepage = "https://isaacscript.github.io/",
|
|
@@ -4848,7 +4872,7 @@ return {
|
|
|
4848
4872
|
type = "commonjs",
|
|
4849
4873
|
main = "dist/src/index",
|
|
4850
4874
|
types = "dist/src/index.d.ts",
|
|
4851
|
-
dependencies = {["lua-types"] = "^2.
|
|
4875
|
+
dependencies = {["lua-types"] = "^2.13.0"}
|
|
4852
4876
|
}
|
|
4853
4877
|
end,
|
|
4854
4878
|
["lua_modules.isaac-typescript-definitions.dist.src.enums.ActiveSlot"] = function(...)
|
|
@@ -9991,7 +10015,7 @@ ____exports.SwingerVariant.SWINGER = 0
|
|
|
9991
10015
|
____exports.SwingerVariant[____exports.SwingerVariant.SWINGER] = "SWINGER"
|
|
9992
10016
|
____exports.SwingerVariant.SWINGER_HEAD = 1
|
|
9993
10017
|
____exports.SwingerVariant[____exports.SwingerVariant.SWINGER_HEAD] = "SWINGER_HEAD"
|
|
9994
|
-
____exports.SwingerVariant.SWINGER_NECK =
|
|
10018
|
+
____exports.SwingerVariant.SWINGER_NECK = 10
|
|
9995
10019
|
____exports.SwingerVariant[____exports.SwingerVariant.SWINGER_NECK] = "SWINGER_NECK"
|
|
9996
10020
|
--- For `EntityType.DIP` (217).
|
|
9997
10021
|
____exports.DipVariant = {}
|
|
@@ -10996,6 +11020,17 @@ ____exports.ControllerIndex.CONTROLLER_2 = 2
|
|
|
10996
11020
|
____exports.ControllerIndex[____exports.ControllerIndex.CONTROLLER_2] = "CONTROLLER_2"
|
|
10997
11021
|
____exports.ControllerIndex.CONTROLLER_3 = 3
|
|
10998
11022
|
____exports.ControllerIndex[____exports.ControllerIndex.CONTROLLER_3] = "CONTROLLER_3"
|
|
11023
|
+
return ____exports
|
|
11024
|
+
end,
|
|
11025
|
+
["lua_modules.isaac-typescript-definitions.dist.src.enums.CopyableIsaacAPIClassType"] = function(...)
|
|
11026
|
+
local ____exports = {}
|
|
11027
|
+
--- An enum containing the Isaac API classes that can be safely copied / serialized.
|
|
11028
|
+
____exports.CopyableIsaacAPIClassType = {}
|
|
11029
|
+
____exports.CopyableIsaacAPIClassType.BIT_SET_128 = "BitSet128"
|
|
11030
|
+
____exports.CopyableIsaacAPIClassType.COLOR = "Color"
|
|
11031
|
+
____exports.CopyableIsaacAPIClassType.K_COLOR = "KColor"
|
|
11032
|
+
____exports.CopyableIsaacAPIClassType.RNG = "RNG"
|
|
11033
|
+
____exports.CopyableIsaacAPIClassType.VECTOR = "Vector"
|
|
10999
11034
|
return ____exports
|
|
11000
11035
|
end,
|
|
11001
11036
|
["lua_modules.isaac-typescript-definitions.dist.src.enums.CurseID"] = function(...)
|
|
@@ -18391,6 +18426,7 @@ local ____types = require("src.functions.types")
|
|
|
18391
18426
|
local isBoolean = ____types.isBoolean
|
|
18392
18427
|
local isNumber = ____types.isNumber
|
|
18393
18428
|
local isString = ____types.isString
|
|
18429
|
+
local isUserdata = ____types.isUserdata
|
|
18394
18430
|
--- In a `Map`, you can use the `clear` method to delete every element. However, in a `LuaMap`, the
|
|
18395
18431
|
-- `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
|
18396
18432
|
function ____exports.clearTable(self, luaMap)
|
|
@@ -18398,11 +18434,14 @@ function ____exports.clearTable(self, luaMap)
|
|
|
18398
18434
|
luaMap[key] = nil
|
|
18399
18435
|
end
|
|
18400
18436
|
end
|
|
18401
|
-
--- Helper function to copy specific values from a object to a table.
|
|
18402
|
-
function ____exports.
|
|
18403
|
-
|
|
18437
|
+
--- Helper function to copy specific values from a userdata object (e.g. `Vector`) to a table.
|
|
18438
|
+
function ____exports.copyUserdataValuesToTable(self, object, keys, luaMap)
|
|
18439
|
+
if not isUserdata(nil, object) then
|
|
18440
|
+
error("Failed to copy an object values to a table, since the object was of type: " .. type(object))
|
|
18441
|
+
end
|
|
18442
|
+
local userdata = object
|
|
18404
18443
|
for ____, key in ipairs(keys) do
|
|
18405
|
-
local value =
|
|
18444
|
+
local value = userdata[key]
|
|
18406
18445
|
luaMap[key] = value
|
|
18407
18446
|
end
|
|
18408
18447
|
end
|
|
@@ -20182,7 +20221,7 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
20182
20221
|
local isRNG = ____rng.isRNG
|
|
20183
20222
|
local newRNG = ____rng.newRNG
|
|
20184
20223
|
local ____table = require("src.functions.table")
|
|
20185
|
-
local
|
|
20224
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
20186
20225
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
20187
20226
|
local tableHasKeys = ____table.tableHasKeys
|
|
20188
20227
|
local ____types = require("src.functions.types")
|
|
@@ -20256,7 +20295,7 @@ function ____exports.serializeVector(self, vector)
|
|
|
20256
20295
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
20257
20296
|
end
|
|
20258
20297
|
local vectorTable = {}
|
|
20259
|
-
|
|
20298
|
+
copyUserdataValuesToTable(nil, vector, KEYS, vectorTable)
|
|
20260
20299
|
vectorTable[SerializationBrand.VECTOR] = ""
|
|
20261
20300
|
return vectorTable
|
|
20262
20301
|
end
|
|
@@ -24900,7 +24939,7 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
24900
24939
|
local isRNG = ____rng.isRNG
|
|
24901
24940
|
local newRNG = ____rng.newRNG
|
|
24902
24941
|
local ____table = require("src.functions.table")
|
|
24903
|
-
local
|
|
24942
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
24904
24943
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
24905
24944
|
local tableHasKeys = ____table.tableHasKeys
|
|
24906
24945
|
local ____types = require("src.functions.types")
|
|
@@ -24984,7 +25023,7 @@ function ____exports.serializeKColor(self, kColor)
|
|
|
24984
25023
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
24985
25024
|
end
|
|
24986
25025
|
local kColorTable = {}
|
|
24987
|
-
|
|
25026
|
+
copyUserdataValuesToTable(nil, kColor, KEYS, kColorTable)
|
|
24988
25027
|
kColorTable[SerializationBrand.K_COLOR] = ""
|
|
24989
25028
|
return kColorTable
|
|
24990
25029
|
end
|
|
@@ -26728,6 +26767,8 @@ end
|
|
|
26728
26767
|
-- @param startingPosition The position to start searching from. If this position is not overlapping
|
|
26729
26768
|
-- with anything, then it will be returned.
|
|
26730
26769
|
-- @param avoidActiveEntities Optional. Default is false.
|
|
26770
|
+
-- @param minimumDistance Optional. If specified, will ensure that the randomly generated position
|
|
26771
|
+
-- is equal to or greater than the distance provided.
|
|
26731
26772
|
function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities, minimumDistance)
|
|
26732
26773
|
if avoidActiveEntities == nil then
|
|
26733
26774
|
avoidActiveEntities = false
|
|
@@ -26866,18 +26907,6 @@ ____exports.SerializationType.SERIALIZE = 1
|
|
|
26866
26907
|
____exports.SerializationType[____exports.SerializationType.SERIALIZE] = "SERIALIZE"
|
|
26867
26908
|
____exports.SerializationType.DESERIALIZE = 2
|
|
26868
26909
|
____exports.SerializationType[____exports.SerializationType.DESERIALIZE] = "DESERIALIZE"
|
|
26869
|
-
return ____exports
|
|
26870
|
-
end,
|
|
26871
|
-
["src.enums.private.CopyableIsaacAPIClassType"] = function(...)
|
|
26872
|
-
local ____exports = {}
|
|
26873
|
-
--- - This must match the JSDoc comments for `deepCopy` and `merge`.
|
|
26874
|
-
-- - This must match the `SerializableIsaacAPIClass` type union.
|
|
26875
|
-
____exports.CopyableIsaacAPIClassType = {}
|
|
26876
|
-
____exports.CopyableIsaacAPIClassType.BIT_SET_128 = "BitSet128"
|
|
26877
|
-
____exports.CopyableIsaacAPIClassType.COLOR = "Color"
|
|
26878
|
-
____exports.CopyableIsaacAPIClassType.K_COLOR = "KColor"
|
|
26879
|
-
____exports.CopyableIsaacAPIClassType.RNG = "RNG"
|
|
26880
|
-
____exports.CopyableIsaacAPIClassType.VECTOR = "Vector"
|
|
26881
26910
|
return ____exports
|
|
26882
26911
|
end,
|
|
26883
26912
|
["src.features.saveDataManager.saveDataManagerConstants"] = function(...)
|
|
@@ -29597,8 +29626,8 @@ return ____exports
|
|
|
29597
29626
|
end,
|
|
29598
29627
|
["src.objects.isaacAPIClassTypeToBrand"] = function(...)
|
|
29599
29628
|
local ____exports = {}
|
|
29600
|
-
local
|
|
29601
|
-
local CopyableIsaacAPIClassType =
|
|
29629
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
29630
|
+
local CopyableIsaacAPIClassType = ____isaac_2Dtypescript_2Ddefinitions.CopyableIsaacAPIClassType
|
|
29602
29631
|
local ____SerializationBrand = require("src.enums.private.SerializationBrand")
|
|
29603
29632
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
29604
29633
|
____exports.ISAAC_API_CLASS_TYPE_TO_BRAND = {
|
|
@@ -29618,7 +29647,7 @@ local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
|
29618
29647
|
local ____isaacAPIClass = require("src.functions.isaacAPIClass")
|
|
29619
29648
|
local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
|
|
29620
29649
|
local ____table = require("src.functions.table")
|
|
29621
|
-
local
|
|
29650
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
29622
29651
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
29623
29652
|
local tableHasKeys = ____table.tableHasKeys
|
|
29624
29653
|
local ____types = require("src.functions.types")
|
|
@@ -29677,7 +29706,7 @@ function ____exports.serializeBitSet128(self, bitSet128)
|
|
|
29677
29706
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
29678
29707
|
end
|
|
29679
29708
|
local bitSet128Table = {}
|
|
29680
|
-
|
|
29709
|
+
copyUserdataValuesToTable(nil, bitSet128, KEYS, bitSet128Table)
|
|
29681
29710
|
bitSet128Table[SerializationBrand.BIT_SET_128] = ""
|
|
29682
29711
|
return bitSet128Table
|
|
29683
29712
|
end
|
|
@@ -29698,7 +29727,7 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
29698
29727
|
local isRNG = ____rng.isRNG
|
|
29699
29728
|
local newRNG = ____rng.newRNG
|
|
29700
29729
|
local ____table = require("src.functions.table")
|
|
29701
|
-
local
|
|
29730
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
29702
29731
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
29703
29732
|
local tableHasKeys = ____table.tableHasKeys
|
|
29704
29733
|
local ____types = require("src.functions.types")
|
|
@@ -29803,7 +29832,7 @@ function ____exports.serializeColor(self, color)
|
|
|
29803
29832
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
29804
29833
|
end
|
|
29805
29834
|
local colorTable = {}
|
|
29806
|
-
|
|
29835
|
+
copyUserdataValuesToTable(nil, color, KEYS, colorTable)
|
|
29807
29836
|
colorTable[SerializationBrand.COLOR] = ""
|
|
29808
29837
|
return colorTable
|
|
29809
29838
|
end
|
|
@@ -29811,44 +29840,75 @@ return ____exports
|
|
|
29811
29840
|
end,
|
|
29812
29841
|
["src.objects.isaacAPIClassTypeToFunctions"] = function(...)
|
|
29813
29842
|
local ____exports = {}
|
|
29814
|
-
local
|
|
29815
|
-
local CopyableIsaacAPIClassType =
|
|
29843
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
29844
|
+
local CopyableIsaacAPIClassType = ____isaac_2Dtypescript_2Ddefinitions.CopyableIsaacAPIClassType
|
|
29816
29845
|
local ____bitSet128 = require("src.functions.bitSet128")
|
|
29817
29846
|
local copyBitSet128 = ____bitSet128.copyBitSet128
|
|
29818
29847
|
local deserializeBitSet128 = ____bitSet128.deserializeBitSet128
|
|
29848
|
+
local isBitSet128 = ____bitSet128.isBitSet128
|
|
29819
29849
|
local isSerializedBitSet128 = ____bitSet128.isSerializedBitSet128
|
|
29820
29850
|
local serializeBitSet128 = ____bitSet128.serializeBitSet128
|
|
29821
29851
|
local ____color = require("src.functions.color")
|
|
29822
29852
|
local copyColor = ____color.copyColor
|
|
29823
29853
|
local deserializeColor = ____color.deserializeColor
|
|
29854
|
+
local isColor = ____color.isColor
|
|
29824
29855
|
local isSerializedColor = ____color.isSerializedColor
|
|
29825
29856
|
local serializeColor = ____color.serializeColor
|
|
29826
29857
|
local ____kColor = require("src.functions.kColor")
|
|
29827
29858
|
local copyKColor = ____kColor.copyKColor
|
|
29828
29859
|
local deserializeKColor = ____kColor.deserializeKColor
|
|
29860
|
+
local isKColor = ____kColor.isKColor
|
|
29829
29861
|
local isSerializedKColor = ____kColor.isSerializedKColor
|
|
29830
29862
|
local serializeKColor = ____kColor.serializeKColor
|
|
29831
29863
|
local ____rng = require("src.functions.rng")
|
|
29832
29864
|
local copyRNG = ____rng.copyRNG
|
|
29833
29865
|
local deserializeRNG = ____rng.deserializeRNG
|
|
29866
|
+
local isRNG = ____rng.isRNG
|
|
29834
29867
|
local isSerializedRNG = ____rng.isSerializedRNG
|
|
29835
29868
|
local serializeRNG = ____rng.serializeRNG
|
|
29836
29869
|
local ____vector = require("src.functions.vector")
|
|
29837
29870
|
local copyVector = ____vector.copyVector
|
|
29838
29871
|
local deserializeVector = ____vector.deserializeVector
|
|
29839
29872
|
local isSerializedVector = ____vector.isSerializedVector
|
|
29873
|
+
local isVector = ____vector.isVector
|
|
29840
29874
|
local serializeVector = ____vector.serializeVector
|
|
29841
29875
|
____exports.ISAAC_API_CLASS_TYPE_TO_FUNCTIONS = {
|
|
29842
|
-
[CopyableIsaacAPIClassType.BIT_SET_128] = {
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29876
|
+
[CopyableIsaacAPIClassType.BIT_SET_128] = {
|
|
29877
|
+
is = isBitSet128,
|
|
29878
|
+
isSerialized = isSerializedBitSet128,
|
|
29879
|
+
copy = copyBitSet128,
|
|
29880
|
+
serialize = serializeBitSet128,
|
|
29881
|
+
deserialize = deserializeBitSet128
|
|
29882
|
+
},
|
|
29883
|
+
[CopyableIsaacAPIClassType.COLOR] = {
|
|
29884
|
+
is = isColor,
|
|
29885
|
+
isSerialized = isSerializedColor,
|
|
29886
|
+
copy = copyColor,
|
|
29887
|
+
serialize = serializeColor,
|
|
29888
|
+
deserialize = deserializeColor
|
|
29889
|
+
},
|
|
29890
|
+
[CopyableIsaacAPIClassType.K_COLOR] = {
|
|
29891
|
+
is = isKColor,
|
|
29892
|
+
isSerialized = isSerializedKColor,
|
|
29893
|
+
copy = copyKColor,
|
|
29894
|
+
serialize = serializeKColor,
|
|
29895
|
+
deserialize = deserializeKColor
|
|
29896
|
+
},
|
|
29897
|
+
[CopyableIsaacAPIClassType.RNG] = {
|
|
29898
|
+
is = isRNG,
|
|
29899
|
+
isSerialized = isSerializedRNG,
|
|
29900
|
+
copy = copyRNG,
|
|
29901
|
+
serialize = serializeRNG,
|
|
29902
|
+
deserialize = deserializeRNG
|
|
29903
|
+
},
|
|
29904
|
+
[CopyableIsaacAPIClassType.VECTOR] = {
|
|
29905
|
+
is = isVector,
|
|
29906
|
+
isSerialized = isSerializedVector,
|
|
29907
|
+
copy = copyVector,
|
|
29908
|
+
serialize = serializeVector,
|
|
29909
|
+
deserialize = deserializeVector
|
|
29910
|
+
}
|
|
29847
29911
|
}
|
|
29848
|
-
return ____exports
|
|
29849
|
-
end,
|
|
29850
|
-
["src.types.SerializedIsaacAPIClass"] = function(...)
|
|
29851
|
-
local ____exports = {}
|
|
29852
29912
|
return ____exports
|
|
29853
29913
|
end,
|
|
29854
29914
|
["src.functions.serialization"] = function(...)
|
|
@@ -29917,6 +29977,21 @@ function ____exports.deserializeIsaacAPIClass(self, serializedIsaacAPIClass)
|
|
|
29917
29977
|
end
|
|
29918
29978
|
return functions:deserialize(serializedIsaacAPIClass)
|
|
29919
29979
|
end
|
|
29980
|
+
--- Helper function to generically check if a given object is a copyable Isaac API class. (This is
|
|
29981
|
+
-- used by the save data manager when determining what is safe to copy.)
|
|
29982
|
+
--
|
|
29983
|
+
-- For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
|
|
29984
|
+
function ____exports.isCopyableIsaacAPIClass(self, object)
|
|
29985
|
+
local allFunctions = __TS__ObjectValues(ISAAC_API_CLASS_TYPE_TO_FUNCTIONS)
|
|
29986
|
+
local isFunctions = __TS__ArrayMap(
|
|
29987
|
+
allFunctions,
|
|
29988
|
+
function(____, functions) return functions.is end
|
|
29989
|
+
)
|
|
29990
|
+
return __TS__ArraySome(
|
|
29991
|
+
isFunctions,
|
|
29992
|
+
function(____, identityFunction) return identityFunction(nil, object) end
|
|
29993
|
+
)
|
|
29994
|
+
end
|
|
29920
29995
|
--- Helper function to generically check if a given Lua table is a serialized Isaac API class. (This
|
|
29921
29996
|
-- is used by the save data manager when reading data from the "save#.dat" file.)
|
|
29922
29997
|
--
|
|
@@ -29955,18 +30030,16 @@ return ____exports
|
|
|
29955
30030
|
end,
|
|
29956
30031
|
["src.functions.deepCopy"] = function(...)
|
|
29957
30032
|
local ____lualib = require("lualib_bundle")
|
|
29958
|
-
local Set = ____lualib.Set
|
|
29959
30033
|
local __TS__New = ____lualib.__TS__New
|
|
29960
30034
|
local Map = ____lualib.Map
|
|
30035
|
+
local Set = ____lualib.Set
|
|
29961
30036
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
29962
30037
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
29963
30038
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
29964
30039
|
local ____exports = {}
|
|
29965
|
-
local deepCopyTable, deepCopyDefaultMap, getNewDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, deepCopyArray, deepCopyNormalLuaTable, getCopiedEntries, checkMetatable, deepCopyUserdata
|
|
30040
|
+
local deepCopyTable, deepCopyDefaultMap, getNewDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, deepCopyArray, deepCopyNormalLuaTable, getCopiedEntries, checkMetatable, deepCopyUserdata
|
|
29966
30041
|
local ____DefaultMap = require("src.classes.DefaultMap")
|
|
29967
30042
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
29968
|
-
local ____CopyableIsaacAPIClassType = require("src.enums.private.CopyableIsaacAPIClassType")
|
|
29969
|
-
local CopyableIsaacAPIClassType = ____CopyableIsaacAPIClassType.CopyableIsaacAPIClassType
|
|
29970
30043
|
local ____SerializationBrand = require("src.enums.private.SerializationBrand")
|
|
29971
30044
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
29972
30045
|
local ____SerializationType = require("src.enums.SerializationType")
|
|
@@ -29977,8 +30050,6 @@ local ____serializationBrands = require("src.features.saveDataManager.serializat
|
|
|
29977
30050
|
local isSerializationBrand = ____serializationBrands.isSerializationBrand
|
|
29978
30051
|
local ____array = require("src.functions.array")
|
|
29979
30052
|
local isArray = ____array.isArray
|
|
29980
|
-
local ____enums = require("src.functions.enums")
|
|
29981
|
-
local getEnumValues = ____enums.getEnumValues
|
|
29982
30053
|
local ____isaacAPIClass = require("src.functions.isaacAPIClass")
|
|
29983
30054
|
local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
|
|
29984
30055
|
local ____log = require("src.functions.log")
|
|
@@ -29986,6 +30057,7 @@ local log = ____log.log
|
|
|
29986
30057
|
local ____serialization = require("src.functions.serialization")
|
|
29987
30058
|
local copyIsaacAPIClass = ____serialization.copyIsaacAPIClass
|
|
29988
30059
|
local deserializeIsaacAPIClass = ____serialization.deserializeIsaacAPIClass
|
|
30060
|
+
local isCopyableIsaacAPIClass = ____serialization.isCopyableIsaacAPIClass
|
|
29989
30061
|
local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
|
|
29990
30062
|
local serializeIsaacAPIClass = ____serialization.serializeIsaacAPIClass
|
|
29991
30063
|
local ____tstlClass = require("src.functions.tstlClass")
|
|
@@ -30069,6 +30141,9 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
|
|
|
30069
30141
|
if serializationType == SerializationType.SERIALIZE then
|
|
30070
30142
|
error((("The deep copy function does not support serialization of \"" .. traversalDescription) .. "\", since it is type: ") .. valueType)
|
|
30071
30143
|
end
|
|
30144
|
+
if serializationType == SerializationType.DESERIALIZE then
|
|
30145
|
+
error((("The deep copy function does not support deserialization of \"" .. traversalDescription) .. "\", since it is type: ") .. valueType)
|
|
30146
|
+
end
|
|
30072
30147
|
return value
|
|
30073
30148
|
end
|
|
30074
30149
|
end
|
|
@@ -30220,15 +30295,15 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
|
|
|
30220
30295
|
end
|
|
30221
30296
|
function getNewDefaultMap(self, defaultMap, serializationType, traversalDescription, constructorArg)
|
|
30222
30297
|
repeat
|
|
30223
|
-
local
|
|
30224
|
-
local
|
|
30225
|
-
if
|
|
30298
|
+
local ____switch35 = serializationType
|
|
30299
|
+
local ____cond35 = ____switch35 == SerializationType.NONE
|
|
30300
|
+
if ____cond35 then
|
|
30226
30301
|
do
|
|
30227
30302
|
return __TS__New(DefaultMap, constructorArg)
|
|
30228
30303
|
end
|
|
30229
30304
|
end
|
|
30230
|
-
|
|
30231
|
-
if
|
|
30305
|
+
____cond35 = ____cond35 or ____switch35 == SerializationType.SERIALIZE
|
|
30306
|
+
if ____cond35 then
|
|
30232
30307
|
do
|
|
30233
30308
|
local newDefaultMap = {}
|
|
30234
30309
|
newDefaultMap[SerializationBrand.DEFAULT_MAP] = ""
|
|
@@ -30236,8 +30311,8 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
|
|
|
30236
30311
|
return newDefaultMap
|
|
30237
30312
|
end
|
|
30238
30313
|
end
|
|
30239
|
-
|
|
30240
|
-
if
|
|
30314
|
+
____cond35 = ____cond35 or ____switch35 == SerializationType.DESERIALIZE
|
|
30315
|
+
if ____cond35 then
|
|
30241
30316
|
do
|
|
30242
30317
|
if isDefaultMap(nil, defaultMap) then
|
|
30243
30318
|
error(("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
|
|
@@ -30437,7 +30512,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
|
|
|
30437
30512
|
local value = ____value[2]
|
|
30438
30513
|
do
|
|
30439
30514
|
if isSerializationBrand(nil, key) then
|
|
30440
|
-
goto
|
|
30515
|
+
goto __continue88
|
|
30441
30516
|
end
|
|
30442
30517
|
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
30443
30518
|
local newValue = ____exports.deepCopy(
|
|
@@ -30459,7 +30534,7 @@ function getCopiedEntries(self, object, serializationType, traversalDescription,
|
|
|
30459
30534
|
end
|
|
30460
30535
|
copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
|
|
30461
30536
|
end
|
|
30462
|
-
::
|
|
30537
|
+
::__continue88::
|
|
30463
30538
|
end
|
|
30464
30539
|
return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
|
|
30465
30540
|
end
|
|
@@ -30472,15 +30547,12 @@ function checkMetatable(self, luaMap, traversalDescription)
|
|
|
30472
30547
|
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.)")
|
|
30473
30548
|
end
|
|
30474
30549
|
function deepCopyUserdata(self, value, serializationType, traversalDescription)
|
|
30475
|
-
if SAVE_DATA_MANAGER_DEBUG then
|
|
30476
|
-
log(nil, "deepCopy is copying userdata.")
|
|
30477
|
-
end
|
|
30478
30550
|
local classType = getIsaacAPIClassName(nil, value)
|
|
30479
30551
|
if classType == nil then
|
|
30480
30552
|
error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
|
|
30481
30553
|
end
|
|
30482
|
-
if not
|
|
30483
|
-
error((("The deep copy function does not support
|
|
30554
|
+
if not isCopyableIsaacAPIClass(nil, value) then
|
|
30555
|
+
error((("The deep copy function does not support serializing \"" .. traversalDescription) .. "\", since it is an Isaac API class of type: ") .. classType)
|
|
30484
30556
|
end
|
|
30485
30557
|
repeat
|
|
30486
30558
|
local ____switch99 = serializationType
|
|
@@ -30499,15 +30571,12 @@ function deepCopyUserdata(self, value, serializationType, traversalDescription)
|
|
|
30499
30571
|
____cond99 = ____cond99 or ____switch99 == SerializationType.DESERIALIZE
|
|
30500
30572
|
if ____cond99 then
|
|
30501
30573
|
do
|
|
30502
|
-
|
|
30574
|
+
error(("The deep copy function can not deserialize \"" .. traversalDescription) .. "\", since it is userdata.")
|
|
30503
30575
|
end
|
|
30576
|
+
break
|
|
30504
30577
|
end
|
|
30505
30578
|
until true
|
|
30506
30579
|
end
|
|
30507
|
-
COPYABLE_ISAAC_API_CLASS_TYPES_SET = __TS__New(
|
|
30508
|
-
Set,
|
|
30509
|
-
getEnumValues(nil, CopyableIsaacAPIClassType)
|
|
30510
|
-
)
|
|
30511
30580
|
return ____exports
|
|
30512
30581
|
end,
|
|
30513
30582
|
["src.interfaces.SaveData"] = function(...)
|
|
@@ -31915,7 +31984,7 @@ local ____flag = require("src.functions.flag")
|
|
|
31915
31984
|
local hasFlag = ____flag.hasFlag
|
|
31916
31985
|
--- Helper function to get the actual bit flag for modded curses.
|
|
31917
31986
|
--
|
|
31918
|
-
-- Will throw a
|
|
31987
|
+
-- Will throw a run-time error if the provided curse does not exist.
|
|
31919
31988
|
--
|
|
31920
31989
|
-- Use this over the `Isaac.GetCurseIdByName` method because that will return an integer instead of
|
|
31921
31990
|
-- a bit flag.
|
|
@@ -45549,16 +45618,21 @@ end
|
|
|
45549
45618
|
-- Specifically, this will clear the current room of all entities and grid entities, and then spawn
|
|
45550
45619
|
-- all of the entries and grid entities in the provided JSON room.
|
|
45551
45620
|
--
|
|
45621
|
+
-- You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
|
|
45622
|
+
-- my-rooms.xml`).
|
|
45623
|
+
--
|
|
45552
45624
|
-- This function is meant to be used in the `POST_NEW_ROOM` callback.
|
|
45553
45625
|
--
|
|
45554
45626
|
-- For example:
|
|
45555
45627
|
--
|
|
45556
45628
|
-- ```ts
|
|
45557
45629
|
--
|
|
45558
|
-
-- import customRooms from "./customRooms";
|
|
45630
|
+
-- import customRooms from "./customRooms.json";
|
|
45559
45631
|
--
|
|
45560
|
-
--
|
|
45561
|
-
--
|
|
45632
|
+
-- export function postNewRoom(): void {
|
|
45633
|
+
-- const firstJSONRoom = customRooms.rooms.room[0];
|
|
45634
|
+
-- deployJSONRoom(firstJSONRoom);
|
|
45635
|
+
-- }
|
|
45562
45636
|
-- ```
|
|
45563
45637
|
--
|
|
45564
45638
|
-- @param jsonRoom The JSON room to deploy. *
|
|
@@ -45596,6 +45670,9 @@ end
|
|
|
45596
45670
|
-- Specifically, this will clear the current room of all entities and grid entities, and then spawn
|
|
45597
45671
|
-- all of the entries and grid entities in one of the provided JSON rooms.
|
|
45598
45672
|
--
|
|
45673
|
+
-- You can create JSON rooms by using the `convert-xml-to-json` tool (e.g. `npx convert-xml-to-json
|
|
45674
|
+
-- my-rooms.xml`).
|
|
45675
|
+
--
|
|
45599
45676
|
-- This function is meant to be used in the `POST_NEW_ROOM` callback.
|
|
45600
45677
|
--
|
|
45601
45678
|
-- Note that this function does not simply choose a random element in the provided array; it will
|
|
@@ -45605,10 +45682,12 @@ end
|
|
|
45605
45682
|
-- For example:
|
|
45606
45683
|
--
|
|
45607
45684
|
-- ```ts
|
|
45608
|
-
-- import customRooms from "./customRooms";
|
|
45685
|
+
-- import customRooms from "./customRooms.json";
|
|
45609
45686
|
--
|
|
45610
|
-
--
|
|
45611
|
-
--
|
|
45687
|
+
-- export function postNewRoom(): void {
|
|
45688
|
+
-- const jsonRooms = customRooms.rooms.room;
|
|
45689
|
+
-- deployRandomJSONRoom(jsonRooms);
|
|
45690
|
+
-- }
|
|
45612
45691
|
-- ```
|
|
45613
45692
|
--
|
|
45614
45693
|
-- @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
|
|
@@ -46824,7 +46903,7 @@ return ____exports
|
|
|
46824
46903
|
["package"] = function(...)
|
|
46825
46904
|
return {
|
|
46826
46905
|
name = "isaacscript-common",
|
|
46827
|
-
version = "
|
|
46906
|
+
version = "10.0.2",
|
|
46828
46907
|
description = "Helper functions and features for IsaacScript mods.",
|
|
46829
46908
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
46830
46909
|
homepage = "https://isaacscript.github.io/",
|
|
@@ -46835,7 +46914,7 @@ return {
|
|
|
46835
46914
|
type = "commonjs",
|
|
46836
46915
|
main = "dist/src/index",
|
|
46837
46916
|
types = "dist/src/index.d.ts",
|
|
46838
|
-
dependencies = {["isaac-typescript-definitions"] = "^
|
|
46917
|
+
dependencies = {["isaac-typescript-definitions"] = "^7.2.0"}
|
|
46839
46918
|
}
|
|
46840
46919
|
end,
|
|
46841
46920
|
["src.functions.map"] = function(...)
|
|
@@ -48312,8 +48391,7 @@ function copiedObjectHasKeyAndValueString(self)
|
|
|
48312
48391
|
local keyToLookFor = "abc"
|
|
48313
48392
|
local valueToLookFor = "def"
|
|
48314
48393
|
local oldObject = {abc = valueToLookFor}
|
|
48315
|
-
local
|
|
48316
|
-
local newObject = newTable
|
|
48394
|
+
local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasKeyAndValueString")
|
|
48317
48395
|
local value = newObject[keyToLookFor]
|
|
48318
48396
|
if value == nil then
|
|
48319
48397
|
error("The copied object did not have a key of: " .. keyToLookFor)
|
|
@@ -48330,8 +48408,7 @@ function copiedTableHasKeyAndValueNumber(self)
|
|
|
48330
48408
|
local valueToLookFor = 456
|
|
48331
48409
|
local oldTable = {}
|
|
48332
48410
|
oldTable[keyToLookFor] = valueToLookFor
|
|
48333
|
-
local
|
|
48334
|
-
local newTable = newObject
|
|
48411
|
+
local newTable = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableHasKeyAndValueNumber")
|
|
48335
48412
|
local value = newTable[keyToLookFor]
|
|
48336
48413
|
if value == nil then
|
|
48337
48414
|
error("The copied object did not have a key of: " .. tostring(keyToLookFor))
|
|
@@ -48348,8 +48425,7 @@ function copiedTableDoesNotCoerceTypes(self)
|
|
|
48348
48425
|
local valueToLookFor = 456
|
|
48349
48426
|
local oldTable = {}
|
|
48350
48427
|
oldTable[keyToLookFor] = valueToLookFor
|
|
48351
|
-
local
|
|
48352
|
-
local newTable = newObject
|
|
48428
|
+
local newTable = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableDoesNotCoerceTypes")
|
|
48353
48429
|
local keyString = tostring(keyToLookFor)
|
|
48354
48430
|
local valueString = tostring(valueToLookFor)
|
|
48355
48431
|
local valueFromString = newTable[keyString]
|
|
@@ -48365,8 +48441,7 @@ function copiedObjectHasNoReferencesForPrimitivesForward(self)
|
|
|
48365
48441
|
local originalStringValue = "abcdef"
|
|
48366
48442
|
local originalNumberValue = 123
|
|
48367
48443
|
local oldObject = {abc = originalStringValue, def = originalNumberValue}
|
|
48368
|
-
local
|
|
48369
|
-
local newObject = newTable
|
|
48444
|
+
local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesForward")
|
|
48370
48445
|
oldObject.abc = "newValue"
|
|
48371
48446
|
if oldObject.abc == newObject.abc then
|
|
48372
48447
|
error("The copied object has a string reference going forward.")
|
|
@@ -48380,8 +48455,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
|
|
|
48380
48455
|
local originalStringValue = "abcdef"
|
|
48381
48456
|
local originalNumberValue = 123
|
|
48382
48457
|
local oldObject = {abc = originalStringValue, def = originalNumberValue}
|
|
48383
|
-
local
|
|
48384
|
-
local newObject = newTable
|
|
48458
|
+
local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesBackward")
|
|
48385
48459
|
newObject.abc = "newValue"
|
|
48386
48460
|
if newObject.abc == oldObject.abc then
|
|
48387
48461
|
error("The copied object has a string reference going backward.")
|
|
@@ -48393,8 +48467,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
|
|
|
48393
48467
|
end
|
|
48394
48468
|
function copiedObjectHasNoReferencesForArray(self)
|
|
48395
48469
|
local oldObject = {abc = {1, 2, 3}}
|
|
48396
|
-
local
|
|
48397
|
-
local newObject = newTable
|
|
48470
|
+
local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForArray")
|
|
48398
48471
|
if oldObject.abc == newObject.abc then
|
|
48399
48472
|
error("The copied object has the same point to the child array.")
|
|
48400
48473
|
end
|
|
@@ -48421,8 +48494,7 @@ function copiedObjectHasChildObject(self)
|
|
|
48421
48494
|
local keyToLookFor = "def"
|
|
48422
48495
|
local valueToLookFor = "ghi"
|
|
48423
48496
|
local oldObject = {abc = {def = valueToLookFor}}
|
|
48424
|
-
local
|
|
48425
|
-
local newObject = newTable
|
|
48497
|
+
local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasChildObject")
|
|
48426
48498
|
local childObject = newObject[childObjectIndex]
|
|
48427
48499
|
if childObject == nil then
|
|
48428
48500
|
error("Failed to find the child object at index: " .. childObjectIndex)
|
|
@@ -48446,8 +48518,7 @@ function copiedMapIsMap(self)
|
|
|
48446
48518
|
local valueToLookFor = "def"
|
|
48447
48519
|
local oldMap = __TS__New(Map)
|
|
48448
48520
|
oldMap:set(keyToLookFor, valueToLookFor)
|
|
48449
|
-
local
|
|
48450
|
-
local newMap = newObject
|
|
48521
|
+
local newMap = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapIsMap")
|
|
48451
48522
|
if not isTSTLMap(nil, newMap) then
|
|
48452
48523
|
error("The copied Map was not a Map and has a type of: " .. __TS__TypeOf(newMap))
|
|
48453
48524
|
end
|
|
@@ -48457,8 +48528,7 @@ function copiedMapHasValue(self)
|
|
|
48457
48528
|
local valueToLookFor = "def"
|
|
48458
48529
|
local oldMap = __TS__New(Map)
|
|
48459
48530
|
oldMap:set(keyToLookFor, valueToLookFor)
|
|
48460
|
-
local
|
|
48461
|
-
local newMap = newTable
|
|
48531
|
+
local newMap = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasValue")
|
|
48462
48532
|
if not isTSTLMap(nil, newMap) then
|
|
48463
48533
|
error("The copied Map was not a Map and has a type of: " .. __TS__TypeOf(newMap))
|
|
48464
48534
|
end
|
|
@@ -48474,8 +48544,7 @@ function copiedSetIsSet(self)
|
|
|
48474
48544
|
local valueToLookFor = "abc"
|
|
48475
48545
|
local oldSet = __TS__New(Set)
|
|
48476
48546
|
oldSet:add(valueToLookFor)
|
|
48477
|
-
local
|
|
48478
|
-
local newSet = newTable
|
|
48547
|
+
local newSet = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetIsSet")
|
|
48479
48548
|
if not isTSTLSet(nil, newSet) then
|
|
48480
48549
|
error("The copied Set was not a Set and has a type of: " .. __TS__TypeOf(newSet))
|
|
48481
48550
|
end
|
|
@@ -48484,8 +48553,7 @@ function copiedSetHasValue(self)
|
|
|
48484
48553
|
local valueToLookFor = "abc"
|
|
48485
48554
|
local oldSet = __TS__New(Set)
|
|
48486
48555
|
oldSet:add(valueToLookFor)
|
|
48487
|
-
local
|
|
48488
|
-
local newSet = newTable
|
|
48556
|
+
local newSet = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetHasValue")
|
|
48489
48557
|
if not isTSTLSet(nil, newSet) then
|
|
48490
48558
|
error("The copied Set was not a Set and has a type of: " .. __TS__TypeOf(newSet))
|
|
48491
48559
|
end
|
|
@@ -48502,8 +48570,7 @@ function copiedMapHasChildMap(self)
|
|
|
48502
48570
|
local keyToLookFor = "childMap"
|
|
48503
48571
|
local oldMap = __TS__New(Map)
|
|
48504
48572
|
oldMap:set(keyToLookFor, oldChildMap)
|
|
48505
|
-
local
|
|
48506
|
-
local newMap = newTable
|
|
48573
|
+
local newMap = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasChildMap")
|
|
48507
48574
|
if not isTSTLMap(nil, newMap) then
|
|
48508
48575
|
error("The copied Map was not a Map and had a type of: " .. __TS__TypeOf(newMap))
|
|
48509
48576
|
end
|
|
@@ -48535,8 +48602,7 @@ function copiedDefaultMapHasChildDefaultMap(self)
|
|
|
48535
48602
|
local oldChildMap = oldParentMap:getAndSetDefault(parentMapKey)
|
|
48536
48603
|
oldChildMap:getAndSetDefault(childMapKey1)
|
|
48537
48604
|
oldChildMap:set(childMapKey2, childMapCustomValue)
|
|
48538
|
-
local
|
|
48539
|
-
local newParentMap = newTable
|
|
48605
|
+
local newParentMap = deepCopy(nil, oldParentMap, SerializationType.NONE, "copiedDefaultMapHasChildDefaultMap")
|
|
48540
48606
|
if not isDefaultMap(nil, newParentMap) then
|
|
48541
48607
|
error("The copied parent DefaultMap was not a DefaultMap and had a type of: " .. __TS__TypeOf(newParentMap))
|
|
48542
48608
|
end
|
|
@@ -54811,6 +54877,47 @@ function ____exports.getVanillaTrinketSet(self)
|
|
|
54811
54877
|
lazyInitVanillaTrinketTypes(nil)
|
|
54812
54878
|
return VANILLA_TRINKET_TYPES_SET
|
|
54813
54879
|
end
|
|
54880
|
+
return ____exports
|
|
54881
|
+
end,
|
|
54882
|
+
["src.types.WeightedArray"] = function(...)
|
|
54883
|
+
local ____exports = {}
|
|
54884
|
+
return ____exports
|
|
54885
|
+
end,
|
|
54886
|
+
["src.functions.weighted"] = function(...)
|
|
54887
|
+
local ____lualib = require("lualib_bundle")
|
|
54888
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
54889
|
+
local ____exports = {}
|
|
54890
|
+
local ____array = require("src.functions.array")
|
|
54891
|
+
local arrayToString = ____array.arrayToString
|
|
54892
|
+
local sumArray = ____array.sumArray
|
|
54893
|
+
local ____random = require("src.functions.random")
|
|
54894
|
+
local getRandomFloat = ____random.getRandomFloat
|
|
54895
|
+
local ____rng = require("src.functions.rng")
|
|
54896
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
54897
|
+
--- Get a random value from a `WeightedArray`. (The second element in the array is the weight.)
|
|
54898
|
+
function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
54899
|
+
if seedOrRNG == nil then
|
|
54900
|
+
seedOrRNG = getRandomSeed(nil)
|
|
54901
|
+
end
|
|
54902
|
+
if #weightedArray == 0 then
|
|
54903
|
+
error("Failed to get a random element from a weighted array since the provided array was empty.")
|
|
54904
|
+
end
|
|
54905
|
+
local weights = __TS__ArrayMap(
|
|
54906
|
+
weightedArray,
|
|
54907
|
+
function(____, tuple) return tuple[2] end
|
|
54908
|
+
)
|
|
54909
|
+
local totalWeight = sumArray(nil, weights)
|
|
54910
|
+
local randomWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
54911
|
+
local weightAccumulator = 0
|
|
54912
|
+
for ____, tuple in ipairs(weightedArray) do
|
|
54913
|
+
local element, weight = table.unpack(tuple)
|
|
54914
|
+
weightAccumulator = weightAccumulator + weight
|
|
54915
|
+
if weightAccumulator >= randomWeight then
|
|
54916
|
+
return element
|
|
54917
|
+
end
|
|
54918
|
+
end
|
|
54919
|
+
error("Failed to get a random element from a weighted array: " .. arrayToString(nil, weightedArray))
|
|
54920
|
+
end
|
|
54814
54921
|
return ____exports
|
|
54815
54922
|
end,
|
|
54816
54923
|
["src.objects.colors"] = function(...)
|
|
@@ -56074,6 +56181,14 @@ do
|
|
|
56074
56181
|
end
|
|
56075
56182
|
end
|
|
56076
56183
|
end
|
|
56184
|
+
do
|
|
56185
|
+
local ____export = require("src.functions.weighted")
|
|
56186
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
56187
|
+
if ____exportKey ~= "default" then
|
|
56188
|
+
____exports[____exportKey] = ____exportValue
|
|
56189
|
+
end
|
|
56190
|
+
end
|
|
56191
|
+
end
|
|
56077
56192
|
do
|
|
56078
56193
|
local ____export = require("src.maps.cardNameToTypeMap")
|
|
56079
56194
|
for ____exportKey, ____exportValue in pairs(____export) do
|