isaacscript-common 1.2.10 → 1.2.11
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/functions/player.d.ts +3 -2
- package/dist/functions/player.lua +40 -18
- package/package.json +1 -1
|
@@ -132,8 +132,9 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
|
|
|
132
132
|
*/
|
|
133
133
|
export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int;
|
|
134
134
|
/**
|
|
135
|
-
* Helper function to get the name of the player. Use this instead of the
|
|
136
|
-
* method
|
|
135
|
+
* Helper function to get the proper name of the player. Use this instead of the
|
|
136
|
+
* `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
|
|
137
|
+
* characters.
|
|
137
138
|
*/
|
|
138
139
|
export declare function getPlayerName(player: EntityPlayer): string;
|
|
139
140
|
/**
|
|
@@ -9,7 +9,7 @@ local __TS__Iterator = ____lualib.__TS__Iterator
|
|
|
9
9
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
10
10
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
11
11
|
local ____exports = {}
|
|
12
|
-
local EXCLUDED_CHARACTERS
|
|
12
|
+
local getAdjustedPlayerName, EXCLUDED_CHARACTERS
|
|
13
13
|
local ____constants = require("constants")
|
|
14
14
|
local CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = ____constants.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART
|
|
15
15
|
local CHARACTERS_WITH_FREE_DEVIL_DEALS = ____constants.CHARACTERS_WITH_FREE_DEVIL_DEALS
|
|
@@ -67,6 +67,29 @@ function ____exports.getPlayerMaxHeartContainers(self, player)
|
|
|
67
67
|
end
|
|
68
68
|
return maxHeartContainers
|
|
69
69
|
end
|
|
70
|
+
function getAdjustedPlayerName(self, player)
|
|
71
|
+
local character = player:GetPlayerType()
|
|
72
|
+
repeat
|
|
73
|
+
local ____switch71 = character
|
|
74
|
+
local ____cond71 = ____switch71 == PlayerType.PLAYER_BLUEBABY or ____switch71 == PlayerType.PLAYER_BLUEBABY_B
|
|
75
|
+
if ____cond71 then
|
|
76
|
+
do
|
|
77
|
+
return "Blue Baby"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2
|
|
81
|
+
if ____cond71 then
|
|
82
|
+
do
|
|
83
|
+
return "Lazarus II"
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
do
|
|
87
|
+
do
|
|
88
|
+
return player:GetName()
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
until true
|
|
92
|
+
end
|
|
70
93
|
function ____exports.getPlayers(self, performExclusions)
|
|
71
94
|
if performExclusions == nil then
|
|
72
95
|
performExclusions = false
|
|
@@ -79,18 +102,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
79
102
|
do
|
|
80
103
|
local player = Isaac.GetPlayer(i)
|
|
81
104
|
if player == nil then
|
|
82
|
-
goto
|
|
105
|
+
goto __continue77
|
|
83
106
|
end
|
|
84
107
|
if ____exports.isChildPlayer(nil, player) then
|
|
85
|
-
goto
|
|
108
|
+
goto __continue77
|
|
86
109
|
end
|
|
87
110
|
local character = player:GetPlayerType()
|
|
88
111
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
89
|
-
goto
|
|
112
|
+
goto __continue77
|
|
90
113
|
end
|
|
91
114
|
__TS__ArrayPush(players, player)
|
|
92
115
|
end
|
|
93
|
-
::
|
|
116
|
+
::__continue77::
|
|
94
117
|
i = i + 1
|
|
95
118
|
end
|
|
96
119
|
end
|
|
@@ -313,12 +336,11 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
313
336
|
return nil
|
|
314
337
|
end
|
|
315
338
|
function ____exports.getPlayerName(self, player)
|
|
316
|
-
local
|
|
317
|
-
local filledInName = name == "???" and "Blue Baby" or name
|
|
339
|
+
local adjustedName = getAdjustedPlayerName(nil, player)
|
|
318
340
|
if not ____exports.isTainted(nil, player) then
|
|
319
|
-
return
|
|
341
|
+
return adjustedName
|
|
320
342
|
end
|
|
321
|
-
local baseName = trimPrefix(nil,
|
|
343
|
+
local baseName = trimPrefix(nil, adjustedName, "The ")
|
|
322
344
|
return "Tainted " .. baseName
|
|
323
345
|
end
|
|
324
346
|
function ____exports.getPlayerNumHitsRemaining(self, player)
|
|
@@ -477,9 +499,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
477
499
|
itemPool:RemoveCollectible(collectibleType)
|
|
478
500
|
end
|
|
479
501
|
repeat
|
|
480
|
-
local
|
|
481
|
-
local
|
|
482
|
-
if
|
|
502
|
+
local ____switch117 = activeSlot
|
|
503
|
+
local ____cond117 = ____switch117 == ActiveSlot.SLOT_PRIMARY
|
|
504
|
+
if ____cond117 then
|
|
483
505
|
do
|
|
484
506
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
485
507
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -488,8 +510,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
488
510
|
break
|
|
489
511
|
end
|
|
490
512
|
end
|
|
491
|
-
|
|
492
|
-
if
|
|
513
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SLOT_SECONDARY
|
|
514
|
+
if ____cond117 then
|
|
493
515
|
do
|
|
494
516
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
495
517
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -504,16 +526,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
504
526
|
break
|
|
505
527
|
end
|
|
506
528
|
end
|
|
507
|
-
|
|
508
|
-
if
|
|
529
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SLOT_POCKET
|
|
530
|
+
if ____cond117 then
|
|
509
531
|
do
|
|
510
532
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
511
533
|
player:SetActiveCharge(charge, activeSlot)
|
|
512
534
|
break
|
|
513
535
|
end
|
|
514
536
|
end
|
|
515
|
-
|
|
516
|
-
if
|
|
537
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SLOT_POCKET2
|
|
538
|
+
if ____cond117 then
|
|
517
539
|
do
|
|
518
540
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
519
541
|
break
|