Trinket Give
Functions
giveTrinketsBack
▸ giveTrinketsBack(player
, trinketSituation
): void
Helper function to restore the player's trinkets back to the way they were before the
temporarilyRemoveTrinket
function was used. It will re-smelt any smelted trinkets that were
removed.
Parameters
Name | Type |
---|---|
player | EntityPlayer |
trinketSituation | undefined | TrinketSituation |
Returns
void
Defined in
packages/isaacscript-common/src/functions/trinketGive.ts:16
smeltTrinket
▸ smeltTrinket(player
, trinketType
, numTrinkets?
): void
Helper function to smelt a trinket. Before smelting, this function will automatically remove the trinkets that the player is holding, if any, and then give them back after the new trinket is smelted.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
player | EntityPlayer | undefined | The player to smelt the trinkets to. |
trinketType | TrinketType | undefined | The trinket type to smelt. |
numTrinkets | number | 1 | Optional. If specified, will smelt the given number of trinkets. Use this to avoid calling this function multiple times. Default is 1. |
Returns
void
Defined in
packages/isaacscript-common/src/functions/trinketGive.ts:62
smeltTrinkets
▸ smeltTrinkets(player
, ...trinketTypes
): void
Helper function to smelt two or more different trinkets. If you want to smelt one trinket (or
multiple copies of one trinket), then use the smeltTrinket
helper function instead.
This function is variadic, meaning that you can pass as many trinket types as you want to smelt.
Before smelting, this function will automatically remove the trinkets that the player is holding, if any, and then give them back after the new trinket is smelted.
Parameters
Name | Type | Description |
---|---|---|
player | EntityPlayer | The player to smelt the trinkets to. |
...trinketTypes | readonly TrinketType [] | The trinket types to smelt. |
Returns
void
Defined in
packages/isaacscript-common/src/functions/trinketGive.ts:89
temporarilyRemoveTrinket
▸ temporarilyRemoveTrinket(player
, trinketType
): TrinketSituation
| undefined
Helper function to temporarily remove a specific kind of trinket from the player. Use this in
combination with the giveTrinketsBack
function to take away and give back a trinket on the same
frame. This function correctly handles multiple trinket slots and ensures that all copies of the
trinket are removed, including smelted trinkets.
Note that one smelted golden trinket is the same as two smelted normal trinkets.
Parameters
Name | Type |
---|---|
player | EntityPlayer |
trinketType | TrinketType |
Returns
TrinketSituation
| undefined
Undefined if the player does not have the trinket, or TrinketSituation if they do.
Defined in
packages/isaacscript-common/src/functions/trinketGive.ts:108
temporarilyRemoveTrinkets
▸ temporarilyRemoveTrinkets(player
): TrinketSituation
| undefined
Helper function to temporarily removes a player's held trinkets, if any. This will not remove any
smelted trinkets. Use this in combination with the giveTrinketsBack
function to take away and
give back trinkets on the same frame.
Parameters
Name | Type |
---|---|
player | EntityPlayer |
Returns
TrinketSituation
| undefined
Undefined if the player does not have any trinkets, or TrinketSituation if they do.
Defined in
packages/isaacscript-common/src/functions/trinketGive.ts:154