Skip to content

Mod Features

initModFeatures<T>(mod, modFeatures, init?): { [K in string | number | symbol]: InstanceType<T[K]> }

Defined in: packages/isaacscript-common/src/functions/modFeatures.ts:29

Helper function to instantiate an array of mod features all at once. Use this function if your mod uses the pattern of expressing mod features as ModFeature classes.

If your feature classes have v variables, then this function will successfully register them with the save data manager.

For example:

const MOD_FEATURES = [
MyFeature1,
MyFeature2,
MyFeature3,
] as const;
initModFeatures(mod, MOD_FEATURES);

T extends readonly typeof ModFeature[]

ModUpgraded

The upgraded mod to use.

T

An array of the feature classes that you have in your mod.

boolean = true

Optional. Whether to automatically add the callbacks on the feature. Defaults to true.

{ [K in string | number | symbol]: InstanceType<T[K]> }

An array of the instantiated features in the same order that the constructors were passed in. (In most cases, you probably won’t need the returned array.)