ModUpgraded
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
Mod
Constructors
constructor
• new ModUpgraded(mod
, debug
, timeThreshold?
): ModUpgraded
Parameters
Name | Type |
---|---|
mod | Mod |
debug | boolean |
timeThreshold? | float |
Returns
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:57
Properties
Name
• Name: string
Implementation of
Mod.Name
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:38
Methods
AddCallback
▸ AddCallback<T
>(modCallback
, ...args
): void
Type parameters
Name | Type |
---|---|
T | extends string | keyof AddCallbackParameters |
Parameters
Name | Type |
---|---|
modCallback | T |
...args | T extends keyof AddCallbackParameters ? AddCallbackParameters [T <T >] : unknown [] |
Returns
void
Implementation of
Mod.AddCallback
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:73
AddPriorityCallback
▸ AddPriorityCallback<T
>(modCallback
, priority
, ...args
): void
Type parameters
Name | Type |
---|---|
T | extends string | keyof AddCallbackParameters |
Parameters
Name | Type |
---|---|
modCallback | T |
priority | int | CallbackPriority |
...args | T extends keyof AddCallbackParameters ? AddCallbackParameters [T <T >] : unknown [] |
Returns
void
Implementation of
Mod.AddPriorityCallback
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:82
HasData
▸ HasData(): boolean
Returns
boolean
Implementation of
Mod.HasData
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:143
LoadData
▸ LoadData(): string
Returns
string
Implementation of
Mod.LoadData
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:147
RemoveCallback
▸ RemoveCallback<T
>(modCallback
, callback
): void
Type parameters
Name | Type |
---|---|
T | extends ModCallback |
Parameters
Name | Type |
---|---|
modCallback | T |
callback | AddCallbackParameters [T ][0 ] |
Returns
void
Implementation of
Mod.RemoveCallback
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:151
RemoveData
▸ RemoveData(): void
Returns
void
Implementation of
Mod.RemoveData
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:158
SaveData
▸ SaveData(data
): void
Parameters
Name | Type |
---|---|
data | string |
Returns
void
Implementation of
Mod.SaveData
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:162
AddCallbackCustom
▸ AddCallbackCustom<T
>(modCallbackCustom
, ...args
): void
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
Name | Type |
---|---|
T | extends ModCallbackCustom |
Parameters
Name | Type |
---|---|
modCallbackCustom | T |
...args | AddCallbackParametersCustom [T ] |
Returns
void
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:177
AddPriorityCallbackCustom
▸ AddPriorityCallbackCustom<T
>(modCallbackCustom
, priority
, ...args
): void
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
Name | Type |
---|---|
T | extends ModCallbackCustom |
Parameters
Name | Type |
---|---|
modCallbackCustom | T |
priority | int | CallbackPriority |
...args | AddCallbackParametersCustom [T ] |
Returns
void
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:193
RemoveCallbackCustom
▸ RemoveCallbackCustom<T
>(modCallbackCustom
, callback
): void
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
Name | Type |
---|---|
T | extends ModCallbackCustom |
Parameters
Name | Type |
---|---|
modCallbackCustom | T |
callback | AddCallbackParametersCustom [T ][0 ] |
Returns
void
Defined in
packages/isaacscript-common/src/classes/ModUpgraded.ts:215
logUsedFeatures
▸ logUsedFeatures(): void
Logs every custom callback or extra feature that is currently enabled. Useful for debugging or profiling.
Returns
void