isaacscript-common 4.5.1 → 4.6.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/constants.d.ts +0 -3
- package/constantsFirstLast.d.ts +0 -3
- package/features/characterHealthConversion.d.ts +6 -0
- package/features/characterStats.d.ts +5 -0
- package/features/deployJSONRoom.lua +2 -4
- package/features/disableAllSound.d.ts +0 -3
- package/features/registerHotkey.lua +1 -1
- package/functions/array.d.ts +30 -1
- package/functions/array.lua +84 -5
- package/functions/bitwise.d.ts +17 -0
- package/functions/bitwise.lua +41 -0
- package/functions/color.d.ts +1 -1
- package/functions/doors.d.ts +6 -0
- package/functions/doors.lua +23 -2
- package/functions/gridEntity.d.ts +12 -0
- package/functions/gridEntity.lua +15 -2
- package/functions/kColor.d.ts +1 -1
- package/functions/log.d.ts +2 -2
- package/functions/rng.d.ts +1 -1
- package/functions/rng.lua +6 -2
- package/functions/roomShape.d.ts +2 -2
- package/functions/rooms.d.ts +1 -0
- package/functions/rooms.lua +1 -0
- package/functions/set.d.ts +17 -0
- package/functions/set.lua +24 -0
- package/functions/stage.d.ts +6 -1
- package/functions/stage.lua +7 -0
- package/functions/vector.d.ts +1 -1
- package/index.d.ts +0 -1
- package/index.lua +0 -8
- package/initFeatures.lua +3 -3
- package/maps/roomTypeMap.lua +0 -1
- package/objects/doorSlotToDoorSlotFlag.d.ts +4 -0
- package/objects/doorSlotToDoorSlotFlag.lua +17 -0
- package/objects/roomShapeBounds.d.ts +1 -1
- package/objects/roomShapeBounds.lua +8 -8
- package/objects/roomShapeLayoutSizes.d.ts +1 -1
- package/objects/roomShapeLayoutSizes.lua +4 -4
- package/objects/roomTypeGotoPrefixes.d.ts +4 -0
- package/objects/roomTypeGotoPrefixes.lua +35 -0
- package/objects/roomTypeNames.lua +0 -1
- package/package.json +2 -2
- package/types/CollectibleIndex.d.ts +1 -1
- package/types/PickingUpItem.d.ts +3 -3
- package/types/PickingUpItem.lua +3 -3
- package/types/PlayerIndex.d.ts +1 -1
- package/types/private/IsaacAPIClass.d.ts +1 -1
- package/types/private/SerializedIsaacAPIClass.d.ts +1 -1
- package/types/private/TSTLClass.d.ts +1 -1
- package/enums/StageTravelEntityState.d.ts +0 -4
- package/enums/StageTravelEntityState.lua +0 -7
- package/enums/StageTravelState.d.ts +0 -6
- package/enums/StageTravelState.lua +0 -11
- package/features/customTrapdoor/constants.d.ts +0 -5
- package/features/customTrapdoor/constants.lua +0 -7
- package/features/customTrapdoor/exports.d.ts +0 -37
- package/features/customTrapdoor/exports.lua +0 -124
- package/features/customTrapdoor/init.d.ts +0 -1
- package/features/customTrapdoor/init.lua +0 -11
- package/features/customTrapdoor/stageTravel.d.ts +0 -0
- package/features/customTrapdoor/stageTravel.lua +0 -0
- package/features/customTrapdoor/trapdoor.d.ts +0 -0
- package/features/customTrapdoor/trapdoor.lua +0 -0
- package/features/customTrapdoor/v.d.ts +0 -14
- package/features/customTrapdoor/v.lua +0 -16
- package/interfaces/StageTravelEntityDescription.d.ts +0 -5
- package/interfaces/StageTravelEntityDescription.lua +0 -2
package/constants.d.ts
CHANGED
package/constantsFirstLast.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Constants (First and Last)
|
|
3
|
-
*/
|
|
4
1
|
import { Card, CollectibleType, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
5
2
|
/** Equal to `CollectibleType.SAD_ONION`. */
|
|
6
3
|
export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Easily create custom characters that have the same health mechanic as Blue Baby (red heart
|
|
3
|
+
* containers --> soul hearts) or Black Judas (red heart containers --> black hearts).
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
1
7
|
import { HeartSubType, PlayerType } from "isaac-typescript-definitions";
|
|
2
8
|
export declare type ConversionHeartSubType = HeartSubType.SOUL | HeartSubType.BLACK;
|
|
3
9
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Easily create custom characters that have base stats different from that of Isaac.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
1
6
|
import { CacheFlag, PlayerType } from "isaac-typescript-definitions";
|
|
2
7
|
/**
|
|
3
8
|
* Helper function to manage the stats for a vanilla or custom character. Call this function once at
|
|
@@ -37,6 +37,7 @@ local removeAllBombs = ____entitySpecific.removeAllBombs
|
|
|
37
37
|
local removeAllPickups = ____entitySpecific.removeAllPickups
|
|
38
38
|
local ____gridEntity = require("functions.gridEntity")
|
|
39
39
|
local convertXMLGridEntityType = ____gridEntity.convertXMLGridEntityType
|
|
40
|
+
local getAllGridIndexes = ____gridEntity.getAllGridIndexes
|
|
40
41
|
local getGridEntities = ____gridEntity.getGridEntities
|
|
41
42
|
local removeAllGridExcept = ____gridEntity.removeAllGridExcept
|
|
42
43
|
local removeGrid = ____gridEntity.removeGrid
|
|
@@ -59,8 +60,6 @@ local setRoomCleared = ____rooms.setRoomCleared
|
|
|
59
60
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
60
61
|
local ____spawnCollectible = require("functions.spawnCollectible")
|
|
61
62
|
local spawnCollectible = ____spawnCollectible.spawnCollectible
|
|
62
|
-
local ____utils = require("functions.utils")
|
|
63
|
-
local erange = ____utils.erange
|
|
64
63
|
local ____runInNFrames = require("features.runInNFrames")
|
|
65
64
|
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
66
65
|
local ____exports = require("features.saveDataManager.exports")
|
|
@@ -182,10 +181,9 @@ function removeSpecificNPCs(self)
|
|
|
182
181
|
end
|
|
183
182
|
function fillRoomWithDecorations(self)
|
|
184
183
|
local room = game:GetRoom()
|
|
185
|
-
local gridSize = room:GetGridSize()
|
|
186
184
|
local roomListIndex = getRoomListIndex(nil)
|
|
187
185
|
local decorationGridIndexes = v.level.roomToDecorationGridIndexesMap:getAndSetDefault(roomListIndex)
|
|
188
|
-
for ____, gridIndex in ipairs(
|
|
186
|
+
for ____, gridIndex in ipairs(getAllGridIndexes(nil)) do
|
|
189
187
|
do
|
|
190
188
|
local existingGridEntity = room:GetGridEntity(gridIndex)
|
|
191
189
|
if existingGridEntity ~= nil then
|
|
@@ -30,7 +30,7 @@ hotkeyFunctionMap = __TS__New(Map)
|
|
|
30
30
|
keyPressedMap = __TS__New(DefaultMap, false)
|
|
31
31
|
---
|
|
32
32
|
-- @internal
|
|
33
|
-
function ____exports.
|
|
33
|
+
function ____exports.registerHotkeyInit(self, mod)
|
|
34
34
|
mod:AddCallback(ModCallback.POST_RENDER, postRender)
|
|
35
35
|
end
|
|
36
36
|
function ____exports.registerHotkey(self, keyboard, func)
|
package/functions/array.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare function arrayRemoveIndex<T>(originalArray: T[] | readonly T[], .
|
|
|
37
37
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
38
38
|
*/
|
|
39
39
|
export declare function arrayRemoveIndexInPlace<T>(array: T[], ...indexesToRemove: int[]): boolean;
|
|
40
|
-
export declare function arrayToString<T>(array: T[]): string;
|
|
40
|
+
export declare function arrayToString<T>(array: T[] | readonly T[]): string;
|
|
41
41
|
/**
|
|
42
42
|
* Helper function to combine two or more arrays. Returns a new array that is the composition of all
|
|
43
43
|
* of the specified arrays.
|
|
@@ -56,6 +56,30 @@ export declare function combineArrays<T>(...arrays: Array<T[] | readonly T[]>):
|
|
|
56
56
|
export declare function copyArray<T>(oldArray: T[] | readonly T[], numElements?: int): T[];
|
|
57
57
|
/** Helper function to remove all of the elements in an array in-place. */
|
|
58
58
|
export declare function emptyArray<T>(array: T[]): void;
|
|
59
|
+
/**
|
|
60
|
+
* Helper function to get all possible combinations of the given array. This includes the
|
|
61
|
+
* combination of an empty array.
|
|
62
|
+
*
|
|
63
|
+
* For example, if this function is provided an array containing 1, 2, and 3, then it will return an
|
|
64
|
+
* array containing the following arrays:
|
|
65
|
+
*
|
|
66
|
+
* - []
|
|
67
|
+
* - [1]
|
|
68
|
+
* - [2]
|
|
69
|
+
* - [3]
|
|
70
|
+
* - [1, 2]
|
|
71
|
+
* - [1, 3]
|
|
72
|
+
* - [2, 3]
|
|
73
|
+
* - [1, 2, 3]
|
|
74
|
+
*
|
|
75
|
+
* From: https://github.com/firstandthird/combinations/blob/master/index.js
|
|
76
|
+
*
|
|
77
|
+
* @param array The array to get the combinations of.
|
|
78
|
+
* @param min Optional. The minimum number of elements to include in each combination. Default is 1.
|
|
79
|
+
* @param max Optional. The maximum number of elements to include in each combination. Default is
|
|
80
|
+
* the length of the array.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getArrayCombinations<T>(array: T[] | readonly T[], min?: int, max?: int): ReadonlyArray<readonly T[]>;
|
|
59
83
|
/**
|
|
60
84
|
* Helper function to get an array containing the indexes of an array.
|
|
61
85
|
*
|
|
@@ -141,4 +165,9 @@ export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedO
|
|
|
141
165
|
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
142
166
|
*/
|
|
143
167
|
export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG?: Seed | RNG): void;
|
|
168
|
+
/** Helper function to sum every value in an array together. */
|
|
144
169
|
export declare function sumArray(array: number[] | readonly number[]): number;
|
|
170
|
+
/**
|
|
171
|
+
* Helper function to swap two different array elements. (The elements will be swapped in-place.)
|
|
172
|
+
*/
|
|
173
|
+
export declare function swapArrayElements<T>(array: T[], i: number, j: number): void;
|
package/functions/array.lua
CHANGED
|
@@ -8,6 +8,9 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
|
8
8
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
9
9
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
10
10
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
11
|
+
local __TS__ArraySlice = ____lualib.__TS__ArraySlice
|
|
12
|
+
local __TS__ArrayConcat = ____lualib.__TS__ArrayConcat
|
|
13
|
+
local __TS__ArrayUnshift = ____lualib.__TS__ArrayUnshift
|
|
11
14
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
12
15
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
13
16
|
local __TS__ArrayReduce = ____lualib.__TS__ArrayReduce
|
|
@@ -50,16 +53,20 @@ function ____exports.shuffleArrayInPlace(self, array, seedOrRNG)
|
|
|
50
53
|
seedOrRNG = getRandomSeed(nil)
|
|
51
54
|
end
|
|
52
55
|
local currentIndex = #array
|
|
53
|
-
local randomIndex
|
|
54
56
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
55
57
|
while currentIndex > 0 do
|
|
56
58
|
currentIndex = currentIndex - 1
|
|
57
|
-
randomIndex = ____exports.getRandomArrayIndex(nil, array, rng)
|
|
58
|
-
|
|
59
|
-
array[currentIndex + 1] = ____temp_0[1]
|
|
60
|
-
array[randomIndex + 1] = ____temp_0[2]
|
|
59
|
+
local randomIndex = ____exports.getRandomArrayIndex(nil, array, rng)
|
|
60
|
+
____exports.swapArrayElements(nil, array, currentIndex, randomIndex)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
|
+
--- Helper function to swap two different array elements. (The elements will be swapped in-place.)
|
|
64
|
+
function ____exports.swapArrayElements(self, array, i, j)
|
|
65
|
+
local value1 = array[i + 1]
|
|
66
|
+
local value2 = array[j + 1]
|
|
67
|
+
array[i + 1] = value2
|
|
68
|
+
array[j + 1] = value1
|
|
69
|
+
end
|
|
63
70
|
--- Helper function for determining if two arrays contain the exact same elements. Note that this
|
|
64
71
|
-- only performs a shallow comparison.
|
|
65
72
|
function ____exports.arrayEquals(self, array1, array2)
|
|
@@ -201,6 +208,77 @@ end
|
|
|
201
208
|
function ____exports.emptyArray(self, array)
|
|
202
209
|
__TS__ArraySplice(array, 0, #array)
|
|
203
210
|
end
|
|
211
|
+
--- Helper function to get all possible combinations of the given array. This includes the
|
|
212
|
+
-- combination of an empty array.
|
|
213
|
+
--
|
|
214
|
+
-- For example, if this function is provided an array containing 1, 2, and 3, then it will return an
|
|
215
|
+
-- array containing the following arrays:
|
|
216
|
+
--
|
|
217
|
+
-- - []
|
|
218
|
+
-- - [1]
|
|
219
|
+
-- - [2]
|
|
220
|
+
-- - [3]
|
|
221
|
+
-- - [1, 2]
|
|
222
|
+
-- - [1, 3]
|
|
223
|
+
-- - [2, 3]
|
|
224
|
+
-- - [1, 2, 3]
|
|
225
|
+
--
|
|
226
|
+
-- From: https://github.com/firstandthird/combinations/blob/master/index.js
|
|
227
|
+
--
|
|
228
|
+
-- @param array The array to get the combinations of.
|
|
229
|
+
-- @param min Optional. The minimum number of elements to include in each combination. Default is 1.
|
|
230
|
+
-- @param max Optional. The maximum number of elements to include in each combination. Default is
|
|
231
|
+
-- the length of the array.
|
|
232
|
+
function ____exports.getArrayCombinations(self, array, min, max)
|
|
233
|
+
if min == nil or min <= 0 then
|
|
234
|
+
min = 1
|
|
235
|
+
end
|
|
236
|
+
if max == nil or max <= 0 then
|
|
237
|
+
max = #array
|
|
238
|
+
end
|
|
239
|
+
local addCombinations
|
|
240
|
+
addCombinations = function(____, n, src, got, all)
|
|
241
|
+
if n == 0 then
|
|
242
|
+
if #got > 0 then
|
|
243
|
+
all[#all + 1] = got
|
|
244
|
+
end
|
|
245
|
+
return
|
|
246
|
+
end
|
|
247
|
+
do
|
|
248
|
+
local j = 0
|
|
249
|
+
while j < #src do
|
|
250
|
+
local value = src[j + 1]
|
|
251
|
+
addCombinations(
|
|
252
|
+
nil,
|
|
253
|
+
n - 1,
|
|
254
|
+
__TS__ArraySlice(src, j + 1),
|
|
255
|
+
__TS__ArrayConcat(got, {value}),
|
|
256
|
+
all
|
|
257
|
+
)
|
|
258
|
+
j = j + 1
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
local all = {}
|
|
263
|
+
do
|
|
264
|
+
local i = min
|
|
265
|
+
while i < #array do
|
|
266
|
+
addCombinations(
|
|
267
|
+
nil,
|
|
268
|
+
i,
|
|
269
|
+
array,
|
|
270
|
+
{},
|
|
271
|
+
all
|
|
272
|
+
)
|
|
273
|
+
i = i + 1
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
if #array == max then
|
|
277
|
+
all[#all + 1] = array
|
|
278
|
+
end
|
|
279
|
+
__TS__ArrayUnshift(all, {})
|
|
280
|
+
return all
|
|
281
|
+
end
|
|
204
282
|
--- Helper function to get an array containing the indexes of an array.
|
|
205
283
|
--
|
|
206
284
|
-- For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
|
|
@@ -351,6 +429,7 @@ function ____exports.shuffleArray(self, originalArray, seedOrRNG)
|
|
|
351
429
|
____exports.shuffleArrayInPlace(nil, array, seedOrRNG)
|
|
352
430
|
return array
|
|
353
431
|
end
|
|
432
|
+
--- Helper function to sum every value in an array together.
|
|
354
433
|
function ____exports.sumArray(self, array)
|
|
355
434
|
return __TS__ArrayReduce(
|
|
356
435
|
array,
|
package/functions/bitwise.d.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
5
|
+
/** Helper function to convert a set of flags to a single `BitFlags` object. */
|
|
6
|
+
export declare function arrayToBitFlags<T extends BitFlag | BitFlag128>(array: T[] | readonly T[]): BitFlags<T>;
|
|
7
|
+
/** Helper function to convert an array of bits to the resulting decimal number. */
|
|
8
|
+
export declare function convertBinaryToDecimal(bits: int[]): number;
|
|
9
|
+
/** Helper function to convert a number to an array of bits. */
|
|
10
|
+
export declare function convertDecimalToBinary(number: number): int[];
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to count the number of bits that are set to 1 in a binary representation of a
|
|
13
|
+
* number.
|
|
14
|
+
*/
|
|
2
15
|
export declare function countSetBits(n: int): int;
|
|
16
|
+
/** Helper function to get the value of a specific but in a binary representation of a number. */
|
|
3
17
|
export declare function getKBitOfN(k: int, n: int): int;
|
|
18
|
+
/** Helper function to get the number of bits in a binary representation of a number. */
|
|
4
19
|
export declare function getNumBitsOfN(n: int): int;
|
|
20
|
+
/** Helper function to convert a set of flags to a single `BitFlags` object. */
|
|
21
|
+
export declare function setToBitFlags<T extends BitFlag | BitFlag128>(set: Set<T> | ReadonlySet<T>): BitFlags<T>;
|
package/functions/bitwise.lua
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ParseInt = ____lualib.__TS__ParseInt
|
|
3
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
1
4
|
local ____exports = {}
|
|
5
|
+
local ____flag = require("functions.flag")
|
|
6
|
+
local addFlag = ____flag.addFlag
|
|
7
|
+
--- Helper function to convert a set of flags to a single `BitFlags` object.
|
|
8
|
+
function ____exports.arrayToBitFlags(self, array)
|
|
9
|
+
local flags = 0
|
|
10
|
+
for ____, flag in ipairs(array) do
|
|
11
|
+
flags = addFlag(nil, flags, flag)
|
|
12
|
+
end
|
|
13
|
+
return flags
|
|
14
|
+
end
|
|
15
|
+
--- Helper function to convert an array of bits to the resulting decimal number.
|
|
16
|
+
function ____exports.convertBinaryToDecimal(self, bits)
|
|
17
|
+
local bitsString = table.concat(bits, "")
|
|
18
|
+
return __TS__ParseInt(bitsString, 2)
|
|
19
|
+
end
|
|
20
|
+
--- Helper function to convert a number to an array of bits.
|
|
21
|
+
function ____exports.convertDecimalToBinary(self, number)
|
|
22
|
+
local bits = {}
|
|
23
|
+
local i = 0
|
|
24
|
+
while number > 0 do
|
|
25
|
+
bits[i + 1] = number % 2
|
|
26
|
+
number = math.floor(number / 2)
|
|
27
|
+
i = i + 1
|
|
28
|
+
end
|
|
29
|
+
return bits
|
|
30
|
+
end
|
|
31
|
+
--- Helper function to count the number of bits that are set to 1 in a binary representation of a
|
|
32
|
+
-- number.
|
|
2
33
|
function ____exports.countSetBits(self, n)
|
|
3
34
|
local count = 0
|
|
4
35
|
while n > 0 do
|
|
@@ -7,9 +38,11 @@ function ____exports.countSetBits(self, n)
|
|
|
7
38
|
end
|
|
8
39
|
return count
|
|
9
40
|
end
|
|
41
|
+
--- Helper function to get the value of a specific but in a binary representation of a number.
|
|
10
42
|
function ____exports.getKBitOfN(self, k, n)
|
|
11
43
|
return n >> k & 1
|
|
12
44
|
end
|
|
45
|
+
--- Helper function to get the number of bits in a binary representation of a number.
|
|
13
46
|
function ____exports.getNumBitsOfN(self, n)
|
|
14
47
|
local numBits = 0
|
|
15
48
|
while n > 0 do
|
|
@@ -18,4 +51,12 @@ function ____exports.getNumBitsOfN(self, n)
|
|
|
18
51
|
end
|
|
19
52
|
return numBits
|
|
20
53
|
end
|
|
54
|
+
--- Helper function to convert a set of flags to a single `BitFlags` object.
|
|
55
|
+
function ____exports.setToBitFlags(self, set)
|
|
56
|
+
local flags = 0
|
|
57
|
+
for ____, flag in __TS__Iterator(set:values()) do
|
|
58
|
+
flags = addFlag(nil, flags, flag)
|
|
59
|
+
end
|
|
60
|
+
return flags
|
|
61
|
+
end
|
|
21
62
|
return ____exports
|
package/functions/color.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
3
|
import { SerializationType } from "../enums/SerializationType";
|
|
4
4
|
declare type SerializedColor = LuaTable<string, unknown> & {
|
|
5
|
-
readonly __serializedColorBrand:
|
|
5
|
+
readonly __serializedColorBrand: symbol;
|
|
6
6
|
};
|
|
7
7
|
interface CopyColorReturn {
|
|
8
8
|
[SerializationType.NONE]: Color;
|
package/functions/doors.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare function closeAllDoors(): void;
|
|
|
7
7
|
export declare function closeDoorFast(door: GridEntityDoor): void;
|
|
8
8
|
export declare function doorSlotFlagToDoorSlot(doorSlotFlag: DoorSlotFlag): DoorSlot;
|
|
9
9
|
export declare function doorSlotToDirection(doorSlot: DoorSlot): Direction;
|
|
10
|
+
export declare function doorSlotToDoorSlotFlag(doorSlot: DoorSlot): DoorSlotFlag;
|
|
10
11
|
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
11
12
|
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
12
13
|
/**
|
|
@@ -30,6 +31,11 @@ export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
|
|
|
30
31
|
* amount of units.
|
|
31
32
|
*/
|
|
32
33
|
export declare function getDoorEnterPositionOffset(doorSlot: DoorSlot): Vector;
|
|
34
|
+
/**
|
|
35
|
+
* Helper function to convert an array of door slots or a set of door slots to the resulting bit
|
|
36
|
+
* flag number.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getDoorSlotFlags(doorSlots: DoorSlot[] | readonly DoorSlot[] | Set<DoorSlot> | ReadonlySet<DoorSlot>): BitFlags<DoorSlotFlag>;
|
|
33
39
|
/** Helper function to get the possible door slots that can exist for a given room shape. */
|
|
34
40
|
export declare function getDoorSlotsForRoomShape(roomShape: RoomShape): ReadonlySet<DoorSlot>;
|
|
35
41
|
/**
|
package/functions/doors.lua
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
4
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
5
|
local __TS__New = ____lualib.__TS__New
|
|
4
6
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
7
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
@@ -18,14 +20,20 @@ local DEFAULT_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DEFAULT_DOOR_SLOT
|
|
|
18
20
|
local DOOR_SLOT_FLAG_TO_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DOOR_SLOT_FLAG_TO_DOOR_SLOT
|
|
19
21
|
local ____doorSlotToDirection = require("objects.doorSlotToDirection")
|
|
20
22
|
local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
|
|
23
|
+
local ____doorSlotToDoorSlotFlag = require("objects.doorSlotToDoorSlotFlag")
|
|
24
|
+
local DOOR_SLOT_TO_DOOR_SLOT_FLAG = ____doorSlotToDoorSlotFlag.DOOR_SLOT_TO_DOOR_SLOT_FLAG
|
|
21
25
|
local ____oppositeDoorSlots = require("objects.oppositeDoorSlots")
|
|
22
26
|
local OPPOSITE_DOOR_SLOTS = ____oppositeDoorSlots.OPPOSITE_DOOR_SLOTS
|
|
23
27
|
local ____roomShapeToDoorSlots = require("objects.roomShapeToDoorSlots")
|
|
24
28
|
local ROOM_SHAPE_TO_DOOR_SLOTS = ____roomShapeToDoorSlots.ROOM_SHAPE_TO_DOOR_SLOTS
|
|
29
|
+
local ____bitwise = require("functions.bitwise")
|
|
30
|
+
local arrayToBitFlags = ____bitwise.arrayToBitFlags
|
|
25
31
|
local ____direction = require("functions.direction")
|
|
26
32
|
local directionToVector = ____direction.directionToVector
|
|
27
33
|
local ____enums = require("functions.enums")
|
|
28
34
|
local getEnumValues = ____enums.getEnumValues
|
|
35
|
+
local ____tstlClass = require("functions.tstlClass")
|
|
36
|
+
local isTSTLSet = ____tstlClass.isTSTLSet
|
|
29
37
|
function ____exports.doorSlotToDirection(self, doorSlot)
|
|
30
38
|
return DOOR_SLOT_TO_DIRECTION[doorSlot]
|
|
31
39
|
end
|
|
@@ -52,13 +60,13 @@ function ____exports.getDoors(self, ...)
|
|
|
52
60
|
do
|
|
53
61
|
local door = room:GetDoor(doorSlot)
|
|
54
62
|
if door == nil then
|
|
55
|
-
goto
|
|
63
|
+
goto __continue18
|
|
56
64
|
end
|
|
57
65
|
if roomTypesSet.size == 0 or roomTypesSet:has(door.TargetRoomType) then
|
|
58
66
|
doors[#doors + 1] = door
|
|
59
67
|
end
|
|
60
68
|
end
|
|
61
|
-
::
|
|
69
|
+
::__continue18::
|
|
62
70
|
end
|
|
63
71
|
return doors
|
|
64
72
|
end
|
|
@@ -101,6 +109,9 @@ function ____exports.doorSlotFlagToDoorSlot(self, doorSlotFlag)
|
|
|
101
109
|
local doorSlot = DOOR_SLOT_FLAG_TO_DOOR_SLOT[doorSlotFlag]
|
|
102
110
|
return doorSlot == nil and DEFAULT_DOOR_SLOT or doorSlot
|
|
103
111
|
end
|
|
112
|
+
function ____exports.doorSlotToDoorSlotFlag(self, doorSlot)
|
|
113
|
+
return DOOR_SLOT_TO_DOOR_SLOT_FLAG[doorSlot]
|
|
114
|
+
end
|
|
104
115
|
function ____exports.getAngelRoomDoor(self)
|
|
105
116
|
local angelRoomDoors = ____exports.getDoors(nil, RoomType.ANGEL)
|
|
106
117
|
local ____temp_0
|
|
@@ -142,6 +153,16 @@ function ____exports.getDoorEnterPosition(self, door)
|
|
|
142
153
|
local offset = ____exports.getDoorEnterPositionOffset(nil, door.Slot)
|
|
143
154
|
return door.Position + offset
|
|
144
155
|
end
|
|
156
|
+
--- Helper function to convert an array of door slots or a set of door slots to the resulting bit
|
|
157
|
+
-- flag number.
|
|
158
|
+
function ____exports.getDoorSlotFlags(self, doorSlots)
|
|
159
|
+
local doorSlotArray = isTSTLSet(nil, doorSlots) and ({__TS__Spread(doorSlots:values())}) or doorSlots
|
|
160
|
+
local doorSlotFlagArray = __TS__ArrayMap(
|
|
161
|
+
doorSlotArray,
|
|
162
|
+
function(____, doorSlot) return ____exports.doorSlotToDoorSlotFlag(nil, doorSlot) end
|
|
163
|
+
)
|
|
164
|
+
return arrayToBitFlags(nil, doorSlotFlagArray)
|
|
165
|
+
end
|
|
145
166
|
--- Helper function to get the possible door slots that can exist for a given room shape.
|
|
146
167
|
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
147
168
|
return ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
@@ -5,6 +5,12 @@ import { GridEntityType, GridEntityXMLType } from "isaac-typescript-definitions"
|
|
|
5
5
|
* 1000.0 in a room XML file, but `GridEntityType.ROCK` is equal to 2.
|
|
6
6
|
*/
|
|
7
7
|
export declare function convertXMLGridEntityType(gridEntityXMLType: GridEntityXMLType, gridEntityXMLVariant: int): [GridEntityType, int] | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to get every legal grid index for the current room.
|
|
10
|
+
*
|
|
11
|
+
* Under the hood, this uses the `Room.GetGridSize` method.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAllGridIndexes(): int[];
|
|
8
14
|
/**
|
|
9
15
|
* Gets the entities that have a hitbox that overlaps with any part of the square that the grid
|
|
10
16
|
* entity is on.
|
|
@@ -79,6 +85,9 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
|
|
|
79
85
|
* Helper function to all grid entities in the room except for ones matching the grid entity types
|
|
80
86
|
* provided.
|
|
81
87
|
*
|
|
88
|
+
* Note that this function will automatically update the room. (This means that you can spawn new
|
|
89
|
+
* grid entities on the same tile on the same frame, if needed.)
|
|
90
|
+
*
|
|
82
91
|
* For example:
|
|
83
92
|
*
|
|
84
93
|
* ```ts
|
|
@@ -95,6 +104,9 @@ export declare function removeAllGridExcept(...gridEntityTypes: GridEntityType[]
|
|
|
95
104
|
* Helper function to remove all of the grid entities in the room that match the grid entity types
|
|
96
105
|
* provided.
|
|
97
106
|
*
|
|
107
|
+
* Note that this function will automatically update the room. (This means that you can spawn new
|
|
108
|
+
* grid entities on the same tile on the same frame, if needed.)
|
|
109
|
+
*
|
|
98
110
|
* For example:
|
|
99
111
|
*
|
|
100
112
|
* ```ts
|
package/functions/gridEntity.lua
CHANGED
|
@@ -32,11 +32,18 @@ local ____utils = require("functions.utils")
|
|
|
32
32
|
local erange = ____utils.erange
|
|
33
33
|
local ____vector = require("functions.vector")
|
|
34
34
|
local isVector = ____vector.isVector
|
|
35
|
-
function
|
|
35
|
+
--- Helper function to get every legal grid index for the current room.
|
|
36
|
+
--
|
|
37
|
+
-- Under the hood, this uses the `Room.GetGridSize` method.
|
|
38
|
+
function ____exports.getAllGridIndexes(self)
|
|
36
39
|
local room = game:GetRoom()
|
|
37
40
|
local gridSize = room:GetGridSize()
|
|
41
|
+
return erange(nil, gridSize)
|
|
42
|
+
end
|
|
43
|
+
function getAllGridEntities(self)
|
|
44
|
+
local room = game:GetRoom()
|
|
38
45
|
local gridEntities = {}
|
|
39
|
-
for ____, gridIndex in ipairs(
|
|
46
|
+
for ____, gridIndex in ipairs(____exports.getAllGridIndexes(nil)) do
|
|
40
47
|
local gridEntity = room:GetGridEntity(gridIndex)
|
|
41
48
|
if gridEntity ~= nil then
|
|
42
49
|
gridEntities[#gridEntities + 1] = gridEntity
|
|
@@ -277,6 +284,9 @@ end
|
|
|
277
284
|
--- Helper function to all grid entities in the room except for ones matching the grid entity types
|
|
278
285
|
-- provided.
|
|
279
286
|
--
|
|
287
|
+
-- Note that this function will automatically update the room. (This means that you can spawn new
|
|
288
|
+
-- grid entities on the same tile on the same frame, if needed.)
|
|
289
|
+
--
|
|
280
290
|
-- For example:
|
|
281
291
|
--
|
|
282
292
|
-- ```ts
|
|
@@ -307,6 +317,9 @@ end
|
|
|
307
317
|
--- Helper function to remove all of the grid entities in the room that match the grid entity types
|
|
308
318
|
-- provided.
|
|
309
319
|
--
|
|
320
|
+
-- Note that this function will automatically update the room. (This means that you can spawn new
|
|
321
|
+
-- grid entities on the same tile on the same frame, if needed.)
|
|
322
|
+
--
|
|
310
323
|
-- For example:
|
|
311
324
|
--
|
|
312
325
|
-- ```ts
|
package/functions/kColor.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
3
|
import { SerializationType } from "../enums/SerializationType";
|
|
4
4
|
declare type SerializedKColor = LuaTable<string, unknown> & {
|
|
5
|
-
readonly __serializedKColorBrand:
|
|
5
|
+
readonly __serializedKColorBrand: symbol;
|
|
6
6
|
};
|
|
7
7
|
interface CopyKColorReturn {
|
|
8
8
|
[SerializationType.NONE]: KColor;
|
package/functions/log.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
|
|
|
11
11
|
* function will also prepend the function name and the line number before the string.
|
|
12
12
|
*/
|
|
13
13
|
export declare function log(this: void, msg: string): void;
|
|
14
|
-
export declare function logArray<T>(this: void, array: T[]): void;
|
|
14
|
+
export declare function logArray<T>(this: void, array: T[] | readonly T[]): void;
|
|
15
15
|
export declare function logColor(this: void, color: Color): void;
|
|
16
16
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
17
17
|
export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
@@ -56,7 +56,7 @@ export declare function logRoom(this: void): void;
|
|
|
56
56
|
* particular run.
|
|
57
57
|
*/
|
|
58
58
|
export declare function logSeedEffects(this: void): void;
|
|
59
|
-
export declare function logSet(this: void, set: Set<AnyNotNil>): void;
|
|
59
|
+
export declare function logSet(this: void, set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
|
|
60
60
|
/** Helper function for logging every sound effect that is currently playing. */
|
|
61
61
|
export declare function logSounds(this: void): void;
|
|
62
62
|
/**
|
package/functions/rng.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
4
4
|
import { SerializationType } from "../enums/SerializationType";
|
|
5
5
|
declare type SerializedRNG = LuaTable<string, unknown> & {
|
|
6
|
-
readonly __serializedRNGBrand:
|
|
6
|
+
readonly __serializedRNGBrand: symbol;
|
|
7
7
|
};
|
|
8
8
|
interface CopyRNGReturn {
|
|
9
9
|
[SerializationType.NONE]: RNG;
|
package/functions/rng.lua
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
3
|
-
local __TS__ObjectValues = ____lualib.__TS__ObjectValues
|
|
4
3
|
local ____exports = {}
|
|
5
4
|
local RECOMMENDED_SHIFT_IDX, OBJECT_NAME
|
|
6
5
|
local ____cachedClasses = require("cachedClasses")
|
|
@@ -123,11 +122,16 @@ function ____exports.setAllRNGToSeed(self, object, seed)
|
|
|
123
122
|
if not isTable(nil, object) then
|
|
124
123
|
error("Failed to iterate over the object containing RNG objects since the type of the provided object was: " .. __TS__TypeOf(object))
|
|
125
124
|
end
|
|
126
|
-
|
|
125
|
+
local setAtLeastOneSeed = false
|
|
126
|
+
for _key, value in pairs(object) do
|
|
127
127
|
if ____exports.isRNG(nil, value) then
|
|
128
128
|
____exports.setSeed(nil, value, seed)
|
|
129
|
+
setAtLeastOneSeed = true
|
|
129
130
|
end
|
|
130
131
|
end
|
|
132
|
+
if not setAtLeastOneSeed then
|
|
133
|
+
error(("Failed to set all RNG objects to seed " .. tostring(seed)) .. " because the parent object did not contain any RNG objects.")
|
|
134
|
+
end
|
|
131
135
|
end
|
|
132
136
|
--- Helper function to iterate over the provided object and set the seed for all of the values that
|
|
133
137
|
-- are RNG objects equal to the start seed for the current run.
|
package/functions/roomShape.d.ts
CHANGED
|
@@ -17,14 +17,14 @@ export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): V
|
|
|
17
17
|
* Helper function to get the bounds of a room shape, which are a box representing its contents.
|
|
18
18
|
* This does not include the tiles that the walls are on. L rooms use the same bounds as a 2x2 room.
|
|
19
19
|
*/
|
|
20
|
-
export declare function getRoomShapeBounds(roomShape: RoomShape):
|
|
20
|
+
export declare function getRoomShapeBounds(roomShape: RoomShape): readonly [width: int, height: int];
|
|
21
21
|
/**
|
|
22
22
|
* Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
23
23
|
* room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
24
24
|
*
|
|
25
25
|
* For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
|
|
26
26
|
*/
|
|
27
|
-
export declare function getRoomShapeLayoutSize(roomShape: RoomShape):
|
|
27
|
+
export declare function getRoomShapeLayoutSize(roomShape: RoomShape): readonly [width: int, height: int];
|
|
28
28
|
/**
|
|
29
29
|
* Helper function to get the grid position of the top-left tile of a given room shape.
|
|
30
30
|
*
|
package/functions/rooms.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function changeRoom(roomGridIndex: int): void;
|
|
|
9
9
|
* Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
|
|
10
10
|
*/
|
|
11
11
|
export declare function getAllDimensions(): Dimension[];
|
|
12
|
+
/** Helper function to get the grid index for every room on the entire floor. */
|
|
12
13
|
export declare function getAllRoomGridIndexes(): int[];
|
|
13
14
|
/**
|
|
14
15
|
* Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
|
package/functions/rooms.lua
CHANGED
|
@@ -123,6 +123,7 @@ end
|
|
|
123
123
|
function ____exports.getAllDimensions(self)
|
|
124
124
|
return erange(nil, NUM_DIMENSIONS)
|
|
125
125
|
end
|
|
126
|
+
--- Helper function to get the grid index for every room on the entire floor.
|
|
126
127
|
function ____exports.getAllRoomGridIndexes(self)
|
|
127
128
|
local rooms = ____exports.getRooms(nil)
|
|
128
129
|
return __TS__ArrayMap(
|
package/functions/set.d.ts
CHANGED
|
@@ -31,6 +31,23 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
|
|
|
31
31
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
32
32
|
*/
|
|
33
33
|
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
34
|
+
/**
|
|
35
|
+
* Helper function to get all possible combinations of the given set. This includes the combination
|
|
36
|
+
* of an empty set.
|
|
37
|
+
*
|
|
38
|
+
* For example, if this function is provided a set containing 1, 2, and 3, then it will return an
|
|
39
|
+
* array containing the following sets:
|
|
40
|
+
*
|
|
41
|
+
* - []
|
|
42
|
+
* - [1]
|
|
43
|
+
* - [2]
|
|
44
|
+
* - [3]
|
|
45
|
+
* - [1, 2]
|
|
46
|
+
* - [1, 3]
|
|
47
|
+
* - [2, 3]
|
|
48
|
+
* - [1, 2, 3]
|
|
49
|
+
*/
|
|
50
|
+
export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>): ReadonlyArray<ReadonlySet<T>>;
|
|
34
51
|
/**
|
|
35
52
|
* Helper function to get a sorted array based on the contents of a set.
|
|
36
53
|
*
|