|
| 1 | +interface ModuleEvents { |
| 2 | + /** |
| 3 | + * Called on any module being enabled. |
| 4 | + */ |
| 5 | + "enable": () => void, |
| 6 | + /** |
| 7 | + * Called on any module being disabled. |
| 8 | + */ |
| 9 | + "disable": () => void, |
| 10 | + /** |
| 11 | + * Called on every frame. Return a bool to set the toggle form of the module - `true` makes it a hold module, like player list; `false`, standard toggle form. |
| 12 | + */ |
| 13 | + "get-hold-to-toggle": () => boolean, // I had no idea how to write this |
| 14 | + |
| 15 | + /** |
| 16 | + * Called on every frame; use this to render something arbitrary. |
| 17 | + * @note Only available in HUD modules. |
| 18 | + * @param isPreview If it's a preview in the main menu (when module settings are extended.) |
| 19 | + * @param isEditor If it's in the HUD editor where you move modules around. |
| 20 | + */ |
| 21 | + "render": (isPreview: boolean, isEditor: boolean) => void, |
| 22 | + /** |
| 23 | + * Only available in HUD modules. |
| 24 | + */ |
| 25 | + //"shouldRender": () => boolean; |
| 26 | + |
| 27 | + /** |
| 28 | + * Called on every frame; use this to render text. Return a string to render it on the next frame. |
| 29 | + * @note Only available in text modules. |
| 30 | + */ |
| 31 | + "text": (isPreview: boolean, isEditor: boolean) => string; |
| 32 | +} |
| 33 | + |
| 34 | +declare class Module { |
| 35 | + readonly name: string |
| 36 | + readonly displayName: string |
| 37 | + readonly description: string |
| 38 | + readonly key: KeyCode |
| 39 | + |
| 40 | + /** |
| 41 | + * IDs for script modules are always 255. |
| 42 | + */ |
| 43 | + readonly id: number; |
| 44 | + /** |
| 45 | + * If the module is a HUD module (that you can move in the hud editor) |
| 46 | + */ |
| 47 | + readonly visual: boolean; |
| 48 | + /** |
| 49 | + * If the module is visible in the ClickGui |
| 50 | + */ |
| 51 | + readonly visible: boolean; |
| 52 | + |
| 53 | +/** |
| 54 | + * |
| 55 | + * @param name The internal name of the module. |
| 56 | + * @param displayName The display name of the module. Shown in the ClickGUI. |
| 57 | + * @param description A short description of what the module does. |
| 58 | + * @param key The default keybind to activate the module. |
| 59 | + */ |
| 60 | + constructor(name: string, displayName: string, description: string, key: KeyCode); |
| 61 | + |
| 62 | + on: <K extends keyof ModuleEvents>(eventName: K, handler: ModuleEvents[K]) => void; |
| 63 | + |
| 64 | + /** |
| 65 | + * Checks if the module is enabled. |
| 66 | + */ |
| 67 | + isEnabled(): boolean; |
| 68 | + |
| 69 | + /** |
| 70 | + * Set the module to be enabled or not. |
| 71 | + * @param b The new status of the module. |
| 72 | + */ |
| 73 | + setEnabled(b: boolean): void; |
| 74 | + |
| 75 | + /** |
| 76 | + * Check if the module is blocked. |
| 77 | + */ |
| 78 | + isBlocked(): boolean; |
| 79 | + |
| 80 | + /** |
| 81 | + * Gets the settings of the module. |
| 82 | + */ |
| 83 | + getSettings(): Setting[]; |
| 84 | + |
| 85 | + /** |
| 86 | + * Adds a setting. |
| 87 | + * @param name The internal name |
| 88 | + * @param displayName The name that shows in the menu |
| 89 | + * @param description A short description of what the setting does |
| 90 | + * @param defVal The default value |
| 91 | + */ |
| 92 | + addBoolSetting(name: string, displayName: string, description: string, defVal: boolean): Setting; |
| 93 | + |
| 94 | + /** |
| 95 | + * Adds a setting. |
| 96 | + * @param name The internal name |
| 97 | + * @param displayName The name that shows in the menu |
| 98 | + * @param description A short description of what the setting does |
| 99 | + * @param min The minimum value |
| 100 | + * @param max The maximum value |
| 101 | + * @param interval The precision of the setting |
| 102 | + * @param defVal The default value |
| 103 | + */ |
| 104 | + addNumberSetting(name: string, displayName: string, description: string, min: number, max: number, interval: number, defVal: number): Setting; |
| 105 | + |
| 106 | + /** |
| 107 | + Adds a setting. |
| 108 | + * @param name The internal name |
| 109 | + * @param displayName The name that shows in the menu |
| 110 | + * @param description A short description of what the setting does |
| 111 | + * @param defVal The default value |
| 112 | + */ |
| 113 | + addKeySetting(name: string, displayName: string, description: string, defVal: KeyCode): Setting; |
| 114 | + |
| 115 | + /** |
| 116 | + Adds a setting. |
| 117 | + * @param name The internal name |
| 118 | + * @param displayName The name that shows in the menu |
| 119 | + * @param description A short description of what the setting does |
| 120 | + * @param defVal The default value |
| 121 | + */ |
| 122 | + addTextSetting(name: string, displayName: string, description: string, defVal: string): Setting; |
| 123 | + |
| 124 | + /** |
| 125 | + Adds a setting. |
| 126 | + * @param name The internal name |
| 127 | + * @param displayName The name that shows in the menu |
| 128 | + * @param description A short description of what the setting does |
| 129 | + * @param defVal The default value |
| 130 | + */ |
| 131 | + addColorSetting(name: string, displayName: string, description: string, defVal: Color): Setting; |
| 132 | +} |
0 commit comments