isaacscript-common 7.17.5 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/constantsFirstLast.d.ts +10 -85
- package/dist/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/core/constantsFirstLast.lua +10 -90
- package/dist/enums/ModCallbackCustom.d.ts +21 -0
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/features/characterStats.lua +2 -2
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +9 -5
- package/dist/features/firstLast.d.ts +190 -0
- package/dist/features/firstLast.d.ts.map +1 -0
- package/dist/features/firstLast.lua +341 -0
- package/dist/functions/array.d.ts +1 -9
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/array.lua +0 -6
- package/dist/functions/cards.d.ts +0 -8
- package/dist/functions/cards.d.ts.map +1 -1
- package/dist/functions/cards.lua +9 -24
- package/dist/functions/{cacheFlag.d.ts → collectibleCacheFlag.d.ts} +8 -8
- package/dist/functions/collectibleCacheFlag.d.ts.map +1 -0
- package/dist/functions/{cacheFlag.lua → collectibleCacheFlag.lua} +12 -13
- package/dist/functions/collectibleSet.d.ts +18 -0
- package/dist/functions/collectibleSet.d.ts.map +1 -1
- package/dist/functions/collectibleSet.lua +29 -9
- package/dist/functions/collectibles.d.ts +0 -13
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +0 -18
- package/dist/functions/flying.lua +2 -2
- package/dist/functions/pills.d.ts +0 -10
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/pills.lua +0 -15
- package/dist/functions/players.lua +1 -1
- package/dist/functions/random.d.ts.map +1 -1
- package/dist/functions/random.lua +2 -0
- package/dist/functions/run.d.ts +5 -0
- package/dist/functions/run.d.ts.map +1 -1
- package/dist/functions/run.lua +13 -0
- package/dist/functions/stats.d.ts +9 -0
- package/dist/functions/stats.d.ts.map +1 -0
- package/dist/functions/stats.lua +11 -0
- package/dist/functions/trinketCacheFlag.d.ts +9 -1
- package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
- package/dist/functions/trinketCacheFlag.lua +28 -10
- package/dist/functions/trinketSet.d.ts +18 -0
- package/dist/functions/trinketSet.d.ts.map +1 -1
- package/dist/functions/trinketSet.lua +29 -9
- package/dist/functions/trinkets.d.ts +1 -10
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +0 -24
- package/dist/index.d.ts +251 -117
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +14 -6
- package/dist/initFeatures.d.ts.map +1 -1
- package/dist/initFeatures.lua +3 -0
- package/package.json +1 -1
- package/src/core/constantsFirstLast.ts +12 -125
- package/src/enums/ModCallbackCustom.ts +21 -0
- package/src/features/characterStats.ts +1 -1
- package/src/features/extraConsoleCommands/listCommands.ts +8 -5
- package/src/features/firstLast.ts +429 -0
- package/src/functions/array.ts +1 -9
- package/src/functions/cards.ts +5 -28
- package/src/functions/{cacheFlag.ts → collectibleCacheFlag.ts} +13 -16
- package/src/functions/collectibleSet.ts +28 -21
- package/src/functions/collectibles.ts +0 -22
- package/src/functions/flying.ts +1 -1
- package/src/functions/pills.ts +0 -22
- package/src/functions/players.ts +2 -2
- package/src/functions/random.ts +3 -0
- package/src/functions/run.ts +23 -1
- package/src/functions/stats.ts +12 -0
- package/src/functions/trinketCacheFlag.ts +29 -7
- package/src/functions/trinketSet.ts +28 -21
- package/src/functions/trinkets.ts +0 -34
- package/src/index.ts +2 -1
- package/src/initFeatures.ts +2 -0
- package/dist/functions/cacheFlag.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstLast.d.ts","sourceRoot":"","sources":["../../src/features/firstLast.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,eAAe,EACf,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAwDtC;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;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,EAAE,CAQnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAKvC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,GAAG,CAM7C"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local postNewRoomEarly, errorIfNoCallbacksFired, FEATURE_NAME, atLeastOneCallbackFired
|
|
3
|
+
local ____cachedClasses = require("core.cachedClasses")
|
|
4
|
+
local itemConfig = ____cachedClasses.itemConfig
|
|
5
|
+
local ____constantsFirstLast = require("core.constantsFirstLast")
|
|
6
|
+
local FIRST_CARD = ____constantsFirstLast.FIRST_CARD
|
|
7
|
+
local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
|
|
8
|
+
local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
|
|
9
|
+
local LAST_VANILLA_CARD = ____constantsFirstLast.LAST_VANILLA_CARD
|
|
10
|
+
local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
11
|
+
local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
|
|
12
|
+
local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
|
|
13
|
+
local NUM_VANILLA_CARDS = ____constantsFirstLast.NUM_VANILLA_CARDS
|
|
14
|
+
local NUM_VANILLA_COLLECTIBLE_TYPES = ____constantsFirstLast.NUM_VANILLA_COLLECTIBLE_TYPES
|
|
15
|
+
local NUM_VANILLA_PILL_EFFECTS = ____constantsFirstLast.NUM_VANILLA_PILL_EFFECTS
|
|
16
|
+
local NUM_VANILLA_TRINKET_TYPES = ____constantsFirstLast.NUM_VANILLA_TRINKET_TYPES
|
|
17
|
+
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
18
|
+
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
19
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
20
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
21
|
+
local ____types = require("functions.types")
|
|
22
|
+
local asCard = ____types.asCard
|
|
23
|
+
local asCollectibleType = ____types.asCollectibleType
|
|
24
|
+
local asNumber = ____types.asNumber
|
|
25
|
+
local asPillEffect = ____types.asPillEffect
|
|
26
|
+
local asTrinketType = ____types.asTrinketType
|
|
27
|
+
local ____utils = require("functions.utils")
|
|
28
|
+
local irange = ____utils.irange
|
|
29
|
+
function postNewRoomEarly(self)
|
|
30
|
+
atLeastOneCallbackFired = true
|
|
31
|
+
end
|
|
32
|
+
function errorIfNoCallbacksFired(self, constantType)
|
|
33
|
+
if not atLeastOneCallbackFired then
|
|
34
|
+
error(("Failed to retrieve a " .. constantType) .. " constant. Since not all mods have been loaded yet, any constants of this type will be inaccurate. Thus, you must wait until at least one callback fires before retrieving these types of constants.")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
--- Will change depending on how many modded collectibles there are.
|
|
38
|
+
--
|
|
39
|
+
-- Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
|
|
40
|
+
-- 666. We subtract one to account for `CollectibleType.NULL`.)
|
|
41
|
+
--
|
|
42
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
43
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
44
|
+
function ____exports.getLastCollectibleType(self)
|
|
45
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
46
|
+
errorIfNoCallbacksFired(nil, "collectible")
|
|
47
|
+
return itemConfig:GetCollectibles().Size - 1
|
|
48
|
+
end
|
|
49
|
+
--- Unlike vanilla collectible types, modded collectible types are always contiguous.
|
|
50
|
+
--
|
|
51
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
52
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
53
|
+
function ____exports.getNumModdedCollectibleTypes(self)
|
|
54
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
55
|
+
errorIfNoCallbacksFired(nil, "collectible")
|
|
56
|
+
local lastCollectibleType = ____exports.getLastCollectibleType(nil)
|
|
57
|
+
return lastCollectibleType - LAST_VANILLA_COLLECTIBLE_TYPE
|
|
58
|
+
end
|
|
59
|
+
--- Will change depending on how many modded cards there are.
|
|
60
|
+
--
|
|
61
|
+
-- Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
|
|
62
|
+
-- `TrinketType.NULL`.)
|
|
63
|
+
--
|
|
64
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
65
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
66
|
+
function ____exports.getNumTrinketTypes(self)
|
|
67
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
68
|
+
errorIfNoCallbacksFired(nil, "trinket")
|
|
69
|
+
return itemConfig:GetTrinkets().Size - 1
|
|
70
|
+
end
|
|
71
|
+
--- Will change depending on how many modded cards there are.
|
|
72
|
+
--
|
|
73
|
+
-- This is equal to the number of cards, since all card sub-types are contiguous (unlike
|
|
74
|
+
-- collectibles).
|
|
75
|
+
--
|
|
76
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
77
|
+
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
78
|
+
function ____exports.getLastCard(self)
|
|
79
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
80
|
+
errorIfNoCallbacksFired(nil, "card")
|
|
81
|
+
local numCards = ____exports.getNumCards(nil)
|
|
82
|
+
return asCard(nil, numCards)
|
|
83
|
+
end
|
|
84
|
+
--- Will change depending on how many modded cards there are.
|
|
85
|
+
--
|
|
86
|
+
-- Equal to `itemConfig.GetCards().Size - 1`. (We subtract one to account for `Card.NULL`.)
|
|
87
|
+
--
|
|
88
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
89
|
+
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
90
|
+
function ____exports.getNumCards(self)
|
|
91
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
92
|
+
errorIfNoCallbacksFired(nil, "card")
|
|
93
|
+
return itemConfig:GetCards().Size - 1
|
|
94
|
+
end
|
|
95
|
+
--- Will change depending on how many modded pill effects there are.
|
|
96
|
+
--
|
|
97
|
+
-- This is equal to the number of pill effects, since all pill effects are contiguous (unlike
|
|
98
|
+
-- collectibles).
|
|
99
|
+
--
|
|
100
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
101
|
+
-- all pill effects will necessarily be present when a mod first loads (due to mod load order).
|
|
102
|
+
function ____exports.getLastPillEffect(self)
|
|
103
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
104
|
+
errorIfNoCallbacksFired(nil, "pill")
|
|
105
|
+
local numPillEffects = ____exports.getNumPillEffects(nil)
|
|
106
|
+
return asPillEffect(nil, numPillEffects)
|
|
107
|
+
end
|
|
108
|
+
--- Will change depending on how many modded pill effects there are.
|
|
109
|
+
--
|
|
110
|
+
-- Equal to `itemConfig.GetPillEffects().Size`. (We do not have to subtract one, because the first
|
|
111
|
+
-- pill effect has an ID of 0 and there is no `PillEffect.NULL`.)
|
|
112
|
+
--
|
|
113
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
114
|
+
-- all pill effects will necessarily be present when a mod first loads (due to mod load order).
|
|
115
|
+
function ____exports.getNumPillEffects(self)
|
|
116
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
117
|
+
errorIfNoCallbacksFired(nil, "pill")
|
|
118
|
+
return itemConfig:GetPillEffects().Size
|
|
119
|
+
end
|
|
120
|
+
FEATURE_NAME = "firstLast"
|
|
121
|
+
atLeastOneCallbackFired = false
|
|
122
|
+
---
|
|
123
|
+
-- @internal
|
|
124
|
+
function ____exports.firstLastInit(self, mod)
|
|
125
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_EARLY, postNewRoomEarly)
|
|
126
|
+
end
|
|
127
|
+
--- Returns the first modded collectible type, or undefined if there are no modded collectibles.
|
|
128
|
+
--
|
|
129
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
130
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
131
|
+
function ____exports.getFirstModdedCollectibleType(self)
|
|
132
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
133
|
+
errorIfNoCallbacksFired(nil, "collectible")
|
|
134
|
+
local firstModdedCollectibleType = asCollectibleType(
|
|
135
|
+
nil,
|
|
136
|
+
asNumber(nil, LAST_VANILLA_COLLECTIBLE_TYPE) + 1
|
|
137
|
+
)
|
|
138
|
+
local itemConfigItem = itemConfig:GetCollectible(firstModdedCollectibleType)
|
|
139
|
+
local ____temp_0
|
|
140
|
+
if itemConfigItem == nil then
|
|
141
|
+
____temp_0 = nil
|
|
142
|
+
else
|
|
143
|
+
____temp_0 = firstModdedCollectibleType
|
|
144
|
+
end
|
|
145
|
+
return ____temp_0
|
|
146
|
+
end
|
|
147
|
+
--- Helper function to get an array that represents the all modded collectible types.
|
|
148
|
+
--
|
|
149
|
+
-- This function is only useful when building collectible type objects. For most purposes, you
|
|
150
|
+
-- should use the `getModdedCollectibleSet` helper function instead.
|
|
151
|
+
--
|
|
152
|
+
-- Returns an empty array if there are no modded collectible types.
|
|
153
|
+
--
|
|
154
|
+
-- (This function is named differently from the `getVanillaCollectibleTypeRange` function because
|
|
155
|
+
-- all modded collectible types are contiguous. Thus, each value represents a real
|
|
156
|
+
-- `CollectibleType`.)
|
|
157
|
+
--
|
|
158
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
159
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
160
|
+
function ____exports.getModdedCollectibleTypes(self)
|
|
161
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
162
|
+
errorIfNoCallbacksFired(nil, "collectible")
|
|
163
|
+
local firstModdedCollectibleType = ____exports.getFirstModdedCollectibleType(nil)
|
|
164
|
+
if firstModdedCollectibleType == nil then
|
|
165
|
+
return {}
|
|
166
|
+
end
|
|
167
|
+
local lastCollectibleType = ____exports.getLastCollectibleType(nil)
|
|
168
|
+
return irange(nil, firstModdedCollectibleType, lastCollectibleType)
|
|
169
|
+
end
|
|
170
|
+
--- This function can only be called if at least one callback has been executed. This is because not
|
|
171
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
172
|
+
function ____exports.getNumCollectibleTypes(self)
|
|
173
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
174
|
+
errorIfNoCallbacksFired(nil, "collectible")
|
|
175
|
+
local numModdedCollectibleTypes = ____exports.getNumModdedCollectibleTypes(nil)
|
|
176
|
+
return NUM_VANILLA_COLLECTIBLE_TYPES + numModdedCollectibleTypes
|
|
177
|
+
end
|
|
178
|
+
--- Returns the first modded trinket type, or undefined if there are no modded trinkets.
|
|
179
|
+
--
|
|
180
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
181
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
182
|
+
function ____exports.getFirstModdedTrinketType(self)
|
|
183
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
184
|
+
errorIfNoCallbacksFired(nil, "trinket")
|
|
185
|
+
local firstModdedTrinketType = asTrinketType(
|
|
186
|
+
nil,
|
|
187
|
+
asNumber(nil, LAST_VANILLA_TRINKET_TYPE) + 1
|
|
188
|
+
)
|
|
189
|
+
local itemConfigItem = itemConfig:GetTrinket(firstModdedTrinketType)
|
|
190
|
+
local ____temp_1
|
|
191
|
+
if itemConfigItem == nil then
|
|
192
|
+
____temp_1 = nil
|
|
193
|
+
else
|
|
194
|
+
____temp_1 = firstModdedTrinketType
|
|
195
|
+
end
|
|
196
|
+
return ____temp_1
|
|
197
|
+
end
|
|
198
|
+
--- Will change depending on how many modded cards there are.
|
|
199
|
+
--
|
|
200
|
+
-- This is equal to the number of trinket types, since all trinket types are contiguous (unlike
|
|
201
|
+
-- collectibles).
|
|
202
|
+
--
|
|
203
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
204
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
205
|
+
function ____exports.getLastTrinketType(self)
|
|
206
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
207
|
+
errorIfNoCallbacksFired(nil, "trinket")
|
|
208
|
+
local numTrinketTypes = ____exports.getNumTrinketTypes(nil)
|
|
209
|
+
return asTrinketType(nil, numTrinketTypes)
|
|
210
|
+
end
|
|
211
|
+
--- Helper function to get an array that represents every modded trinket type.
|
|
212
|
+
--
|
|
213
|
+
-- Returns an empty array if there are no modded trinket types.
|
|
214
|
+
--
|
|
215
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
216
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
217
|
+
function ____exports.getModdedTrinketTypes(self)
|
|
218
|
+
local firstModdedTrinketType = ____exports.getFirstModdedTrinketType(nil)
|
|
219
|
+
if firstModdedTrinketType == nil then
|
|
220
|
+
return {}
|
|
221
|
+
end
|
|
222
|
+
local lastTrinketType = ____exports.getLastTrinketType(nil)
|
|
223
|
+
return irange(nil, firstModdedTrinketType, lastTrinketType)
|
|
224
|
+
end
|
|
225
|
+
--- This function can only be called if at least one callback has been executed. This is because not
|
|
226
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
227
|
+
function ____exports.getNumModdedTrinketTypes(self)
|
|
228
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
229
|
+
errorIfNoCallbacksFired(nil, "trinket")
|
|
230
|
+
local numTrinketTypes = ____exports.getNumTrinketTypes(nil)
|
|
231
|
+
return numTrinketTypes - NUM_VANILLA_TRINKET_TYPES
|
|
232
|
+
end
|
|
233
|
+
--- Helper function to get an array that contains every trinket type.
|
|
234
|
+
--
|
|
235
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
236
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
237
|
+
function ____exports.getTrinketTypes(self)
|
|
238
|
+
local lastTrinketType = ____exports.getLastTrinketType(nil)
|
|
239
|
+
return irange(nil, FIRST_TRINKET_TYPE, lastTrinketType)
|
|
240
|
+
end
|
|
241
|
+
--- Helper function to get an array with every valid card sub-type. This includes modded cards.
|
|
242
|
+
--
|
|
243
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
244
|
+
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
245
|
+
function ____exports.getAllCards(self)
|
|
246
|
+
local lastCard = ____exports.getLastCard(nil)
|
|
247
|
+
return irange(nil, FIRST_CARD, lastCard)
|
|
248
|
+
end
|
|
249
|
+
--- Returns the first modded card sub-type, or undefined if there are no modded cards.
|
|
250
|
+
--
|
|
251
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
252
|
+
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
253
|
+
function ____exports.getFirstModdedCard(self)
|
|
254
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
255
|
+
errorIfNoCallbacksFired(nil, "card")
|
|
256
|
+
local firstModdedCard = asCard(
|
|
257
|
+
nil,
|
|
258
|
+
asNumber(nil, LAST_VANILLA_CARD) + 1
|
|
259
|
+
)
|
|
260
|
+
local itemConfigCard = itemConfig:GetCard(firstModdedCard)
|
|
261
|
+
local ____temp_2
|
|
262
|
+
if itemConfigCard == nil then
|
|
263
|
+
____temp_2 = nil
|
|
264
|
+
else
|
|
265
|
+
____temp_2 = firstModdedCard
|
|
266
|
+
end
|
|
267
|
+
return ____temp_2
|
|
268
|
+
end
|
|
269
|
+
--- Helper function to get an array with every modded card sub-type.
|
|
270
|
+
--
|
|
271
|
+
-- Returns an empty array if there are no modded cards.
|
|
272
|
+
--
|
|
273
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
274
|
+
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
275
|
+
function ____exports.getModdedCards(self)
|
|
276
|
+
local firstModdedCard = ____exports.getFirstModdedCard(nil)
|
|
277
|
+
if firstModdedCard == nil then
|
|
278
|
+
return {}
|
|
279
|
+
end
|
|
280
|
+
local lastCard = ____exports.getLastCard(nil)
|
|
281
|
+
return irange(nil, firstModdedCard, lastCard)
|
|
282
|
+
end
|
|
283
|
+
--- This function can only be called if at least one callback has been executed. This is because not
|
|
284
|
+
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
285
|
+
function ____exports.getNumModdedCards(self)
|
|
286
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
287
|
+
errorIfNoCallbacksFired(nil, "card")
|
|
288
|
+
local numCards = ____exports.getNumCards(nil)
|
|
289
|
+
return numCards - NUM_VANILLA_CARDS
|
|
290
|
+
end
|
|
291
|
+
--- Helper function to get an array with every valid pill effect. This includes modded pill effects.
|
|
292
|
+
--
|
|
293
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
294
|
+
-- all pill effects will necessarily be present when a mod first loads (due to mod load order).
|
|
295
|
+
function ____exports.getAllPillEffects(self)
|
|
296
|
+
local lastPillEffect = ____exports.getLastPillEffect(nil)
|
|
297
|
+
return irange(nil, FIRST_PILL_EFFECT, lastPillEffect)
|
|
298
|
+
end
|
|
299
|
+
--- Returns the first modded pill effect, or undefined if there are no modded pill effects.
|
|
300
|
+
--
|
|
301
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
302
|
+
-- all pill effects will necessarily be present when a mod first loads (due to mod load order).
|
|
303
|
+
function ____exports.getFirstModdedPillEffect(self)
|
|
304
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
305
|
+
errorIfNoCallbacksFired(nil, "pill")
|
|
306
|
+
local firstModdedPillEffect = asPillEffect(
|
|
307
|
+
nil,
|
|
308
|
+
asNumber(nil, LAST_VANILLA_PILL_EFFECT) + 1
|
|
309
|
+
)
|
|
310
|
+
local itemConfigPillEffect = itemConfig:GetPillEffect(firstModdedPillEffect)
|
|
311
|
+
local ____temp_3
|
|
312
|
+
if itemConfigPillEffect == nil then
|
|
313
|
+
____temp_3 = nil
|
|
314
|
+
else
|
|
315
|
+
____temp_3 = firstModdedPillEffect
|
|
316
|
+
end
|
|
317
|
+
return ____temp_3
|
|
318
|
+
end
|
|
319
|
+
--- Helper function to get an array with every modded pill effect.
|
|
320
|
+
--
|
|
321
|
+
-- Returns an empty array if there are no modded pill effects.
|
|
322
|
+
--
|
|
323
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
324
|
+
-- all pill effects will necessarily be present when a mod first loads (due to mod load order).
|
|
325
|
+
function ____exports.getModdedPillEffects(self)
|
|
326
|
+
local firstModdedPillEffect = ____exports.getFirstModdedPillEffect(nil)
|
|
327
|
+
if firstModdedPillEffect == nil then
|
|
328
|
+
return {}
|
|
329
|
+
end
|
|
330
|
+
local lastPillEffect = ____exports.getLastPillEffect(nil)
|
|
331
|
+
return irange(nil, firstModdedPillEffect, lastPillEffect)
|
|
332
|
+
end
|
|
333
|
+
--- This function can only be called if at least one callback has been executed. This is because not
|
|
334
|
+
-- all pill effects will necessarily be present when a mod first loads (due to mod load order).
|
|
335
|
+
function ____exports.getNumModdedPillEffects(self)
|
|
336
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
337
|
+
errorIfNoCallbacksFired(nil, "pill")
|
|
338
|
+
local numPillEffects = ____exports.getNumPillEffects(nil)
|
|
339
|
+
return numPillEffects - NUM_VANILLA_PILL_EFFECTS
|
|
340
|
+
end
|
|
341
|
+
return ____exports
|
|
@@ -159,15 +159,7 @@ export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG?
|
|
|
159
159
|
* index. Default is an empty array.
|
|
160
160
|
*/
|
|
161
161
|
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOrRNG?: Seed | RNG, exceptions?: int[] | readonly int[]): int;
|
|
162
|
-
/**
|
|
163
|
-
* Initializes an array with all elements containing the specified default value.
|
|
164
|
-
*
|
|
165
|
-
* For example:
|
|
166
|
-
*
|
|
167
|
-
* ```ts
|
|
168
|
-
* const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
162
|
+
/** Initializes an array with all elements containing the specified default value. */
|
|
171
163
|
export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
172
164
|
/**
|
|
173
165
|
* Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":";;;AAKA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAC1B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GACzB,OAAO,CAST;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,CAAC,EAAE,CAIL;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,CAAC,EAAE,CAIL;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,CAAC,EAAE,EACV,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,OAAO,CAcT;AAED;;;;;;;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,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,CAO5D;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,OAAO,EAAE,CAkC5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAavD;AAED,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,CAAC,EAC9B,YAAY,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAChC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,GACrC,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,CAAC,EAAE,CAKL;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,IAAI,CAWN;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM3E"}
|
package/dist/functions/array.lua
CHANGED
|
@@ -399,12 +399,6 @@ function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exce
|
|
|
399
399
|
return randomArrayElement
|
|
400
400
|
end
|
|
401
401
|
--- Initializes an array with all elements containing the specified default value.
|
|
402
|
-
--
|
|
403
|
-
-- For example:
|
|
404
|
-
--
|
|
405
|
-
-- ```ts
|
|
406
|
-
-- const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
|
|
407
|
-
-- ```
|
|
408
402
|
function ____exports.initArray(self, defaultValue, size)
|
|
409
403
|
local array = {}
|
|
410
404
|
____repeat(
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Card, ItemConfigCardType } from "isaac-typescript-definitions";
|
|
2
|
-
/** Helper function to get an array with every valid card sub-type. This includes modded cards. */
|
|
3
|
-
export declare function getAllCards(): Card[];
|
|
4
2
|
/**
|
|
5
3
|
* Helper function to get a card description from a Card enum value.
|
|
6
4
|
*
|
|
@@ -31,12 +29,6 @@ export declare function getCardType(card: Card): ItemConfigCardType;
|
|
|
31
29
|
* containing cards that match any of the specified types.
|
|
32
30
|
*/
|
|
33
31
|
export declare function getCardsOfType(...cardTypes: ItemConfigCardType[]): Set<Card>;
|
|
34
|
-
/**
|
|
35
|
-
* Helper function to get an array with every modded card sub-type.
|
|
36
|
-
*
|
|
37
|
-
* Returns an empty array if there are no modded cards.
|
|
38
|
-
*/
|
|
39
|
-
export declare function getModdedCards(): Card[];
|
|
40
32
|
/**
|
|
41
33
|
* Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
|
|
42
34
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/functions/cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../src/functions/cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAsDxE;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAerD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EA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G,OAAO,CAEjD;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE9C;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE/C"}
|
package/dist/functions/cards.lua
CHANGED
|
@@ -4,7 +4,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local Set = ____lualib.Set
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local
|
|
7
|
+
local lazyInitCardMapsSets, CARD_TYPE_TO_CARDS_MAP, CARD_SET
|
|
8
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
9
|
local Card = ____isaac_2Dtypescript_2Ddefinitions.Card
|
|
10
10
|
local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
|
|
@@ -12,9 +12,7 @@ local ____cachedClasses = require("core.cachedClasses")
|
|
|
12
12
|
local itemConfig = ____cachedClasses.itemConfig
|
|
13
13
|
local ____constantsFirstLast = require("core.constantsFirstLast")
|
|
14
14
|
local FIRST_CARD = ____constantsFirstLast.FIRST_CARD
|
|
15
|
-
local
|
|
16
|
-
local LAST_CARD = ____constantsFirstLast.LAST_CARD
|
|
17
|
-
local MAX_VANILLA_CARD = ____constantsFirstLast.MAX_VANILLA_CARD
|
|
15
|
+
local LAST_VANILLA_CARD = ____constantsFirstLast.LAST_VANILLA_CARD
|
|
18
16
|
local ____cardDescriptions = require("objects.cardDescriptions")
|
|
19
17
|
local CARD_DESCRIPTIONS = ____cardDescriptions.CARD_DESCRIPTIONS
|
|
20
18
|
local DEFAULT_CARD_DESCRIPTION = ____cardDescriptions.DEFAULT_CARD_DESCRIPTION
|
|
@@ -33,14 +31,14 @@ local addSetsToSet = ____set.addSetsToSet
|
|
|
33
31
|
local getRandomSetElement = ____set.getRandomSetElement
|
|
34
32
|
local ____utils = require("functions.utils")
|
|
35
33
|
local irange = ____utils.irange
|
|
36
|
-
function
|
|
34
|
+
function lazyInitCardMapsSets(self)
|
|
37
35
|
for ____, cardType in ipairs(getEnumValues(nil, ItemConfigCardType)) do
|
|
38
36
|
CARD_TYPE_TO_CARDS_MAP:set(
|
|
39
37
|
cardType,
|
|
40
38
|
__TS__New(Set)
|
|
41
39
|
)
|
|
42
40
|
end
|
|
43
|
-
for ____, card in ipairs(____exports.
|
|
41
|
+
for ____, card in ipairs(____exports.getVanillaCards(nil)) do
|
|
44
42
|
local cardType = ____exports.getCardType(nil, card)
|
|
45
43
|
local cardTypeSet = CARD_TYPE_TO_CARDS_MAP:get(cardType)
|
|
46
44
|
if cardTypeSet == nil then
|
|
@@ -57,10 +55,6 @@ function initCardObjects(self)
|
|
|
57
55
|
)
|
|
58
56
|
addSetsToSet(nil, CARD_SET, cards)
|
|
59
57
|
end
|
|
60
|
-
--- Helper function to get an array with every valid card sub-type. This includes modded cards.
|
|
61
|
-
function ____exports.getAllCards(self)
|
|
62
|
-
return irange(nil, FIRST_CARD, LAST_CARD)
|
|
63
|
-
end
|
|
64
58
|
function ____exports.getCardType(self, card)
|
|
65
59
|
local cardType = CARD_TYPES[card]
|
|
66
60
|
return cardType == nil and DEFAULT_CARD_TYPE or cardType
|
|
@@ -72,7 +66,7 @@ end
|
|
|
72
66
|
function ____exports.getCardsOfType(self, ...)
|
|
73
67
|
local cardTypes = {...}
|
|
74
68
|
if CARD_TYPE_TO_CARDS_MAP.size == 0 then
|
|
75
|
-
|
|
69
|
+
lazyInitCardMapsSets(nil)
|
|
76
70
|
end
|
|
77
71
|
local matchingCards = __TS__New(Set)
|
|
78
72
|
for ____, cardType in ipairs(cardTypes) do
|
|
@@ -86,6 +80,10 @@ function ____exports.getCardsOfType(self, ...)
|
|
|
86
80
|
end
|
|
87
81
|
return matchingCards
|
|
88
82
|
end
|
|
83
|
+
--- Helper function to get an array with every valid vanilla card sub-type.
|
|
84
|
+
function ____exports.getVanillaCards(self)
|
|
85
|
+
return irange(nil, FIRST_CARD, LAST_VANILLA_CARD)
|
|
86
|
+
end
|
|
89
87
|
CARD_TYPE_TO_CARDS_MAP = __TS__New(Map)
|
|
90
88
|
CARD_SET = __TS__New(Set)
|
|
91
89
|
--- Helper function to get a card description from a Card enum value.
|
|
@@ -126,15 +124,6 @@ function ____exports.getCardName(self, card)
|
|
|
126
124
|
end
|
|
127
125
|
return DEFAULT_CARD_NAME
|
|
128
126
|
end
|
|
129
|
-
--- Helper function to get an array with every modded card sub-type.
|
|
130
|
-
--
|
|
131
|
-
-- Returns an empty array if there are no modded cards.
|
|
132
|
-
function ____exports.getModdedCards(self)
|
|
133
|
-
if MAX_VANILLA_CARD == LAST_CARD then
|
|
134
|
-
return {}
|
|
135
|
-
end
|
|
136
|
-
return irange(nil, FIRST_MODDED_CARD, LAST_CARD)
|
|
137
|
-
end
|
|
138
127
|
--- Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
|
|
139
128
|
--
|
|
140
129
|
-- This will not return:
|
|
@@ -187,10 +176,6 @@ function ____exports.getRandomRune(self, seedOrRNG, exceptions)
|
|
|
187
176
|
runesSet:delete(Card.RUNE_SHARD)
|
|
188
177
|
return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
|
|
189
178
|
end
|
|
190
|
-
--- Helper function to get an array with every valid vanilla card sub-type.
|
|
191
|
-
function ____exports.getVanillaCards(self)
|
|
192
|
-
return irange(nil, FIRST_CARD, MAX_VANILLA_CARD)
|
|
193
|
-
end
|
|
194
179
|
--- Returns true for cards that have the following card type:
|
|
195
180
|
-- - CardType.TAROT
|
|
196
181
|
-- - CardType.SUIT
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { CacheFlag, CollectibleType } from "isaac-typescript-definitions";
|
|
2
|
+
/** Helper function to check in the item config if a given collectible has a given cache flag. */
|
|
2
3
|
export declare function collectibleHasCacheFlag(collectibleType: CollectibleType, cacheFlag: CacheFlag): boolean;
|
|
3
4
|
/**
|
|
4
5
|
* Returns a set containing every collectible type with the given cache flag, including modded
|
|
5
6
|
* collectibles.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType>;
|
|
8
|
-
/**
|
|
9
|
-
* Returns the starting stat that Isaac (the default character) starts with. For example, if you
|
|
10
|
-
* pass this function `CacheFlag.DAMAGE`, it will return 3.5.
|
|
11
7
|
*
|
|
12
|
-
*
|
|
8
|
+
* This function can only be called if at least one callback has been executed. This is because not
|
|
9
|
+
* all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
13
10
|
*/
|
|
14
|
-
export declare function
|
|
11
|
+
export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType>;
|
|
15
12
|
/**
|
|
16
13
|
* Returns an array containing every collectible type that the player has that matches the provided
|
|
17
14
|
* CacheFlag.
|
|
@@ -26,6 +23,9 @@ export declare function getDefaultPlayerStat(cacheFlag: CacheFlag): number | und
|
|
|
26
23
|
* CollectibleType.DEAD_DOVE,
|
|
27
24
|
* ]
|
|
28
25
|
* ```
|
|
26
|
+
*
|
|
27
|
+
* This function can only be called if at least one callback has been executed. This is because not
|
|
28
|
+
* all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
29
29
|
*/
|
|
30
30
|
export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): CollectibleType[];
|
|
31
|
-
//# sourceMappingURL=
|
|
31
|
+
//# sourceMappingURL=collectibleCacheFlag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectibleCacheFlag.d.ts","sourceRoot":"","sources":["../../src/functions/collectibleCacheFlag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AA+B1E,iGAAiG;AACjG,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,eAAe,CAAC,CAStB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,eAAe,EAAE,CAYnB"}
|
|
@@ -7,8 +7,6 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
7
7
|
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
8
8
|
local ____cachedClasses = require("core.cachedClasses")
|
|
9
9
|
local itemConfig = ____cachedClasses.itemConfig
|
|
10
|
-
local ____defaultPlayerStatMap = require("maps.defaultPlayerStatMap")
|
|
11
|
-
local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
|
|
12
10
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
13
11
|
local getCollectibleArray = ____collectibleSet.getCollectibleArray
|
|
14
12
|
local ____enums = require("functions.enums")
|
|
@@ -20,6 +18,7 @@ local copySet = ____set.copySet
|
|
|
20
18
|
local getSortedSetValues = ____set.getSortedSetValues
|
|
21
19
|
local ____utils = require("functions.utils")
|
|
22
20
|
local ____repeat = ____utils["repeat"]
|
|
21
|
+
--- Helper function to check in the item config if a given collectible has a given cache flag.
|
|
23
22
|
function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
|
|
24
23
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
25
24
|
if itemConfigItem == nil then
|
|
@@ -28,7 +27,10 @@ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
|
|
|
28
27
|
return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
|
|
29
28
|
end
|
|
30
29
|
local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
|
|
31
|
-
local function
|
|
30
|
+
local function lazyInitCacheFlagMap(self)
|
|
31
|
+
if CACHE_FLAG_TO_COLLECTIBLES_MAP.size > 0 then
|
|
32
|
+
return
|
|
33
|
+
end
|
|
32
34
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
33
35
|
local collectiblesSet = __TS__New(Set)
|
|
34
36
|
for ____, collectibleType in ipairs(getCollectibleArray(nil)) do
|
|
@@ -41,23 +43,17 @@ local function initCacheFlagMap(self)
|
|
|
41
43
|
end
|
|
42
44
|
--- Returns a set containing every collectible type with the given cache flag, including modded
|
|
43
45
|
-- collectibles.
|
|
46
|
+
--
|
|
47
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
48
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
44
49
|
function ____exports.getCollectiblesForCacheFlag(self, cacheFlag)
|
|
45
|
-
|
|
46
|
-
initCacheFlagMap(nil)
|
|
47
|
-
end
|
|
50
|
+
lazyInitCacheFlagMap(nil)
|
|
48
51
|
local collectiblesSet = CACHE_FLAG_TO_COLLECTIBLES_MAP:get(cacheFlag)
|
|
49
52
|
if collectiblesSet == nil then
|
|
50
53
|
return __TS__New(Set)
|
|
51
54
|
end
|
|
52
55
|
return copySet(nil, collectiblesSet)
|
|
53
56
|
end
|
|
54
|
-
--- Returns the starting stat that Isaac (the default character) starts with. For example, if you
|
|
55
|
-
-- pass this function `CacheFlag.DAMAGE`, it will return 3.5.
|
|
56
|
-
--
|
|
57
|
-
-- Note that the default fire delay is represented in the tear stat, not the `MaxFireDelay` value.
|
|
58
|
-
function ____exports.getDefaultPlayerStat(self, cacheFlag)
|
|
59
|
-
return DEFAULT_PLAYER_STAT_MAP:get(cacheFlag)
|
|
60
|
-
end
|
|
61
57
|
--- Returns an array containing every collectible type that the player has that matches the provided
|
|
62
58
|
-- CacheFlag.
|
|
63
59
|
--
|
|
@@ -71,6 +67,9 @@ end
|
|
|
71
67
|
-- CollectibleType.DEAD_DOVE,
|
|
72
68
|
-- ]
|
|
73
69
|
-- ```
|
|
70
|
+
--
|
|
71
|
+
-- This function can only be called if at least one callback has been executed. This is because not
|
|
72
|
+
-- all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
74
73
|
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
75
74
|
local collectiblesForCacheFlag = ____exports.getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
76
75
|
local playerCollectibles = {}
|