Players
Functions
Section titled “Functions”anyPlayerHoldingItem()
Section titled “anyPlayerHoldingItem()”anyPlayerHoldingItem():
boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:26
Helper function to check to see if any player is holding up an item (from e.g. an active item activation, a poop from IBS, etc.).
Returns
Section titled “Returns”boolean
anyPlayerIs()
Section titled “anyPlayerIs()”anyPlayerIs(…
matchingCharacters):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:37
Helper function to determine if the given character is present.
This function is variadic, meaning that you can supply as many characters as you want to check for. Returns true if any of the characters supplied are present.
Parameters
Section titled “Parameters”matchingCharacters
Section titled “matchingCharacters”…readonly PlayerType[]
Returns
Section titled “Returns”boolean
canPlayerCrushRocks()
Section titled “canPlayerCrushRocks()”canPlayerCrushRocks(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:55
Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
The following situations allow for this to be true:
- the player has Leo (collectible 302)
- the player has Thunder Thighs (collectible 314)
- the player is under the effects of Mega Mush (collectible 625)
- the player has Stompy (transformation 13)
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
dequeueItem()
Section titled “dequeueItem()”dequeueItem(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:79
Helper function to remove a collectible or trinket that is currently queued to go into a player’s inventory (i.e. the item is being held over their head).
If the player does not have an item currently queued, then this function will be a no-op.
Returns whether an item was actually dequeued.
Under the hood, this clones the QueuedItemData, since directly setting the Item field to
undefined does not work for some reason.
This method was discovered by im_tem.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
getAzazelBrimstoneDistance()
Section titled “getAzazelBrimstoneDistance()”getAzazelBrimstoneDistance(
playerOrTearHeight):float
Defined in: packages/isaacscript-common/src/functions/players.ts:98
Helper function to get how long Azazel’s Brimstone laser should be. You can pass either an
EntityPlayer object or a tear height stat.
The formula for calculating it is: 32 - 2.5 * tearHeight
Parameters
Section titled “Parameters”playerOrTearHeight
Section titled “playerOrTearHeight”float | EntityPlayer
Returns
Section titled “Returns”float
getCharacters()
Section titled “getCharacters()”getCharacters(): readonly
PlayerType[]
Defined in: packages/isaacscript-common/src/functions/players.ts:109
Helper function to get an array containing the characters of all of the current players.
Returns
Section titled “Returns”readonly PlayerType[]
getClosestPlayer()
Section titled “getClosestPlayer()”getClosestPlayer(
position):EntityPlayer
Defined in: packages/isaacscript-common/src/functions/players.ts:119
Helper function to get the closest player to a certain position. Note that this will never include players with a non-undefined parent, since they are not real players (e.g. the Strawman Keeper).
Parameters
Section titled “Parameters”position
Section titled “position”Vector
Returns
Section titled “Returns”EntityPlayer
getFinalPlayer()
Section titled “getFinalPlayer()”getFinalPlayer():
EntityPlayer
Defined in: packages/isaacscript-common/src/functions/players.ts:140
Helper function to return the player with the highest ID, according to the Isaac.GetPlayer
method.
Returns
Section titled “Returns”EntityPlayer
getNewestPlayer()
Section titled “getNewestPlayer()”getNewestPlayer():
EntityPlayer
Defined in: packages/isaacscript-common/src/functions/players.ts:157
Helper function to get the first player with the lowest frame count. Useful to find a freshly spawned player after using items like Esau Jr. Don’t use this function if two or more players will be spawned on the same frame.
Returns
Section titled “Returns”EntityPlayer
getPlayerCloserThan()
Section titled “getPlayerCloserThan()”getPlayerCloserThan(
position,distance):EntityPlayer|undefined
Defined in: packages/isaacscript-common/src/functions/players.ts:179
Iterates over all players and checks if any are close enough to the specified position.
Parameters
Section titled “Parameters”position
Section titled “position”Vector
distance
Section titled “distance”float
Returns
Section titled “Returns”EntityPlayer | undefined
The first player found when iterating upwards from index 0.
getPlayerFromEntity()
Section titled “getPlayerFromEntity()”getPlayerFromEntity(
entity):EntityPlayer|undefined
Defined in: packages/isaacscript-common/src/functions/players.ts:197
Helper function to get the player from a tear, laser, bomb, etc. Returns undefined if the entity does not correspond to any particular player.
This function works by looking at the Parent and the SpawnerEntity fields (in that order). As
a last resort, it will attempt to use the Entity.ToPlayer method on the entity itself.
Parameters
Section titled “Parameters”entity
Section titled “entity”Entity
Returns
Section titled “Returns”EntityPlayer | undefined
getPlayerFromPtr()
Section titled “getPlayerFromPtr()”getPlayerFromPtr(
entityPtr):EntityPlayer|undefined
Defined in: packages/isaacscript-common/src/functions/players.ts:229
Helper function to get an EntityPlayer object from an EntityPtr. Returns undefined if the
entity has gone out of scope or if the associated entity is not a player.
Parameters
Section titled “Parameters”entityPtr
Section titled “entityPtr”EntityPtr
Returns
Section titled “Returns”EntityPlayer | undefined
getPlayerName()
Section titled “getPlayerName()”getPlayerName(
player):string
Defined in: packages/isaacscript-common/src/functions/players.ts:245
Helper function to get the proper name of the player. Use this instead of the
EntityPlayer.GetName method because it accounts for Blue Baby, Lazarus II, and Tainted
characters.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”string
getPlayerNumHitsRemaining()
Section titled “getPlayerNumHitsRemaining()”getPlayerNumHitsRemaining(
player):int
Defined in: packages/isaacscript-common/src/functions/players.ts:263
Returns the combined value of all of the player’s red hearts, soul/black hearts, and bone hearts, minus the value of the player’s rotten hearts.
This is equivalent to the number of hits that the player can currently take, but does not take into account double damage from champion enemies and/or being on later floors. (For example, on Womb 1, players who have 1 soul heart remaining would die in 1 hit to anything, even though this function would report that they have 2 hits remaining.)
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”int
getPlayersOfType()
Section titled “getPlayersOfType()”getPlayersOfType(…
characters): readonlyEntityPlayer[]
Defined in: packages/isaacscript-common/src/functions/players.ts:279
Helper function to get all of the players that are a certain character.
This function is variadic, meaning that you can supply as many characters as you want to check for. Returns true if any of the characters supplied are present.
Parameters
Section titled “Parameters”characters
Section titled “characters”…readonly PlayerType[]
Returns
Section titled “Returns”readonly EntityPlayer[]
getPlayersOnKeyboard()
Section titled “getPlayersOnKeyboard()”getPlayersOnKeyboard(): readonly
EntityPlayer[]
Defined in: packages/isaacscript-common/src/functions/players.ts:299
Helper function to get all of the players that are using keyboard (i.e.
ControllerIndex.KEYBOARD). This function returns an array of players because it is possible
that there is more than one player with the same controller index (e.g. Jacob & Esau).
Note that this function includes players with a non-undefined parent like e.g. the Strawman Keeper.
Returns
Section titled “Returns”readonly EntityPlayer[]
getPlayersWithControllerIndex()
Section titled “getPlayersWithControllerIndex()”getPlayersWithControllerIndex(
controllerIndex): readonlyEntityPlayer[]
Defined in: packages/isaacscript-common/src/functions/players.ts:315
Helper function to get all of the players that match the provided controller index. This function returns an array of players because it is possible that there is more than one player with the same controller index (e.g. Jacob & Esau).
Note that this function includes players with a non-undefined parent like e.g. the Strawman Keeper.
Parameters
Section titled “Parameters”controllerIndex
Section titled “controllerIndex”ControllerIndex
Returns
Section titled “Returns”readonly EntityPlayer[]
hasForm()
Section titled “hasForm()”hasForm(
player, …playerForms):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:328
Helper function to check to see if a player has one or more transformations.
This function is variadic, meaning that you can supply as many transformations as you want to check for. Returns true if the player has any of the supplied transformations.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
playerForms
Section titled “playerForms”…readonly PlayerForm[]
Returns
Section titled “Returns”boolean
hasHoming()
Section titled “hasHoming()”hasHoming(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:340
Helper function to check if a player has homing tears.
Under the hood, this checks the EntityPlayer.TearFlags variable for TearFlag.HOMING (1 << 2).
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
hasLostCurse()
Section titled “hasLostCurse()”hasLostCurse(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:345
After touching a white fire, a player will turn into The Lost until they clear a room.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
hasPiercing()
Section titled “hasPiercing()”hasPiercing(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:356
Helper function to check if a player has piercing tears.
Under the hood, this checks the EntityPlayer.TearFlags variable for TearFlag.PIERCING (1 <<
1).
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
hasSpectral()
Section titled “hasSpectral()”hasSpectral(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:366
Helper function to check if a player has spectral tears.
Under the hood, this checks the EntityPlayer.TearFlags variable for TearFlag.SPECTRAL (1 <<
0).
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isBethany()
Section titled “isBethany()”isBethany(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:375
Helper function for detecting when a player is Bethany or Tainted Bethany. This is useful if you need to adjust UI elements to account for Bethany’s soul charges or Tainted Bethany’s blood charges.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isCharacter()
Section titled “isCharacter()”isCharacter(
player, …characters):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:386
Helper function to check if a player is a specific character (i.e. PlayerType).
This function is variadic, meaning that you can supply as many characters as you want to check for. Returns true if the player is any of the supplied characters.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
characters
Section titled “characters”…readonly PlayerType[]
Returns
Section titled “Returns”boolean
isDamageFromPlayer()
Section titled “isDamageFromPlayer()”isDamageFromPlayer(
damageSource):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:400
Helper function to see if a damage source is from a player. Use this instead of comparing to the entity directly because it takes familiars into account.
Parameters
Section titled “Parameters”damageSource
Section titled “damageSource”Entity
Returns
Section titled “Returns”boolean
isEden()
Section titled “isEden()”isEden(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:414
Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where you want to know if the starting stats were randomized, for example.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isFirstPlayer()
Section titled “isFirstPlayer()”isFirstPlayer(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:419
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isJacobOrEsau()
Section titled “isJacobOrEsau()”isJacobOrEsau(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:427
Helper function for detecting when a player is Jacob or Esau. This will only match the non-tainted versions of these characters.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isKeeper()
Section titled “isKeeper()”isKeeper(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:436
Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations where you want to know if the health is coin hearts, for example.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isLost()
Section titled “isLost()”isLost(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:442
Helper function for detecting when a player is The Lost or Tainted Lost.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isModdedPlayer()
Section titled “isModdedPlayer()”isModdedPlayer(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:447
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isPlayerAbleToAim()
Section titled “isPlayerAbleToAim()”isPlayerAbleToAim(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:457
Helper function for determining if a player is able to turn their head by pressing the shooting buttons.
Under the hood, this function uses the EntityPlayer.IsExtraAnimationFinished method.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isTainted()
Section titled “isTainted()”isTainted(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:462
Helper function for detecting if a player is one of the Tainted characters.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isTaintedLazarus()
Section titled “isTaintedLazarus()”isTaintedLazarus(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:471
Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
isVanillaPlayer()
Section titled “isVanillaPlayer()”isVanillaPlayer(
player):boolean
Defined in: packages/isaacscript-common/src/functions/players.ts:479
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
removeDeadEyeMultiplier()
Section titled “removeDeadEyeMultiplier()”removeDeadEyeMultiplier(
player):void
Defined in: packages/isaacscript-common/src/functions/players.ts:490
Helper function to remove the Dead Eye multiplier from a player.
Note that each time the EntityPlayer.ClearDeadEyeCharge method is called, it only has a chance
of working, so this function calls it 100 times to be safe.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”void
setBlindfold()
Section titled “setBlindfold()”setBlindfold(
player,enabled,modifyCostume?):void
Defined in: packages/isaacscript-common/src/functions/players.ts:510
Helper function to blindfold the player by using a hack with the challenge variable.
Note that if the player dies and respawns (from e.g. Dead Cat), the blindfold will have to be reapplied.
Under the hood, this function sets the challenge to one with a blindfold, changes the player to the same character that they currently are, and then changes the challenge back. This method was discovered by im_tem.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
The player to apply or remove the blindfold state from.
enabled
Section titled “enabled”boolean
Whether to apply or remove the blindfold.
modifyCostume?
Section titled “modifyCostume?”boolean = true
Optional. Whether to add or remove the blindfold costume. Default is true.
Returns
Section titled “Returns”void
