Skip to main content

Players

Functions

anyPlayerHoldingItem

anyPlayerHoldingItem(): boolean

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

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:26


anyPlayerIs

anyPlayerIs(...matchingCharacters): boolean

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

NameType
...matchingCharactersreadonly PlayerType[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:37


canPlayerCrushRocks

canPlayerCrushRocks(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:55


dequeueItem

dequeueItem(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:79


getAzazelBrimstoneDistance

getAzazelBrimstoneDistance(playerOrTearHeight): float

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

NameType
playerOrTearHeightfloat | EntityPlayer

Returns

float

Defined in

packages/isaacscript-common/src/functions/players.ts:98


getCharacters

getCharacters(): readonly PlayerType[]

Helper function to get an array containing the characters of all of the current players.

Returns

readonly PlayerType[]

Defined in

packages/isaacscript-common/src/functions/players.ts:109


getClosestPlayer

getClosestPlayer(position): EntityPlayer

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

NameType
positionVector

Returns

EntityPlayer

Defined in

packages/isaacscript-common/src/functions/players.ts:119


getFinalPlayer

getFinalPlayer(): EntityPlayer

Helper function to return the player with the highest ID, according to the Isaac.GetPlayer method.

Returns

EntityPlayer

Defined in

packages/isaacscript-common/src/functions/players.ts:140


getNewestPlayer

getNewestPlayer(): EntityPlayer

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

EntityPlayer

Defined in

packages/isaacscript-common/src/functions/players.ts:157


getPlayerCloserThan

getPlayerCloserThan(position, distance): EntityPlayer | undefined

Iterates over all players and checks if any are close enough to the specified position.

Parameters

NameType
positionVector
distancefloat

Returns

EntityPlayer | undefined

The first player found when iterating upwards from index 0.

Defined in

packages/isaacscript-common/src/functions/players.ts:177


getPlayerFromEntity

getPlayerFromEntity(entity): EntityPlayer | undefined

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

NameType
entityEntity

Returns

EntityPlayer | undefined

Defined in

packages/isaacscript-common/src/functions/players.ts:195


getPlayerFromPtr

getPlayerFromPtr(entityPtr): EntityPlayer | undefined

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

NameType
entityPtrEntityPtr

Returns

EntityPlayer | undefined

Defined in

packages/isaacscript-common/src/functions/players.ts:227


getPlayerName

getPlayerName(player): string

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

NameType
playerEntityPlayer

Returns

string

Defined in

packages/isaacscript-common/src/functions/players.ts:243


getPlayerNumHitsRemaining

getPlayerNumHitsRemaining(player): int

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

NameType
playerEntityPlayer

Returns

int

Defined in

packages/isaacscript-common/src/functions/players.ts:261


getPlayersOfType

getPlayersOfType(...characters): readonly EntityPlayer[]

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

NameType
...charactersreadonly PlayerType[]

Returns

readonly EntityPlayer[]

Defined in

packages/isaacscript-common/src/functions/players.ts:277


getPlayersOnKeyboard

getPlayersOnKeyboard(): readonly EntityPlayer[]

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

readonly EntityPlayer[]

Defined in

packages/isaacscript-common/src/functions/players.ts:297


getPlayersWithControllerIndex

getPlayersWithControllerIndex(controllerIndex): readonly EntityPlayer[]

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

NameType
controllerIndexControllerIndex

Returns

readonly EntityPlayer[]

Defined in

packages/isaacscript-common/src/functions/players.ts:313


hasForm

hasForm(player, ...playerForms): boolean

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

NameType
playerEntityPlayer
...playerFormsreadonly PlayerForm[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:326


hasHoming

hasHoming(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:338


hasLostCurse

hasLostCurse(player): boolean

After touching a white fire, a player will turn into The Lost until they clear a room.

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:343


hasPiercing

hasPiercing(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:354


hasSpectral

hasSpectral(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:364


isBethany

isBethany(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:373


isCharacter

isCharacter(player, ...characters): boolean

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

NameType
playerEntityPlayer
...charactersreadonly PlayerType[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:384


isDamageFromPlayer

isDamageFromPlayer(damageSource): boolean

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

NameType
damageSourceEntity

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:398


isEden

isEden(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:412


isFirstPlayer

isFirstPlayer(player): boolean

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:417


isJacobOrEsau

isJacobOrEsau(player): boolean

Helper function for detecting when a player is Jacob or Esau. This will only match the non-tainted versions of these characters.

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:425


isKeeper

isKeeper(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:434


isLost

isLost(player): boolean

Helper function for detecting when a player is The Lost or Tainted Lost.

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:440


isModdedPlayer

isModdedPlayer(player): boolean

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:445


isPlayerAbleToAim

isPlayerAbleToAim(player): boolean

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

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:455


isTainted

isTainted(player): boolean

Helper function for detecting if a player is one of the Tainted characters.

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:460


isTaintedLazarus

isTaintedLazarus(player): boolean

Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus.

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:469


isVanillaPlayer

isVanillaPlayer(player): boolean

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/players.ts:477


removeDeadEyeMultiplier

removeDeadEyeMultiplier(player): void

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

NameType
playerEntityPlayer

Returns

void

Defined in

packages/isaacscript-common/src/functions/players.ts:488


setBlindfold

setBlindfold(player, enabled, modifyCostume?): void

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

NameTypeDefault valueDescription
playerEntityPlayerundefinedThe player to apply or remove the blindfold state from.
enabledbooleanundefinedWhether to apply or remove the blindfold.
modifyCostumebooleantrueOptional. Whether to add or remove the blindfold costume. Default is true.

Returns

void

Defined in

packages/isaacscript-common/src/functions/players.ts:508