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
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
4
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
5
|
local __TS__ArrayAt = ____lualib.__TS__ArrayAt
|
|
7
6
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
8
|
-
local
|
|
7
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
9
8
|
local ____exports = {}
|
|
10
9
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
-
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
12
10
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
13
11
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
14
12
|
local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
|
|
@@ -16,22 +14,13 @@ local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
|
|
|
16
14
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
17
15
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
18
16
|
local TearFlag = ____isaac_2Dtypescript_2Ddefinitions.TearFlag
|
|
19
|
-
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
20
|
-
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
21
|
-
local ACTIVE_SLOT_VALUES = ____cachedEnumValues.ACTIVE_SLOT_VALUES
|
|
22
|
-
local TRINKET_SLOT_VALUES = ____cachedEnumValues.TRINKET_SLOT_VALUES
|
|
23
17
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
24
18
|
local game = ____cachedClasses.game
|
|
25
|
-
local itemConfig = ____cachedClasses.itemConfig
|
|
26
19
|
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
27
20
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
28
|
-
local ____array = require("src.functions.array")
|
|
29
|
-
local sumArray = ____array.sumArray
|
|
30
21
|
local ____characters = require("src.functions.characters")
|
|
31
22
|
local getCharacterName = ____characters.getCharacterName
|
|
32
23
|
local isVanillaCharacter = ____characters.isVanillaCharacter
|
|
33
|
-
local ____collectibles = require("src.functions.collectibles")
|
|
34
|
-
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
35
24
|
local ____flag = require("src.functions.flag")
|
|
36
25
|
local hasFlag = ____flag.hasFlag
|
|
37
26
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
@@ -51,16 +40,6 @@ function ____exports.getCharacters(self)
|
|
|
51
40
|
function(____, player) return player:GetPlayerType() end
|
|
52
41
|
)
|
|
53
42
|
end
|
|
54
|
-
--- Helper function to check if a player is a specific character (i.e. `PlayerType`).
|
|
55
|
-
--
|
|
56
|
-
-- This function is variadic, meaning that you can supply as many characters as you want to check
|
|
57
|
-
-- for. Returns true if the player is any of the supplied characters.
|
|
58
|
-
function ____exports.isCharacter(self, player, ...)
|
|
59
|
-
local characters = {...}
|
|
60
|
-
local characterSet = __TS__New(ReadonlySet, characters)
|
|
61
|
-
local character = player:GetPlayerType()
|
|
62
|
-
return characterSet:has(character)
|
|
63
|
-
end
|
|
64
43
|
function ____exports.isModdedPlayer(self, player)
|
|
65
44
|
return not ____exports.isVanillaPlayer(nil, player)
|
|
66
45
|
end
|
|
@@ -68,43 +47,6 @@ function ____exports.isVanillaPlayer(self, player)
|
|
|
68
47
|
local character = player:GetPlayerType()
|
|
69
48
|
return isVanillaCharacter(nil, character)
|
|
70
49
|
end
|
|
71
|
-
--- Helper function to add one or more collectibles to a player.
|
|
72
|
-
--
|
|
73
|
-
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
74
|
-
-- add.
|
|
75
|
-
function ____exports.addCollectible(self, player, ...)
|
|
76
|
-
local collectibleTypes = {...}
|
|
77
|
-
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
78
|
-
player:AddCollectible(collectibleType)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
function ____exports.addCollectibleCostume(self, player, collectibleType)
|
|
82
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
83
|
-
if itemConfigItem == nil then
|
|
84
|
-
return
|
|
85
|
-
end
|
|
86
|
-
player:AddCostume(itemConfigItem, false)
|
|
87
|
-
end
|
|
88
|
-
function ____exports.addTrinketCostume(self, player, trinketType)
|
|
89
|
-
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
90
|
-
if itemConfigTrinket == nil then
|
|
91
|
-
return
|
|
92
|
-
end
|
|
93
|
-
player:AddCostume(itemConfigTrinket, false)
|
|
94
|
-
end
|
|
95
|
-
--- Helper function to check to see if any player has a particular collectible.
|
|
96
|
-
--
|
|
97
|
-
-- @param collectibleType The collectible type to check for.
|
|
98
|
-
-- @param ignoreModifiers If set to true, only counts collectibles the player actually owns and
|
|
99
|
-
-- ignores effects granted by items like Zodiac, 3 Dollar Bill and Lemegeton.
|
|
100
|
-
-- Default is false.
|
|
101
|
-
function ____exports.anyPlayerHasCollectible(self, collectibleType, ignoreModifiers)
|
|
102
|
-
local players = getAllPlayers(nil)
|
|
103
|
-
return __TS__ArraySome(
|
|
104
|
-
players,
|
|
105
|
-
function(____, player) return player:HasCollectible(collectibleType, ignoreModifiers) end
|
|
106
|
-
)
|
|
107
|
-
end
|
|
108
50
|
--- Helper function to check to see if any player has a temporary collectible effect.
|
|
109
51
|
function ____exports.anyPlayerHasCollectibleEffect(self, collectibleType)
|
|
110
52
|
local players = getAllPlayers(nil)
|
|
@@ -127,18 +69,6 @@ function ____exports.anyPlayerHasNullEffect(self, nullItemID)
|
|
|
127
69
|
end
|
|
128
70
|
)
|
|
129
71
|
end
|
|
130
|
-
--- Helper function to check to see if any player has a particular trinket.
|
|
131
|
-
--
|
|
132
|
-
-- @param trinketType The trinket type to check for.
|
|
133
|
-
-- @param ignoreModifiers If set to true, only counts trinkets the player actually holds and ignores
|
|
134
|
-
-- effects granted by other items. Default is false.
|
|
135
|
-
function ____exports.anyPlayerHasTrinket(self, trinketType, ignoreModifiers)
|
|
136
|
-
local players = getAllPlayers(nil)
|
|
137
|
-
return __TS__ArraySome(
|
|
138
|
-
players,
|
|
139
|
-
function(____, player) return player:HasTrinket(trinketType, ignoreModifiers) end
|
|
140
|
-
)
|
|
141
|
-
end
|
|
142
72
|
--- Helper function to check to see if any player has a temporary trinket effect.
|
|
143
73
|
function ____exports.anyPlayerHasTrinketEffect(self, trinketType)
|
|
144
74
|
local players = getAllPlayers(nil)
|
|
@@ -198,17 +128,6 @@ function ____exports.dequeueItem(self, player)
|
|
|
198
128
|
player.QueuedItem = queue
|
|
199
129
|
return true
|
|
200
130
|
end
|
|
201
|
-
--- Helper function to find the active slots that the player has the corresponding collectible type
|
|
202
|
-
-- in. Returns an empty array if the player does not have the collectible in any active slot.
|
|
203
|
-
function ____exports.getActiveItemSlots(self, player, collectibleType)
|
|
204
|
-
return __TS__ArrayFilter(
|
|
205
|
-
ACTIVE_SLOT_VALUES,
|
|
206
|
-
function(____, activeSlot)
|
|
207
|
-
local activeItem = player:GetActiveItem(activeSlot)
|
|
208
|
-
return activeItem == collectibleType
|
|
209
|
-
end
|
|
210
|
-
)
|
|
211
|
-
end
|
|
212
131
|
--- Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
213
132
|
-- `EntityPlayer` object or a tear height stat.
|
|
214
133
|
--
|
|
@@ -284,20 +203,6 @@ function ____exports.getPlayerCloserThan(self, position, distance)
|
|
|
284
203
|
function(____, player) return player.Position:Distance(position) <= distance end
|
|
285
204
|
)
|
|
286
205
|
end
|
|
287
|
-
--- Helper function to return the total amount of collectibles that a player has that match the
|
|
288
|
-
-- collectible type(s) provided.
|
|
289
|
-
--
|
|
290
|
-
-- This function is variadic, meaning that you can specify N collectible types.
|
|
291
|
-
--
|
|
292
|
-
-- Note that this will filter out non-real collectibles like Lilith's Incubus.
|
|
293
|
-
function ____exports.getPlayerCollectibleCount(self, player, ...)
|
|
294
|
-
local collectibleTypes = {...}
|
|
295
|
-
local numCollectibles = 0
|
|
296
|
-
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
297
|
-
numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType, true)
|
|
298
|
-
end
|
|
299
|
-
return numCollectibles
|
|
300
|
-
end
|
|
301
206
|
--- Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity
|
|
302
207
|
-- does not correspond to any particular player.
|
|
303
208
|
--
|
|
@@ -373,9 +278,9 @@ function ____exports.getPlayersOfType(self, ...)
|
|
|
373
278
|
end
|
|
374
279
|
)
|
|
375
280
|
end
|
|
376
|
-
--- Helper function to get all of the players that
|
|
377
|
-
-- returns an array of players because it is possible
|
|
378
|
-
-- same controller index (e.g. Jacob & Esau).
|
|
281
|
+
--- Helper function to get all of the players that are using keyboard (i.e.
|
|
282
|
+
-- `ControllerIndex.KEYBOARD`). This function returns an array of players because it is possible
|
|
283
|
+
-- that there is more than one player with the same controller index (e.g. Jacob & Esau).
|
|
379
284
|
--
|
|
380
285
|
-- Note that this function includes players with a non-undefined parent like e.g. the Strawman
|
|
381
286
|
-- Keeper.
|
|
@@ -386,21 +291,6 @@ function ____exports.getPlayersOnKeyboard(self)
|
|
|
386
291
|
function(____, player) return player.ControllerIndex == ControllerIndex.KEYBOARD end
|
|
387
292
|
)
|
|
388
293
|
end
|
|
389
|
-
--- Helper function to get only the players that have a certain collectible.
|
|
390
|
-
--
|
|
391
|
-
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
392
|
-
-- check for. It only returns the players that have all of the collectibles.
|
|
393
|
-
function ____exports.getPlayersWithCollectible(self, ...)
|
|
394
|
-
local collectibleTypes = {...}
|
|
395
|
-
local players = getPlayers(nil)
|
|
396
|
-
return __TS__ArrayFilter(
|
|
397
|
-
players,
|
|
398
|
-
function(____, player) return __TS__ArrayEvery(
|
|
399
|
-
collectibleTypes,
|
|
400
|
-
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
401
|
-
) end
|
|
402
|
-
)
|
|
403
|
-
end
|
|
404
294
|
--- Helper function to get all of the players that match the provided controller index. This function
|
|
405
295
|
-- returns an array of players because it is possible that there is more than one player with the
|
|
406
296
|
-- same controller index (e.g. Jacob & Esau).
|
|
@@ -414,61 +304,6 @@ function ____exports.getPlayersWithControllerIndex(self, controllerIndex)
|
|
|
414
304
|
function(____, player) return player.ControllerIndex == controllerIndex end
|
|
415
305
|
)
|
|
416
306
|
end
|
|
417
|
-
--- Helper function to get only the players that have a certain trinket.
|
|
418
|
-
--
|
|
419
|
-
-- This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
420
|
-
-- for. It only returns the players that have all of the trinkets.
|
|
421
|
-
function ____exports.getPlayersWithTrinket(self, ...)
|
|
422
|
-
local trinketTypes = {...}
|
|
423
|
-
local players = getPlayers(nil)
|
|
424
|
-
return __TS__ArrayFilter(
|
|
425
|
-
players,
|
|
426
|
-
function(____, player) return __TS__ArrayEvery(
|
|
427
|
-
trinketTypes,
|
|
428
|
-
function(____, trinketType) return player:HasTrinket(trinketType) end
|
|
429
|
-
) end
|
|
430
|
-
)
|
|
431
|
-
end
|
|
432
|
-
--- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
|
|
433
|
-
-- Onion and player 2 has 2 Sad Onions, then this function would return 3.
|
|
434
|
-
--
|
|
435
|
-
-- Note that this will filter out non-real collectibles like Lilith's Incubus.
|
|
436
|
-
function ____exports.getTotalPlayerCollectibles(self, collectibleType)
|
|
437
|
-
local players = getPlayers(nil)
|
|
438
|
-
local numCollectiblesArray = __TS__ArrayMap(
|
|
439
|
-
players,
|
|
440
|
-
function(____, player) return player:GetCollectibleNum(collectibleType, true) end
|
|
441
|
-
)
|
|
442
|
-
return sumArray(nil, numCollectiblesArray)
|
|
443
|
-
end
|
|
444
|
-
--- Helper function to check to see if a player has one or more collectibles.
|
|
445
|
-
--
|
|
446
|
-
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
447
|
-
-- check for. Returns true if the player has any of the supplied collectible types.
|
|
448
|
-
--
|
|
449
|
-
-- This function always passes `false` to the `ignoreModifiers` argument.
|
|
450
|
-
function ____exports.hasCollectible(self, player, ...)
|
|
451
|
-
local collectibleTypes = {...}
|
|
452
|
-
return __TS__ArraySome(
|
|
453
|
-
collectibleTypes,
|
|
454
|
-
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
455
|
-
)
|
|
456
|
-
end
|
|
457
|
-
--- Helper function to check to see if a player has a specific collectible in one or more active
|
|
458
|
-
-- slots.
|
|
459
|
-
--
|
|
460
|
-
-- This function is variadic, meaning that you can specify as many active slots as you want to check
|
|
461
|
-
-- for. This function will return true if the collectible type is located in any of the active slots
|
|
462
|
-
-- provided.
|
|
463
|
-
function ____exports.hasCollectibleInActiveSlot(self, player, collectibleType, ...)
|
|
464
|
-
local activeSlots = {...}
|
|
465
|
-
local matchingActiveSlotsSet = __TS__New(ReadonlySet, activeSlots)
|
|
466
|
-
local activeItemSlots = ____exports.getActiveItemSlots(nil, player, collectibleType)
|
|
467
|
-
return __TS__ArraySome(
|
|
468
|
-
activeItemSlots,
|
|
469
|
-
function(____, activeSlot) return matchingActiveSlotsSet:has(activeSlot) end
|
|
470
|
-
)
|
|
471
|
-
end
|
|
472
307
|
--- Helper function to check to see if a player has one or more transformations.
|
|
473
308
|
--
|
|
474
309
|
-- This function is variadic, meaning that you can supply as many transformations as you want to
|
|
@@ -485,23 +320,6 @@ function ____exports.hasLostCurse(self, player)
|
|
|
485
320
|
local effects = player:GetEffects()
|
|
486
321
|
return effects:HasNullEffect(NullItemID.LOST_CURSE)
|
|
487
322
|
end
|
|
488
|
-
--- Returns whether the player can hold an additional active item, beyond what they are currently
|
|
489
|
-
-- carrying. This takes the Schoolbag into account.
|
|
490
|
-
--
|
|
491
|
-
-- If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
492
|
-
-- items. (Only Tainted Forgotten can pick up items.)
|
|
493
|
-
function ____exports.hasOpenActiveItemSlot(self, player)
|
|
494
|
-
if ____exports.isCharacter(nil, player, PlayerType.SOUL_B) then
|
|
495
|
-
return false
|
|
496
|
-
end
|
|
497
|
-
local activeItemPrimary = player:GetActiveItem(ActiveSlot.PRIMARY)
|
|
498
|
-
local activeItemSecondary = player:GetActiveItem(ActiveSlot.SECONDARY)
|
|
499
|
-
local hasSchoolbag = player:HasCollectible(CollectibleType.SCHOOLBAG)
|
|
500
|
-
if hasSchoolbag then
|
|
501
|
-
return activeItemPrimary == CollectibleType.NULL or activeItemSecondary == CollectibleType.NULL
|
|
502
|
-
end
|
|
503
|
-
return activeItemPrimary == CollectibleType.NULL
|
|
504
|
-
end
|
|
505
323
|
--- Helper function to check if a player has piercing tears.
|
|
506
324
|
--
|
|
507
325
|
-- Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
@@ -514,30 +332,6 @@ end
|
|
|
514
332
|
function ____exports.hasSpectral(self, player)
|
|
515
333
|
return hasFlag(nil, player.TearFlags, TearFlag.SPECTRAL)
|
|
516
334
|
end
|
|
517
|
-
--- Helper function to check to see if a player has one or more trinkets.
|
|
518
|
-
--
|
|
519
|
-
-- This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
520
|
-
-- for. Returns true if the player has any of the supplied trinket types.
|
|
521
|
-
--
|
|
522
|
-
-- This function always passes `false` to the `ignoreModifiers` argument.
|
|
523
|
-
function ____exports.hasTrinket(self, player, ...)
|
|
524
|
-
local trinketTypes = {...}
|
|
525
|
-
return __TS__ArraySome(
|
|
526
|
-
trinketTypes,
|
|
527
|
-
function(____, trinketType) return player:HasTrinket(trinketType) end
|
|
528
|
-
)
|
|
529
|
-
end
|
|
530
|
-
--- Helper function to check if the active slot of a particular player is empty.
|
|
531
|
-
--
|
|
532
|
-
-- @param player The player to check.
|
|
533
|
-
-- @param activeSlot Optional. The active slot to check. Default is `ActiveSlot.PRIMARY`.
|
|
534
|
-
function ____exports.isActiveSlotEmpty(self, player, activeSlot)
|
|
535
|
-
if activeSlot == nil then
|
|
536
|
-
activeSlot = ActiveSlot.PRIMARY
|
|
537
|
-
end
|
|
538
|
-
local activeCollectibleType = player:GetActiveItem(activeSlot)
|
|
539
|
-
return activeCollectibleType == CollectibleType.NULL
|
|
540
|
-
end
|
|
541
335
|
--- Helper function for detecting when a player is Bethany or Tainted Bethany. This is useful if you
|
|
542
336
|
-- need to adjust UI elements to account for Bethany's soul charges or Tainted Bethany's blood
|
|
543
337
|
-- charges.
|
|
@@ -545,6 +339,16 @@ function ____exports.isBethany(self, player)
|
|
|
545
339
|
local character = player:GetPlayerType()
|
|
546
340
|
return character == PlayerType.BETHANY or character == PlayerType.BETHANY_B
|
|
547
341
|
end
|
|
342
|
+
--- Helper function to check if a player is a specific character (i.e. `PlayerType`).
|
|
343
|
+
--
|
|
344
|
+
-- This function is variadic, meaning that you can supply as many characters as you want to check
|
|
345
|
+
-- for. Returns true if the player is any of the supplied characters.
|
|
346
|
+
function ____exports.isCharacter(self, player, ...)
|
|
347
|
+
local characters = {...}
|
|
348
|
+
local characterSet = __TS__New(ReadonlySet, characters)
|
|
349
|
+
local character = player:GetPlayerType()
|
|
350
|
+
return characterSet:has(character)
|
|
351
|
+
end
|
|
548
352
|
--- Helper function to see if a damage source is from a player. Use this instead of comparing to the
|
|
549
353
|
-- entity directly because it takes familiars into account.
|
|
550
354
|
function ____exports.isDamageFromPlayer(self, damageSource)
|
|
@@ -561,6 +365,12 @@ function ____exports.isEden(self, player)
|
|
|
561
365
|
local character = player:GetPlayerType()
|
|
562
366
|
return character == PlayerType.EDEN or character == PlayerType.EDEN_B
|
|
563
367
|
end
|
|
368
|
+
local function isTaintedModded(self, player)
|
|
369
|
+
local character = player:GetPlayerType()
|
|
370
|
+
local name = player:GetName()
|
|
371
|
+
local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
|
|
372
|
+
return character == taintedCharacter
|
|
373
|
+
end
|
|
564
374
|
function ____exports.isFirstPlayer(self, player)
|
|
565
375
|
return getPlayerIndexVanilla(nil, player) == 0
|
|
566
376
|
end
|
|
@@ -581,12 +391,6 @@ function ____exports.isLost(self, player)
|
|
|
581
391
|
local character = player:GetPlayerType()
|
|
582
392
|
return character == PlayerType.LOST or character == PlayerType.LOST_B
|
|
583
393
|
end
|
|
584
|
-
local function isTaintedModded(self, player)
|
|
585
|
-
local character = player:GetPlayerType()
|
|
586
|
-
local name = player:GetName()
|
|
587
|
-
local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
|
|
588
|
-
return character == taintedCharacter
|
|
589
|
-
end
|
|
590
394
|
--- Helper function for determining if a player is able to turn their head by pressing the shooting
|
|
591
395
|
-- buttons.
|
|
592
396
|
--
|
|
@@ -610,82 +414,6 @@ function ____exports.isTaintedLazarus(self, player)
|
|
|
610
414
|
local character = player:GetPlayerType()
|
|
611
415
|
return character == PlayerType.LAZARUS_B or character == PlayerType.LAZARUS_2_B
|
|
612
416
|
end
|
|
613
|
-
--- Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
614
|
-
-- and any pocket actives.
|
|
615
|
-
function ____exports.removeAllActiveItems(self, player)
|
|
616
|
-
for ____, activeSlot in ipairs(ACTIVE_SLOT_VALUES) do
|
|
617
|
-
do
|
|
618
|
-
local collectibleType = player:GetActiveItem(activeSlot)
|
|
619
|
-
if collectibleType == CollectibleType.NULL then
|
|
620
|
-
goto __continue104
|
|
621
|
-
end
|
|
622
|
-
local stillHasCollectible
|
|
623
|
-
repeat
|
|
624
|
-
do
|
|
625
|
-
player:RemoveCollectible(collectibleType)
|
|
626
|
-
stillHasCollectible = player:HasCollectible(collectibleType)
|
|
627
|
-
end
|
|
628
|
-
until not stillHasCollectible
|
|
629
|
-
end
|
|
630
|
-
::__continue104::
|
|
631
|
-
end
|
|
632
|
-
end
|
|
633
|
-
--- Helper function to remove all of the held trinkets from a player.
|
|
634
|
-
--
|
|
635
|
-
-- This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
636
|
-
-- that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
637
|
-
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
638
|
-
for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
|
|
639
|
-
do
|
|
640
|
-
local trinketType = player:GetTrinket(trinketSlot)
|
|
641
|
-
if trinketType == TrinketType.NULL then
|
|
642
|
-
goto __continue109
|
|
643
|
-
end
|
|
644
|
-
local alreadyHasTrinket
|
|
645
|
-
repeat
|
|
646
|
-
do
|
|
647
|
-
player:TryRemoveTrinket(trinketType)
|
|
648
|
-
alreadyHasTrinket = player:HasTrinket(trinketType)
|
|
649
|
-
end
|
|
650
|
-
until not alreadyHasTrinket
|
|
651
|
-
end
|
|
652
|
-
::__continue109::
|
|
653
|
-
end
|
|
654
|
-
end
|
|
655
|
-
--- Helper function to remove one or more collectibles to a player.
|
|
656
|
-
--
|
|
657
|
-
-- This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
658
|
-
-- remove.
|
|
659
|
-
function ____exports.removeCollectible(self, player, ...)
|
|
660
|
-
local collectibleTypes = {...}
|
|
661
|
-
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
662
|
-
player:RemoveCollectible(collectibleType)
|
|
663
|
-
end
|
|
664
|
-
end
|
|
665
|
-
--- Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
666
|
-
-- having to request the collectible from the item config.
|
|
667
|
-
function ____exports.removeCollectibleCostume(self, player, collectibleType)
|
|
668
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
669
|
-
if itemConfigItem == nil then
|
|
670
|
-
return
|
|
671
|
-
end
|
|
672
|
-
player:RemoveCostume(itemConfigItem)
|
|
673
|
-
end
|
|
674
|
-
--- Helper function to remove one or more collectibles from all players. If any player has more than
|
|
675
|
-
-- one copy of the item, then all copies of it will be removed.
|
|
676
|
-
--
|
|
677
|
-
-- This function is variadic, meaning that you can specify as many collectibles as you want to
|
|
678
|
-
-- remove.
|
|
679
|
-
function ____exports.removeCollectibleFromAllPlayers(self, ...)
|
|
680
|
-
local collectibleTypes = {...}
|
|
681
|
-
for ____, player in ipairs(getAllPlayers(nil)) do
|
|
682
|
-
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
683
|
-
while player:HasCollectible(collectibleType, true) do
|
|
684
|
-
player:RemoveCollectible(collectibleType)
|
|
685
|
-
end
|
|
686
|
-
end
|
|
687
|
-
end
|
|
688
|
-
end
|
|
689
417
|
--- Helper function to remove the Dead Eye multiplier from a player.
|
|
690
418
|
--
|
|
691
419
|
-- Note that each time the `EntityPlayer.ClearDeadEyeCharge` method is called, it only has a chance
|
|
@@ -699,91 +427,6 @@ function ____exports.removeDeadEyeMultiplier(self, player)
|
|
|
699
427
|
end
|
|
700
428
|
)
|
|
701
429
|
end
|
|
702
|
-
--- Helper function to remove a trinket costume from a player. Use this helper function to avoid
|
|
703
|
-
-- having to request the trinket from the item config.
|
|
704
|
-
function ____exports.removeTrinketCostume(self, player, trinketType)
|
|
705
|
-
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
706
|
-
if itemConfigTrinket == nil then
|
|
707
|
-
return
|
|
708
|
-
end
|
|
709
|
-
player:RemoveCostume(itemConfigTrinket)
|
|
710
|
-
end
|
|
711
|
-
--- Helper function to set an active collectible to a particular slot. This has different behavior
|
|
712
|
-
-- than calling the `player.AddCollectible` method with the `activeSlot` argument, because this
|
|
713
|
-
-- function will not shift existing items into the Schoolbag and it handles
|
|
714
|
-
-- `ActiveSlot.SLOT_POCKET2`.
|
|
715
|
-
--
|
|
716
|
-
-- Note that if an item is set to `ActiveSlot.SLOT_POCKET2`, it will disappear after being used and
|
|
717
|
-
-- will be automatically removed upon entering a new room.
|
|
718
|
-
--
|
|
719
|
-
-- @param player The player to give the item to.
|
|
720
|
-
-- @param collectibleType The collectible type of the item to give.
|
|
721
|
-
-- @param activeSlot Optional. The slot to set. Default is `ActiveSlot.PRIMARY`.
|
|
722
|
-
-- @param charge Optional. The argument of charges to set. If not specified, the item will be set
|
|
723
|
-
-- with maximum charges.
|
|
724
|
-
-- @param keepInPools Optional. Whether to remove the item from pools. Default is false.
|
|
725
|
-
function ____exports.setActiveItem(self, player, collectibleType, activeSlot, charge, keepInPools)
|
|
726
|
-
if activeSlot == nil then
|
|
727
|
-
activeSlot = ActiveSlot.PRIMARY
|
|
728
|
-
end
|
|
729
|
-
if keepInPools == nil then
|
|
730
|
-
keepInPools = false
|
|
731
|
-
end
|
|
732
|
-
local itemPool = game:GetItemPool()
|
|
733
|
-
local primaryCollectibleType = player:GetActiveItem(ActiveSlot.PRIMARY)
|
|
734
|
-
local primaryCharge = player:GetActiveCharge(ActiveSlot.PRIMARY)
|
|
735
|
-
local secondaryCollectibleType = player:GetActiveItem(ActiveSlot.SECONDARY)
|
|
736
|
-
if charge == nil then
|
|
737
|
-
charge = getCollectibleMaxCharges(nil, collectibleType)
|
|
738
|
-
end
|
|
739
|
-
if not keepInPools then
|
|
740
|
-
itemPool:RemoveCollectible(collectibleType)
|
|
741
|
-
end
|
|
742
|
-
repeat
|
|
743
|
-
local ____switch131 = activeSlot
|
|
744
|
-
local ____cond131 = ____switch131 == ActiveSlot.PRIMARY
|
|
745
|
-
if ____cond131 then
|
|
746
|
-
do
|
|
747
|
-
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
748
|
-
player:RemoveCollectible(primaryCollectibleType)
|
|
749
|
-
end
|
|
750
|
-
player:AddCollectible(collectibleType, charge, false)
|
|
751
|
-
break
|
|
752
|
-
end
|
|
753
|
-
end
|
|
754
|
-
____cond131 = ____cond131 or ____switch131 == ActiveSlot.SECONDARY
|
|
755
|
-
if ____cond131 then
|
|
756
|
-
do
|
|
757
|
-
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
758
|
-
player:RemoveCollectible(primaryCollectibleType)
|
|
759
|
-
end
|
|
760
|
-
if secondaryCollectibleType ~= CollectibleType.NULL then
|
|
761
|
-
player:RemoveCollectible(secondaryCollectibleType)
|
|
762
|
-
end
|
|
763
|
-
player:AddCollectible(secondaryCollectibleType, charge, false)
|
|
764
|
-
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
765
|
-
player:AddCollectible(primaryCollectibleType, primaryCharge, false)
|
|
766
|
-
end
|
|
767
|
-
break
|
|
768
|
-
end
|
|
769
|
-
end
|
|
770
|
-
____cond131 = ____cond131 or ____switch131 == ActiveSlot.POCKET
|
|
771
|
-
if ____cond131 then
|
|
772
|
-
do
|
|
773
|
-
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
774
|
-
player:SetActiveCharge(charge, activeSlot)
|
|
775
|
-
break
|
|
776
|
-
end
|
|
777
|
-
end
|
|
778
|
-
____cond131 = ____cond131 or ____switch131 == ActiveSlot.POCKET_SINGLE_USE
|
|
779
|
-
if ____cond131 then
|
|
780
|
-
do
|
|
781
|
-
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
782
|
-
break
|
|
783
|
-
end
|
|
784
|
-
end
|
|
785
|
-
until true
|
|
786
|
-
end
|
|
787
430
|
--- Helper function to blindfold the player by using a hack with the challenge variable.
|
|
788
431
|
--
|
|
789
432
|
-- The method used in this function was discovered by im_tem.
|
|
@@ -813,16 +456,4 @@ function ____exports.setBlindfold(self, player, enabled, modifyCostume)
|
|
|
813
456
|
end
|
|
814
457
|
end
|
|
815
458
|
end
|
|
816
|
-
--- Helper function to use an active item without showing an animation, keeping the item, or adding
|
|
817
|
-
-- any costumes.
|
|
818
|
-
function ____exports.useActiveItemTemp(self, player, collectibleType)
|
|
819
|
-
player:UseActiveItem(
|
|
820
|
-
collectibleType,
|
|
821
|
-
false,
|
|
822
|
-
false,
|
|
823
|
-
true,
|
|
824
|
-
false,
|
|
825
|
-
-1
|
|
826
|
-
)
|
|
827
|
-
end
|
|
828
459
|
return ____exports
|
|
@@ -3,8 +3,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
3
3
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
4
4
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
5
5
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
6
|
-
local
|
|
7
|
-
local useActiveItemTemp =
|
|
6
|
+
local ____playerCollectibles = require("src.functions.playerCollectibles")
|
|
7
|
+
local useActiveItemTemp = ____playerCollectibles.useActiveItemTemp
|
|
8
8
|
local ____trinkets = require("src.functions.trinkets")
|
|
9
9
|
local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
|
|
10
10
|
local ____utils = require("src.functions.utils")
|
|
@@ -29,26 +29,6 @@ export declare function getGoldenTrinketType(trinketType: TrinketType): TrinketT
|
|
|
29
29
|
* Default is the current frame.
|
|
30
30
|
*/
|
|
31
31
|
export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, frameCount?: int): MysteriousPaperEffect | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
34
|
-
*
|
|
35
|
-
* For example:
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* const player = Isaac.GetPlayer();
|
|
39
|
-
* const trinketSlot = getOpenTrinketSlotNum(player);
|
|
40
|
-
* if (trinketSlot !== undefined) {
|
|
41
|
-
* // They have one or more open trinket slots
|
|
42
|
-
* player.AddTrinket(TrinketType.SWALLOWED_PENNY);
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
49
|
-
* include any smelted trinkets.
|
|
50
|
-
*/
|
|
51
|
-
export declare function getPlayerTrinkets(player: EntityPlayer): TrinketType[];
|
|
52
32
|
/**
|
|
53
33
|
* Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
54
34
|
* trinket type was not valid.
|
|
@@ -74,16 +54,6 @@ export declare function getTrinketGfxFilename(trinketType: TrinketType): string;
|
|
|
74
54
|
* This function works for both vanilla and modded trinkets.
|
|
75
55
|
*/
|
|
76
56
|
export declare function getTrinketName(trinketType: TrinketType): string;
|
|
77
|
-
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
78
|
-
export declare function hasAnyTrinket(player: EntityPlayer): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
81
|
-
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
82
|
-
*
|
|
83
|
-
* If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
84
|
-
* items. (Only Tainted Forgotten can pick up items.)
|
|
85
|
-
*/
|
|
86
|
-
export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
|
|
87
57
|
export declare function isGoldenTrinketType(trinketType: TrinketType): boolean;
|
|
88
58
|
export declare function isModdedTrinketType(trinketType: TrinketType): boolean;
|
|
89
59
|
export declare function isVanillaTrinketType(trinketType: TrinketType): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AA8BvE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,GAAG,GACf,qBAAqB,GAAG,SAAS,CAUnC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CActE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAOtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAc/D;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAYjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAiBN;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
|