isaacscript-common 9.19.3 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -6
- package/dist/isaacscript-common.lua +83 -55
- package/dist/lualib_bundle.lua +53 -37
- package/dist/package.lua +2 -2
- 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 +1 -1
- 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 +1 -1
- package/dist/src/functions/color.d.ts.map +1 -1
- package/dist/src/functions/color.lua +2 -2
- 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 +1 -1
- 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 +3 -1
- package/dist/src/functions/positionVelocity.d.ts.map +1 -1
- package/dist/src/functions/positionVelocity.lua +9 -1
- package/dist/src/functions/rng.d.ts +1 -1
- 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 +1 -1
- package/dist/src/functions/vector.d.ts.map +1 -1
- package/dist/src/functions/vector.lua +2 -2
- package/dist/src/interfaces/private/TSTLClassMetatable.d.ts +1 -1
- package/dist/src/types/SerializedIsaacAPIClass.d.ts +1 -1
- package/dist/src/types/TSTLClass.d.ts +1 -1
- package/package.json +2 -2
- package/src/functions/bitSet128.ts +6 -2
- package/src/functions/color.ts +6 -2
- package/src/functions/kColor.ts +6 -2
- package/src/functions/log.ts +8 -6
- package/src/functions/positionVelocity.ts +10 -0
- package/src/functions/table.ts +15 -6
- package/src/functions/vector.ts +6 -2
package/dist/lualib_bundle.lua
CHANGED
|
@@ -255,11 +255,15 @@ local function __TS__ArrayPushArray(self, items)
|
|
|
255
255
|
return len
|
|
256
256
|
end
|
|
257
257
|
|
|
258
|
+
local function __TS__CountVarargs(...)
|
|
259
|
+
return select("#", ...)
|
|
260
|
+
end
|
|
261
|
+
|
|
258
262
|
local function __TS__ArrayReduce(self, callbackFn, ...)
|
|
259
263
|
local len = #self
|
|
260
264
|
local k = 0
|
|
261
265
|
local accumulator = nil
|
|
262
|
-
if
|
|
266
|
+
if __TS__CountVarargs(...) ~= 0 then
|
|
263
267
|
accumulator = ...
|
|
264
268
|
elseif len > 0 then
|
|
265
269
|
accumulator = self[1]
|
|
@@ -283,7 +287,7 @@ local function __TS__ArrayReduceRight(self, callbackFn, ...)
|
|
|
283
287
|
local len = #self
|
|
284
288
|
local k = len - 1
|
|
285
289
|
local accumulator = nil
|
|
286
|
-
if
|
|
290
|
+
if __TS__CountVarargs(...) ~= 0 then
|
|
287
291
|
accumulator = ...
|
|
288
292
|
elseif len > 0 then
|
|
289
293
|
accumulator = self[k + 1]
|
|
@@ -399,7 +403,7 @@ end
|
|
|
399
403
|
local function __TS__ArraySplice(self, ...)
|
|
400
404
|
local args = {...}
|
|
401
405
|
local len = #self
|
|
402
|
-
local actualArgumentCount =
|
|
406
|
+
local actualArgumentCount = __TS__CountVarargs(...)
|
|
403
407
|
local start = args[1]
|
|
404
408
|
local deleteCount = args[2]
|
|
405
409
|
if start < 0 then
|
|
@@ -1016,6 +1020,16 @@ local function __TS__DecorateParam(paramIndex, decorator)
|
|
|
1016
1020
|
return function(____, target, key) return decorator(nil, target, key, paramIndex) end
|
|
1017
1021
|
end
|
|
1018
1022
|
|
|
1023
|
+
local function __TS__StringIncludes(self, searchString, position)
|
|
1024
|
+
if not position then
|
|
1025
|
+
position = 1
|
|
1026
|
+
else
|
|
1027
|
+
position = position + 1
|
|
1028
|
+
end
|
|
1029
|
+
local index = string.find(self, searchString, position, true)
|
|
1030
|
+
return index ~= nil
|
|
1031
|
+
end
|
|
1032
|
+
|
|
1019
1033
|
local Error, RangeError, ReferenceError, SyntaxError, TypeError, URIError
|
|
1020
1034
|
do
|
|
1021
1035
|
local function getErrorStack(self, constructor)
|
|
@@ -1030,13 +1044,18 @@ do
|
|
|
1030
1044
|
break
|
|
1031
1045
|
end
|
|
1032
1046
|
end
|
|
1033
|
-
|
|
1047
|
+
if __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
1048
|
+
return debug.traceback(("[Level " .. tostring(level)) .. "]")
|
|
1049
|
+
else
|
|
1050
|
+
return debug.traceback(nil, level)
|
|
1051
|
+
end
|
|
1034
1052
|
end
|
|
1035
1053
|
local function wrapErrorToString(self, getDescription)
|
|
1036
1054
|
return function(self)
|
|
1037
1055
|
local description = getDescription(self)
|
|
1038
1056
|
local caller = debug.getinfo(3, "f")
|
|
1039
|
-
|
|
1057
|
+
local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0") or _VERSION == "Lua 5.1"
|
|
1058
|
+
if isClassicLua or caller and caller.func ~= error then
|
|
1040
1059
|
return description
|
|
1041
1060
|
else
|
|
1042
1061
|
return (tostring(description) .. "\n") .. self.stack
|
|
@@ -1185,16 +1204,9 @@ do
|
|
|
1185
1204
|
function __TS__Generator(fn)
|
|
1186
1205
|
return function(...)
|
|
1187
1206
|
local args = {...}
|
|
1188
|
-
local argsLength =
|
|
1207
|
+
local argsLength = __TS__CountVarargs(...)
|
|
1189
1208
|
return {
|
|
1190
|
-
____coroutine = coroutine.create(function()
|
|
1191
|
-
local ____fn_1 = fn
|
|
1192
|
-
local ____unpack_0 = unpack
|
|
1193
|
-
if ____unpack_0 == nil then
|
|
1194
|
-
____unpack_0 = table.unpack
|
|
1195
|
-
end
|
|
1196
|
-
return ____fn_1(____unpack_0(args, 1, argsLength))
|
|
1197
|
-
end),
|
|
1209
|
+
____coroutine = coroutine.create(function() return fn(__TS__Unpack(args, 1, argsLength)) end),
|
|
1198
1210
|
[Symbol.iterator] = generatorIterator,
|
|
1199
1211
|
next = generatorNext
|
|
1200
1212
|
}
|
|
@@ -1358,8 +1370,12 @@ do
|
|
|
1358
1370
|
Map[Symbol.species] = Map
|
|
1359
1371
|
end
|
|
1360
1372
|
|
|
1373
|
+
local __TS__Match = string.match
|
|
1374
|
+
|
|
1361
1375
|
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
1362
1376
|
|
|
1377
|
+
local __TS__MathModf = math.modf
|
|
1378
|
+
|
|
1363
1379
|
local function __TS__MathSign(val)
|
|
1364
1380
|
if val > 0 then
|
|
1365
1381
|
return 1
|
|
@@ -1369,6 +1385,10 @@ local function __TS__MathSign(val)
|
|
|
1369
1385
|
return 0
|
|
1370
1386
|
end
|
|
1371
1387
|
|
|
1388
|
+
local function __TS__Modulo50(a, b)
|
|
1389
|
+
return a - math.floor(a / b) * b
|
|
1390
|
+
end
|
|
1391
|
+
|
|
1372
1392
|
local function __TS__Number(value)
|
|
1373
1393
|
local valueType = type(value)
|
|
1374
1394
|
if valueType == "number" then
|
|
@@ -1415,7 +1435,7 @@ do
|
|
|
1415
1435
|
if radix < 2 or radix > 36 then
|
|
1416
1436
|
error("toString() radix argument must be between 2 and 36", 0)
|
|
1417
1437
|
end
|
|
1418
|
-
local integer, fraction =
|
|
1438
|
+
local integer, fraction = __TS__MathModf(math.abs(self))
|
|
1419
1439
|
local result = ""
|
|
1420
1440
|
if radix == 8 then
|
|
1421
1441
|
result = string.format("%o", integer)
|
|
@@ -1571,7 +1591,7 @@ local function __TS__ObjectValues(obj)
|
|
|
1571
1591
|
end
|
|
1572
1592
|
|
|
1573
1593
|
local function __TS__ParseFloat(numberString)
|
|
1574
|
-
local infinityMatch =
|
|
1594
|
+
local infinityMatch = __TS__Match(numberString, "^%s*(-?Infinity)")
|
|
1575
1595
|
if infinityMatch then
|
|
1576
1596
|
local ____temp_0
|
|
1577
1597
|
if __TS__StringAccess(infinityMatch, 0) == "-" then
|
|
@@ -1581,7 +1601,7 @@ local function __TS__ParseFloat(numberString)
|
|
|
1581
1601
|
end
|
|
1582
1602
|
return ____temp_0
|
|
1583
1603
|
end
|
|
1584
|
-
local number = tonumber(
|
|
1604
|
+
local number = tonumber(__TS__Match(numberString, "^%s*(-?%d+%.?%d*)"))
|
|
1585
1605
|
local ____number_1 = number
|
|
1586
1606
|
if ____number_1 == nil then
|
|
1587
1607
|
____number_1 = 0 / 0
|
|
@@ -1629,16 +1649,16 @@ do
|
|
|
1629
1649
|
function __TS__ParseInt(numberString, base)
|
|
1630
1650
|
if base == nil then
|
|
1631
1651
|
base = 10
|
|
1632
|
-
local hexMatch =
|
|
1652
|
+
local hexMatch = __TS__Match(numberString, "^%s*-?0[xX]")
|
|
1633
1653
|
if hexMatch then
|
|
1634
1654
|
base = 16
|
|
1635
|
-
local
|
|
1636
|
-
if
|
|
1637
|
-
|
|
1655
|
+
local ____TS__Match_result__0_0
|
|
1656
|
+
if __TS__Match(hexMatch, "-") then
|
|
1657
|
+
____TS__Match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
|
|
1638
1658
|
else
|
|
1639
|
-
|
|
1659
|
+
____TS__Match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
|
|
1640
1660
|
end
|
|
1641
|
-
numberString =
|
|
1661
|
+
numberString = ____TS__Match_result__0_0
|
|
1642
1662
|
end
|
|
1643
1663
|
end
|
|
1644
1664
|
if base < 2 or base > 36 then
|
|
@@ -1653,7 +1673,7 @@ do
|
|
|
1653
1673
|
local allowedDigits = ____temp_1
|
|
1654
1674
|
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
1655
1675
|
local number = tonumber(
|
|
1656
|
-
|
|
1676
|
+
__TS__Match(numberString, pattern),
|
|
1657
1677
|
base
|
|
1658
1678
|
)
|
|
1659
1679
|
if number == nil then
|
|
@@ -1965,13 +1985,13 @@ end
|
|
|
1965
1985
|
|
|
1966
1986
|
local function __TS__SparseArrayNew(...)
|
|
1967
1987
|
local sparseArray = {...}
|
|
1968
|
-
sparseArray.sparseLength =
|
|
1988
|
+
sparseArray.sparseLength = __TS__CountVarargs(...)
|
|
1969
1989
|
return sparseArray
|
|
1970
1990
|
end
|
|
1971
1991
|
|
|
1972
1992
|
local function __TS__SparseArrayPush(sparseArray, ...)
|
|
1973
1993
|
local args = {...}
|
|
1974
|
-
local argsLen =
|
|
1994
|
+
local argsLen = __TS__CountVarargs(...)
|
|
1975
1995
|
local listLen = sparseArray.sparseLength
|
|
1976
1996
|
for i = 1, argsLen do
|
|
1977
1997
|
sparseArray[listLen + i] = args[i]
|
|
@@ -2086,6 +2106,8 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2086
2106
|
local trace
|
|
2087
2107
|
if thread == nil and message == nil and level == nil then
|
|
2088
2108
|
trace = originalTraceback()
|
|
2109
|
+
elseif __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
2110
|
+
trace = originalTraceback((("[Level " .. tostring(level)) .. "] ") .. message)
|
|
2089
2111
|
else
|
|
2090
2112
|
trace = originalTraceback(thread, message, level)
|
|
2091
2113
|
end
|
|
@@ -2111,7 +2133,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2111
2133
|
local function stringReplacer(____, file, line)
|
|
2112
2134
|
local fileSourceMap = _G.__TS__sourcemap[file]
|
|
2113
2135
|
if fileSourceMap and fileSourceMap[line] then
|
|
2114
|
-
local chunkName =
|
|
2136
|
+
local chunkName = __TS__Match(file, "%[string \"([^\"]+)\"%]")
|
|
2115
2137
|
local sourceName = string.gsub(chunkName, ".lua$", ".ts")
|
|
2116
2138
|
local data = fileSourceMap[line]
|
|
2117
2139
|
if type(data) == "number" then
|
|
@@ -2178,16 +2200,6 @@ local function __TS__StringEndsWith(self, searchString, endPosition)
|
|
|
2178
2200
|
return string.sub(self, endPosition - #searchString + 1, endPosition) == searchString
|
|
2179
2201
|
end
|
|
2180
2202
|
|
|
2181
|
-
local function __TS__StringIncludes(self, searchString, position)
|
|
2182
|
-
if not position then
|
|
2183
|
-
position = 1
|
|
2184
|
-
else
|
|
2185
|
-
position = position + 1
|
|
2186
|
-
end
|
|
2187
|
-
local index = string.find(self, searchString, position, true)
|
|
2188
|
-
return index ~= nil
|
|
2189
|
-
end
|
|
2190
|
-
|
|
2191
2203
|
local function __TS__StringPadEnd(self, maxLength, fillString)
|
|
2192
2204
|
if fillString == nil then
|
|
2193
2205
|
fillString = " "
|
|
@@ -2443,6 +2455,7 @@ return {
|
|
|
2443
2455
|
__TS__Class = __TS__Class,
|
|
2444
2456
|
__TS__ClassExtends = __TS__ClassExtends,
|
|
2445
2457
|
__TS__CloneDescriptor = __TS__CloneDescriptor,
|
|
2458
|
+
__TS__CountVarargs = __TS__CountVarargs,
|
|
2446
2459
|
__TS__Decorate = __TS__Decorate,
|
|
2447
2460
|
__TS__DecorateParam = __TS__DecorateParam,
|
|
2448
2461
|
__TS__Delete = __TS__Delete,
|
|
@@ -2460,8 +2473,11 @@ return {
|
|
|
2460
2473
|
__TS__Iterator = __TS__Iterator,
|
|
2461
2474
|
__TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
|
|
2462
2475
|
Map = Map,
|
|
2476
|
+
__TS__Match = __TS__Match,
|
|
2463
2477
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2478
|
+
__TS__MathModf = __TS__MathModf,
|
|
2464
2479
|
__TS__MathSign = __TS__MathSign,
|
|
2480
|
+
__TS__Modulo50 = __TS__Modulo50,
|
|
2465
2481
|
__TS__New = __TS__New,
|
|
2466
2482
|
__TS__Number = __TS__Number,
|
|
2467
2483
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
package/dist/package.lua
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
return {
|
|
2
2
|
name = "isaacscript-common",
|
|
3
|
-
version = "
|
|
3
|
+
version = "10.0.1",
|
|
4
4
|
description = "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
|
|
6
6
|
homepage = "https://isaacscript.github.io/",
|
|
@@ -11,5 +11,5 @@ return {
|
|
|
11
11
|
type = "commonjs",
|
|
12
12
|
main = "dist/src/index",
|
|
13
13
|
types = "dist/src/index.d.ts",
|
|
14
|
-
dependencies = {["isaac-typescript-definitions"] = "^
|
|
14
|
+
dependencies = {["isaac-typescript-definitions"] = "^7.0.0"}
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
3
3
|
import { SaveData } from "../../interfaces/SaveData";
|
|
4
4
|
export declare function loadFromDisk(mod: Mod, oldSaveData: LuaMap<string, SaveData>): void;
|
|
5
5
|
//# sourceMappingURL=load.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
import { SaveData } from "../../interfaces/SaveData";
|
|
3
3
|
/**
|
|
4
4
|
* The save data map is indexed by subscriber name. We use Lua tables instead of TypeScriptToLua
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/**
|
|
3
3
|
* `merge` takes the values from a new table and recursively merges them into an old object (while
|
|
4
4
|
* performing appropriate deserialization).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
3
3
|
import { SaveData } from "../../interfaces/SaveData";
|
|
4
4
|
export declare function saveToDisk(mod: Mod, saveDataMap: LuaMap<string, SaveData>, saveDataConditionalFuncMap: LuaMap<string, () => boolean>): void;
|
|
5
5
|
//# sourceMappingURL=save.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
export declare type SerializedBitSet128 = LuaMap<string, unknown> & {
|
|
4
4
|
readonly __serializedBitSet128Brand: symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitSet128.d.ts","sourceRoot":"","sources":["../../../src/functions/bitSet128.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"bitSet128.d.ts","sourceRoot":"","sources":["../../../src/functions/bitSet128.ts"],"names":[],"mappings":";;AASA,oBAAY,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC1D,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;CAC7C,CAAC;AAKF,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAW7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,mBAAmB,GAC7B,SAAS,CAqBX;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,SAAS,CAEhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,mBAAmB,CAQ/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,mBAAmB,CAW5E"}
|
|
@@ -5,7 +5,7 @@ local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
|
5
5
|
local ____isaacAPIClass = require("src.functions.isaacAPIClass")
|
|
6
6
|
local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
|
|
7
7
|
local ____table = require("src.functions.table")
|
|
8
|
-
local
|
|
8
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
9
9
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
10
10
|
local tableHasKeys = ____table.tableHasKeys
|
|
11
11
|
local ____types = require("src.functions.types")
|
|
@@ -64,7 +64,7 @@ function ____exports.serializeBitSet128(self, bitSet128)
|
|
|
64
64
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
65
65
|
end
|
|
66
66
|
local bitSet128Table = {}
|
|
67
|
-
|
|
67
|
+
copyUserdataValuesToTable(nil, bitSet128, KEYS, bitSet128Table)
|
|
68
68
|
bitSet128Table[SerializationBrand.BIT_SET_128] = ""
|
|
69
69
|
return bitSet128Table
|
|
70
70
|
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="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
4
|
/// <reference types="isaac-typescript-definitions" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/functions/color.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/functions/color.ts"],"names":[],"mappings":";;;;AAWA,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACtD,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;CACzC,CAAC;AAKF,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAEjE;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAgB7C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CA8B9D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,KAAK,SAAI,GACR,KAAK,CAQP;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,KAAK,CAExD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,eAAe,CAM5E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CAW5D"}
|
|
@@ -12,7 +12,7 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
12
12
|
local isRNG = ____rng.isRNG
|
|
13
13
|
local newRNG = ____rng.newRNG
|
|
14
14
|
local ____table = require("src.functions.table")
|
|
15
|
-
local
|
|
15
|
+
local copyUserdataValuesToTable = ____table.copyUserdataValuesToTable
|
|
16
16
|
local getNumbersFromTable = ____table.getNumbersFromTable
|
|
17
17
|
local tableHasKeys = ____table.tableHasKeys
|
|
18
18
|
local ____types = require("src.functions.types")
|
|
@@ -117,7 +117,7 @@ function ____exports.serializeColor(self, color)
|
|
|
117
117
|
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
118
118
|
end
|
|
119
119
|
local colorTable = {}
|
|
120
|
-
|
|
120
|
+
copyUserdataValuesToTable(nil, color, KEYS, colorTable)
|
|
121
121
|
colorTable[SerializationBrand.COLOR] = ""
|
|
122
122
|
return colorTable
|
|
123
123
|
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,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
4
|
/// <reference types="isaac-typescript-definitions" />
|
|
@@ -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":";;;;AAWA,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,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,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGrC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,CAG3D;AAED,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,eAAe,EAAE,GAAG,IAAI,CAS7E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAI3C;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7E;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGhD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI1C;AAED,4FAA4F;AAC5F,wBAAgB,QAAQ,C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AM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI,CAG7D"}
|
|
@@ -20,8 +20,10 @@ 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
|
-
export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
|
|
26
|
+
export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
|
|
25
27
|
/**
|
|
26
28
|
* Helper function to get a map containing the positions of every entity in the current room.
|
|
27
29
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,GAAG,GACZ,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,OAAO,CAKT;AAED
|
|
1
|
+
{"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,GAAG,GACZ,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,OAAO,CAKT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,UAAQ,EAC3B,eAAe,CAAC,EAAE,KAAK,GACtB,MAAM,CAwCR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN"}
|
|
@@ -45,7 +45,9 @@ 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
|
-
|
|
48
|
+
-- @param minimumDistance Optional. If specified, will ensure that the randomly generated position
|
|
49
|
+
-- is equal to or greater than the distance provided.
|
|
50
|
+
function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities, minimumDistance)
|
|
49
51
|
if avoidActiveEntities == nil then
|
|
50
52
|
avoidActiveEntities = false
|
|
51
53
|
end
|
|
@@ -64,6 +66,12 @@ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntitie
|
|
|
64
66
|
if isCloseHeavenDoor then
|
|
65
67
|
goto __continue7
|
|
66
68
|
end
|
|
69
|
+
if minimumDistance ~= nil then
|
|
70
|
+
local distance = startingPosition:Distance(position)
|
|
71
|
+
if distance < minimumDistance then
|
|
72
|
+
goto __continue7
|
|
73
|
+
end
|
|
74
|
+
end
|
|
67
75
|
return position
|
|
68
76
|
end
|
|
69
77
|
::__continue7::
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
4
|
export declare type SerializedRNG = LuaMap<string, unknown> & {
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
import { Direction } from "isaac-typescript-definitions";
|
|
3
3
|
export declare type SerializedVector = LuaMap<string, unknown> & {
|
|
4
4
|
readonly __serializedVectorBrand: symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAazD,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="lua-types/5.3" />
|
|
2
2
|
/// <reference types="lua-types/5.3" />
|
|
3
3
|
/// <reference types="lua-types/5.3" />
|
|
4
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
4
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
5
5
|
export interface TSTLClassMetatable {
|
|
6
6
|
____constructor: () => void;
|
|
7
7
|
__index: unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/**
|
|
3
3
|
* This is a type representing an Isaac API class like `Color` or `RNG` that has been written to the
|
|
4
4
|
* "save#.dat" file. It is used by the save data manager when reading and writing to that file.
|