isaacscript-common 1.2.174 → 1.2.175
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/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -5
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -3
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +43 -0
- package/dist/features/deployJSONRoom.lua +2 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -22
- package/dist/features/extraConsoleCommands/init.lua +6 -6
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +51 -15
- package/dist/features/saveDataManager/constants.d.ts +1 -1
- package/dist/features/saveDataManager/constants.lua +1 -1
- package/dist/features/saveDataManager/exports.d.ts +6 -6
- package/dist/features/saveDataManager/exports.lua +4 -4
- package/dist/features/saveDataManager/merge.lua +5 -3
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +3 -3
- package/dist/functions/array.d.ts +39 -39
- package/dist/functions/array.lua +79 -79
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -7
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibles.d.ts +53 -15
- package/dist/functions/collectibles.lua +44 -21
- package/dist/functions/color.d.ts +2 -2
- package/dist/functions/color.lua +6 -6
- package/dist/functions/deepCopy.d.ts +0 -3
- package/dist/functions/deepCopy.lua +5 -22
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -16
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -34
- package/dist/functions/gridEntity.d.ts +1 -1
- package/dist/functions/gridEntity.lua +5 -5
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -74
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -3
- package/dist/functions/player.d.ts +6 -8
- package/dist/functions/player.lua +22 -29
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -20
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -5
- package/dist/functions/random.d.ts +7 -7
- package/dist/functions/revive.d.ts +5 -5
- package/dist/functions/revive.lua +8 -8
- package/dist/functions/roomData.d.ts +96 -0
- package/dist/functions/roomData.lua +57 -0
- package/dist/functions/rooms.d.ts +1 -96
- package/dist/functions/rooms.lua +30 -75
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -7
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -2
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinkets.d.ts +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/ui.d.ts +13 -13
- package/dist/functions/ui.lua +28 -28
- package/dist/functions/utils.d.ts +6 -0
- package/dist/functions/utils.lua +7 -0
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +8 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
@@ -4,12 +4,12 @@ local featuresInitialized = false
|
|
|
4
4
|
function ____exports.areFeaturesInitialized(self)
|
|
5
5
|
return featuresInitialized
|
|
6
6
|
end
|
|
7
|
-
function ____exports.setFeaturesInitialized(self)
|
|
8
|
-
featuresInitialized = true
|
|
9
|
-
end
|
|
10
7
|
function ____exports.errorIfFeaturesNotInitialized(self, featureName)
|
|
11
8
|
if not ____exports.areFeaturesInitialized(nil) then
|
|
12
9
|
error(("The " .. featureName) .. " is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
|
|
13
10
|
end
|
|
14
11
|
end
|
|
12
|
+
function ____exports.setFeaturesInitialized(self)
|
|
13
|
+
featuresInitialized = true
|
|
14
|
+
end
|
|
15
15
|
return ____exports
|
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
* only performs a shallow comparison.
|
|
5
5
|
*/
|
|
6
6
|
export declare function arrayEquals<T>(array1: T[] | readonly T[], array2: T[] | readonly T[]): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
9
|
+
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
10
|
+
* array.
|
|
11
|
+
*
|
|
12
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
13
|
+
*/
|
|
14
|
+
export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...elementsToRemove: T[]): T[];
|
|
15
|
+
/**
|
|
16
|
+
* Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
17
|
+
* array, this function will do nothing. Returns whether or not one or more elements were removed.
|
|
18
|
+
*
|
|
19
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
20
|
+
*/
|
|
21
|
+
export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T[]): boolean;
|
|
22
|
+
export declare function arrayToString<T>(array: T[]): string;
|
|
7
23
|
/**
|
|
8
24
|
* Helper function to combine two or more arrays. Returns a new array that is the composition of all
|
|
9
25
|
* of the specified arrays.
|
|
@@ -23,45 +39,6 @@ export declare function copyArray<T>(oldArray: T[] | readonly T[], numElements?:
|
|
|
23
39
|
export declare function emptyArray<T>(array: T[]): void;
|
|
24
40
|
/** Helper function to return the last element of an array. */
|
|
25
41
|
export declare function getLastElement<T>(array: T[]): T;
|
|
26
|
-
/**
|
|
27
|
-
* Initializes an array with all elements containing the specified default value.
|
|
28
|
-
*
|
|
29
|
-
* Example:
|
|
30
|
-
* ```
|
|
31
|
-
* const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
35
|
-
export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
|
|
38
|
-
*
|
|
39
|
-
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
40
|
-
*/
|
|
41
|
-
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seed?: Seed): T[];
|
|
42
|
-
/**
|
|
43
|
-
* Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
44
|
-
*
|
|
45
|
-
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
46
|
-
*/
|
|
47
|
-
export declare function shuffleArrayInPlace<T>(array: T[], seed?: Seed): void;
|
|
48
|
-
export declare function sumArray(array: number[] | readonly number[]): number;
|
|
49
|
-
export declare function arrayToString<T>(array: T[]): string;
|
|
50
|
-
/**
|
|
51
|
-
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
52
|
-
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
53
|
-
* array.
|
|
54
|
-
*
|
|
55
|
-
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
56
|
-
*/
|
|
57
|
-
export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...elementsToRemove: T[]): T[];
|
|
58
|
-
/**
|
|
59
|
-
* Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
60
|
-
* array, this function will do nothing. Returns whether or not one or more elements were removed.
|
|
61
|
-
*
|
|
62
|
-
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
63
|
-
*/
|
|
64
|
-
export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T[]): boolean;
|
|
65
42
|
/**
|
|
66
43
|
* Helper function to get a random element from the provided array.
|
|
67
44
|
*
|
|
@@ -80,6 +57,15 @@ export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seed
|
|
|
80
57
|
*/
|
|
81
58
|
export declare function getRandomArrayElementAndRemove<T>(array: T[], seed?: Seed, exceptions?: T[] | readonly T[]): T;
|
|
82
59
|
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seed?: Seed): int;
|
|
60
|
+
/**
|
|
61
|
+
* Initializes an array with all elements containing the specified default value.
|
|
62
|
+
*
|
|
63
|
+
* Example:
|
|
64
|
+
* ```
|
|
65
|
+
* const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
83
69
|
/**
|
|
84
70
|
* Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
|
|
85
71
|
* particular table is being used as an array. isArray returns true if:
|
|
@@ -88,3 +74,17 @@ export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seed?:
|
|
|
88
74
|
* - the table has no keys (i.e. an "empty" table)
|
|
89
75
|
*/
|
|
90
76
|
export declare function isArray(thing: unknown): boolean;
|
|
77
|
+
export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
|
|
80
|
+
*
|
|
81
|
+
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
82
|
+
*/
|
|
83
|
+
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seed?: Seed): T[];
|
|
84
|
+
/**
|
|
85
|
+
* Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
86
|
+
*
|
|
87
|
+
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
88
|
+
*/
|
|
89
|
+
export declare function shuffleArrayInPlace<T>(array: T[], seed?: Seed): void;
|
|
90
|
+
export declare function sumArray(array: number[] | readonly number[]): number;
|
package/dist/functions/array.lua
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
4
|
+
local Set = ____lualib.Set
|
|
5
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
6
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
+
local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
|
|
5
8
|
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
9
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
10
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
7
11
|
local __TS__ArrayReduce = ____lualib.__TS__ArrayReduce
|
|
8
|
-
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
9
|
-
local Set = ____lualib.Set
|
|
10
|
-
local __TS__New = ____lualib.__TS__New
|
|
11
|
-
local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
|
|
12
12
|
local ____exports = {}
|
|
13
13
|
local ____random = require("functions.random")
|
|
14
14
|
local getRandomInt = ____random.getRandomInt
|
|
15
15
|
local nextSeed = ____random.nextSeed
|
|
16
16
|
local ____utils = require("functions.utils")
|
|
17
17
|
local ____repeat = ____utils["repeat"]
|
|
18
|
+
function ____exports.getRandomArrayIndex(self, array, seed)
|
|
19
|
+
if seed == nil then
|
|
20
|
+
seed = Random()
|
|
21
|
+
end
|
|
22
|
+
if #array == 0 then
|
|
23
|
+
error("Failed to get a random array index since the provided array is empty.")
|
|
24
|
+
end
|
|
25
|
+
return getRandomInt(nil, 0, #array - 1, seed)
|
|
26
|
+
end
|
|
18
27
|
function ____exports.shuffleArrayInPlace(self, array, seed)
|
|
19
28
|
if seed == nil then
|
|
20
29
|
seed = Random()
|
|
@@ -30,15 +39,6 @@ function ____exports.shuffleArrayInPlace(self, array, seed)
|
|
|
30
39
|
array[randomIndex + 1] = ____temp_0[2]
|
|
31
40
|
end
|
|
32
41
|
end
|
|
33
|
-
function ____exports.getRandomArrayIndex(self, array, seed)
|
|
34
|
-
if seed == nil then
|
|
35
|
-
seed = Random()
|
|
36
|
-
end
|
|
37
|
-
if #array == 0 then
|
|
38
|
-
error("Failed to get a random array index since the provided array is empty.")
|
|
39
|
-
end
|
|
40
|
-
return getRandomInt(nil, 0, #array - 1, seed)
|
|
41
|
-
end
|
|
42
42
|
function ____exports.arrayEquals(self, array1, array2)
|
|
43
43
|
if #array1 ~= #array2 then
|
|
44
44
|
return false
|
|
@@ -51,6 +51,40 @@ function ____exports.arrayEquals(self, array1, array2)
|
|
|
51
51
|
end
|
|
52
52
|
)
|
|
53
53
|
end
|
|
54
|
+
function ____exports.arrayRemove(self, originalArray, ...)
|
|
55
|
+
local elementsToRemove = {...}
|
|
56
|
+
local elementsToRemoveSet = __TS__New(Set, elementsToRemove)
|
|
57
|
+
local array = {}
|
|
58
|
+
for ____, element in ipairs(originalArray) do
|
|
59
|
+
if not elementsToRemoveSet:has(element) then
|
|
60
|
+
__TS__ArrayPush(array, element)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
return array
|
|
64
|
+
end
|
|
65
|
+
function ____exports.arrayRemoveInPlace(self, array, ...)
|
|
66
|
+
local elementsToRemove = {...}
|
|
67
|
+
local removedOneOrMoreElements = false
|
|
68
|
+
for ____, element in ipairs(elementsToRemove) do
|
|
69
|
+
local index = __TS__ArrayIndexOf(array, element)
|
|
70
|
+
if index > -1 then
|
|
71
|
+
removedOneOrMoreElements = true
|
|
72
|
+
__TS__ArraySplice(array, index, 1)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
return removedOneOrMoreElements
|
|
76
|
+
end
|
|
77
|
+
function ____exports.arrayToString(self, array)
|
|
78
|
+
if #array == 0 then
|
|
79
|
+
return "[]"
|
|
80
|
+
end
|
|
81
|
+
local strings = __TS__ArrayMap(
|
|
82
|
+
array,
|
|
83
|
+
function(____, element) return tostring(element) end
|
|
84
|
+
)
|
|
85
|
+
local commaSeparatedStrings = table.concat(strings, ", " or ",")
|
|
86
|
+
return ("[" .. commaSeparatedStrings) .. "]"
|
|
87
|
+
end
|
|
54
88
|
function ____exports.combineArrays(self, ...)
|
|
55
89
|
local arrays = {...}
|
|
56
90
|
local elements = {}
|
|
@@ -82,72 +116,6 @@ end
|
|
|
82
116
|
function ____exports.getLastElement(self, array)
|
|
83
117
|
return array[#array]
|
|
84
118
|
end
|
|
85
|
-
function ____exports.initArray(self, defaultValue, size)
|
|
86
|
-
local array = {}
|
|
87
|
-
____repeat(
|
|
88
|
-
nil,
|
|
89
|
-
size,
|
|
90
|
-
function()
|
|
91
|
-
__TS__ArrayPush(array, defaultValue)
|
|
92
|
-
end
|
|
93
|
-
)
|
|
94
|
-
return array
|
|
95
|
-
end
|
|
96
|
-
function ____exports.isArrayInArray(self, arrayToMatch, parentArray)
|
|
97
|
-
return __TS__ArraySome(
|
|
98
|
-
parentArray,
|
|
99
|
-
function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
|
|
100
|
-
)
|
|
101
|
-
end
|
|
102
|
-
function ____exports.shuffleArray(self, originalArray, seed)
|
|
103
|
-
if seed == nil then
|
|
104
|
-
seed = Random()
|
|
105
|
-
end
|
|
106
|
-
local array = ____exports.copyArray(nil, originalArray)
|
|
107
|
-
____exports.shuffleArrayInPlace(nil, array, seed)
|
|
108
|
-
return array
|
|
109
|
-
end
|
|
110
|
-
function ____exports.sumArray(self, array)
|
|
111
|
-
return __TS__ArrayReduce(
|
|
112
|
-
array,
|
|
113
|
-
function(____, accumulator, element) return accumulator + element end,
|
|
114
|
-
0
|
|
115
|
-
)
|
|
116
|
-
end
|
|
117
|
-
function ____exports.arrayToString(self, array)
|
|
118
|
-
if #array == 0 then
|
|
119
|
-
return "[]"
|
|
120
|
-
end
|
|
121
|
-
local strings = __TS__ArrayMap(
|
|
122
|
-
array,
|
|
123
|
-
function(____, element) return tostring(element) end
|
|
124
|
-
)
|
|
125
|
-
local commaSeparatedStrings = table.concat(strings, ", " or ",")
|
|
126
|
-
return ("[" .. commaSeparatedStrings) .. "]"
|
|
127
|
-
end
|
|
128
|
-
function ____exports.arrayRemove(self, originalArray, ...)
|
|
129
|
-
local elementsToRemove = {...}
|
|
130
|
-
local elementsToRemoveSet = __TS__New(Set, elementsToRemove)
|
|
131
|
-
local array = {}
|
|
132
|
-
for ____, element in ipairs(originalArray) do
|
|
133
|
-
if not elementsToRemoveSet:has(element) then
|
|
134
|
-
__TS__ArrayPush(array, element)
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
return array
|
|
138
|
-
end
|
|
139
|
-
function ____exports.arrayRemoveInPlace(self, array, ...)
|
|
140
|
-
local elementsToRemove = {...}
|
|
141
|
-
local removedOneOrMoreElements = false
|
|
142
|
-
for ____, element in ipairs(elementsToRemove) do
|
|
143
|
-
local index = __TS__ArrayIndexOf(array, element)
|
|
144
|
-
if index > -1 then
|
|
145
|
-
removedOneOrMoreElements = true
|
|
146
|
-
__TS__ArraySplice(array, index, 1)
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
return removedOneOrMoreElements
|
|
150
|
-
end
|
|
151
119
|
function ____exports.getRandomArrayElement(self, array, seed, exceptions)
|
|
152
120
|
if seed == nil then
|
|
153
121
|
seed = Random()
|
|
@@ -177,6 +145,17 @@ function ____exports.getRandomArrayElementAndRemove(self, array, seed, exception
|
|
|
177
145
|
____exports.arrayRemoveInPlace(nil, array, randomArrayElement)
|
|
178
146
|
return randomArrayElement
|
|
179
147
|
end
|
|
148
|
+
function ____exports.initArray(self, defaultValue, size)
|
|
149
|
+
local array = {}
|
|
150
|
+
____repeat(
|
|
151
|
+
nil,
|
|
152
|
+
size,
|
|
153
|
+
function()
|
|
154
|
+
__TS__ArrayPush(array, defaultValue)
|
|
155
|
+
end
|
|
156
|
+
)
|
|
157
|
+
return array
|
|
158
|
+
end
|
|
180
159
|
function ____exports.isArray(self, thing)
|
|
181
160
|
if type(thing) ~= "table" then
|
|
182
161
|
return false
|
|
@@ -208,4 +187,25 @@ function ____exports.isArray(self, thing)
|
|
|
208
187
|
end
|
|
209
188
|
return true
|
|
210
189
|
end
|
|
190
|
+
function ____exports.isArrayInArray(self, arrayToMatch, parentArray)
|
|
191
|
+
return __TS__ArraySome(
|
|
192
|
+
parentArray,
|
|
193
|
+
function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
|
|
194
|
+
)
|
|
195
|
+
end
|
|
196
|
+
function ____exports.shuffleArray(self, originalArray, seed)
|
|
197
|
+
if seed == nil then
|
|
198
|
+
seed = Random()
|
|
199
|
+
end
|
|
200
|
+
local array = ____exports.copyArray(nil, originalArray)
|
|
201
|
+
____exports.shuffleArrayInPlace(nil, array, seed)
|
|
202
|
+
return array
|
|
203
|
+
end
|
|
204
|
+
function ____exports.sumArray(self, array)
|
|
205
|
+
return __TS__ArrayReduce(
|
|
206
|
+
array,
|
|
207
|
+
function(____, accumulator, element) return accumulator + element end,
|
|
208
|
+
0
|
|
209
|
+
)
|
|
210
|
+
end
|
|
211
211
|
return ____exports
|
|
@@ -20,6 +20,7 @@ export declare function getCardDescription(card: Card | int): string;
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export declare function getCardName(card: Card | int): string;
|
|
23
|
+
export declare function getCardType(card: Card | int): CardType;
|
|
23
24
|
/**
|
|
24
25
|
* Helper function to get a set of cards matching the type. Also see the [[`CardType`]] enum.
|
|
25
26
|
*
|
|
@@ -27,7 +28,6 @@ export declare function getCardName(card: Card | int): string;
|
|
|
27
28
|
* containing cards that match any of the specified types.
|
|
28
29
|
*/
|
|
29
30
|
export declare function getCardsOfType(...cardTypes: CardType[]): Set<Card>;
|
|
30
|
-
export declare function getCardType(card: Card | int): CardType;
|
|
31
31
|
/**
|
|
32
32
|
* Helper function to get the final card sub-type in the game.
|
|
33
33
|
*
|
|
@@ -75,8 +75,6 @@ export declare function isCardType(card: Card, cardType: CardType): boolean;
|
|
|
75
75
|
export declare function isModdedCard(card: Card): boolean;
|
|
76
76
|
/** Returns true for cards that have `CardType.OBJECT`. */
|
|
77
77
|
export declare function isPocketItemObject(card: Card): boolean;
|
|
78
|
-
/** Returns true for cards that have `CardType.TAROT`. */
|
|
79
|
-
export declare function isTarotCard(card: Card): boolean;
|
|
80
78
|
/** Returns true for cards that have `CardType.TAROT_REVERSE`. */
|
|
81
79
|
export declare function isReverseTarotCard(card: Card): boolean;
|
|
82
80
|
/** Returns true for cards that have `CardType.RUNE`. */
|
|
@@ -85,3 +83,5 @@ export declare function isRune(card: Card): boolean;
|
|
|
85
83
|
export declare function isSpecialCard(card: Card): boolean;
|
|
86
84
|
/** Returns true for cards that have `CardType.SUIT`. */
|
|
87
85
|
export declare function isSuitCard(card: Card): boolean;
|
|
86
|
+
/** Returns true for cards that have `CardType.TAROT`. */
|
|
87
|
+
export declare function isTarotCard(card: Card): boolean;
|
package/dist/functions/cards.lua
CHANGED
|
@@ -51,6 +51,10 @@ function initCardObjects(self)
|
|
|
51
51
|
)
|
|
52
52
|
addSetsToSet(nil, CARD_SET, cards)
|
|
53
53
|
end
|
|
54
|
+
function ____exports.getCardType(self, card)
|
|
55
|
+
local cardType = CARD_TYPES[card]
|
|
56
|
+
return cardType == nil and DEFAULT_CARD_TYPE or cardType
|
|
57
|
+
end
|
|
54
58
|
function ____exports.getCardsOfType(self, ...)
|
|
55
59
|
local cardTypes = {...}
|
|
56
60
|
if CARD_TYPE_TO_CARDS_MAP.size == 0 then
|
|
@@ -68,10 +72,6 @@ function ____exports.getCardsOfType(self, ...)
|
|
|
68
72
|
end
|
|
69
73
|
return matchingCards
|
|
70
74
|
end
|
|
71
|
-
function ____exports.getCardType(self, card)
|
|
72
|
-
local cardType = CARD_TYPES[card]
|
|
73
|
-
return cardType == nil and DEFAULT_CARD_TYPE or cardType
|
|
74
|
-
end
|
|
75
75
|
function ____exports.getMaxCards(self)
|
|
76
76
|
return itemConfig:GetCards().Size - 1
|
|
77
77
|
end
|
|
@@ -141,9 +141,6 @@ end
|
|
|
141
141
|
function ____exports.isPocketItemObject(self, card)
|
|
142
142
|
return ____exports.isCardType(nil, card, CardType.OBJECT)
|
|
143
143
|
end
|
|
144
|
-
function ____exports.isTarotCard(self, card)
|
|
145
|
-
return ____exports.isCardType(nil, card, CardType.TAROT)
|
|
146
|
-
end
|
|
147
144
|
function ____exports.isReverseTarotCard(self, card)
|
|
148
145
|
return ____exports.isCardType(nil, card, CardType.TAROT_REVERSE)
|
|
149
146
|
end
|
|
@@ -156,4 +153,7 @@ end
|
|
|
156
153
|
function ____exports.isSuitCard(self, card)
|
|
157
154
|
return ____exports.isCardType(nil, card, CardType.SUIT)
|
|
158
155
|
end
|
|
156
|
+
function ____exports.isTarotCard(self, card)
|
|
157
|
+
return ____exports.isCardType(nil, card, CardType.TAROT)
|
|
158
|
+
end
|
|
159
159
|
return ____exports
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
|
-
* Helper function to add a charge to
|
|
4
|
-
*
|
|
3
|
+
* Helper function to add a charge to a player's active item, emulating what happens when a room is
|
|
4
|
+
* cleared.
|
|
5
5
|
*
|
|
6
6
|
* This function will take the following things into account:
|
|
7
7
|
* - L rooms and 2x2 rooms granting a double charge
|
|
8
8
|
* - The Battery
|
|
9
9
|
* - AAA Battery
|
|
10
10
|
*
|
|
11
|
+
* @param player The player to grant the charges to.
|
|
11
12
|
* @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
|
|
12
13
|
* 1x1 room for the purposes of calculating how much charge to grant. Default is false.
|
|
13
14
|
*/
|
|
14
|
-
export declare function
|
|
15
|
+
export declare function addRoomClearCharge(player: EntityPlayer, ignoreBigRoomDoubleCharge?: boolean): void;
|
|
15
16
|
/**
|
|
16
|
-
* Helper function to add a charge to a player's active
|
|
17
|
-
* cleared.
|
|
17
|
+
* Helper function to add a charge to one of a player's active items, emulating what happens when a
|
|
18
|
+
* room is cleared.
|
|
18
19
|
*
|
|
19
20
|
* This function will take the following things into account:
|
|
20
21
|
* - L rooms and 2x2 rooms granting a double charge
|
|
@@ -22,25 +23,24 @@ export declare function addRoomClearCharges(ignoreBigRoomDoubleCharge?: boolean)
|
|
|
22
23
|
* - AAA Battery
|
|
23
24
|
*
|
|
24
25
|
* @param player The player to grant the charges to.
|
|
26
|
+
* @param activeSlot The active item slot to grant the charges to.
|
|
25
27
|
* @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
|
|
26
28
|
* 1x1 room for the purposes of calculating how much charge to grant. Default is false.
|
|
27
29
|
*/
|
|
28
|
-
export declare function
|
|
30
|
+
export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot: ActiveSlot, ignoreBigRoomDoubleCharge?: boolean): void;
|
|
29
31
|
/**
|
|
30
|
-
* Helper function to add a charge to
|
|
31
|
-
*
|
|
32
|
+
* Helper function to add a charge to every player's active item, emulating what happens when a room
|
|
33
|
+
* is cleared.
|
|
32
34
|
*
|
|
33
35
|
* This function will take the following things into account:
|
|
34
36
|
* - L rooms and 2x2 rooms granting a double charge
|
|
35
37
|
* - The Battery
|
|
36
38
|
* - AAA Battery
|
|
37
39
|
*
|
|
38
|
-
* @param player The player to grant the charges to.
|
|
39
|
-
* @param activeSlot The active item slot to grant the charges to.
|
|
40
40
|
* @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
|
|
41
41
|
* 1x1 room for the purposes of calculating how much charge to grant. Default is false.
|
|
42
42
|
*/
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function addRoomClearCharges(ignoreBigRoomDoubleCharge?: boolean): void;
|
|
44
44
|
/**
|
|
45
45
|
* Helper function to get the combined normal charge and the battery charge for the player's active
|
|
46
46
|
* item. This is useful because you have to add these two values together when setting the active
|
|
@@ -8,14 +8,6 @@ local ____collectibles = require("functions.collectibles")
|
|
|
8
8
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
9
9
|
local ____player = require("functions.player")
|
|
10
10
|
local getPlayers = ____player.getPlayers
|
|
11
|
-
function ____exports.addRoomClearCharge(self, player, ignoreBigRoomDoubleCharge)
|
|
12
|
-
if ignoreBigRoomDoubleCharge == nil then
|
|
13
|
-
ignoreBigRoomDoubleCharge = false
|
|
14
|
-
end
|
|
15
|
-
for ____, activeSlot in ipairs({ActiveSlot.SLOT_PRIMARY, ActiveSlot.SLOT_SECONDARY, ActiveSlot.SLOT_POCKET}) do
|
|
16
|
-
____exports.addRoomClearChargeToSlot(nil, player, activeSlot, ignoreBigRoomDoubleCharge)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
11
|
function ____exports.addRoomClearChargeToSlot(self, player, activeSlot, ignoreBigRoomDoubleCharge)
|
|
20
12
|
if ignoreBigRoomDoubleCharge == nil then
|
|
21
13
|
ignoreBigRoomDoubleCharge = false
|
|
@@ -60,11 +52,6 @@ function getNumChargesToAdd(self, player, activeSlot, ignoreBigRoomDoubleCharge)
|
|
|
60
52
|
end
|
|
61
53
|
return 1
|
|
62
54
|
end
|
|
63
|
-
function ____exports.getTotalCharge(self, player, activeSlot)
|
|
64
|
-
local activeCharge = player:GetActiveCharge(activeSlot)
|
|
65
|
-
local batteryCharge = player:GetBatteryCharge(activeSlot)
|
|
66
|
-
return activeCharge + batteryCharge
|
|
67
|
-
end
|
|
68
55
|
function getNumChargesWithAAAModifier(self, player, activeSlot, chargesToAdd)
|
|
69
56
|
local activeItem = player:GetActiveItem(activeSlot)
|
|
70
57
|
local activeCharge = player:GetActiveCharge(activeSlot)
|
|
@@ -83,6 +70,11 @@ function getNumChargesWithAAAModifier(self, player, activeSlot, chargesToAdd)
|
|
|
83
70
|
end
|
|
84
71
|
return chargesToAdd
|
|
85
72
|
end
|
|
73
|
+
function ____exports.getTotalCharge(self, player, activeSlot)
|
|
74
|
+
local activeCharge = player:GetActiveCharge(activeSlot)
|
|
75
|
+
local batteryCharge = player:GetBatteryCharge(activeSlot)
|
|
76
|
+
return activeCharge + batteryCharge
|
|
77
|
+
end
|
|
86
78
|
function ____exports.playChargeSoundEffect(self, player, activeSlot)
|
|
87
79
|
for ____, soundEffect in ipairs({SoundEffect.SOUND_BATTERYCHARGE, SoundEffect.SOUND_BEEP}) do
|
|
88
80
|
sfxManager:Stop(soundEffect)
|
|
@@ -101,6 +93,14 @@ function shouldPlayFullRechargeSound(self, player, activeSlot)
|
|
|
101
93
|
end
|
|
102
94
|
return not player:NeedsCharge(activeSlot) or activeCharge == maxCharges and batteryCharge == 0
|
|
103
95
|
end
|
|
96
|
+
function ____exports.addRoomClearCharge(self, player, ignoreBigRoomDoubleCharge)
|
|
97
|
+
if ignoreBigRoomDoubleCharge == nil then
|
|
98
|
+
ignoreBigRoomDoubleCharge = false
|
|
99
|
+
end
|
|
100
|
+
for ____, activeSlot in ipairs({ActiveSlot.SLOT_PRIMARY, ActiveSlot.SLOT_SECONDARY, ActiveSlot.SLOT_POCKET}) do
|
|
101
|
+
____exports.addRoomClearChargeToSlot(nil, player, activeSlot, ignoreBigRoomDoubleCharge)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
104
|
function ____exports.addRoomClearCharges(self, ignoreBigRoomDoubleCharge)
|
|
105
105
|
if ignoreBigRoomDoubleCharge == nil then
|
|
106
106
|
ignoreBigRoomDoubleCharge = false
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { CollectiblePedestalType } from "../enums/CollectiblePedestalType";
|
|
3
|
-
|
|
3
|
+
import { CollectibleIndex } from "../types/CollectibleIndex";
|
|
4
4
|
export declare function clearCollectibleSprite(collectible: EntityPickup): void;
|
|
5
5
|
export declare function collectibleHasCacheFlag(collectibleType: CollectibleType | int, cacheFlag: CacheFlag): boolean;
|
|
6
|
+
export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
|
|
6
7
|
/**
|
|
7
8
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
8
9
|
* provided collectible type was not valid.
|
|
@@ -18,16 +19,42 @@ export declare function getCollectibleDevilHeartPrice(collectibleType: Collectib
|
|
|
18
19
|
* "gfx/items/collectibles/questionmark.png" if the provided collectible type was not valid.
|
|
19
20
|
*/
|
|
20
21
|
export declare function getCollectibleGfxFilename(collectibleType: CollectibleType | int): string;
|
|
22
|
+
/**
|
|
23
|
+
* Mods often have to track variables relating to a collectible. Finding an index for these kinds of
|
|
24
|
+
* data structures is difficult, since collectibles are respawned every time a player re-enters a
|
|
25
|
+
* room, so the `PtrHash` will change. Instead, we use a 3-tuple of the room list index, the grid
|
|
26
|
+
* index of the collectible in the room, and the collectible's InitSeed.
|
|
27
|
+
*
|
|
28
|
+
* When collectibles are rolled (e.g. with a D6), their InitSeed changes. If you want to track
|
|
29
|
+
* collectibles independently of any rerolls, then use the `PtrHash` as an index instead. (The
|
|
30
|
+
* `PtrHash` will not persist between rooms, however.)
|
|
31
|
+
*
|
|
32
|
+
* Note that:
|
|
33
|
+
* - The grid index is a necessary part of the collectible index because Diplopia and Crooked Penny
|
|
34
|
+
* can cause two or more collectibles with the same sub-type and InitSeed to exist in the same room.
|
|
35
|
+
* - This index will fail in the case where the player uses Diplopia or a successful Crooked Penny
|
|
36
|
+
* seven or more times in the same room, since that will cause two or more collectibles with the
|
|
37
|
+
* same grid index and InitSeed to exist.
|
|
38
|
+
* - Using a collectible's position as part of the index is problematic, since players can push a
|
|
39
|
+
* pedestal. (Even using the grid index does not solve this problem, since it is possible in certain
|
|
40
|
+
* cases for collectibles to be spawned at a position that is not aligned with the grid, and the
|
|
41
|
+
* pedestal pushed to an adjacent tile, but this case should be extremely rare.)
|
|
42
|
+
* - Mega Chests spawn two collectibles on the exact same position. However, both of them will have
|
|
43
|
+
* different InitSeeds, so this is not a problem for this indexing scheme.
|
|
44
|
+
* - The indexing scheme used is different for collectibles that are inside of a Treasure Room, in
|
|
45
|
+
* order to handle the case of the player seeing the same collectible again in a post-Ascent
|
|
46
|
+
* Treasure Room. An 4-tuple of stage, stage type, grid index, and InitSeed is used in this case.
|
|
47
|
+
* (Using the room list index or the room grid index is not suitable for this purpose, since both
|
|
48
|
+
* of these values can change in the post-Ascent Treasure Room.) Even though there can be two
|
|
49
|
+
* Treasure Rooms on an XL floor, both Treasure Rooms should not have collectibles with the same
|
|
50
|
+
* InitSeed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCollectibleIndex(collectible: EntityPickup): CollectibleIndex;
|
|
21
53
|
/**
|
|
22
54
|
* Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
|
|
23
55
|
* provided collectible type was not valid.
|
|
24
56
|
*/
|
|
25
|
-
export declare function
|
|
26
|
-
/**
|
|
27
|
-
* Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
|
|
28
|
-
* type was not valid.
|
|
29
|
-
*/
|
|
30
|
-
export declare function getCollectibleQuality(collectibleType: CollectibleType | int): int;
|
|
57
|
+
export declare function getCollectibleInitCharge(collectibleType: CollectibleType | int): int;
|
|
31
58
|
/**
|
|
32
59
|
* Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
|
|
33
60
|
* provided collectible type was not valid.
|
|
@@ -50,6 +77,11 @@ export declare function getCollectibleMaxCharges(collectibleType: CollectibleTyp
|
|
|
50
77
|
*/
|
|
51
78
|
export declare function getCollectibleName(collectibleType: CollectibleType | int): string;
|
|
52
79
|
export declare function getCollectiblePedestalType(collectible: EntityPickup): CollectiblePedestalType;
|
|
80
|
+
/**
|
|
81
|
+
* Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
|
|
82
|
+
* type was not valid.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getCollectibleQuality(collectibleType: CollectibleType | int): int;
|
|
53
85
|
/** Helper function to get all of the collectible entities in the room. */
|
|
54
86
|
export declare function getCollectibles(matchingSubType?: number): EntityPickup[];
|
|
55
87
|
/**
|
|
@@ -59,6 +91,8 @@ export declare function getCollectibles(matchingSubType?: number): EntityPickup[
|
|
|
59
91
|
* collectibles.
|
|
60
92
|
*/
|
|
61
93
|
export declare function getMaxCollectibleType(): int;
|
|
94
|
+
/** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
|
|
95
|
+
export declare function isActiveCollectible(collectibleType: CollectibleType | int): boolean;
|
|
62
96
|
/**
|
|
63
97
|
* Returns whether or not the given collectible is a "glitched" item. All items are replaced by
|
|
64
98
|
* glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear
|
|
@@ -86,11 +120,6 @@ export declare function isSingleUseCollectible(collectibleType: CollectibleType
|
|
|
86
120
|
* @returns True if one or more collectibles was removed, false otherwise.
|
|
87
121
|
*/
|
|
88
122
|
export declare function removeAllCollectibles(collectibleType?: CollectibleType | int, cap?: int): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
|
|
91
|
-
* frame delay before they can be picked up by a player.
|
|
92
|
-
*/
|
|
93
|
-
export declare function removeCollectiblePickupDelay(collectible: EntityPickup): void;
|
|
94
123
|
/**
|
|
95
124
|
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
|
|
96
125
|
* should remove an item.
|
|
@@ -100,10 +129,14 @@ export declare function removeCollectiblePickupDelay(collectible: EntityPickup):
|
|
|
100
129
|
*/
|
|
101
130
|
export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType | int): void;
|
|
102
131
|
/**
|
|
103
|
-
* Helper function to
|
|
104
|
-
*
|
|
132
|
+
* Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
|
|
133
|
+
* frame delay before they can be picked up by a player.
|
|
134
|
+
*/
|
|
135
|
+
export declare function removeCollectiblePickupDelay(collectible: EntityPickup): void;
|
|
136
|
+
/**
|
|
137
|
+
* Helper function to set a collectible sprite to a question mark (i.e. how collectibles look when
|
|
138
|
+
* the player has Curse of the Blind).
|
|
105
139
|
*/
|
|
106
|
-
export declare function setCollectiblesRerolledForItemTracker(): void;
|
|
107
140
|
export declare function setCollectibleBlind(collectible: EntityPickup): void;
|
|
108
141
|
/**
|
|
109
142
|
* Helper function to remove the collectible from a collectible pedestal and make it appear as if a
|
|
@@ -130,3 +163,8 @@ export declare function setCollectibleSprite(collectible: EntityPickup, pngPath:
|
|
|
130
163
|
* not sufficient because the sprite will not change.
|
|
131
164
|
*/
|
|
132
165
|
export declare function setCollectibleSubType(collectible: EntityPickup, newCollectibleType: CollectibleType | int): void;
|
|
166
|
+
/**
|
|
167
|
+
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that
|
|
168
|
+
* the build has been rerolled.
|
|
169
|
+
*/
|
|
170
|
+
export declare function setCollectiblesRerolledForItemTracker(): void;
|