isaacscript-common 1.0.551 → 1.0.555
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.
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to combine arrays. Returns a new array that is the composition of all of the
|
|
5
|
+
* specified arrays. This function is variadic, meaning that you can specify N arguments to combine
|
|
6
|
+
* N arrays. Note that this will only perform a shallow copy of the array elements.
|
|
7
|
+
*/
|
|
8
|
+
export declare function arrayCombine<T>(...arrays: T[][]): T[];
|
|
9
|
+
/** Helper function to perform a shallow copy. */
|
|
10
|
+
export declare function arrayCopy<T>(array: T[]): T[];
|
|
4
11
|
export declare function arrayEmpty<T>(array: T[]): void;
|
|
5
12
|
/** Helper function for determining if two arrays contain the exact same elements. */
|
|
6
13
|
export declare function arrayEquals<T>(array1: T[], array2: T[]): boolean;
|
package/dist/functions/array.lua
CHANGED
|
@@ -27,18 +27,19 @@ function ____exports.getRandomArrayIndex(self, array, seed)
|
|
|
27
27
|
local randomIndex = getRandomInt(nil, 0, #array - 1, seed)
|
|
28
28
|
return randomIndex
|
|
29
29
|
end
|
|
30
|
-
function ____exports.arrayCombine(self,
|
|
30
|
+
function ____exports.arrayCombine(self, ...)
|
|
31
|
+
local arrays = {...}
|
|
32
|
+
local elements = {}
|
|
33
|
+
for ____, array in ipairs(arrays) do
|
|
34
|
+
for ____, element in ipairs(array) do
|
|
35
|
+
__TS__ArrayPush(elements, element)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
return elements
|
|
39
|
+
end
|
|
40
|
+
function ____exports.arrayCopy(self, array)
|
|
31
41
|
return {
|
|
32
|
-
table.unpack(
|
|
33
|
-
__TS__ArrayConcat(
|
|
34
|
-
{
|
|
35
|
-
table.unpack(array1)
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
table.unpack(array2)
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
)
|
|
42
|
+
table.unpack(array)
|
|
42
43
|
}
|
|
43
44
|
end
|
|
44
45
|
function ____exports.arrayEmpty(self, array)
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare function closeAllDoors(): void;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
5
|
+
* can optionally specify one or more room types to return only the doors that match the specified
|
|
6
|
+
* room types.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
4
9
|
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
5
10
|
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
6
11
|
/**
|
package/dist/functions/doors.lua
CHANGED
|
@@ -3,9 +3,11 @@ require("lualib_bundle");
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____constants = require("constants")
|
|
5
5
|
local MAX_NUM_DOORS = ____constants.MAX_NUM_DOORS
|
|
6
|
-
function ____exports.getDoors(self,
|
|
6
|
+
function ____exports.getDoors(self, ...)
|
|
7
|
+
local roomTypes = {...}
|
|
7
8
|
local game = Game()
|
|
8
9
|
local room = game:GetRoom()
|
|
10
|
+
local roomTypesSet = __TS__New(Set, roomTypes)
|
|
9
11
|
local doors = {}
|
|
10
12
|
do
|
|
11
13
|
local i = 0
|
|
@@ -15,9 +17,9 @@ function ____exports.getDoors(self, roomType)
|
|
|
15
17
|
if door == nil then
|
|
16
18
|
goto __continue5
|
|
17
19
|
end
|
|
18
|
-
if
|
|
20
|
+
if #roomTypes == 0 then
|
|
19
21
|
__TS__ArrayPush(doors, door)
|
|
20
|
-
elseif
|
|
22
|
+
elseif roomTypesSet:has(door.TargetRoomType) then
|
|
21
23
|
__TS__ArrayPush(doors, door)
|
|
22
24
|
end
|
|
23
25
|
end
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -61,7 +61,6 @@ export declare function getEnumValues(transpiledEnum: unknown): int[];
|
|
|
61
61
|
* @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
|
|
62
62
|
*/
|
|
63
63
|
export declare function hexToKColor(hexString: string, alpha: float): KColor;
|
|
64
|
-
export declare function isGreedMode(): boolean;
|
|
65
64
|
/**
|
|
66
65
|
* Players can boot the game with an launch option called "--luadebug", which will enable additional
|
|
67
66
|
* functionality that is considered to be unsafe. For more information about this flag, see the
|
package/dist/functions/util.lua
CHANGED
|
@@ -60,10 +60,6 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
60
60
|
local base = 255
|
|
61
61
|
return KColor(R / base, G / base, B / base, alpha)
|
|
62
62
|
end
|
|
63
|
-
function ____exports.isGreedMode(self)
|
|
64
|
-
local game = Game()
|
|
65
|
-
return (game.Difficulty == Difficulty.DIFFICULTY_GREED) or (game.Difficulty == Difficulty.DIFFICULTY_GREEDIER)
|
|
66
|
-
end
|
|
67
63
|
function ____exports.isLuaDebugEnabled(self)
|
|
68
64
|
return package ~= nil
|
|
69
65
|
end
|