-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlowerAPI.ts
More file actions
31 lines (28 loc) · 844 Bytes
/
Copy pathFlowerAPI.ts
File metadata and controls
31 lines (28 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import type { Patchable, PatchFn } from "./FlowerPatch";
import type { FlowerModule } from "./FlowerPlugin";
export type FlowerAPI<T> = {
/**
* Register a patch for a method on an object with a prefix or postfix
* @param obj
* @param methodName - The name of the method to patch
* @param patch - The function to run as a detour
* @param isPrefix - If true, the patch will run before the original method
* @returns {boolean}
*/
RegisterPatch: (
obj: Patchable,
methodName: string,
patch: PatchFn,
isPrefix: boolean,
) => boolean;
// Returns the main game object
GetGameMain: () => T;
};
export function isModule(thing: unknown): thing is FlowerModule {
const temp = thing as FlowerModule;
return (
temp.META !== undefined &&
temp.default !== undefined &&
temp.default.constructor !== undefined
);
}