isaacscript-common 87.6.2 → 87.8.0
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/classes/ModUpgraded.lua +4 -4
- package/dist/classes/callbacks/InputActionFilter.lua +2 -2
- package/dist/classes/callbacks/InputActionPlayer.lua +2 -2
- package/dist/classes/callbacks/PostCollectibleEmpty.lua +2 -2
- package/dist/classes/callbacks/PostCursedTeleport.lua +2 -2
- package/dist/classes/callbacks/PostCustomRevive.lua +2 -2
- package/dist/classes/callbacks/PostDiceRoomActivated.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityCollision.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityCustomCollision.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityCustomRemove.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityRemove.lua +2 -2
- package/dist/classes/callbacks/PostItemDischarge.lua +2 -2
- package/dist/classes/callbacks/PostKeyboardChanged.lua +2 -2
- package/dist/classes/callbacks/PostPickupSelectionFilter.lua +2 -2
- package/dist/classes/callbacks/PostPurchase.lua +2 -2
- package/dist/classes/callbacks/PostRoomClearChanged.lua +2 -2
- package/dist/classes/callbacks/PostTransformation.lua +2 -2
- package/dist/classes/callbacks/PreEntitySpawnFilter.lua +2 -2
- package/dist/classes/callbacks/PreRoomEntitySpawnFilter.lua +2 -2
- package/dist/classes/features/callbackLogic/GridEntityUpdateDetection.lua +2 -2
- package/dist/classes/features/other/DeployJSONRoom.lua +1 -1
- package/dist/classes/features/other/ExtraConsoleCommands.lua +1 -1
- package/dist/classes/features/other/NoSirenSteal.lua +1 -1
- package/dist/classes/features/other/PersistentEntities.lua +1 -1
- package/dist/classes/features/other/extraConsoleCommands/commands.lua +5 -5
- package/dist/functions/array.d.ts +3 -17
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/array.js +13 -31
- package/dist/functions/array.lua +45 -61
- package/dist/functions/bitSet128.lua +10 -6
- package/dist/functions/color.lua +10 -6
- package/dist/functions/debugFunctions.d.ts.map +1 -1
- package/dist/functions/debugFunctions.js +0 -1
- package/dist/functions/doors.lua +1 -1
- package/dist/functions/entities.lua +8 -4
- package/dist/functions/globals.lua +1 -1
- package/dist/functions/gridEntities.lua +1 -1
- package/dist/functions/input.lua +1 -1
- package/dist/functions/kColor.lua +10 -6
- package/dist/functions/logMisc.lua +0 -1
- package/dist/functions/map.d.ts +1 -1
- package/dist/functions/map.d.ts.map +1 -1
- package/dist/functions/map.js +0 -1
- package/dist/functions/rng.lua +10 -6
- package/dist/functions/roomShapeWalls.lua +5 -5
- package/dist/functions/set.d.ts +1 -1
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.js +0 -4
- package/dist/functions/sort.d.ts.map +1 -1
- package/dist/functions/sort.js +0 -1
- package/dist/functions/utils.d.ts +11 -1
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +19 -1
- package/dist/functions/utils.lua +17 -1
- package/dist/functions/vector.lua +10 -6
- package/dist/functions/weighted.lua +1 -1
- package/dist/index.rollup.d.ts +17 -21
- package/dist/isaacscript-common.lua +8184 -8126
- package/dist/maps/entityTypeVariantToBossIDMap.lua +1 -1
- package/dist/shouldFire.lua +56 -56
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +7 -10
- package/src/functions/array.ts +9 -33
- package/src/functions/debugFunctions.ts +0 -1
- package/src/functions/map.ts +1 -2
- package/src/functions/set.ts +6 -5
- package/src/functions/sort.ts +1 -1
- package/src/functions/utils.ts +19 -1
package/dist/functions/array.lua
CHANGED
|
@@ -15,7 +15,7 @@ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
|
15
15
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
16
16
|
local Set = ____lualib.Set
|
|
17
17
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
18
|
-
local
|
|
18
|
+
local __TS__ArrayToSorted = ____lualib.__TS__ArrayToSorted
|
|
19
19
|
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
|
|
20
20
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
21
21
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
@@ -37,52 +37,6 @@ local isTable = ____types.isTable
|
|
|
37
37
|
local ____utils = require("functions.utils")
|
|
38
38
|
local assertDefined = ____utils.assertDefined
|
|
39
39
|
local eRange = ____utils.eRange
|
|
40
|
-
--- Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
41
|
-
-- in the array, this function will do nothing.
|
|
42
|
-
--
|
|
43
|
-
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
44
|
-
--
|
|
45
|
-
-- If there is more than one matching element in the array, this function will remove every matching
|
|
46
|
-
-- element. If you want to only remove the first matching element, use the `arrayRemoveInPlace`
|
|
47
|
-
-- function instead.
|
|
48
|
-
--
|
|
49
|
-
-- @returns True if one or more elements were removed, false otherwise.
|
|
50
|
-
function ____exports.arrayRemoveAllInPlace(self, array, ...)
|
|
51
|
-
local elementsToRemove = {...}
|
|
52
|
-
local removedOneOrMoreElements = false
|
|
53
|
-
for ____, element in ipairs(elementsToRemove) do
|
|
54
|
-
local index
|
|
55
|
-
repeat
|
|
56
|
-
do
|
|
57
|
-
index = __TS__ArrayIndexOf(array, element)
|
|
58
|
-
if index > -1 then
|
|
59
|
-
removedOneOrMoreElements = true
|
|
60
|
-
__TS__ArraySplice(array, index, 1)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
until not (index > -1)
|
|
64
|
-
end
|
|
65
|
-
return removedOneOrMoreElements
|
|
66
|
-
end
|
|
67
|
-
--- Helper function to perform a shallow copy.
|
|
68
|
-
--
|
|
69
|
-
-- @param oldArray The array to copy.
|
|
70
|
-
-- @param numElements Optional. If specified, will only copy the first N elements. By default, the
|
|
71
|
-
-- entire array will be copied.
|
|
72
|
-
function ____exports.copyArray(self, oldArray, numElements)
|
|
73
|
-
if numElements == nil then
|
|
74
|
-
return {table.unpack(oldArray)}
|
|
75
|
-
end
|
|
76
|
-
local newArrayWithFirstNElements = {}
|
|
77
|
-
do
|
|
78
|
-
local i = 0
|
|
79
|
-
while i < numElements do
|
|
80
|
-
newArrayWithFirstNElements[#newArrayWithFirstNElements + 1] = oldArray[i + 1]
|
|
81
|
-
i = i + 1
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
return newArrayWithFirstNElements
|
|
85
|
-
end
|
|
86
40
|
function addCombinations(self, n, src, got, all)
|
|
87
41
|
if n == 0 then
|
|
88
42
|
if #got > 0 then
|
|
@@ -178,11 +132,9 @@ end
|
|
|
178
132
|
-- array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
179
133
|
-- copy of the array.
|
|
180
134
|
--
|
|
181
|
-
--
|
|
135
|
+
-- If there is more than one matching element in the array, this function will remove all of them.
|
|
182
136
|
--
|
|
183
|
-
--
|
|
184
|
-
-- matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
185
|
-
-- instead.
|
|
137
|
+
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
186
138
|
function ____exports.arrayRemove(self, originalArray, ...)
|
|
187
139
|
local elementsToRemove = {...}
|
|
188
140
|
local elementsToRemoveSet = __TS__New(ReadonlySet, elementsToRemove)
|
|
@@ -194,19 +146,32 @@ function ____exports.arrayRemove(self, originalArray, ...)
|
|
|
194
146
|
end
|
|
195
147
|
return array
|
|
196
148
|
end
|
|
197
|
-
---
|
|
198
|
-
--
|
|
199
|
-
-- array.
|
|
149
|
+
--- Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
150
|
+
-- in the array, this function will do nothing.
|
|
200
151
|
--
|
|
201
152
|
-- This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
202
153
|
--
|
|
203
154
|
-- If there is more than one matching element in the array, this function will remove every matching
|
|
204
|
-
-- element. If you want to only remove the first matching element, use the `
|
|
205
|
-
-- instead.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
155
|
+
-- element. If you want to only remove the first matching element, use the `arrayRemoveInPlace`
|
|
156
|
+
-- function instead.
|
|
157
|
+
--
|
|
158
|
+
-- @returns True if one or more elements were removed, false otherwise.
|
|
159
|
+
function ____exports.arrayRemoveAllInPlace(self, array, ...)
|
|
160
|
+
local elementsToRemove = {...}
|
|
161
|
+
local removedOneOrMoreElements = false
|
|
162
|
+
for ____, element in ipairs(elementsToRemove) do
|
|
163
|
+
local index
|
|
164
|
+
repeat
|
|
165
|
+
do
|
|
166
|
+
index = __TS__ArrayIndexOf(array, element)
|
|
167
|
+
if index > -1 then
|
|
168
|
+
removedOneOrMoreElements = true
|
|
169
|
+
__TS__ArraySplice(array, index, 1)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
until not (index > -1)
|
|
173
|
+
end
|
|
174
|
+
return removedOneOrMoreElements
|
|
210
175
|
end
|
|
211
176
|
--- Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
212
177
|
-- array, this function will do nothing.
|
|
@@ -303,6 +268,25 @@ function ____exports.combineArrays(self, ...)
|
|
|
303
268
|
end
|
|
304
269
|
return elements
|
|
305
270
|
end
|
|
271
|
+
--- Helper function to perform a shallow copy.
|
|
272
|
+
--
|
|
273
|
+
-- @param oldArray The array to copy.
|
|
274
|
+
-- @param numElements Optional. If specified, will only copy the first N elements. By default, the
|
|
275
|
+
-- entire array will be copied.
|
|
276
|
+
function ____exports.copyArray(self, oldArray, numElements)
|
|
277
|
+
if numElements == nil then
|
|
278
|
+
return {table.unpack(oldArray)}
|
|
279
|
+
end
|
|
280
|
+
local newArrayWithFirstNElements = {}
|
|
281
|
+
do
|
|
282
|
+
local i = 0
|
|
283
|
+
while i < numElements do
|
|
284
|
+
newArrayWithFirstNElements[#newArrayWithFirstNElements + 1] = oldArray[i + 1]
|
|
285
|
+
i = i + 1
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
return newArrayWithFirstNElements
|
|
289
|
+
end
|
|
306
290
|
--- Helper function to remove all of the elements in an array in-place.
|
|
307
291
|
function ____exports.emptyArray(self, array)
|
|
308
292
|
__TS__ArraySplice(array, 0)
|
|
@@ -389,7 +373,7 @@ function ____exports.getArrayDuplicateElements(self, array)
|
|
|
389
373
|
set:add(element)
|
|
390
374
|
end
|
|
391
375
|
local values = {__TS__Spread(duplicateElements)}
|
|
392
|
-
return
|
|
376
|
+
return __TS__ArrayToSorted(values, sortNormal)
|
|
393
377
|
end
|
|
394
378
|
--- Helper function to get an array containing the indexes of an array.
|
|
395
379
|
--
|
|
@@ -33,12 +33,16 @@ function ____exports.deserializeBitSet128(self, bitSet128)
|
|
|
33
33
|
if not isTable(nil, bitSet128) then
|
|
34
34
|
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
35
35
|
end
|
|
36
|
-
local l, h = table.unpack(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
local l, h = table.unpack(
|
|
37
|
+
getNumbersFromTable(
|
|
38
|
+
nil,
|
|
39
|
+
bitSet128,
|
|
40
|
+
OBJECT_NAME,
|
|
41
|
+
table.unpack(KEYS)
|
|
42
|
+
),
|
|
43
|
+
1,
|
|
44
|
+
2
|
|
45
|
+
)
|
|
42
46
|
assertDefined(nil, l, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: l")
|
|
43
47
|
assertDefined(nil, h, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: h")
|
|
44
48
|
return BitSet128(l, h)
|
package/dist/functions/color.lua
CHANGED
|
@@ -56,12 +56,16 @@ function ____exports.deserializeColor(self, color)
|
|
|
56
56
|
if not isTable(nil, color) then
|
|
57
57
|
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
58
58
|
end
|
|
59
|
-
local r, g, b, a, ro, go, bo = table.unpack(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
local r, g, b, a, ro, go, bo = table.unpack(
|
|
60
|
+
getNumbersFromTable(
|
|
61
|
+
nil,
|
|
62
|
+
color,
|
|
63
|
+
OBJECT_NAME,
|
|
64
|
+
table.unpack(KEYS)
|
|
65
|
+
),
|
|
66
|
+
1,
|
|
67
|
+
7
|
|
68
|
+
)
|
|
65
69
|
assertDefined(nil, r, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: R")
|
|
66
70
|
assertDefined(nil, g, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: G")
|
|
67
71
|
assertDefined(nil, b, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: B")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/debugFunctions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,GAAG,KAAK,EACjB,oBAAoB,UAAO,GAC1B,GAAG,CAEL;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,oBAAoB,UAAO,GAAG,GAAG,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"debugFunctions.d.ts","sourceRoot":"","sources":["../../src/functions/debugFunctions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,GAAG,KAAK,EACjB,oBAAoB,UAAO,GAC1B,GAAG,CAEL;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,oBAAoB,UAAO,GAAG,GAAG,GAAG,KAAK,CAmBhE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAa/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAG1C"}
|
|
@@ -43,7 +43,6 @@ function getTime(useSocketIfAvailable = true) {
|
|
|
43
43
|
return SandboxGetTime();
|
|
44
44
|
}
|
|
45
45
|
if (isLuaDebugEnabled()) {
|
|
46
|
-
// eslint-disable-next-line unicorn/prefer-module
|
|
47
46
|
const [ok, requiredSocket] = pcall(require, "socket");
|
|
48
47
|
if (ok) {
|
|
49
48
|
const socket = requiredSocket;
|
package/dist/functions/doors.lua
CHANGED
|
@@ -314,7 +314,7 @@ function ____exports.getRoomShapeDoorSlot(self, roomShape, x, y)
|
|
|
314
314
|
if doorSlot == nil or not isEnumValue(nil, doorSlot, DoorSlot) then
|
|
315
315
|
goto __continue40
|
|
316
316
|
end
|
|
317
|
-
local doorX, doorY = table.unpack(coordinates)
|
|
317
|
+
local doorX, doorY = table.unpack(coordinates, 1, 2)
|
|
318
318
|
if x == doorX and y == doorY then
|
|
319
319
|
return doorSlot
|
|
320
320
|
end
|
|
@@ -219,7 +219,7 @@ function ____exports.getConstituentsFromEntityID(self, entityID)
|
|
|
219
219
|
if #parts ~= 3 then
|
|
220
220
|
error("Failed to get the constituents from entity ID: " .. entityID)
|
|
221
221
|
end
|
|
222
|
-
local entityTypeString, variantString, subTypeString = table.unpack(parts)
|
|
222
|
+
local entityTypeString, variantString, subTypeString = table.unpack(parts, 1, 3)
|
|
223
223
|
assertDefined(nil, entityTypeString, "Failed to get the first constituent from an entity ID: " .. entityID)
|
|
224
224
|
assertDefined(nil, variantString, "Failed to get the second constituent from an entity ID: " .. entityID)
|
|
225
225
|
assertDefined(nil, subTypeString, "Failed to get the third constituent from an entity ID: " .. entityID)
|
|
@@ -436,7 +436,7 @@ function ____exports.parseEntityID(self, entityID)
|
|
|
436
436
|
if #entityIDArray ~= 3 then
|
|
437
437
|
return nil
|
|
438
438
|
end
|
|
439
|
-
local entityTypeString, variantString, subTypeString = table.unpack(entityIDArray)
|
|
439
|
+
local entityTypeString, variantString, subTypeString = table.unpack(entityIDArray, 1, 3)
|
|
440
440
|
if entityTypeString == nil or variantString == nil or subTypeString == nil then
|
|
441
441
|
return nil
|
|
442
442
|
end
|
|
@@ -459,7 +459,7 @@ function ____exports.parseEntityTypeVariantString(self, entityTypeVariantString)
|
|
|
459
459
|
if #entityTypeVariantArray ~= 2 then
|
|
460
460
|
return nil
|
|
461
461
|
end
|
|
462
|
-
local entityTypeString, variantString = table.unpack(entityTypeVariantArray)
|
|
462
|
+
local entityTypeString, variantString = table.unpack(entityTypeVariantArray, 1, 2)
|
|
463
463
|
if entityTypeString == nil or variantString == nil then
|
|
464
464
|
return nil
|
|
465
465
|
end
|
|
@@ -588,7 +588,11 @@ function ____exports.spawnEntityID(self, entityID, positionOrGridIndex, velocity
|
|
|
588
588
|
if velocity == nil then
|
|
589
589
|
velocity = VectorZero
|
|
590
590
|
end
|
|
591
|
-
local entityType, variant, subType = table.unpack(
|
|
591
|
+
local entityType, variant, subType = table.unpack(
|
|
592
|
+
____exports.getConstituentsFromEntityID(nil, entityID),
|
|
593
|
+
1,
|
|
594
|
+
3
|
|
595
|
+
)
|
|
592
596
|
return ____exports.spawn(
|
|
593
597
|
nil,
|
|
594
598
|
entityType,
|
|
@@ -237,7 +237,7 @@ function ____exports.logNewGlobals(self)
|
|
|
237
237
|
for ____, ____value in __TS__Iterator(__TS__ArrayEntries(newGlobals)) do
|
|
238
238
|
local i = ____value[1]
|
|
239
239
|
local tuple = ____value[2]
|
|
240
|
-
local key, value = table.unpack(tuple)
|
|
240
|
+
local key, value = table.unpack(tuple, 1, 2)
|
|
241
241
|
log((((tostring(i + 1) .. ") ") .. tostring(key)) .. " - ") .. tostring(value))
|
|
242
242
|
end
|
|
243
243
|
end
|
|
@@ -559,7 +559,7 @@ function ____exports.getConstituentsFromGridEntityID(self, gridEntityID)
|
|
|
559
559
|
if #parts ~= 2 then
|
|
560
560
|
error("Failed to get the constituents from a grid entity ID: " .. gridEntityID)
|
|
561
561
|
end
|
|
562
|
-
local gridEntityTypeString, variantString = table.unpack(parts)
|
|
562
|
+
local gridEntityTypeString, variantString = table.unpack(parts, 1, 2)
|
|
563
563
|
assertDefined(nil, gridEntityTypeString, "Failed to get the first constituent from a grid entity ID: " .. gridEntityID)
|
|
564
564
|
assertDefined(nil, variantString, "Failed to get the second constituent from a grid entity ID: " .. gridEntityID)
|
|
565
565
|
local gridEntityType = parseIntSafe(nil, gridEntityTypeString)
|
package/dist/functions/input.lua
CHANGED
|
@@ -204,7 +204,7 @@ function ____exports.keyboardToString(self, keyboard, uppercase)
|
|
|
204
204
|
if tuple == nil then
|
|
205
205
|
return nil
|
|
206
206
|
end
|
|
207
|
-
local lowercaseCharacter, uppercaseCharacter = table.unpack(tuple)
|
|
207
|
+
local lowercaseCharacter, uppercaseCharacter = table.unpack(tuple, 1, 2)
|
|
208
208
|
return uppercase and uppercaseCharacter or lowercaseCharacter
|
|
209
209
|
end
|
|
210
210
|
return ____exports
|
|
@@ -37,12 +37,16 @@ function ____exports.deserializeKColor(self, kColor)
|
|
|
37
37
|
if not isTable(nil, kColor) then
|
|
38
38
|
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
39
39
|
end
|
|
40
|
-
local r, g, b, a = table.unpack(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
local r, g, b, a = table.unpack(
|
|
41
|
+
getNumbersFromTable(
|
|
42
|
+
nil,
|
|
43
|
+
kColor,
|
|
44
|
+
OBJECT_NAME,
|
|
45
|
+
table.unpack(KEYS)
|
|
46
|
+
),
|
|
47
|
+
1,
|
|
48
|
+
4
|
|
49
|
+
)
|
|
46
50
|
assertDefined(nil, r, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Red")
|
|
47
51
|
assertDefined(nil, g, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Green")
|
|
48
52
|
assertDefined(nil, b, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Blue")
|
|
@@ -6,7 +6,6 @@ local __TS__Iterator = ____lualib.__TS__Iterator
|
|
|
6
6
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
7
7
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
8
8
|
local __TS__New = ____lualib.__TS__New
|
|
9
|
-
local Set = ____lualib.Set
|
|
10
9
|
local ____exports = {}
|
|
11
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
12
11
|
local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
|
package/dist/functions/map.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function mapSetHash<V>(map: Map<PtrHash, V>, entity: Entity, valu
|
|
|
54
54
|
*
|
|
55
55
|
* Also see the `objectToReadonlyMap` function.
|
|
56
56
|
*/
|
|
57
|
-
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>):
|
|
57
|
+
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
58
58
|
/**
|
|
59
59
|
* Helper function to convert an object to a read-only map.
|
|
60
60
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/functions/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,mGAAmG;AAEnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAOlE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EACtD,GAAG,EAAE,UAAU,CAAC,OAAO,EAAE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AAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EACjC,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACrB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQnB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAE1B,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAGN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EAC/D,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACvE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAEnB;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,CAGhE"}
|
package/dist/functions/map.js
CHANGED
package/dist/functions/rng.lua
CHANGED
|
@@ -69,12 +69,16 @@ function ____exports.deserializeRNG(self, rng)
|
|
|
69
69
|
if not isTable(nil, rng) then
|
|
70
70
|
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
71
71
|
end
|
|
72
|
-
local seed = table.unpack(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
local seed = table.unpack(
|
|
73
|
+
getNumbersFromTable(
|
|
74
|
+
nil,
|
|
75
|
+
rng,
|
|
76
|
+
OBJECT_NAME,
|
|
77
|
+
table.unpack(KEYS)
|
|
78
|
+
),
|
|
79
|
+
1,
|
|
80
|
+
1
|
|
81
|
+
)
|
|
78
82
|
assertDefined(nil, seed, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: seed")
|
|
79
83
|
return ____exports.newRNG(nil, seed)
|
|
80
84
|
end
|
|
@@ -45,7 +45,7 @@ function ____exports.getVanillaWallGridIndexSetForRoomShape(self, roomShape)
|
|
|
45
45
|
local ____cond5 = ____switch5 == RoomShape.LTL
|
|
46
46
|
if ____cond5 then
|
|
47
47
|
do
|
|
48
|
-
local topMiddle, topRight, middleLeft, middle, bottomLeft, bottomRight = table.unpack(corners)
|
|
48
|
+
local topMiddle, topRight, middleLeft, middle, bottomLeft, bottomRight = table.unpack(corners, 1, 6)
|
|
49
49
|
local ____ReadonlySet_1 = ReadonlySet
|
|
50
50
|
local ____array_0 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topMiddle.gridIndex, topRight.gridIndex, roomShape)))
|
|
51
51
|
__TS__SparseArrayPush(
|
|
@@ -77,7 +77,7 @@ function ____exports.getVanillaWallGridIndexSetForRoomShape(self, roomShape)
|
|
|
77
77
|
____cond5 = ____cond5 or ____switch5 == RoomShape.LTR
|
|
78
78
|
if ____cond5 then
|
|
79
79
|
do
|
|
80
|
-
local topLeft, topMiddle, middle, middleRight, bottomLeft, bottomRight = table.unpack(corners)
|
|
80
|
+
local topLeft, topMiddle, middle, middleRight, bottomLeft, bottomRight = table.unpack(corners, 1, 6)
|
|
81
81
|
local ____ReadonlySet_3 = ReadonlySet
|
|
82
82
|
local ____array_2 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topMiddle.gridIndex, roomShape)))
|
|
83
83
|
__TS__SparseArrayPush(
|
|
@@ -109,7 +109,7 @@ function ____exports.getVanillaWallGridIndexSetForRoomShape(self, roomShape)
|
|
|
109
109
|
____cond5 = ____cond5 or ____switch5 == RoomShape.LBL
|
|
110
110
|
if ____cond5 then
|
|
111
111
|
do
|
|
112
|
-
local topLeft, topRight, middleLeft, middle, bottomMiddle, bottomRight = table.unpack(corners)
|
|
112
|
+
local topLeft, topRight, middleLeft, middle, bottomMiddle, bottomRight = table.unpack(corners, 1, 6)
|
|
113
113
|
local ____ReadonlySet_5 = ReadonlySet
|
|
114
114
|
local ____array_4 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
|
|
115
115
|
__TS__SparseArrayPush(
|
|
@@ -141,7 +141,7 @@ function ____exports.getVanillaWallGridIndexSetForRoomShape(self, roomShape)
|
|
|
141
141
|
____cond5 = ____cond5 or ____switch5 == RoomShape.LBR
|
|
142
142
|
if ____cond5 then
|
|
143
143
|
do
|
|
144
|
-
local topLeft, topRight, middle, middleRight, bottomLeft, bottomMiddle = table.unpack(corners)
|
|
144
|
+
local topLeft, topRight, middle, middleRight, bottomLeft, bottomMiddle = table.unpack(corners, 1, 6)
|
|
145
145
|
local ____ReadonlySet_7 = ReadonlySet
|
|
146
146
|
local ____array_6 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
|
|
147
147
|
__TS__SparseArrayPush(
|
|
@@ -181,7 +181,7 @@ function getVanillaWallGridIndexSetForRectangleRoomShape(self, roomShape, corner
|
|
|
181
181
|
if #corners ~= 4 then
|
|
182
182
|
error("Failed to get the correct amount of corners for rectangular room shape.")
|
|
183
183
|
end
|
|
184
|
-
local topLeft, topRight, bottomLeft, bottomRight = table.unpack(corners)
|
|
184
|
+
local topLeft, topRight, bottomLeft, bottomRight = table.unpack(corners, 1, 4)
|
|
185
185
|
local ____ReadonlySet_9 = ReadonlySet
|
|
186
186
|
local ____array_8 = __TS__SparseArrayNew(table.unpack(getGridIndexesBetween(nil, topLeft.gridIndex, topRight.gridIndex, roomShape)))
|
|
187
187
|
__TS__SparseArrayPush(
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: ReadonlyA
|
|
|
10
10
|
*
|
|
11
11
|
* This function is variadic, meaning that you can specify N sets.
|
|
12
12
|
*/
|
|
13
|
-
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
|
|
13
|
+
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>): ReadonlySet<T>;
|
|
14
14
|
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
15
15
|
export declare function copySet<T>(oldSet: ReadonlySet<T>): Set<T>;
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAE5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI,CAMN;AAED;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAE5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrC,WAAW,CAAC,CAAC,CAAC,CAShB;AAED,mGAAmG;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CAAC,CAAC,CAAC,CAQR;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAClC,CAAC,EACD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAEtC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACrE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAEnB,GAAG,CAAC,CAAC,CAAC,CAQR;AAED;;;;;GAKG;AAEH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAItE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EACnB,GAAG,QAAQ,EAAE,SAAS,CAAC,EAAE,GACxB,OAAO,CAET;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAGvD"}
|
package/dist/functions/set.js
CHANGED
|
@@ -38,7 +38,6 @@ mainSet, ...setsToAdd) {
|
|
|
38
38
|
*
|
|
39
39
|
* This function is variadic, meaning that you can specify N sets.
|
|
40
40
|
*/
|
|
41
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
42
41
|
function combineSets(...sets) {
|
|
43
42
|
const newSet = new Set();
|
|
44
43
|
for (const set of sets) {
|
|
@@ -118,7 +117,6 @@ function getSetCombinations(set, includeEmptyArray) {
|
|
|
118
117
|
* Normally, set values are returned in insertion order, so use this function when the ordering of
|
|
119
118
|
* the contents is important.
|
|
120
119
|
*/
|
|
121
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
122
120
|
function getSortedSetValues(set) {
|
|
123
121
|
const values = [...set];
|
|
124
122
|
// Check for problematic types in order to throw a helpful error message.
|
|
@@ -151,7 +149,6 @@ function objectKeysToReadonlySet(object) {
|
|
|
151
149
|
*
|
|
152
150
|
* Also see the `objectKeysToReadonlySet` function.
|
|
153
151
|
*/
|
|
154
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
155
152
|
function objectKeysToSet(object) {
|
|
156
153
|
const set = new Set();
|
|
157
154
|
for (const key of Object.keys(object)) {
|
|
@@ -178,7 +175,6 @@ function objectValuesToReadonlySet(object) {
|
|
|
178
175
|
*
|
|
179
176
|
* Also see the `objectValuesToReadonlySet` function.
|
|
180
177
|
*/
|
|
181
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
182
178
|
function objectValuesToSet(object) {
|
|
183
179
|
const set = new Set();
|
|
184
180
|
for (const key of Object.values(object)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA0B7D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,IACtC,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAsB5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,CAAC,EAAE,SAAS,CAAC,EAAE,EACf,CAAC,EAAE,SAAS,CAAC,EAAE,GACd,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAiDZ;AAED;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA0B7D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,IACtC,GAAG,OAAO,EAAE,GAAG,OAAO,KAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAsB5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,CAAC,EAAE,SAAS,CAAC,EAAE,EACf,CAAC,EAAE,SAAS,CAAC,EAAE,GACd,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAiDZ;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAE1B,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAc,GAEhD,CAAC,EAAE,CAuDL"}
|
package/dist/functions/sort.js
CHANGED
|
@@ -105,7 +105,6 @@ function sortTwoDimensionalArray(a, b) {
|
|
|
105
105
|
*
|
|
106
106
|
* Under the hood, this uses the merge sort algorithm.
|
|
107
107
|
*/
|
|
108
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
109
108
|
function stableSort(
|
|
110
109
|
// eslint-disable-next-line complete/prefer-readonly-parameter-types
|
|
111
110
|
array, sortFunc = sortNormal) {
|
|
@@ -88,7 +88,7 @@ export declare function inRange(num: int, start: int, end: int): boolean;
|
|
|
88
88
|
*/
|
|
89
89
|
export declare function isMultiplayer(): boolean;
|
|
90
90
|
/**
|
|
91
|
-
* Helper function to check if the player
|
|
91
|
+
* Helper function to check if the player has the Repentance DLC installed.
|
|
92
92
|
*
|
|
93
93
|
* This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
94
94
|
*
|
|
@@ -96,6 +96,16 @@ export declare function isMultiplayer(): boolean;
|
|
|
96
96
|
* https://bindingofisaacrebirth.fandom.com/wiki/V1.06.J818#Lua_Changes
|
|
97
97
|
*/
|
|
98
98
|
export declare function isRepentance(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to check if the player has the Repentance+ DLC installed.
|
|
101
|
+
*
|
|
102
|
+
* This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
103
|
+
* safe.
|
|
104
|
+
*
|
|
105
|
+
* Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
106
|
+
* https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
107
|
+
*/
|
|
108
|
+
export declare function isRepentancePlus(): boolean;
|
|
99
109
|
/**
|
|
100
110
|
* Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
101
111
|
* API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAC7B,CAAC,MAAM,CAAC,GACR;IACE,iFAAiF;CAClF,GACJ,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,CAIxC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GACxB,CAAC,MAAM,CAAC,GACR;IACE,4EAA4E;CAC7E,GACJ,OAAO,CAAC,KAAK,IA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.isRepentance = isRepentance;
|
|
11
|
+
exports.isRepentancePlus = isRepentancePlus;
|
|
11
12
|
exports.isRepentogon = isRepentogon;
|
|
12
13
|
exports.repeat = repeat;
|
|
13
14
|
exports.todo = todo;
|
|
15
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
14
16
|
const ReadonlySet_1 = require("../types/ReadonlySet");
|
|
15
17
|
const playerIndex_1 = require("./playerIndex");
|
|
16
18
|
const types_1 = require("./types");
|
|
@@ -136,7 +138,7 @@ function isMultiplayer() {
|
|
|
136
138
|
return controllerIndexesSet.size > 1;
|
|
137
139
|
}
|
|
138
140
|
/**
|
|
139
|
-
* Helper function to check if the player
|
|
141
|
+
* Helper function to check if the player has the Repentance DLC installed.
|
|
140
142
|
*
|
|
141
143
|
* This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
142
144
|
*
|
|
@@ -151,6 +153,22 @@ function isRepentance() {
|
|
|
151
153
|
const getAnimation = classTable.get("GetAnimation");
|
|
152
154
|
return (0, types_1.isFunction)(getAnimation);
|
|
153
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Helper function to check if the player has the Repentance+ DLC installed.
|
|
158
|
+
*
|
|
159
|
+
* This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
160
|
+
* safe.
|
|
161
|
+
*
|
|
162
|
+
* Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
163
|
+
* https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
164
|
+
*/
|
|
165
|
+
function isRepentancePlus() {
|
|
166
|
+
const room = cachedClasses_1.game.GetRoom();
|
|
167
|
+
const metatable = getmetatable(room);
|
|
168
|
+
assertDefined(metatable, "Failed to get the metatable of the room class.");
|
|
169
|
+
const damageGridWithSource = metatable.get("DamageGridWithSource");
|
|
170
|
+
return (0, types_1.isFunction)(damageGridWithSource);
|
|
171
|
+
}
|
|
154
172
|
/**
|
|
155
173
|
* Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
156
174
|
* API.
|
package/dist/functions/utils.lua
CHANGED
|
@@ -2,6 +2,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local ____exports = {}
|
|
5
|
+
local ____cachedClasses = require("core.cachedClasses")
|
|
6
|
+
local game = ____cachedClasses.game
|
|
5
7
|
local ____ReadonlySet = require("types.ReadonlySet")
|
|
6
8
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
7
9
|
local ____playerIndex = require("functions.playerIndex")
|
|
@@ -134,7 +136,7 @@ function ____exports.isMultiplayer(self)
|
|
|
134
136
|
local controllerIndexesSet = __TS__New(ReadonlySet, controllerIndexes)
|
|
135
137
|
return controllerIndexesSet.size > 1
|
|
136
138
|
end
|
|
137
|
-
--- Helper function to check if the player
|
|
139
|
+
--- Helper function to check if the player has the Repentance DLC installed.
|
|
138
140
|
--
|
|
139
141
|
-- This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
|
|
140
142
|
--
|
|
@@ -148,6 +150,20 @@ function ____exports.isRepentance(self)
|
|
|
148
150
|
local getAnimation = classTable.GetAnimation
|
|
149
151
|
return isFunction(nil, getAnimation)
|
|
150
152
|
end
|
|
153
|
+
--- Helper function to check if the player has the Repentance+ DLC installed.
|
|
154
|
+
--
|
|
155
|
+
-- This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
|
|
156
|
+
-- safe.
|
|
157
|
+
--
|
|
158
|
+
-- Specifically, this function checks for `Room:DamageGridWithSource` method:
|
|
159
|
+
-- https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
|
|
160
|
+
function ____exports.isRepentancePlus(self)
|
|
161
|
+
local room = game:GetRoom()
|
|
162
|
+
local metatable = getmetatable(room)
|
|
163
|
+
____exports.assertDefined(nil, metatable, "Failed to get the metatable of the room class.")
|
|
164
|
+
local damageGridWithSource = metatable.DamageGridWithSource
|
|
165
|
+
return isFunction(nil, damageGridWithSource)
|
|
166
|
+
end
|
|
151
167
|
--- Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
|
|
152
168
|
-- API.
|
|
153
169
|
--
|
|
@@ -39,12 +39,16 @@ function ____exports.deserializeVector(self, vector)
|
|
|
39
39
|
if not isTable(nil, vector) then
|
|
40
40
|
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
41
41
|
end
|
|
42
|
-
local x, y = table.unpack(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
local x, y = table.unpack(
|
|
43
|
+
getNumbersFromTable(
|
|
44
|
+
nil,
|
|
45
|
+
vector,
|
|
46
|
+
OBJECT_NAME,
|
|
47
|
+
table.unpack(KEYS)
|
|
48
|
+
),
|
|
49
|
+
1,
|
|
50
|
+
2
|
|
51
|
+
)
|
|
48
52
|
assertDefined(nil, x, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: X")
|
|
49
53
|
assertDefined(nil, y, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Y")
|
|
50
54
|
return Vector(x, y)
|