isaacscript-common 1.2.216 → 1.2.219
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/callbacks/customRevive.lua +3 -2
- package/dist/features/extraConsoleCommands/commands.lua +5 -4
- package/dist/functions/log.d.ts +1 -1
- package/dist/functions/log.lua +29 -27
- package/dist/functions/player.d.ts +7 -0
- package/dist/functions/player.lua +16 -11
- package/dist/functions/playerHealth.lua +3 -4
- package/dist/functions/pocketItems.lua +3 -2
- package/dist/functions/trinkets.lua +2 -2
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ local removeAllFamiliars = ____familiars.removeAllFamiliars
|
|
|
16
16
|
local ____log = require("functions.log")
|
|
17
17
|
local log = ____log.log
|
|
18
18
|
local logError = ____log.logError
|
|
19
|
+
local ____player = require("functions.player")
|
|
20
|
+
local isCharacter = ____player.isCharacter
|
|
19
21
|
local ____playerIndex = require("functions.playerIndex")
|
|
20
22
|
local getPlayerFromIndex = ____playerIndex.getPlayerFromIndex
|
|
21
23
|
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
@@ -51,13 +53,12 @@ function checkWaitingForItemAnimation(self, player)
|
|
|
51
53
|
if v.run.dyingPlayerIndex == nil then
|
|
52
54
|
return
|
|
53
55
|
end
|
|
54
|
-
local character = player:GetPlayerType()
|
|
55
56
|
local playerIndex = getPlayerIndex(nil, player)
|
|
56
57
|
if playerIndex ~= v.run.dyingPlayerIndex then
|
|
57
58
|
return
|
|
58
59
|
end
|
|
59
60
|
local playerToCheckHoldingItem = player
|
|
60
|
-
if
|
|
61
|
+
if isCharacter(nil, player, PlayerType.PLAYER_THESOUL_B) then
|
|
61
62
|
local forgottenBody = player:GetOtherTwin()
|
|
62
63
|
if forgottenBody ~= nil then
|
|
63
64
|
playerToCheckHoldingItem = forgottenBody
|
|
@@ -19,12 +19,12 @@ local getCharacterName = ____character.getCharacterName
|
|
|
19
19
|
local ____gridEntity = require("functions.gridEntity")
|
|
20
20
|
local spawnGridEntityWithVariant = ____gridEntity.spawnGridEntityWithVariant
|
|
21
21
|
local ____log = require("functions.log")
|
|
22
|
+
local logEffects = ____log.logEffects
|
|
22
23
|
local logEntities = ____log.logEntities
|
|
23
24
|
local logGridEntities = ____log.logGridEntities
|
|
24
25
|
local logRoom = ____log.logRoom
|
|
25
26
|
local logSeedEffects = ____log.logSeedEffects
|
|
26
27
|
local logSounds = ____log.logSounds
|
|
27
|
-
local logTemporaryEffects = ____log.logTemporaryEffects
|
|
28
28
|
local ____map = require("functions.map")
|
|
29
29
|
local getMapPartialMatch = ____map.getMapPartialMatch
|
|
30
30
|
local ____npc = require("functions.npc")
|
|
@@ -32,6 +32,7 @@ local getNPCs = ____npc.getNPCs
|
|
|
32
32
|
local ____pills = require("functions.pills")
|
|
33
33
|
local getPillEffectName = ____pills.getPillEffectName
|
|
34
34
|
local ____player = require("functions.player")
|
|
35
|
+
local getPlayerName = ____player.getPlayerName
|
|
35
36
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
36
37
|
local ____playerHealth = require("functions.playerHealth")
|
|
37
38
|
local addPlayerHealthType = ____playerHealth.addPlayerHealthType
|
|
@@ -487,7 +488,7 @@ function ____exports.dungeon(self)
|
|
|
487
488
|
end
|
|
488
489
|
function ____exports.effects(self)
|
|
489
490
|
local player = Isaac.GetPlayer()
|
|
490
|
-
|
|
491
|
+
logEffects(player)
|
|
491
492
|
printConsole(nil, "Logged the player's effects to the \"log.txt\" file.")
|
|
492
493
|
end
|
|
493
494
|
function ____exports.eh(self, params)
|
|
@@ -501,10 +502,10 @@ function ____exports.fool(self)
|
|
|
501
502
|
end
|
|
502
503
|
function ____exports.getPosition(self)
|
|
503
504
|
for ____, player in ipairs(getPlayers(nil)) do
|
|
504
|
-
local
|
|
505
|
+
local playerName = getPlayerName(nil, player)
|
|
505
506
|
printConsole(
|
|
506
507
|
nil,
|
|
507
|
-
((((("Player position for
|
|
508
|
+
((((("Player position for " .. playerName) .. ": (") .. tostring(player.Position.X)) .. ", ") .. tostring(player.Position.Y)) .. ")"
|
|
508
509
|
)
|
|
509
510
|
end
|
|
510
511
|
end
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare function logArray<T>(this: void, array: T[]): void;
|
|
|
14
14
|
export declare function logColor(this: void, color: Color): void;
|
|
15
15
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
16
16
|
export declare function logDamageFlags(this: void, flags: int): void;
|
|
17
|
+
export declare function logEffects(this: void, player: EntityPlayer): void;
|
|
17
18
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
18
19
|
export declare function logEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType | int): void;
|
|
19
20
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
@@ -56,7 +57,6 @@ export declare function logSounds(this: void): void;
|
|
|
56
57
|
export declare function logTable(this: void, table: unknown, parentTables?: number): void;
|
|
57
58
|
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
58
59
|
export declare function logTearFlags(this: void, flags: int): void;
|
|
59
|
-
export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
|
|
60
60
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
61
61
|
export declare function logUseFlags(this: void, flags: int): void;
|
|
62
62
|
/**
|
package/dist/functions/log.lua
CHANGED
|
@@ -80,14 +80,14 @@ function ____exports.logFlags(flags, flagEnum, description)
|
|
|
80
80
|
for key, value in pairs(flagEnum) do
|
|
81
81
|
do
|
|
82
82
|
if type(value) ~= "number" then
|
|
83
|
-
goto
|
|
83
|
+
goto __continue42
|
|
84
84
|
end
|
|
85
85
|
if hasFlag(nil, flags, value) then
|
|
86
86
|
____exports.log((((" Has flag: " .. tostring(key)) .. " (") .. tostring(value)) .. ")")
|
|
87
87
|
hasNoFlags = false
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
|
-
::
|
|
90
|
+
::__continue42::
|
|
91
91
|
end
|
|
92
92
|
if hasNoFlags then
|
|
93
93
|
____exports.log(" n/a (no flags)")
|
|
@@ -114,6 +114,32 @@ end
|
|
|
114
114
|
function ____exports.logDamageFlags(flags)
|
|
115
115
|
____exports.logFlags(flags, DamageFlag, "damage")
|
|
116
116
|
end
|
|
117
|
+
function ____exports.logEffects(player)
|
|
118
|
+
local effects = getEffectsList(nil, player)
|
|
119
|
+
____exports.log("Logging player effects:")
|
|
120
|
+
if #effects == 0 then
|
|
121
|
+
____exports.log(" n/a (no effects)")
|
|
122
|
+
return
|
|
123
|
+
end
|
|
124
|
+
__TS__ArrayForEach(
|
|
125
|
+
effects,
|
|
126
|
+
function(____, effect, i)
|
|
127
|
+
local effectDescription
|
|
128
|
+
if effect.Item:IsCollectible() then
|
|
129
|
+
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
130
|
+
effectDescription = "Collectible: " .. collectibleName
|
|
131
|
+
elseif effect.Item:IsTrinket() then
|
|
132
|
+
local trinketName = getTrinketName(nil, effect.Item.ID)
|
|
133
|
+
effectDescription = "Trinket: " .. trinketName
|
|
134
|
+
elseif effect.Item:IsNull() then
|
|
135
|
+
effectDescription = "Null item: " .. tostring(effect.Item.ID)
|
|
136
|
+
else
|
|
137
|
+
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
138
|
+
end
|
|
139
|
+
____exports.log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
|
|
140
|
+
end
|
|
141
|
+
)
|
|
142
|
+
end
|
|
117
143
|
function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
118
144
|
local headerMsg = "Entities in the room"
|
|
119
145
|
if entityTypeFilter ~= nil then
|
|
@@ -394,30 +420,6 @@ end
|
|
|
394
420
|
function ____exports.logTearFlags(flags)
|
|
395
421
|
____exports.logFlags(flags, TearFlags, "tear")
|
|
396
422
|
end
|
|
397
|
-
function ____exports.logTemporaryEffects(player)
|
|
398
|
-
local effects = getEffectsList(nil, player)
|
|
399
|
-
____exports.log("Logging player temporary effects:")
|
|
400
|
-
if #effects == 0 then
|
|
401
|
-
____exports.log(" n/a (no temporary effects)")
|
|
402
|
-
return
|
|
403
|
-
end
|
|
404
|
-
__TS__ArrayForEach(
|
|
405
|
-
effects,
|
|
406
|
-
function(____, effect, i)
|
|
407
|
-
if effect.Item:IsCollectible() then
|
|
408
|
-
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
409
|
-
____exports.log(((" " .. tostring(i + 1)) .. ") ") .. collectibleName)
|
|
410
|
-
elseif effect.Item:IsTrinket() then
|
|
411
|
-
local trinketName = getTrinketName(nil, effect.Item.ID)
|
|
412
|
-
____exports.log(((" " .. tostring(i + 1)) .. ") ") .. trinketName)
|
|
413
|
-
elseif effect.Item:IsNull() then
|
|
414
|
-
____exports.log(((" " .. tostring(i + 1)) .. ") Null item: ") .. tostring(effect.Item.ID))
|
|
415
|
-
else
|
|
416
|
-
____exports.log(((" " .. tostring(i + 1)) .. ") Unknown type of temporary effect: ") .. tostring(effect.Item.ID))
|
|
417
|
-
end
|
|
418
|
-
end
|
|
419
|
-
)
|
|
420
|
-
end
|
|
421
423
|
function ____exports.logUseFlags(flags)
|
|
422
424
|
____exports.logFlags(flags, UseFlag, "use")
|
|
423
425
|
end
|
|
@@ -449,6 +451,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
449
451
|
globals.logArray = ____exports.logArray
|
|
450
452
|
globals.logColor = ____exports.logColor
|
|
451
453
|
globals.logDamageFlags = ____exports.logDamageFlags
|
|
454
|
+
globals.logEffects = ____exports.logEffects
|
|
452
455
|
globals.logEntities = ____exports.logEntities
|
|
453
456
|
globals.logEntityID = ____exports.logEntityID
|
|
454
457
|
globals.logEntityFlags = ____exports.logEntityFlags
|
|
@@ -466,7 +469,6 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
466
469
|
globals.logSounds = ____exports.logSounds
|
|
467
470
|
globals.logTable = ____exports.logTable
|
|
468
471
|
globals.logTearFlags = ____exports.logTearFlags
|
|
469
|
-
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
470
472
|
globals.logUseFlags = ____exports.logUseFlags
|
|
471
473
|
globals.logUserdata = ____exports.logUserdata
|
|
472
474
|
globals.logVector = ____exports.logVector
|
|
@@ -186,6 +186,13 @@ export declare function isActiveSlotEmpty(player: EntityPlayer, activeSlot: Acti
|
|
|
186
186
|
* charges.
|
|
187
187
|
*/
|
|
188
188
|
export declare function isBethany(player: EntityPlayer): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Helper function to check if a player is a specific character (i.e. `PlayerType`).
|
|
191
|
+
*
|
|
192
|
+
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
193
|
+
* for. Returns true if the player is any of the supplied characters.
|
|
194
|
+
*/
|
|
195
|
+
export declare function isCharacter(player: EntityPlayer, ...characters: Array<PlayerType | int>): boolean;
|
|
189
196
|
/**
|
|
190
197
|
* Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
191
198
|
* you want to know if the starting stats were randomized, for example.
|
|
@@ -64,6 +64,12 @@ function ____exports.getPlayerMaxHeartContainers(self, player)
|
|
|
64
64
|
end
|
|
65
65
|
return characterMaxHeartContainers
|
|
66
66
|
end
|
|
67
|
+
function ____exports.isCharacter(self, player, ...)
|
|
68
|
+
local characters = {...}
|
|
69
|
+
local characterSet = __TS__New(Set, characters)
|
|
70
|
+
local character = player:GetPlayerType()
|
|
71
|
+
return characterSet:has(character)
|
|
72
|
+
end
|
|
67
73
|
function ____exports.isKeeper(self, player)
|
|
68
74
|
local character = player:GetPlayerType()
|
|
69
75
|
return character == PlayerType.PLAYER_KEEPER or character == PlayerType.PLAYER_KEEPER_B
|
|
@@ -391,8 +397,7 @@ function ____exports.hasLostCurse(self, player)
|
|
|
391
397
|
return effects:HasNullEffect(112)
|
|
392
398
|
end
|
|
393
399
|
function ____exports.hasOpenActiveItemSlot(self, player)
|
|
394
|
-
|
|
395
|
-
if character == PlayerType.PLAYER_THESOUL_B then
|
|
400
|
+
if ____exports.isCharacter(nil, player, PlayerType.PLAYER_THESOUL_B) then
|
|
396
401
|
return false
|
|
397
402
|
end
|
|
398
403
|
local activeItemPrimary = player:GetActiveItem(ActiveSlot.SLOT_PRIMARY)
|
|
@@ -478,9 +483,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
478
483
|
itemPool:RemoveCollectible(collectibleType)
|
|
479
484
|
end
|
|
480
485
|
repeat
|
|
481
|
-
local
|
|
482
|
-
local
|
|
483
|
-
if
|
|
486
|
+
local ____switch101 = activeSlot
|
|
487
|
+
local ____cond101 = ____switch101 == ActiveSlot.SLOT_PRIMARY
|
|
488
|
+
if ____cond101 then
|
|
484
489
|
do
|
|
485
490
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
486
491
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -489,8 +494,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
489
494
|
break
|
|
490
495
|
end
|
|
491
496
|
end
|
|
492
|
-
|
|
493
|
-
if
|
|
497
|
+
____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_SECONDARY
|
|
498
|
+
if ____cond101 then
|
|
494
499
|
do
|
|
495
500
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
496
501
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -505,16 +510,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
505
510
|
break
|
|
506
511
|
end
|
|
507
512
|
end
|
|
508
|
-
|
|
509
|
-
if
|
|
513
|
+
____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET
|
|
514
|
+
if ____cond101 then
|
|
510
515
|
do
|
|
511
516
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
512
517
|
player:SetActiveCharge(charge, activeSlot)
|
|
513
518
|
break
|
|
514
519
|
end
|
|
515
520
|
end
|
|
516
|
-
|
|
517
|
-
if
|
|
521
|
+
____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET2
|
|
522
|
+
if ____cond101 then
|
|
518
523
|
do
|
|
519
524
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
520
525
|
break
|
|
@@ -10,6 +10,7 @@ local ____player = require("functions.player")
|
|
|
10
10
|
local getPlayerBlackHearts = ____player.getPlayerBlackHearts
|
|
11
11
|
local getPlayerHearts = ____player.getPlayerHearts
|
|
12
12
|
local getPlayerSoulHearts = ____player.getPlayerSoulHearts
|
|
13
|
+
local isCharacter = ____player.isCharacter
|
|
13
14
|
local ____utils = require("functions.utils")
|
|
14
15
|
local ensureAllCases = ____utils.ensureAllCases
|
|
15
16
|
local ____repeat = ____utils["repeat"]
|
|
@@ -213,7 +214,6 @@ function ____exports.getPlayerHealthType(self, player, healthType)
|
|
|
213
214
|
until true
|
|
214
215
|
end
|
|
215
216
|
function ____exports.removeAllPlayerHealth(self, player)
|
|
216
|
-
local character = player:GetPlayerType()
|
|
217
217
|
local goldenHearts = player:GetGoldenHearts()
|
|
218
218
|
local eternalHearts = player:GetEternalHearts()
|
|
219
219
|
local boneHearts = player:GetBoneHearts()
|
|
@@ -224,7 +224,7 @@ function ____exports.removeAllPlayerHealth(self, player)
|
|
|
224
224
|
player:AddBrokenHearts(brokenHearts * -1)
|
|
225
225
|
player:AddMaxHearts(MAX_PLAYER_HEART_CONTAINERS * -2, true)
|
|
226
226
|
player:AddSoulHearts(MAX_PLAYER_HEART_CONTAINERS * -2)
|
|
227
|
-
if
|
|
227
|
+
if isCharacter(nil, player, PlayerType.PLAYER_THESOUL) then
|
|
228
228
|
local forgotten = player:GetSubPlayer()
|
|
229
229
|
if forgotten ~= nil then
|
|
230
230
|
local forgottenBoneHearts = forgotten:GetBoneHearts()
|
|
@@ -235,7 +235,6 @@ end
|
|
|
235
235
|
function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
236
236
|
local character = player:GetPlayerType()
|
|
237
237
|
local subPlayer = player:GetSubPlayer()
|
|
238
|
-
local isTaintedMagdalene = character == PlayerType.PLAYER_MAGDALENE_B
|
|
239
238
|
____exports.removeAllPlayerHealth(nil, player)
|
|
240
239
|
if character == PlayerType.PLAYER_THESOUL and subPlayer ~= nil then
|
|
241
240
|
subPlayer:AddMaxHearts(playerHealth.maxHearts, false)
|
|
@@ -269,7 +268,7 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
269
268
|
playerHealth.hearts,
|
|
270
269
|
function()
|
|
271
270
|
player:AddHearts(1)
|
|
272
|
-
if
|
|
271
|
+
if character == PlayerType.PLAYER_MAGDALENE_B then
|
|
273
272
|
player:AddHearts(-1)
|
|
274
273
|
end
|
|
275
274
|
end
|
|
@@ -9,6 +9,8 @@ local ____PocketItemType = require("enums.PocketItemType")
|
|
|
9
9
|
local PocketItemType = ____PocketItemType.PocketItemType
|
|
10
10
|
local ____math = require("functions.math")
|
|
11
11
|
local range = ____math.range
|
|
12
|
+
local ____player = require("functions.player")
|
|
13
|
+
local isCharacter = ____player.isCharacter
|
|
12
14
|
function ____exports.getPocketItems(self, player)
|
|
13
15
|
local pocketItem = player:GetActiveItem(ActiveSlot.SLOT_POCKET)
|
|
14
16
|
local hasPocketItem = pocketItem ~= CollectibleType.COLLECTIBLE_NULL
|
|
@@ -50,8 +52,7 @@ function ____exports.getFirstCardOrPill(self, player)
|
|
|
50
52
|
)
|
|
51
53
|
end
|
|
52
54
|
function ____exports.hasOpenPocketItemSlot(self, player)
|
|
53
|
-
|
|
54
|
-
if character == PlayerType.PLAYER_THESOUL_B then
|
|
55
|
+
if isCharacter(nil, player, PlayerType.PLAYER_THESOUL_B) then
|
|
55
56
|
return false
|
|
56
57
|
end
|
|
57
58
|
local pocketItems = ____exports.getPocketItems(nil, player)
|
|
@@ -15,6 +15,7 @@ local hasFlag = ____flag.hasFlag
|
|
|
15
15
|
local ____pickups = require("functions.pickups")
|
|
16
16
|
local getPickups = ____pickups.getPickups
|
|
17
17
|
local ____player = require("functions.player")
|
|
18
|
+
local isCharacter = ____player.isCharacter
|
|
18
19
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
19
20
|
local ____sprite = require("functions.sprite")
|
|
20
21
|
local clearSprite = ____sprite.clearSprite
|
|
@@ -71,8 +72,7 @@ function ____exports.getTrinkets(self, matchingSubType)
|
|
|
71
72
|
return getPickups(nil, 350, matchingSubType)
|
|
72
73
|
end
|
|
73
74
|
function ____exports.hasOpenTrinketSlot(self, player)
|
|
74
|
-
|
|
75
|
-
if character == PlayerType.PLAYER_THESOUL_B then
|
|
75
|
+
if isCharacter(nil, player, PlayerType.PLAYER_THESOUL_B) then
|
|
76
76
|
return false
|
|
77
77
|
end
|
|
78
78
|
local openTrinketSlot = ____exports.getOpenTrinketSlot(nil, player)
|