isaacscript-common 1.2.132 → 1.2.135
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.
|
@@ -3,6 +3,8 @@ local ____exports = {}
|
|
|
3
3
|
local hasSubscriptions, postRender, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, CustomReviveState, v
|
|
4
4
|
local ____cachedClasses = require("cachedClasses")
|
|
5
5
|
local sfxManager = ____cachedClasses.sfxManager
|
|
6
|
+
local ____runInNFrames = require("features.runInNFrames")
|
|
7
|
+
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
6
8
|
local ____exports = require("features.saveDataManager.exports")
|
|
7
9
|
local saveDataManager = ____exports.saveDataManager
|
|
8
10
|
local ____collectibles = require("functions.collectibles")
|
|
@@ -10,6 +12,7 @@ local removeCollectibleFromItemTracker = ____collectibles.removeCollectibleFromI
|
|
|
10
12
|
local ____familiars = require("functions.familiars")
|
|
11
13
|
local removeAllFamiliars = ____familiars.removeAllFamiliars
|
|
12
14
|
local ____player = require("functions.player")
|
|
15
|
+
local getPlayerFromIndex = ____player.getPlayerFromIndex
|
|
13
16
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
14
17
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
15
18
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
@@ -83,6 +86,26 @@ function playerIsAboutToDie(self, player)
|
|
|
83
86
|
player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
|
|
84
87
|
removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
|
|
85
88
|
removeCollectibleFromItemTracker(nil, CollectibleType.COLLECTIBLE_1UP)
|
|
89
|
+
local character = player:GetPlayerType()
|
|
90
|
+
if character ~= PlayerType.PLAYER_SAMSON_B then
|
|
91
|
+
return
|
|
92
|
+
end
|
|
93
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
94
|
+
runNextGameFrame(
|
|
95
|
+
nil,
|
|
96
|
+
function()
|
|
97
|
+
local taintedSamson = getPlayerFromIndex(nil, playerIndex)
|
|
98
|
+
if taintedSamson == nil then
|
|
99
|
+
return
|
|
100
|
+
end
|
|
101
|
+
local effects = player:GetEffects()
|
|
102
|
+
local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
103
|
+
if not isBerserk then
|
|
104
|
+
return
|
|
105
|
+
end
|
|
106
|
+
effects:RemoveCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK, -1)
|
|
107
|
+
end
|
|
108
|
+
)
|
|
86
109
|
end
|
|
87
110
|
CustomReviveState = CustomReviveState or ({})
|
|
88
111
|
CustomReviveState.DISABLED = 0
|
|
@@ -11,7 +11,7 @@ export declare function anyEntityCloserThan(entities: Entity[], position: Vector
|
|
|
11
11
|
* @param subType Default is -1.
|
|
12
12
|
* @param ignoreFriendly Default is false.
|
|
13
13
|
*/
|
|
14
|
-
export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean):
|
|
14
|
+
export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): int;
|
|
15
15
|
/**
|
|
16
16
|
* Given an array of entities, this helper function returns the closest one to a provided reference
|
|
17
17
|
* entity.
|
|
@@ -14,6 +14,16 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
|
|
|
14
14
|
* for. Returns true if any of the characters supplied are present.
|
|
15
15
|
*/
|
|
16
16
|
export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | int>): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to determine if a player will destroy a rock/pot/skull/etc. if they walk over it.
|
|
19
|
+
*
|
|
20
|
+
* The following situations allow for this to be true:
|
|
21
|
+
* - the player has Leo (collectible 302)
|
|
22
|
+
* - the player has Thunder Thighs (collectible 314)
|
|
23
|
+
* - the player is under the effects of Mega Mush (collectible 625)
|
|
24
|
+
* - the player has Stompy (transformation 13)
|
|
25
|
+
*/
|
|
26
|
+
export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
|
|
17
27
|
/**
|
|
18
28
|
* Helper function to determine if the provided character can have red heart containers. Returns
|
|
19
29
|
* true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
|
|
@@ -47,7 +57,7 @@ export declare function getAllPlayers(): EntityPlayer[];
|
|
|
47
57
|
*
|
|
48
58
|
* The formula for calculating it is: 32 - 2.5 * player.TearHeight
|
|
49
59
|
*/
|
|
50
|
-
export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float):
|
|
60
|
+
export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): float;
|
|
51
61
|
/**
|
|
52
62
|
* Returns the number of black hearts that the player has, excluding any soul hearts. For example,
|
|
53
63
|
* if the player has one full black heart, one full soul heart, and one half black heart, this
|
|
@@ -63,7 +73,7 @@ export declare function getBlackHearts(player: EntityPlayer): int;
|
|
|
63
73
|
*/
|
|
64
74
|
export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
|
|
65
75
|
/** Helper function to get an array containing the characters of all of the current players. */
|
|
66
|
-
export declare function getCharacters():
|
|
76
|
+
export declare function getCharacters(): PlayerType[];
|
|
67
77
|
export declare function getClosestPlayer(position: Vector): EntityPlayer;
|
|
68
78
|
/**
|
|
69
79
|
* Most characters have a 56 frame death animation (i.e. the "Death" animation).
|
|
@@ -194,7 +204,13 @@ export declare function getPlayers(performCharacterExclusions?: boolean): Entity
|
|
|
194
204
|
* for. Returns true if any of the characters supplied are present.
|
|
195
205
|
*/
|
|
196
206
|
export declare function getPlayersOfType(...characters: Array<PlayerType | int>): EntityPlayer[];
|
|
197
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Helper function to get only the players that have a certain collectible.
|
|
209
|
+
*
|
|
210
|
+
* This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
211
|
+
* check for. It only returns the players that have all of the collectibles.
|
|
212
|
+
*/
|
|
213
|
+
export declare function getPlayersWithCollectible(...collectibleTypes: Array<CollectibleType | int>): EntityPlayer[];
|
|
198
214
|
/**
|
|
199
215
|
* Returns the number of soul hearts that the player has, excluding any black hearts. For example,
|
|
200
216
|
* if the player has one full black heart, one full soul heart, and one half black heart, this
|
|
@@ -220,7 +236,7 @@ export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPl
|
|
|
220
236
|
* This function does not validate whether or not the provided player is Tainted Magdalene; that
|
|
221
237
|
* should be accomplished before invoking this function.
|
|
222
238
|
*/
|
|
223
|
-
export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer):
|
|
239
|
+
export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): int;
|
|
224
240
|
/**
|
|
225
241
|
* Helper function to return the active charge and the battery charge combined. This is useful
|
|
226
242
|
* because you are not able to set the battery charge directly.
|
|
@@ -9,6 +9,7 @@ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
|
9
9
|
local Map = ____lualib.Map
|
|
10
10
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
11
11
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
12
|
+
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
12
13
|
local ____exports = {}
|
|
13
14
|
local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
|
|
14
15
|
local ____cachedClasses = require("cachedClasses")
|
|
@@ -99,15 +100,15 @@ end
|
|
|
99
100
|
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
100
101
|
local character = player:GetPlayerType()
|
|
101
102
|
repeat
|
|
102
|
-
local
|
|
103
|
-
local
|
|
104
|
-
if
|
|
103
|
+
local ____switch69 = character
|
|
104
|
+
local ____cond69 = ____switch69 == PlayerType.PLAYER_THESOUL
|
|
105
|
+
if ____cond69 then
|
|
105
106
|
do
|
|
106
107
|
return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
|
|
107
108
|
end
|
|
108
109
|
end
|
|
109
|
-
|
|
110
|
-
if
|
|
110
|
+
____cond69 = ____cond69 or ____switch69 == PlayerType.PLAYER_LAZARUS2_B
|
|
111
|
+
if ____cond69 then
|
|
111
112
|
do
|
|
112
113
|
return CollectibleType.COLLECTIBLE_INNER_EYE
|
|
113
114
|
end
|
|
@@ -138,39 +139,39 @@ end
|
|
|
138
139
|
function getAdjustedPlayerName(self, player)
|
|
139
140
|
local character = player:GetPlayerType()
|
|
140
141
|
repeat
|
|
141
|
-
local
|
|
142
|
-
local
|
|
143
|
-
if
|
|
142
|
+
local ____switch82 = character
|
|
143
|
+
local ____cond82 = ____switch82 == PlayerType.PLAYER_BLUEBABY or ____switch82 == PlayerType.PLAYER_BLUEBABY_B
|
|
144
|
+
if ____cond82 then
|
|
144
145
|
do
|
|
145
146
|
return "Blue Baby"
|
|
146
147
|
end
|
|
147
148
|
end
|
|
148
|
-
|
|
149
|
-
if
|
|
149
|
+
____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2
|
|
150
|
+
if ____cond82 then
|
|
150
151
|
do
|
|
151
152
|
return "Lazarus II"
|
|
152
153
|
end
|
|
153
154
|
end
|
|
154
|
-
|
|
155
|
-
if
|
|
155
|
+
____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_BLACKJUDAS
|
|
156
|
+
if ____cond82 then
|
|
156
157
|
do
|
|
157
158
|
return "Dark Judas"
|
|
158
159
|
end
|
|
159
160
|
end
|
|
160
|
-
|
|
161
|
-
if
|
|
161
|
+
____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB
|
|
162
|
+
if ____cond82 then
|
|
162
163
|
do
|
|
163
164
|
return "Jacob & Esau"
|
|
164
165
|
end
|
|
165
166
|
end
|
|
166
|
-
|
|
167
|
-
if
|
|
167
|
+
____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2_B
|
|
168
|
+
if ____cond82 then
|
|
168
169
|
do
|
|
169
170
|
return "Dead Tainted Lazarus"
|
|
170
171
|
end
|
|
171
172
|
end
|
|
172
|
-
|
|
173
|
-
if
|
|
173
|
+
____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB2_B
|
|
174
|
+
if ____cond82 then
|
|
174
175
|
do
|
|
175
176
|
return "Dead Tainted Jacob"
|
|
176
177
|
end
|
|
@@ -291,6 +292,10 @@ function ____exports.anyPlayerIs(self, ...)
|
|
|
291
292
|
function(____, character) return matchingCharacterSet:has(character) end
|
|
292
293
|
)
|
|
293
294
|
end
|
|
295
|
+
function ____exports.canPlayerCrushRocks(self, player)
|
|
296
|
+
local effects = player:GetEffects()
|
|
297
|
+
return player:HasCollectible(CollectibleType.COLLECTIBLE_LEO) or player:HasCollectible(CollectibleType.COLLECTIBLE_THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_MEGA_MUSH) or player:HasPlayerForm(PlayerForm.PLAYERFORM_STOMPY)
|
|
298
|
+
end
|
|
294
299
|
function ____exports.characterCanHaveRedHearts(self, character)
|
|
295
300
|
return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
|
|
296
301
|
end
|
|
@@ -498,11 +503,15 @@ function ____exports.getPlayersOfType(self, ...)
|
|
|
498
503
|
end
|
|
499
504
|
)
|
|
500
505
|
end
|
|
501
|
-
function ____exports.getPlayersWithCollectible(self,
|
|
506
|
+
function ____exports.getPlayersWithCollectible(self, ...)
|
|
507
|
+
local collectibleTypes = {...}
|
|
502
508
|
local players = ____exports.getPlayers(nil)
|
|
503
509
|
return __TS__ArrayFilter(
|
|
504
510
|
players,
|
|
505
|
-
function(____, player) return
|
|
511
|
+
function(____, player) return __TS__ArrayEvery(
|
|
512
|
+
collectibleTypes,
|
|
513
|
+
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
514
|
+
) end
|
|
506
515
|
)
|
|
507
516
|
end
|
|
508
517
|
function ____exports.getSoulHearts(self, player)
|
|
@@ -611,9 +620,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
611
620
|
itemPool:RemoveCollectible(collectibleType)
|
|
612
621
|
end
|
|
613
622
|
repeat
|
|
614
|
-
local
|
|
615
|
-
local
|
|
616
|
-
if
|
|
623
|
+
local ____switch133 = activeSlot
|
|
624
|
+
local ____cond133 = ____switch133 == ActiveSlot.SLOT_PRIMARY
|
|
625
|
+
if ____cond133 then
|
|
617
626
|
do
|
|
618
627
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
619
628
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -622,8 +631,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
622
631
|
break
|
|
623
632
|
end
|
|
624
633
|
end
|
|
625
|
-
|
|
626
|
-
if
|
|
634
|
+
____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_SECONDARY
|
|
635
|
+
if ____cond133 then
|
|
627
636
|
do
|
|
628
637
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
629
638
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -638,16 +647,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
638
647
|
break
|
|
639
648
|
end
|
|
640
649
|
end
|
|
641
|
-
|
|
642
|
-
if
|
|
650
|
+
____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET
|
|
651
|
+
if ____cond133 then
|
|
643
652
|
do
|
|
644
653
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
645
654
|
player:SetActiveCharge(charge, activeSlot)
|
|
646
655
|
break
|
|
647
656
|
end
|
|
648
657
|
end
|
|
649
|
-
|
|
650
|
-
if
|
|
658
|
+
____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET2
|
|
659
|
+
if ____cond133 then
|
|
651
660
|
do
|
|
652
661
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
653
662
|
break
|
|
@@ -188,7 +188,7 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
|
|
|
188
188
|
export declare function inSecretShop(): boolean;
|
|
189
189
|
/**
|
|
190
190
|
* Helper function to determine whether or not the current room is the starting room of a floor.
|
|
191
|
-
*
|
|
191
|
+
* It only returns true for the starting room of the primary dimension (meaning that being in the
|
|
192
192
|
* starting room of the mirror world does not count).
|
|
193
193
|
*/
|
|
194
194
|
export declare function inStartingRoom(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.135",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.2",
|
|
29
29
|
"isaac-typescript-definitions": "^1.0.364",
|
|
30
|
-
"isaacscript-lint": "^1.0.
|
|
30
|
+
"isaacscript-lint": "^1.0.88",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.13",
|
|
33
33
|
"typescript": "4.5.5"
|