publicModSDKModAPI
Index
Methods
callOriginal
Parameters
functionName: TFunctionName
Name of function to call. Can contain dots to change methods in objects (e.g.
Player.CanChange)args: [...Parameters<GetDotedPathType<typeof globalThis, TFunctionName>>[]]
Arguments to use for the call
optionalcontext: any
thiscontext to use. Defaults towindow. If calling method of object, then set this to the object itself (e.g.functionName=Player.CanChangethencontext=Player)
Returns ReturnType<GetDotedPathType<typeof globalThis, TFunctionName>>
getOriginalHash
Get hash of original function in CRC32.
The hash is computed from source obtained using
toStringwith line endings normalized to LFParameters
functionName: string
Name of function. Can contain dots to change methods in objects (e.g.
Player.CanChange)
Returns string
hookFunction
Hook a BC function
Parameters
functionName: TFunctionName
Name of function to hook. Can contain dots to change methods in objects (e.g.
Player.CanChange)priority: number
Number used to determinate order hooks will be called in. Higher number is called first
hook: PatchHook<GetDotedPathType<typeof globalThis, TFunctionName>>
The hook itself to use,
Returns () => void
Function that can be called to remove this hook
Returns void
patchFunction
Patch a BC function
This method is DANGEROUS to use and has high potential to conflict with other mods.
Only use it if what you are trying to accomplish can't be done easily with
hookFunction.This function tranforms BC function to string, replaces patches as pure text and then
evaluates it. If you don't know what this means, please avoid this function.Parameters
functionName: TFunctionName
Name of function to patch. Can contain dots to change methods in objects (e.g.
Player.CanChange)patches: GetDotedPathType<typeof globalThis, TFunctionName> extends AnyFunction ? Record<string, string> : never
Object in key: value format, where keys are chunks to replace and values are result.
Patches from multiple calls are merged; where key matches the older one is replaced. Specifying value of
nullremoves patch with this key.
Returns void
removePatches
Remove all patches by
patchFunctionfrom specified function.Parameters
functionName: string
Name of function to patch. Can contain dots to change methods in objects (e.g.
Player.CanChange)
Returns void
unload
Unload this mod, removing any hooks or patches by it. To continue using SDK another call to
registerModis requiredReturns void
Call original function, bypassing any hooks and ignoring any patches applied by ALL mods.