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
Name | Type |
---|---|
T | extends readonly ISCFeature [] = never [] |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
modVanilla | Mod | undefined | The mod object returned by the RegisterMod function. |
features | ISCFeatureTuple <T > | undefined | Optional. An array containing the optional standard library features that you want to enable, if any. Default is an empty array. |
debug | boolean | false | Optional. Whether to log additional output when a callback is fired. Default is false. |
timeThreshold? | float | undefined | 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). |
Returns
ModUpgradedWithFeatures
<T
>
The upgraded mod object.