isaacscript-common 1.2.10 → 1.2.14
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 +17 -2
- package/dist/functions/player.lua +87 -20
- package/dist/functions/util.d.ts +1 -0
- package/dist/functions/util.lua +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +16 -0
- package/dist/types/PillEffectClass.d.ts +7 -0
- package/dist/types/PillEffectClass.lua +12 -0
- package/dist/types/PillEffectType.d.ts +5 -0
- package/dist/types/PillEffectType.lua +10 -0
- package/package.json +2 -2
|
@@ -59,6 +59,10 @@ export declare function getClosestPlayer(position: Vector): EntityPlayer;
|
|
|
59
59
|
* Tainted Forgotten have a 20 frame death animation (i.e. the "ForgottenDeath" animation).
|
|
60
60
|
*/
|
|
61
61
|
export declare function getDeathAnimationName(player: EntityPlayer): string;
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to return the player with the highest index, according to the
|
|
64
|
+
* `Isaac.GetPlayer()` method.
|
|
65
|
+
*/
|
|
62
66
|
export declare function getFinalPlayer(): EntityPlayer;
|
|
63
67
|
/**
|
|
64
68
|
* Helper function that returns the type of the rightmost heart, not including golden hearts since
|
|
@@ -132,8 +136,9 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
|
|
|
132
136
|
*/
|
|
133
137
|
export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int;
|
|
134
138
|
/**
|
|
135
|
-
* Helper function to get the name of the player. Use this instead of the
|
|
136
|
-
* method
|
|
139
|
+
* Helper function to get the proper name of the player. Use this instead of the
|
|
140
|
+
* `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
|
|
141
|
+
* characters.
|
|
137
142
|
*/
|
|
138
143
|
export declare function getPlayerName(player: EntityPlayer): string;
|
|
139
144
|
/**
|
|
@@ -216,6 +221,12 @@ export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
|
|
|
216
221
|
export declare function isTainted(player: EntityPlayer): boolean;
|
|
217
222
|
/** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
|
|
218
223
|
export declare function isTaintedLazarus(player: EntityPlayer): boolean;
|
|
224
|
+
export declare function isModdedCharacter(player: EntityPlayer): boolean;
|
|
225
|
+
export declare function isVanillaCharacter(player: EntityPlayer): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
228
|
+
* having to request the collectible from the item config.
|
|
229
|
+
*/
|
|
219
230
|
export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
|
|
220
231
|
/**
|
|
221
232
|
* Helper function to remove the Dead Eye multiplier from a player.
|
|
@@ -224,6 +235,10 @@ export declare function removeCollectibleCostume(player: EntityPlayer, collectib
|
|
|
224
235
|
* chance of working, so this function calls it 100 times to be safe.
|
|
225
236
|
*/
|
|
226
237
|
export declare function removeDeadEyeMultiplier(player: EntityPlayer): void;
|
|
238
|
+
/**
|
|
239
|
+
* Helper function to remove a trinket costume from a player. Use this helper function to avoid
|
|
240
|
+
* having to request the trinket from the item config.
|
|
241
|
+
*/
|
|
227
242
|
export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType | int): void;
|
|
228
243
|
/**
|
|
229
244
|
* Helper function to set an active collectible to a particular slot. This has different behavior
|
|
@@ -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, isTaintedModded, 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
|
|
@@ -17,6 +17,7 @@ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEART
|
|
|
17
17
|
local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
|
|
18
18
|
local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
|
|
19
19
|
local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
|
|
20
|
+
local MAX_VANILLA_CHARACTER = ____constants.MAX_VANILLA_CHARACTER
|
|
20
21
|
local ____HealthType = require("types.HealthType")
|
|
21
22
|
local HealthType = ____HealthType.HealthType
|
|
22
23
|
local ____array = require("functions.array")
|
|
@@ -30,6 +31,7 @@ local ____collectibleSet = require("functions.collectibleSet")
|
|
|
30
31
|
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
31
32
|
local ____util = require("functions.util")
|
|
32
33
|
local ensureAllCases = ____util.ensureAllCases
|
|
34
|
+
local stringContains = ____util.stringContains
|
|
33
35
|
local trimPrefix = ____util.trimPrefix
|
|
34
36
|
function ____exports.getCharacterMaxHeartContainers(self, character)
|
|
35
37
|
if character == PlayerType.PLAYER_KEEPER then
|
|
@@ -67,6 +69,53 @@ function ____exports.getPlayerMaxHeartContainers(self, player)
|
|
|
67
69
|
end
|
|
68
70
|
return maxHeartContainers
|
|
69
71
|
end
|
|
72
|
+
function getAdjustedPlayerName(self, player)
|
|
73
|
+
local character = player:GetPlayerType()
|
|
74
|
+
repeat
|
|
75
|
+
local ____switch71 = character
|
|
76
|
+
local ____cond71 = ____switch71 == PlayerType.PLAYER_BLUEBABY or ____switch71 == PlayerType.PLAYER_BLUEBABY_B
|
|
77
|
+
if ____cond71 then
|
|
78
|
+
do
|
|
79
|
+
return "Blue Baby"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2
|
|
83
|
+
if ____cond71 then
|
|
84
|
+
do
|
|
85
|
+
return "Lazarus II"
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_BLACKJUDAS
|
|
89
|
+
if ____cond71 then
|
|
90
|
+
do
|
|
91
|
+
return "Dark Judas"
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_JACOB
|
|
95
|
+
if ____cond71 then
|
|
96
|
+
do
|
|
97
|
+
return "Jacob & Esau"
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2_B
|
|
101
|
+
if ____cond71 then
|
|
102
|
+
do
|
|
103
|
+
return "Dead Tainted Lazarus"
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_JACOB2_B
|
|
107
|
+
if ____cond71 then
|
|
108
|
+
do
|
|
109
|
+
return "Dead Tainted Jacob"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
do
|
|
113
|
+
do
|
|
114
|
+
return player:GetName()
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
until true
|
|
118
|
+
end
|
|
70
119
|
function ____exports.getPlayers(self, performExclusions)
|
|
71
120
|
if performExclusions == nil then
|
|
72
121
|
performExclusions = false
|
|
@@ -79,18 +128,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
79
128
|
do
|
|
80
129
|
local player = Isaac.GetPlayer(i)
|
|
81
130
|
if player == nil then
|
|
82
|
-
goto
|
|
131
|
+
goto __continue81
|
|
83
132
|
end
|
|
84
133
|
if ____exports.isChildPlayer(nil, player) then
|
|
85
|
-
goto
|
|
134
|
+
goto __continue81
|
|
86
135
|
end
|
|
87
136
|
local character = player:GetPlayerType()
|
|
88
137
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
89
|
-
goto
|
|
138
|
+
goto __continue81
|
|
90
139
|
end
|
|
91
140
|
__TS__ArrayPush(players, player)
|
|
92
141
|
end
|
|
93
|
-
::
|
|
142
|
+
::__continue81::
|
|
94
143
|
i = i + 1
|
|
95
144
|
end
|
|
96
145
|
end
|
|
@@ -101,7 +150,26 @@ function ____exports.isChildPlayer(self, player)
|
|
|
101
150
|
end
|
|
102
151
|
function ____exports.isTainted(self, player)
|
|
103
152
|
local character = player:GetPlayerType()
|
|
104
|
-
|
|
153
|
+
local ____isVanillaCharacter_result_0
|
|
154
|
+
if ____exports.isVanillaCharacter(nil, player) then
|
|
155
|
+
____isVanillaCharacter_result_0 = character >= PlayerType.PLAYER_ISAAC_B
|
|
156
|
+
else
|
|
157
|
+
____isVanillaCharacter_result_0 = isTaintedModded(nil, player)
|
|
158
|
+
end
|
|
159
|
+
return ____isVanillaCharacter_result_0
|
|
160
|
+
end
|
|
161
|
+
function isTaintedModded(self, player)
|
|
162
|
+
local character = player:GetPlayerType()
|
|
163
|
+
local name = player:GetName()
|
|
164
|
+
local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
|
|
165
|
+
return character == taintedCharacter
|
|
166
|
+
end
|
|
167
|
+
function ____exports.isModdedCharacter(self, player)
|
|
168
|
+
local character = player:GetPlayerType()
|
|
169
|
+
return character > MAX_VANILLA_CHARACTER
|
|
170
|
+
end
|
|
171
|
+
function ____exports.isVanillaCharacter(self, player)
|
|
172
|
+
return not ____exports.isModdedCharacter(nil, player)
|
|
105
173
|
end
|
|
106
174
|
EXCLUDED_CHARACTERS = __TS__New(Set, {PlayerType.PLAYER_ESAU, PlayerType.PLAYER_THESOUL_B})
|
|
107
175
|
function ____exports.addCollectibleCostume(self, player, collectibleType)
|
|
@@ -313,13 +381,12 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
313
381
|
return nil
|
|
314
382
|
end
|
|
315
383
|
function ____exports.getPlayerName(self, player)
|
|
316
|
-
local
|
|
317
|
-
local filledInName = name == "???" and "Blue Baby" or name
|
|
384
|
+
local adjustedName = getAdjustedPlayerName(nil, player)
|
|
318
385
|
if not ____exports.isTainted(nil, player) then
|
|
319
|
-
return
|
|
386
|
+
return adjustedName
|
|
320
387
|
end
|
|
321
|
-
local baseName = trimPrefix(nil,
|
|
322
|
-
return "Tainted " .. baseName
|
|
388
|
+
local baseName = trimPrefix(nil, adjustedName, "The ")
|
|
389
|
+
return stringContains(nil, baseName, "Tainted") and baseName or "Tainted " .. baseName
|
|
323
390
|
end
|
|
324
391
|
function ____exports.getPlayerNumHitsRemaining(self, player)
|
|
325
392
|
local hearts = player:GetHearts()
|
|
@@ -477,9 +544,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
477
544
|
itemPool:RemoveCollectible(collectibleType)
|
|
478
545
|
end
|
|
479
546
|
repeat
|
|
480
|
-
local
|
|
481
|
-
local
|
|
482
|
-
if
|
|
547
|
+
local ____switch124 = activeSlot
|
|
548
|
+
local ____cond124 = ____switch124 == ActiveSlot.SLOT_PRIMARY
|
|
549
|
+
if ____cond124 then
|
|
483
550
|
do
|
|
484
551
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
485
552
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -488,8 +555,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
488
555
|
break
|
|
489
556
|
end
|
|
490
557
|
end
|
|
491
|
-
|
|
492
|
-
if
|
|
558
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_SECONDARY
|
|
559
|
+
if ____cond124 then
|
|
493
560
|
do
|
|
494
561
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
495
562
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -504,16 +571,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
504
571
|
break
|
|
505
572
|
end
|
|
506
573
|
end
|
|
507
|
-
|
|
508
|
-
if
|
|
574
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET
|
|
575
|
+
if ____cond124 then
|
|
509
576
|
do
|
|
510
577
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
511
578
|
player:SetActiveCharge(charge, activeSlot)
|
|
512
579
|
break
|
|
513
580
|
end
|
|
514
581
|
end
|
|
515
|
-
|
|
516
|
-
if
|
|
582
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET2
|
|
583
|
+
if ____cond124 then
|
|
517
584
|
do
|
|
518
585
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
519
586
|
break
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export declare function onSetSeed(): boolean;
|
|
|
80
80
|
* message (which `Isaac.ConsoleOutput()` does not do by default).
|
|
81
81
|
*/
|
|
82
82
|
export declare function printConsole(msg: string): void;
|
|
83
|
+
export declare function stringContains(string: string, searchString: string): boolean;
|
|
83
84
|
/**
|
|
84
85
|
* In a Map, you can use the `clear` method to delete every element. However, in a LuaTable, the
|
|
85
86
|
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
package/dist/functions/util.lua
CHANGED
|
@@ -67,6 +67,9 @@ end
|
|
|
67
67
|
function ____exports.printConsole(self, msg)
|
|
68
68
|
Isaac.ConsoleOutput(msg .. "\n")
|
|
69
69
|
end
|
|
70
|
+
function ____exports.stringContains(self, ____string, searchString)
|
|
71
|
+
return (string.find(____string, searchString, nil, true) or 0) - 1 ~= -1
|
|
72
|
+
end
|
|
70
73
|
function ____exports.tableClear(self, ____table)
|
|
71
74
|
for key in pairs(____table) do
|
|
72
75
|
____table[key] = nil
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,8 @@ export * from "./types/JSONSpawn";
|
|
|
74
74
|
export * from "./types/ModCallbacksCustom";
|
|
75
75
|
export * from "./types/ModUpgraded";
|
|
76
76
|
export * from "./types/PickingUpItem";
|
|
77
|
+
export * from "./types/PillEffectClass";
|
|
78
|
+
export * from "./types/PillEffectType";
|
|
77
79
|
export * from "./types/PlayerHealth";
|
|
78
80
|
export * from "./types/PocketItemDescription";
|
|
79
81
|
export * from "./types/PocketItemType";
|
package/dist/index.lua
CHANGED
|
@@ -534,6 +534,22 @@ do
|
|
|
534
534
|
end
|
|
535
535
|
end
|
|
536
536
|
end
|
|
537
|
+
do
|
|
538
|
+
local ____export = require("types.PillEffectClass")
|
|
539
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
540
|
+
if ____exportKey ~= "default" then
|
|
541
|
+
____exports[____exportKey] = ____exportValue
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
do
|
|
546
|
+
local ____export = require("types.PillEffectType")
|
|
547
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
548
|
+
if ____exportKey ~= "default" then
|
|
549
|
+
____exports[____exportKey] = ____exportValue
|
|
550
|
+
end
|
|
551
|
+
end
|
|
552
|
+
end
|
|
537
553
|
do
|
|
538
554
|
local ____export = require("types.PocketItemType")
|
|
539
555
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.PillEffectClass = PillEffectClass or ({})
|
|
4
|
+
____exports.PillEffectClass.JOKE = 0
|
|
5
|
+
____exports.PillEffectClass[____exports.PillEffectClass.JOKE] = "JOKE"
|
|
6
|
+
____exports.PillEffectClass.MINOR = 1
|
|
7
|
+
____exports.PillEffectClass[____exports.PillEffectClass.MINOR] = "MINOR"
|
|
8
|
+
____exports.PillEffectClass.MEDIUM = 2
|
|
9
|
+
____exports.PillEffectClass[____exports.PillEffectClass.MEDIUM] = "MEDIUM"
|
|
10
|
+
____exports.PillEffectClass.MAJOR = 3
|
|
11
|
+
____exports.PillEffectClass[____exports.PillEffectClass.MAJOR] = "MAJOR"
|
|
12
|
+
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.PillEffectType = PillEffectType or ({})
|
|
4
|
+
____exports.PillEffectType.GOOD = 0
|
|
5
|
+
____exports.PillEffectType[____exports.PillEffectType.GOOD] = "GOOD"
|
|
6
|
+
____exports.PillEffectType.BAD = 1
|
|
7
|
+
____exports.PillEffectType[____exports.PillEffectType.BAD] = "BAD"
|
|
8
|
+
____exports.PillEffectType.NEUTRAL = 2
|
|
9
|
+
____exports.PillEffectType[____exports.PillEffectType.NEUTRAL] = "NEUTRAL"
|
|
10
|
+
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.337",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.11",
|