Skip to content

UpgradeMod

upgradeMod<T>(modVanilla, features?, debug?, timeThreshold?): ModUpgradedWithFeatures<T>

Defined in: packages/isaacscript-common/src/core/upgradeMod.ts:40

Use this function to enable the custom callbacks and other optional features provided by isaacscript-common.

For example:

const modVanilla = RegisterMod("My Mod", 1);
const mod = upgradeMod(modVanilla);
// Subscribe to vanilla callbacks.
mod.AddCallback(ModCallback.POST_UPDATE, postUpdate);
// Subscribe to custom callbacks.
mod.AddCallbackCustom(ModCallbackCustom.POST_ITEM_PICKUP, postItemPickup);

T extends readonly ISCFeature[] = never[]

Mod

The mod object returned by the RegisterMod function.

ISCFeatureTuple<T> = ...

Optional. An array containing the optional standard library features that you want to enable, if any. Default is an empty array.

boolean = false

Optional. Whether to log additional output when a callback is fired. Default is false.

float

Optional. If provided, will only log callbacks that take longer than the specified number of seconds (if the “–luadebug” launch flag is turned on) or milliseconds (if the “–luadebug” launch flag is turned off).

ModUpgradedWithFeatures<T>

The upgraded mod object.