Skip to main content

Upgrading Your Mod

Functions

upgradeMod

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

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

Type parameters

NameType
Textends readonly ISCFeature[] = never[]

Parameters

NameTypeDefault valueDescription
modVanillaModundefinedThe mod object returned by the RegisterMod function.
featuresISCFeatureTuple<T>undefinedOptional. An array containing the optional standard library features that you want to enable, if any. Default is an empty array.
debugbooleanfalseOptional. Whether to log additional output when a callback is fired. Default is false.
timeThreshold?floatundefinedOptional. 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).

Returns

ModUpgradedWithFeatures<T>

The upgraded mod object.

Defined in

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