Tears
Functions
Section titled “Functions”addTearsStat()
Section titled “addTearsStat()”addTearsStat(
player,tearsStat):void
Defined in: packages/isaacscript-common/src/functions/tears.ts:19
- Converts the specified amount of tears stat into the format of
EntityPlayer.MaxFireDelayand adds it to the player. - This function should only be used inside the
EVALUATE_CACHEcallback. - In this context, the “tears stat” represents what is shown on the in-game stat UI.
For example:
function evaluateCacheTears(player: EntityPlayer) { const numFoo = player.GetNumCollectible(CollectibleTypeCustom.FOO); const tearsStat = numFoo * FOO_TEARS_STAT; addTearsStat(player, tearsStat);}Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
tearsStat
Section titled “tearsStat”float
Returns
Section titled “Returns”void
getFireDelay()
Section titled “getFireDelay()”getFireDelay(
tearsStat):float
Defined in: packages/isaacscript-common/src/functions/tears.ts:33
- The
EntityPlayerobject stores a player’s tear rate in theMaxFireDelayfield. This is equivalent to how many tears the player can shoot per frame. - If you already have a “tears” stat and you want to convert it back to MaxFireDelay, then use this function.
- In this context, the “tears stat” represents what is shown on the in-game stat UI.
Parameters
Section titled “Parameters”tearsStat
Section titled “tearsStat”float
Returns
Section titled “Returns”float
getTearsStat()
Section titled “getTearsStat()”getTearsStat(
fireDelay):float
Defined in: packages/isaacscript-common/src/functions/tears.ts:43
- The
EntityPlayerobject stores a player’s tear rate in theMaxFireDelayfield. This is equivalent to how many tears the player can shoot per frame. - If you want to convert this to the “tears” stat that is shown on the in-game stat UI, then use this function.
Parameters
Section titled “Parameters”fireDelay
Section titled “fireDelay”float
Returns
Section titled “Returns”float
isMissedTear()
Section titled “isMissedTear()”isMissedTear(
tear):boolean
Defined in: packages/isaacscript-common/src/functions/tears.ts:58
Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the ground, a wall, or a grid entity.
Note that tears are still considered to be missed if they hit a poop or fire, so you may want to
handle those separately using the POST_GRID_ENTITY_COLLISION and POST_ENTITY_COLLISION
callbacks, respectively.
Under the hood, this function uses the Entity.IsDead method. (Tears will not die if they hit an
enemy, but they will die if they hit a wall or object.)
Parameters
Section titled “Parameters”EntityTear
Returns
Section titled “Returns”boolean
isTearFromFamiliar()
Section titled “isTearFromFamiliar()”isTearFromFamiliar(
tear,familiarVariant?,subType?):boolean
Defined in: packages/isaacscript-common/src/functions/tears.ts:82
Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This is determined by looking at the parent.
For the special case of Incubus and Blood Babies, the parent of the tear is always the player,
but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to the
player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
only use this function in the POST_TEAR_INIT_VERY_LATE callback or on frame 1+.
If this function is called on frame 0, it will throw a run-time error.
Note that this function does not work properly when the tear is from a Lead Pencil barrage. In this case, it will always appear as if the tear is coming from a player.
Parameters
Section titled “Parameters”EntityTear
The tear to inspect.
familiarVariant?
Section titled “familiarVariant?”FamiliarVariant
Optional. Specify this to check if the tear came from a specific familiar variant. Default is undefined, which checks for any familiar.
subType?
Section titled “subType?”int
Optional. Specify this to check if the tear came from a specific familiar sub-type. Default is undefined, which checks for any familiar.
Returns
Section titled “Returns”boolean
isTearFromPlayer()
Section titled “isTearFromPlayer()”isTearFromPlayer(
tear):boolean
Defined in: packages/isaacscript-common/src/functions/tears.ts:125
Helper function to check if a given tear is from a player (as opposed to e.g. a familiar). This
is determined by looking at the SpawnerEntity.
For the special case of Incubus and Blood Babies, the SpawnerEntity of the tear is always the
player, but the spawner entity of the tear changes. On frame 0, the spawner entity is equal to
the player, and on frame 1, the spawner entity is equal to the familiar. For this reason, you can
only use this function in the POST_TEAR_INIT_VERY_LATE callback or on frame 1+.
If this function is called on frame 0, it will throw a run-time error.
Note that this function does not work properly when the tear is from a Lead Pencil barrage. In this case, it will always appear as if the tear is coming from a player.
Parameters
Section titled “Parameters”EntityTear
Returns
Section titled “Returns”boolean
