ModUpgraded
Classes
Section titled “Classes”ModUpgraded
Section titled “ModUpgraded”Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:33
isaacscript-common has many custom callbacks that you can use in your mods. Instead of
hijacking the vanilla Mod object, we provide a ModUpgraded object for you to use, which
extends the base class and adds a new method of AddCallbackCustom.
To upgrade your mod, use the upgradeMod helper function.
By specifying one or more optional features when upgrading your mod, you will get a version of
ModUpgraded that has extra methods corresponding to the features that were specified. (This
corresponds to the internal-type ModUpgradedWithFeatures type, which extends ModUpgraded.)
Implements
Section titled “Implements”Mod
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModUpgraded(
mod,debug,timeThreshold?):ModUpgraded
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:57
Parameters
Section titled “Parameters”Mod
boolean
timeThreshold?
Section titled “timeThreshold?”float
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyName:string
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:51
The RegisterMod function stores the name of the mod on the mod object for some reason. (It
is never used or referenced.)
Implementation of
Section titled “Implementation of”Mod.Name
Methods
Section titled “Methods”AddCallback()
Section titled “AddCallback()”AddCallback<
T>(modCallback, …args):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:215
Registers a function to be executed when an in-game event happens. For example, the
ModCallback.POST_UPDATE event corresponds to an in-game logic frame being finished.
The different types of callbacks are represented in the ModCallback enum.
Some callbacks take an optional third argument to specify that you only want it the function to fire on a specific thing. For example:
mod.AddCallback( ModCallback.POST_EFFECT_UPDATE, postEffectUpdatePoof1, EffectVariant.POOF_1,)Type Parameters
Section titled “Type Parameters”T extends string | keyof AddCallbackParameters
Parameters
Section titled “Parameters”modCallback
Section titled “modCallback”T
…T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Mod.AddCallback
AddPriorityCallback()
Section titled “AddPriorityCallback()”AddPriorityCallback<
T>(modCallback,priority, …args):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:224
The same as the Mod.AddCallback method, but allows setting a custom priority. By default,
callbacks are added with a priority of 0, so this allows you to add early or late callbacks
as necessary. See the CallbackPriority enum.
Type Parameters
Section titled “Type Parameters”T extends string | keyof AddCallbackParameters
Parameters
Section titled “Parameters”modCallback
Section titled “modCallback”T
priority
Section titled “priority”int | CallbackPriority
…T extends keyof AddCallbackParameters ? AddCallbackParameters[T] : unknown[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Mod.AddPriorityCallback
HasData()
Section titled “HasData()”HasData():
boolean
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:285
Returns whether a corresponding “save#.dat” file exists for the current mod.
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Mod.HasData
LoadData()
Section titled “LoadData()”LoadData():
string
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:289
Returns a string containing all of the data inside of the corresponding “save#.dat” file for this mod.
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”Mod.LoadData
RemoveCallback()
Section titled “RemoveCallback()”RemoveCallback<
T>(modCallback,callback):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:293
Unregisters a function that was previously registered with the AddCallback method.
This method does not care about the tertiary argument. In other words, regardless of the conditions of how you registered the callback, it will be removed.
Type Parameters
Section titled “Type Parameters”T extends ModCallback
Parameters
Section titled “Parameters”modCallback
Section titled “modCallback”T
callback
Section titled “callback”AddCallbackParameters[T][0]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Mod.RemoveCallback
RemoveData()
Section titled “RemoveData()”RemoveData():
void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:300
Deletes the corresponding “save#.dat” file for this mod, if it exists.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Mod.RemoveData
SaveData()
Section titled “SaveData()”SaveData(
data):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:304
Creates or updates the corresponding “save#.dat” file for this mod with the provided string.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Mod.SaveData
AddCallbackCustom()
Section titled “AddCallbackCustom()”AddCallbackCustom<
T>(modCallbackCustom, …args):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:319
Registers a function to be executed when an in-game event happens.
This method is specifically for events that are provided by the IsaacScript standard library.
For example, the ModCallbackCustom.POST_BOMB_EXPLODE event corresponds to when a bomb
explodes.
Type Parameters
Section titled “Type Parameters”T extends ModCallbackCustom
Parameters
Section titled “Parameters”modCallbackCustom
Section titled “modCallbackCustom”T
…AddCallbackParametersCustom[T]
Returns
Section titled “Returns”void
AddPriorityCallbackCustom()
Section titled “AddPriorityCallbackCustom()”AddPriorityCallbackCustom<
T>(modCallbackCustom,priority, …args):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:335
The same as the ModUpgraded.AddCallbackCustom method, but allows setting a custom priority.
By default, callbacks are added with a priority of 0, so this allows you to add early or late
callbacks as necessary. See the CallbackPriority enum.
Type Parameters
Section titled “Type Parameters”T extends ModCallbackCustom
Parameters
Section titled “Parameters”modCallbackCustom
Section titled “modCallbackCustom”T
priority
Section titled “priority”int | CallbackPriority
…AddCallbackParametersCustom[T]
Returns
Section titled “Returns”void
RemoveCallbackCustom()
Section titled “RemoveCallbackCustom()”RemoveCallbackCustom<
T>(modCallbackCustom,callback):void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:357
Unregisters a function that was previously registered with the AddCallbackCustom method.
This method is specifically for events that are provided by the IsaacScript standard library.
For example, the ModCallbackCustom.POST_BOMB_EXPLODE event corresponds to when a bomb
explodes.
This method does not care about the tertiary argument. In other words, regardless of the conditions of how you registered the callback, it will be removed.
Type Parameters
Section titled “Type Parameters”T extends ModCallbackCustom
Parameters
Section titled “Parameters”modCallbackCustom
Section titled “modCallbackCustom”T
callback
Section titled “callback”AddCallbackParametersCustom[T][0]
Returns
Section titled “Returns”void
logUsedFeatures()
Section titled “logUsedFeatures()”logUsedFeatures():
void
Defined in: packages/isaacscript-common/src/classes/ModUpgraded.ts:371
Logs every custom callback or extra feature that is currently enabled. Useful for debugging or profiling.
Returns
Section titled “Returns”void
