isaacscript-common 44.0.0 → 45.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.rollup.d.ts +31 -11
- package/dist/isaacscript-common.lua +5383 -5236
- package/dist/src/classes/features/other/{EdenStartingStats.d.ts → EdenStartingStatsHealth.d.ts} +17 -5
- package/dist/src/classes/features/other/EdenStartingStatsHealth.d.ts.map +1 -0
- package/dist/src/classes/features/other/EdenStartingStatsHealth.lua +75 -0
- package/dist/src/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
- package/dist/src/classes/features/other/ItemPoolDetection.lua +2 -1
- package/dist/src/classes/features/other/Pause.lua +2 -2
- package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +4 -3
- package/dist/src/enums/ISCFeature.d.ts +1 -1
- package/dist/src/enums/ISCFeature.d.ts.map +1 -1
- package/dist/src/enums/ISCFeature.lua +2 -2
- package/dist/src/features.d.ts +3 -3
- package/dist/src/features.d.ts.map +1 -1
- package/dist/src/features.lua +3 -3
- package/dist/src/functions/characters.d.ts +9 -2
- package/dist/src/functions/characters.d.ts.map +1 -1
- package/dist/src/functions/characters.lua +13 -4
- package/dist/src/functions/charge.lua +2 -2
- package/dist/src/functions/math.d.ts +1 -0
- package/dist/src/functions/math.d.ts.map +1 -1
- package/dist/src/functions/math.lua +1 -0
- package/dist/src/functions/playerCollectibles.d.ts +127 -0
- package/dist/src/functions/playerCollectibles.d.ts.map +1 -0
- package/dist/src/functions/playerCollectibles.lua +308 -0
- package/dist/src/functions/playerHealth.d.ts +1 -1
- package/dist/src/functions/playerHealth.d.ts.map +1 -1
- package/dist/src/functions/playerHealth.lua +10 -6
- package/dist/src/functions/playerTrinkets.d.ts +69 -0
- package/dist/src/functions/playerTrinkets.d.ts.map +1 -0
- package/dist/src/functions/playerTrinkets.lua +160 -0
- package/dist/src/functions/players.d.ts +5 -166
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +20 -389
- package/dist/src/functions/trinketGive.lua +2 -2
- package/dist/src/functions/trinkets.d.ts +0 -30
- package/dist/src/functions/trinkets.d.ts.map +1 -1
- package/dist/src/functions/trinkets.lua +0 -71
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +16 -0
- package/dist/src/objects/{characterStartingCollectibles.d.ts → characterStartingCollectibleTypes.d.ts} +2 -2
- package/dist/src/objects/characterStartingCollectibleTypes.d.ts.map +1 -0
- package/dist/src/objects/{characterStartingCollectibles.lua → characterStartingCollectibleTypes.lua} +1 -1
- package/dist/src/objects/characterStartingTrinketTypes.d.ts +46 -0
- package/dist/src/objects/characterStartingTrinketTypes.d.ts.map +1 -0
- package/dist/src/objects/characterStartingTrinketTypes.lua +49 -0
- package/package.json +1 -1
- package/src/classes/features/other/{EdenStartingStats.ts → EdenStartingStatsHealth.ts} +38 -5
- package/src/classes/features/other/ItemPoolDetection.ts +2 -4
- package/src/classes/features/other/Pause.ts +1 -1
- package/src/classes/features/other/extraConsoleCommands/commands.ts +3 -3
- package/src/enums/ISCFeature.ts +1 -1
- package/src/features.ts +3 -3
- package/src/functions/characters.ts +20 -4
- package/src/functions/charge.ts +1 -1
- package/src/functions/math.ts +1 -0
- package/src/functions/playerCollectibles.ts +372 -0
- package/src/functions/playerHealth.ts +23 -15
- package/src/functions/playerTrinkets.ts +184 -0
- package/src/functions/players.ts +16 -481
- package/src/functions/trinketGive.ts +1 -1
- package/src/functions/trinkets.ts +1 -84
- package/src/index.ts +2 -0
- package/src/objects/{characterStartingCollectibles.ts → characterStartingCollectibleTypes.ts} +1 -1
- package/src/objects/characterStartingTrinketTypes.ts +129 -0
- package/dist/src/classes/features/other/EdenStartingStats.d.ts.map +0 -1
- package/dist/src/classes/features/other/EdenStartingStats.lua +0 -54
- package/dist/src/objects/characterStartingCollectibles.d.ts.map +0 -1
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
|
+
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
5
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
|
+
local __TS__New = ____lualib.__TS__New
|
|
7
|
+
local ____exports = {}
|
|
8
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
|
+
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
10
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
11
|
+
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
12
|
+
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
13
|
+
local ACTIVE_SLOT_VALUES = ____cachedEnumValues.ACTIVE_SLOT_VALUES
|
|
14
|
+
local ____cachedClasses = require("src.core.cachedClasses")
|
|
15
|
+
local game = ____cachedClasses.game
|
|
16
|
+
local itemConfig = ____cachedClasses.itemConfig
|
|
17
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
18
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
19
|
+
local ____array = require("src.functions.array")
|
|
20
|
+
local sumArray = ____array.sumArray
|
|
21
|
+
local ____collectibles = require("src.functions.collectibles")
|
|
22
|
+
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
23
|
+
local ____playerIndex = require("src.functions.playerIndex")
|
|
24
|
+
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
25
|
+
local getPlayers = ____playerIndex.getPlayers
|
|
26
|
+
local ____players = require("src.functions.players")
|
|
27
|
+
local isCharacter = ____players.isCharacter
|
|
28
|
+
--- Helper function to add one or more collectibles to a player.
|
|
29
|
+
--
|
|
30
|
+
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
31
|
+
-- add.
|
|
32
|
+
function ____exports.addCollectible(self, player, ...)
|
|
33
|
+
local collectibleTypes = {...}
|
|
34
|
+
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
35
|
+
player:AddCollectible(collectibleType)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
function ____exports.addCollectibleCostume(self, player, collectibleType)
|
|
39
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
40
|
+
if itemConfigItem == nil then
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
player:AddCostume(itemConfigItem, false)
|
|
44
|
+
end
|
|
45
|
+
--- Helper function to check to see if any player has a particular collectible.
|
|
46
|
+
--
|
|
47
|
+
-- @param collectibleType The collectible type to check for.
|
|
48
|
+
-- @param ignoreModifiers If set to true, only counts collectibles the player actually owns and
|
|
49
|
+
-- ignores effects granted by items like Zodiac, 3 Dollar Bill and Lemegeton.
|
|
50
|
+
-- Default is false.
|
|
51
|
+
function ____exports.anyPlayerHasCollectible(self, collectibleType, ignoreModifiers)
|
|
52
|
+
local players = getAllPlayers(nil)
|
|
53
|
+
return __TS__ArraySome(
|
|
54
|
+
players,
|
|
55
|
+
function(____, player) return player:HasCollectible(collectibleType, ignoreModifiers) end
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
--- Helper function to find the active slots that the player has the corresponding collectible type
|
|
59
|
+
-- in. Returns an empty array if the player does not have the collectible in any active slot.
|
|
60
|
+
function ____exports.getActiveItemSlots(self, player, collectibleType)
|
|
61
|
+
return __TS__ArrayFilter(
|
|
62
|
+
ACTIVE_SLOT_VALUES,
|
|
63
|
+
function(____, activeSlot)
|
|
64
|
+
local activeItem = player:GetActiveItem(activeSlot)
|
|
65
|
+
return activeItem == collectibleType
|
|
66
|
+
end
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
--- Helper function to return the total amount of collectibles that a player has that match the
|
|
70
|
+
-- collectible type(s) provided.
|
|
71
|
+
--
|
|
72
|
+
-- This function is variadic, meaning that you can specify N collectible types.
|
|
73
|
+
--
|
|
74
|
+
-- Note that this will filter out non-real collectibles like Lilith's Incubus.
|
|
75
|
+
function ____exports.getPlayerCollectibleCount(self, player, ...)
|
|
76
|
+
local collectibleTypes = {...}
|
|
77
|
+
local numCollectibles = 0
|
|
78
|
+
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
79
|
+
numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType, true)
|
|
80
|
+
end
|
|
81
|
+
return numCollectibles
|
|
82
|
+
end
|
|
83
|
+
--- Helper function to get only the players that have a certain collectible.
|
|
84
|
+
--
|
|
85
|
+
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
86
|
+
-- check for. It only returns the players that have all of the collectibles.
|
|
87
|
+
function ____exports.getPlayersWithCollectible(self, ...)
|
|
88
|
+
local collectibleTypes = {...}
|
|
89
|
+
local players = getPlayers(nil)
|
|
90
|
+
return __TS__ArrayFilter(
|
|
91
|
+
players,
|
|
92
|
+
function(____, player) return __TS__ArrayEvery(
|
|
93
|
+
collectibleTypes,
|
|
94
|
+
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
95
|
+
) end
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
--- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
|
|
99
|
+
-- Onion and player 2 has 2 Sad Onions, then this function would return 3.
|
|
100
|
+
--
|
|
101
|
+
-- Note that this will filter out non-real collectibles like Lilith's Incubus.
|
|
102
|
+
function ____exports.getTotalPlayerCollectibles(self, collectibleType)
|
|
103
|
+
local players = getPlayers(nil)
|
|
104
|
+
local numCollectiblesArray = __TS__ArrayMap(
|
|
105
|
+
players,
|
|
106
|
+
function(____, player) return player:GetCollectibleNum(collectibleType, true) end
|
|
107
|
+
)
|
|
108
|
+
return sumArray(nil, numCollectiblesArray)
|
|
109
|
+
end
|
|
110
|
+
--- Helper function to check to see if a player has one or more collectibles.
|
|
111
|
+
--
|
|
112
|
+
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
113
|
+
-- check for. Returns true if the player has any of the supplied collectible types.
|
|
114
|
+
--
|
|
115
|
+
-- This function always passes `false` to the `ignoreModifiers` argument.
|
|
116
|
+
function ____exports.hasCollectible(self, player, ...)
|
|
117
|
+
local collectibleTypes = {...}
|
|
118
|
+
return __TS__ArraySome(
|
|
119
|
+
collectibleTypes,
|
|
120
|
+
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
121
|
+
)
|
|
122
|
+
end
|
|
123
|
+
--- Helper function to check to see if a player has a specific collectible in one or more active
|
|
124
|
+
-- slots.
|
|
125
|
+
--
|
|
126
|
+
-- This function is variadic, meaning that you can specify as many active slots as you want to check
|
|
127
|
+
-- for. This function will return true if the collectible type is located in any of the active slots
|
|
128
|
+
-- provided.
|
|
129
|
+
function ____exports.hasCollectibleInActiveSlot(self, player, collectibleType, ...)
|
|
130
|
+
local activeSlots = {...}
|
|
131
|
+
local matchingActiveSlotsSet = __TS__New(ReadonlySet, activeSlots)
|
|
132
|
+
local activeItemSlots = ____exports.getActiveItemSlots(nil, player, collectibleType)
|
|
133
|
+
return __TS__ArraySome(
|
|
134
|
+
activeItemSlots,
|
|
135
|
+
function(____, activeSlot) return matchingActiveSlotsSet:has(activeSlot) end
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
--- Returns whether the player can hold an additional active item, beyond what they are currently
|
|
139
|
+
-- carrying. This takes the Schoolbag into account.
|
|
140
|
+
--
|
|
141
|
+
-- If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
142
|
+
-- items. (Only Tainted Forgotten can pick up items.)
|
|
143
|
+
function ____exports.hasOpenActiveItemSlot(self, player)
|
|
144
|
+
if isCharacter(nil, player, PlayerType.SOUL_B) then
|
|
145
|
+
return false
|
|
146
|
+
end
|
|
147
|
+
local activeItemPrimary = player:GetActiveItem(ActiveSlot.PRIMARY)
|
|
148
|
+
local activeItemSecondary = player:GetActiveItem(ActiveSlot.SECONDARY)
|
|
149
|
+
local hasSchoolbag = player:HasCollectible(CollectibleType.SCHOOLBAG)
|
|
150
|
+
if hasSchoolbag then
|
|
151
|
+
return activeItemPrimary == CollectibleType.NULL or activeItemSecondary == CollectibleType.NULL
|
|
152
|
+
end
|
|
153
|
+
return activeItemPrimary == CollectibleType.NULL
|
|
154
|
+
end
|
|
155
|
+
--- Helper function to check if the active slot of a particular player is empty.
|
|
156
|
+
--
|
|
157
|
+
-- @param player The player to check.
|
|
158
|
+
-- @param activeSlot Optional. The active slot to check. Default is `ActiveSlot.PRIMARY`.
|
|
159
|
+
function ____exports.isActiveSlotEmpty(self, player, activeSlot)
|
|
160
|
+
if activeSlot == nil then
|
|
161
|
+
activeSlot = ActiveSlot.PRIMARY
|
|
162
|
+
end
|
|
163
|
+
local activeCollectibleType = player:GetActiveItem(activeSlot)
|
|
164
|
+
return activeCollectibleType == CollectibleType.NULL
|
|
165
|
+
end
|
|
166
|
+
--- Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
167
|
+
-- and any pocket actives.
|
|
168
|
+
function ____exports.removeAllActiveItems(self, player)
|
|
169
|
+
for ____, activeSlot in ipairs(ACTIVE_SLOT_VALUES) do
|
|
170
|
+
do
|
|
171
|
+
local collectibleType = player:GetActiveItem(activeSlot)
|
|
172
|
+
if collectibleType == CollectibleType.NULL then
|
|
173
|
+
goto __continue28
|
|
174
|
+
end
|
|
175
|
+
local stillHasCollectible
|
|
176
|
+
repeat
|
|
177
|
+
do
|
|
178
|
+
player:RemoveCollectible(collectibleType)
|
|
179
|
+
stillHasCollectible = player:HasCollectible(collectibleType)
|
|
180
|
+
end
|
|
181
|
+
until not stillHasCollectible
|
|
182
|
+
end
|
|
183
|
+
::__continue28::
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
--- Helper function to remove one or more collectibles to a player.
|
|
187
|
+
--
|
|
188
|
+
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
189
|
+
-- remove.
|
|
190
|
+
function ____exports.removeCollectible(self, player, ...)
|
|
191
|
+
local collectibleTypes = {...}
|
|
192
|
+
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
193
|
+
player:RemoveCollectible(collectibleType)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
--- Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
197
|
+
-- having to request the collectible from the item config.
|
|
198
|
+
function ____exports.removeCollectibleCostume(self, player, collectibleType)
|
|
199
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
200
|
+
if itemConfigItem == nil then
|
|
201
|
+
return
|
|
202
|
+
end
|
|
203
|
+
player:RemoveCostume(itemConfigItem)
|
|
204
|
+
end
|
|
205
|
+
--- Helper function to remove one or more collectibles from all players. If any player has more than
|
|
206
|
+
-- one copy of the item, then all copies of it will be removed.
|
|
207
|
+
--
|
|
208
|
+
-- This function is variadic, meaning that you can specify as many collectibles as you want to
|
|
209
|
+
-- remove.
|
|
210
|
+
function ____exports.removeCollectibleFromAllPlayers(self, ...)
|
|
211
|
+
local collectibleTypes = {...}
|
|
212
|
+
for ____, player in ipairs(getAllPlayers(nil)) do
|
|
213
|
+
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
214
|
+
while player:HasCollectible(collectibleType, true) do
|
|
215
|
+
player:RemoveCollectible(collectibleType)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
--- Helper function to set an active collectible to a particular slot. This has different behavior
|
|
221
|
+
-- than calling the `player.AddCollectible` method with the `activeSlot` argument, because this
|
|
222
|
+
-- function will not shift existing items into the Schoolbag and it handles
|
|
223
|
+
-- `ActiveSlot.SLOT_POCKET2`.
|
|
224
|
+
--
|
|
225
|
+
-- Note that if an item is set to `ActiveSlot.SLOT_POCKET2`, it will disappear after being used and
|
|
226
|
+
-- will be automatically removed upon entering a new room.
|
|
227
|
+
--
|
|
228
|
+
-- @param player The player to give the item to.
|
|
229
|
+
-- @param collectibleType The collectible type of the item to give.
|
|
230
|
+
-- @param activeSlot Optional. The slot to set. Default is `ActiveSlot.PRIMARY`.
|
|
231
|
+
-- @param charge Optional. The argument of charges to set. If not specified, the item will be set
|
|
232
|
+
-- with maximum charges.
|
|
233
|
+
-- @param keepInPools Optional. Whether to remove the item from pools. Default is false.
|
|
234
|
+
function ____exports.setActiveItem(self, player, collectibleType, activeSlot, charge, keepInPools)
|
|
235
|
+
if activeSlot == nil then
|
|
236
|
+
activeSlot = ActiveSlot.PRIMARY
|
|
237
|
+
end
|
|
238
|
+
if keepInPools == nil then
|
|
239
|
+
keepInPools = false
|
|
240
|
+
end
|
|
241
|
+
local itemPool = game:GetItemPool()
|
|
242
|
+
local primaryCollectibleType = player:GetActiveItem(ActiveSlot.PRIMARY)
|
|
243
|
+
local primaryCharge = player:GetActiveCharge(ActiveSlot.PRIMARY)
|
|
244
|
+
local secondaryCollectibleType = player:GetActiveItem(ActiveSlot.SECONDARY)
|
|
245
|
+
if charge == nil then
|
|
246
|
+
charge = getCollectibleMaxCharges(nil, collectibleType)
|
|
247
|
+
end
|
|
248
|
+
if not keepInPools then
|
|
249
|
+
itemPool:RemoveCollectible(collectibleType)
|
|
250
|
+
end
|
|
251
|
+
repeat
|
|
252
|
+
local ____switch46 = activeSlot
|
|
253
|
+
local ____cond46 = ____switch46 == ActiveSlot.PRIMARY
|
|
254
|
+
if ____cond46 then
|
|
255
|
+
do
|
|
256
|
+
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
257
|
+
player:RemoveCollectible(primaryCollectibleType)
|
|
258
|
+
end
|
|
259
|
+
player:AddCollectible(collectibleType, charge, false)
|
|
260
|
+
break
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
____cond46 = ____cond46 or ____switch46 == ActiveSlot.SECONDARY
|
|
264
|
+
if ____cond46 then
|
|
265
|
+
do
|
|
266
|
+
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
267
|
+
player:RemoveCollectible(primaryCollectibleType)
|
|
268
|
+
end
|
|
269
|
+
if secondaryCollectibleType ~= CollectibleType.NULL then
|
|
270
|
+
player:RemoveCollectible(secondaryCollectibleType)
|
|
271
|
+
end
|
|
272
|
+
player:AddCollectible(secondaryCollectibleType, charge, false)
|
|
273
|
+
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
274
|
+
player:AddCollectible(primaryCollectibleType, primaryCharge, false)
|
|
275
|
+
end
|
|
276
|
+
break
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
____cond46 = ____cond46 or ____switch46 == ActiveSlot.POCKET
|
|
280
|
+
if ____cond46 then
|
|
281
|
+
do
|
|
282
|
+
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
283
|
+
player:SetActiveCharge(charge, activeSlot)
|
|
284
|
+
break
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
____cond46 = ____cond46 or ____switch46 == ActiveSlot.POCKET_SINGLE_USE
|
|
288
|
+
if ____cond46 then
|
|
289
|
+
do
|
|
290
|
+
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
291
|
+
break
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
until true
|
|
295
|
+
end
|
|
296
|
+
--- Helper function to use an active item without showing an animation, keeping the item, or adding
|
|
297
|
+
-- any costumes.
|
|
298
|
+
function ____exports.useActiveItemTemp(self, player, collectibleType)
|
|
299
|
+
player:UseActiveItem(
|
|
300
|
+
collectibleType,
|
|
301
|
+
false,
|
|
302
|
+
false,
|
|
303
|
+
true,
|
|
304
|
+
false,
|
|
305
|
+
-1
|
|
306
|
+
)
|
|
307
|
+
end
|
|
308
|
+
return ____exports
|
|
@@ -59,7 +59,7 @@ export declare function getPlayerBlackHearts(player: EntityPlayer): int;
|
|
|
59
59
|
*
|
|
60
60
|
* This is based on the `REVEL.StoreHealth` function in the Revelations mod.
|
|
61
61
|
*/
|
|
62
|
-
export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth
|
|
62
|
+
export declare function getPlayerHealth(player: EntityPlayer): Readonly<PlayerHealth>;
|
|
63
63
|
export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
|
|
64
64
|
/**
|
|
65
65
|
* Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQ9E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,CA2E5E;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAmDL;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAKzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAoDnE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAqCrE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,YAAY,GACnB,GAAG,CAML;AAED,sDAAsD;AACtD,wBAAgB,eAAe,IAAI,YAAY,CAc9C;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAcN;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAcN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAyHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
3
4
|
local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
|
|
4
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
5
6
|
local ____exports = {}
|
|
@@ -20,11 +21,12 @@ local ____characters = require("src.functions.characters")
|
|
|
20
21
|
local getCharacterMaxHeartContainers = ____characters.getCharacterMaxHeartContainers
|
|
21
22
|
local ____charge = require("src.functions.charge")
|
|
22
23
|
local getTotalCharge = ____charge.getTotalCharge
|
|
24
|
+
local ____playerCollectibles = require("src.functions.playerCollectibles")
|
|
25
|
+
local getActiveItemSlots = ____playerCollectibles.getActiveItemSlots
|
|
26
|
+
local setActiveItem = ____playerCollectibles.setActiveItem
|
|
23
27
|
local ____players = require("src.functions.players")
|
|
24
|
-
local getActiveItemSlots = ____players.getActiveItemSlots
|
|
25
28
|
local isCharacter = ____players.isCharacter
|
|
26
29
|
local isKeeper = ____players.isKeeper
|
|
27
|
-
local setActiveItem = ____players.setActiveItem
|
|
28
30
|
local ____utils = require("src.functions.utils")
|
|
29
31
|
local ____repeat = ____utils["repeat"]
|
|
30
32
|
--- Returns the number of black hearts that the player has, excluding any soul hearts. For example,
|
|
@@ -525,22 +527,24 @@ end
|
|
|
525
527
|
function ____exports.playerConvertBlackHeartsToSoulHearts(self, player)
|
|
526
528
|
local playerHealth = ____exports.getPlayerHealth(nil, player)
|
|
527
529
|
____exports.removeAllPlayerHealth(nil, player)
|
|
528
|
-
|
|
530
|
+
local newSoulHeartTypes = __TS__ArrayMap(
|
|
529
531
|
playerHealth.soulHeartTypes,
|
|
530
532
|
function(____, soulHeartType) return soulHeartType == HeartSubType.BLACK and HeartSubType.SOUL or soulHeartType end
|
|
531
533
|
)
|
|
532
|
-
|
|
534
|
+
local playerHealthWithSoulHearts = __TS__ObjectAssign({}, playerHealth, {soulHeartTypes = newSoulHeartTypes})
|
|
535
|
+
____exports.setPlayerHealth(nil, player, playerHealthWithSoulHearts)
|
|
533
536
|
end
|
|
534
537
|
--- Helper function to remove all of a player's soul hearts and add the corresponding amount of black
|
|
535
538
|
-- hearts.
|
|
536
539
|
function ____exports.playerConvertSoulHeartsToBlackHearts(self, player)
|
|
537
540
|
local playerHealth = ____exports.getPlayerHealth(nil, player)
|
|
538
541
|
____exports.removeAllPlayerHealth(nil, player)
|
|
539
|
-
|
|
542
|
+
local newSoulHeartTypes = __TS__ArrayMap(
|
|
540
543
|
playerHealth.soulHeartTypes,
|
|
541
544
|
function(____, soulHeartType) return soulHeartType == HeartSubType.SOUL and HeartSubType.BLACK or soulHeartType end
|
|
542
545
|
)
|
|
543
|
-
|
|
546
|
+
local playerHealthWithBlackHearts = __TS__ObjectAssign({}, playerHealth, {soulHeartTypes = newSoulHeartTypes})
|
|
547
|
+
____exports.setPlayerHealth(nil, player, playerHealthWithBlackHearts)
|
|
544
548
|
end
|
|
545
549
|
--- Helper function to see if the player is out of health.
|
|
546
550
|
--
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TrinketType } from "isaac-typescript-definitions";
|
|
2
|
+
export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to check to see if any player has a particular trinket.
|
|
5
|
+
*
|
|
6
|
+
* @param trinketType The trinket type to check for.
|
|
7
|
+
* @param ignoreModifiers If set to true, only counts trinkets the player actually holds and ignores
|
|
8
|
+
* effects granted by other items. Default is false.
|
|
9
|
+
*/
|
|
10
|
+
export declare function anyPlayerHasTrinket(trinketType: TrinketType, ignoreModifiers?: boolean): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
13
|
+
*
|
|
14
|
+
* For example:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const player = Isaac.GetPlayer();
|
|
18
|
+
* const trinketSlot = getOpenTrinketSlotNum(player);
|
|
19
|
+
* if (trinketSlot !== undefined) {
|
|
20
|
+
* // They have one or more open trinket slots
|
|
21
|
+
* player.AddTrinket(TrinketType.SWALLOWED_PENNY);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
28
|
+
* include any smelted trinkets.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getPlayerTrinkets(player: EntityPlayer): TrinketType[];
|
|
31
|
+
/**
|
|
32
|
+
* Helper function to get only the players that have a certain trinket.
|
|
33
|
+
*
|
|
34
|
+
* This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
35
|
+
* for. It only returns the players that have all of the trinkets.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getPlayersWithTrinket(...trinketTypes: TrinketType[]): EntityPlayer[];
|
|
38
|
+
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
39
|
+
export declare function hasAnyTrinket(player: EntityPlayer): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
42
|
+
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
43
|
+
*
|
|
44
|
+
* If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
45
|
+
* items. (Only Tainted Forgotten can pick up items.)
|
|
46
|
+
*/
|
|
47
|
+
export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Helper function to check to see if a player has one or more trinkets.
|
|
50
|
+
*
|
|
51
|
+
* This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
52
|
+
* for. Returns true if the player has any of the supplied trinket types.
|
|
53
|
+
*
|
|
54
|
+
* This function always passes `false` to the `ignoreModifiers` argument.
|
|
55
|
+
*/
|
|
56
|
+
export declare function hasTrinket(player: EntityPlayer, ...trinketTypes: TrinketType[]): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Helper function to remove all of the held trinkets from a player.
|
|
59
|
+
*
|
|
60
|
+
* This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
61
|
+
* that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
62
|
+
*/
|
|
63
|
+
export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
|
|
64
|
+
/**
|
|
65
|
+
* Helper function to remove a trinket costume from a player. Use this helper function to avoid
|
|
66
|
+
* having to request the trinket from the item config.
|
|
67
|
+
*/
|
|
68
|
+
export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
|
|
69
|
+
//# sourceMappingURL=playerTrinkets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playerTrinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/playerTrinkets.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAMtC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAMT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,GAAG,SAAS,CAkBxE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,EAAE,CAWrE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,YAAY,EAAE,WAAW,EAAE,GAC7B,YAAY,EAAE,CAMhB;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAO3D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAOhE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,EACpB,GAAG,YAAY,EAAE,WAAW,EAAE,GAC7B,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
|
+
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
4
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
|
+
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
9
|
+
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
10
|
+
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
11
|
+
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
12
|
+
local TRINKET_SLOT_VALUES = ____cachedEnumValues.TRINKET_SLOT_VALUES
|
|
13
|
+
local ____cachedClasses = require("src.core.cachedClasses")
|
|
14
|
+
local itemConfig = ____cachedClasses.itemConfig
|
|
15
|
+
local ____playerIndex = require("src.functions.playerIndex")
|
|
16
|
+
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
17
|
+
local getPlayers = ____playerIndex.getPlayers
|
|
18
|
+
local ____players = require("src.functions.players")
|
|
19
|
+
local isCharacter = ____players.isCharacter
|
|
20
|
+
function ____exports.addTrinketCostume(self, player, trinketType)
|
|
21
|
+
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
22
|
+
if itemConfigTrinket == nil then
|
|
23
|
+
return
|
|
24
|
+
end
|
|
25
|
+
player:AddCostume(itemConfigTrinket, false)
|
|
26
|
+
end
|
|
27
|
+
--- Helper function to check to see if any player has a particular trinket.
|
|
28
|
+
--
|
|
29
|
+
-- @param trinketType The trinket type to check for.
|
|
30
|
+
-- @param ignoreModifiers If set to true, only counts trinkets the player actually holds and ignores
|
|
31
|
+
-- effects granted by other items. Default is false.
|
|
32
|
+
function ____exports.anyPlayerHasTrinket(self, trinketType, ignoreModifiers)
|
|
33
|
+
local players = getAllPlayers(nil)
|
|
34
|
+
return __TS__ArraySome(
|
|
35
|
+
players,
|
|
36
|
+
function(____, player) return player:HasTrinket(trinketType, ignoreModifiers) end
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
--- Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
40
|
+
--
|
|
41
|
+
-- For example:
|
|
42
|
+
--
|
|
43
|
+
-- ```ts
|
|
44
|
+
-- const player = Isaac.GetPlayer();
|
|
45
|
+
-- const trinketSlot = getOpenTrinketSlotNum(player);
|
|
46
|
+
-- if (trinketSlot !== undefined) {
|
|
47
|
+
-- // They have one or more open trinket slots
|
|
48
|
+
-- player.AddTrinket(TrinketType.SWALLOWED_PENNY);
|
|
49
|
+
-- }
|
|
50
|
+
-- ```
|
|
51
|
+
function ____exports.getOpenTrinketSlot(self, player)
|
|
52
|
+
local maxTrinkets = player:GetMaxTrinkets()
|
|
53
|
+
local trinketType1 = player:GetTrinket(TrinketSlot.SLOT_1)
|
|
54
|
+
local trinketType2 = player:GetTrinket(TrinketSlot.SLOT_2)
|
|
55
|
+
if maxTrinkets == 1 then
|
|
56
|
+
return trinketType1 == TrinketType.NULL and 0 or nil
|
|
57
|
+
end
|
|
58
|
+
if maxTrinkets == 2 then
|
|
59
|
+
if trinketType1 == TrinketType.NULL then
|
|
60
|
+
return 0
|
|
61
|
+
end
|
|
62
|
+
return trinketType2 == TrinketType.NULL and 1 or nil
|
|
63
|
+
end
|
|
64
|
+
error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
65
|
+
end
|
|
66
|
+
--- Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
67
|
+
-- include any smelted trinkets.
|
|
68
|
+
function ____exports.getPlayerTrinkets(self, player)
|
|
69
|
+
local trinketTypes = {}
|
|
70
|
+
for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
|
|
71
|
+
local trinketType = player:GetTrinket(trinketSlot)
|
|
72
|
+
if trinketType ~= TrinketType.NULL then
|
|
73
|
+
trinketTypes[#trinketTypes + 1] = trinketType
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
return trinketTypes
|
|
77
|
+
end
|
|
78
|
+
--- Helper function to get only the players that have a certain trinket.
|
|
79
|
+
--
|
|
80
|
+
-- This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
81
|
+
-- for. It only returns the players that have all of the trinkets.
|
|
82
|
+
function ____exports.getPlayersWithTrinket(self, ...)
|
|
83
|
+
local trinketTypes = {...}
|
|
84
|
+
local players = getPlayers(nil)
|
|
85
|
+
return __TS__ArrayFilter(
|
|
86
|
+
players,
|
|
87
|
+
function(____, player) return __TS__ArrayEvery(
|
|
88
|
+
trinketTypes,
|
|
89
|
+
function(____, trinketType) return player:HasTrinket(trinketType) end
|
|
90
|
+
) end
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
--- Helper function to check to see if the player is holding one or more trinkets.
|
|
94
|
+
function ____exports.hasAnyTrinket(self, player)
|
|
95
|
+
local playerTrinketTypes = __TS__ArrayMap(
|
|
96
|
+
TRINKET_SLOT_VALUES,
|
|
97
|
+
function(____, trinketSlot) return player:GetTrinket(trinketSlot) end
|
|
98
|
+
)
|
|
99
|
+
return __TS__ArraySome(
|
|
100
|
+
playerTrinketTypes,
|
|
101
|
+
function(____, trinketType) return trinketType ~= TrinketType.NULL end
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
--- Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
105
|
+
-- carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
106
|
+
--
|
|
107
|
+
-- If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
108
|
+
-- items. (Only Tainted Forgotten can pick up items.)
|
|
109
|
+
function ____exports.hasOpenTrinketSlot(self, player)
|
|
110
|
+
if isCharacter(nil, player, PlayerType.SOUL_B) then
|
|
111
|
+
return false
|
|
112
|
+
end
|
|
113
|
+
local openTrinketSlot = ____exports.getOpenTrinketSlot(nil, player)
|
|
114
|
+
return openTrinketSlot ~= nil
|
|
115
|
+
end
|
|
116
|
+
--- Helper function to check to see if a player has one or more trinkets.
|
|
117
|
+
--
|
|
118
|
+
-- This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
119
|
+
-- for. Returns true if the player has any of the supplied trinket types.
|
|
120
|
+
--
|
|
121
|
+
-- This function always passes `false` to the `ignoreModifiers` argument.
|
|
122
|
+
function ____exports.hasTrinket(self, player, ...)
|
|
123
|
+
local trinketTypes = {...}
|
|
124
|
+
return __TS__ArraySome(
|
|
125
|
+
trinketTypes,
|
|
126
|
+
function(____, trinketType) return player:HasTrinket(trinketType) end
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
--- Helper function to remove all of the held trinkets from a player.
|
|
130
|
+
--
|
|
131
|
+
-- This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
132
|
+
-- that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
133
|
+
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
134
|
+
for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
|
|
135
|
+
do
|
|
136
|
+
local trinketType = player:GetTrinket(trinketSlot)
|
|
137
|
+
if trinketType == TrinketType.NULL then
|
|
138
|
+
goto __continue25
|
|
139
|
+
end
|
|
140
|
+
local alreadyHasTrinket
|
|
141
|
+
repeat
|
|
142
|
+
do
|
|
143
|
+
player:TryRemoveTrinket(trinketType)
|
|
144
|
+
alreadyHasTrinket = player:HasTrinket(trinketType)
|
|
145
|
+
end
|
|
146
|
+
until not alreadyHasTrinket
|
|
147
|
+
end
|
|
148
|
+
::__continue25::
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
--- Helper function to remove a trinket costume from a player. Use this helper function to avoid
|
|
152
|
+
-- having to request the trinket from the item config.
|
|
153
|
+
function ____exports.removeTrinketCostume(self, player, trinketType)
|
|
154
|
+
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
155
|
+
if itemConfigTrinket == nil then
|
|
156
|
+
return
|
|
157
|
+
end
|
|
158
|
+
player:RemoveCostume(itemConfigTrinket)
|
|
159
|
+
end
|
|
160
|
+
return ____exports
|