Skip to content

Players

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.).

boolean


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.

…readonly PlayerType[]

boolean


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)

EntityPlayer

boolean


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.

EntityPlayer

boolean


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

float | EntityPlayer

float


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.

readonly PlayerType[]


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).

Vector

EntityPlayer


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.

EntityPlayer


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.

EntityPlayer


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.

Vector

float

EntityPlayer | undefined

The first player found when iterating upwards from index 0.


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.

Entity

EntityPlayer | undefined


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.

EntityPtr

EntityPlayer | undefined


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.

EntityPlayer

string


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.)

EntityPlayer

int


getPlayersOfType(…characters): readonly EntityPlayer[]

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.

…readonly PlayerType[]

readonly EntityPlayer[]


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.

readonly EntityPlayer[]


getPlayersWithControllerIndex(controllerIndex): readonly EntityPlayer[]

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.

ControllerIndex

readonly EntityPlayer[]


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.

EntityPlayer

…readonly PlayerForm[]

boolean


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).

EntityPlayer

boolean


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.

EntityPlayer

boolean


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).

EntityPlayer

boolean


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).

EntityPlayer

boolean


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.

EntityPlayer

boolean


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.

EntityPlayer

…readonly PlayerType[]

boolean


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.

Entity

boolean


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.

EntityPlayer

boolean


isFirstPlayer(player): boolean

Defined in: packages/isaacscript-common/src/functions/players.ts:419

EntityPlayer

boolean


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.

EntityPlayer

boolean


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.

EntityPlayer

boolean


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.

EntityPlayer

boolean


isModdedPlayer(player): boolean

Defined in: packages/isaacscript-common/src/functions/players.ts:447

EntityPlayer

boolean


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.

EntityPlayer

boolean


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.

EntityPlayer

boolean


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.

EntityPlayer

boolean


isVanillaPlayer(player): boolean

Defined in: packages/isaacscript-common/src/functions/players.ts:479

EntityPlayer

boolean


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.

EntityPlayer

void


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.

EntityPlayer

The player to apply or remove the blindfold state from.

boolean

Whether to apply or remove the blindfold.

boolean = true

Optional. Whether to add or remove the blindfold costume. Default is true.

void