Last active
October 26, 2021 21:39
-
-
Save Losiel/e64a39ca3b7f8ba7d7cf75312a06e540 to your computer and use it in GitHub Desktop.
Types for every function in the Synapse API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Debug */ | |
type constant = number | boolean | undefined | string | |
type level = number | (() => any) | |
declare namespace debug { | |
function getconstants(fi: level): constant[]; | |
function getconstant(fi: level, idx: number): constant; | |
} | |
/* File system */ | |
declare function readfile(path: string): string; // it can sometimes error but apparently i cant seem to tell TypeScript that this function can error | |
declare function writefile(path: string, data: string): void; | |
declare function appendfile(path: string, data: string): void; | |
declare function listfiles(folder: string): string[]; | |
declare function isfile(path: string): boolean; | |
declare function isfolder(path: string): boolean; | |
declare function makefolder(path: string): void; | |
declare function delfolder(path: string): void; | |
declare function delfile(path: string): void; | |
/* Input functions */ | |
declare function iswindowactive(): boolean; | |
declare function keypress(): void; | |
declare function keyrelease(): void; | |
declare function mouse1click(): void; | |
declare function mouse1press(): void; | |
declare function mouse1release(): void; | |
declare function mouse2click(): void; | |
declare function mouse2press(): void; | |
declare function mouse2release(): void; | |
declare function mousescroll(px: number): void; | |
declare function mousemoverel(x: number, y: number): void; | |
declare function mousemoveabs(x: number, y: number): void; | |
/* Environment functions */ | |
declare class SynConnection { | |
Function: () => void; | |
State: boolean; | |
Enable(): void; | |
Disable(): void; | |
Fire(): void; | |
} | |
declare function getconnections(signal: RBXScriptSignal): SynConnection[]; | |
declare function fireclickdetector(instance: ClickDetector, distance: number): void; | |
declare function fireproximityprompt(instance: ProximityPrompt, distance: number): void; | |
type TouchInterestToggle = 0 | 1 | |
declare function firetouchinterest(part: Instance, touching: BasePart, Toggle: TouchInterestToggle): void; | |
declare function isnetworkowner(part: BasePart): boolean; | |
declare function gethiddenproperty(instance: Instance, property: string): unknown; | |
declare function sethiddenproperty(instance: Instance, property: string, value: any): void; | |
declare function setsimulationradius(radius: number, maxradius?: number): void; | |
declare function getloadedmodules(): ModuleScript[]; | |
type ClientScript = LocalScript | ModuleScript | |
declare function getscripts(): ClientScript[]; | |
declare function getnilinstances(): Instance[]; | |
declare function getinstances(): Instance[]; | |
declare function getgc(includetables?: boolean): any[]; // how do I even implement this? | |
declare function getreg(): Record<any, any>; | |
declare function getrenv(): Record<any, any>; | |
declare function getgenv(): Record<any, any>; | |
/* Miscellaneous functions */ | |
declare function setclipboard(data: string): void; | |
declare function setfflag(flag: string, value: string): void; | |
declare function getnamecallmethod(): string; | |
declare function setnamecallmethod(method: string): void; | |
interface saveinstanceSettings { | |
mode?: "optimized" | "full" | "scripts"; | |
noscripts?: boolean; | |
scriptcache?: boolean; | |
timeout?: number; | |
} | |
declare function saveinstance(settings: saveinstanceSettings): void; | |
/* Drawing lib */ | |
declare class Base { | |
Visible: boolean; | |
ZIndex: number; | |
Transparency: number; | |
Color3: Color3; | |
Remove(): void; | |
} | |
declare class Line extends Base { | |
Thickness: number; | |
To: Vector2; | |
From: Vector2; | |
} | |
declare class Text extends Base { | |
Text: string; | |
Size: number; | |
Center: boolean; | |
Outline: boolean; | |
OutlineColor: Color3; | |
Position: Vector2; | |
TextBounds: Readonly<number>; | |
Font: DrawingFontsTypes; | |
} | |
declare class Image extends Base { | |
// set Data(data: string); | |
Data: string; // cannot make this readonly as original syn documentation | |
Size: Vector2; | |
Position: Vector2; | |
Rounding: number; | |
} | |
declare class Circle extends Base { | |
Thickness: number; | |
NumSides: number; | |
Radius: number; | |
Filled: boolean; | |
Position: Vector2; | |
} | |
declare class Square extends Base { | |
Thickness: number; | |
Size: Vector2; | |
Position: Vector2; | |
Filled: boolean; | |
} | |
declare class Quad extends Base { | |
Thickness: number; | |
Filled: boolean; | |
PointA: number; | |
PointB: number; | |
PointC: number; | |
PointD: number; | |
} | |
declare class Triangle extends Base { | |
Thickness: number; | |
Filled: boolean; | |
PointA: number; | |
PointB: number; | |
PointC: number; | |
} | |
declare type DrawingLibValues = { | |
Line: Line, | |
Text: Text, | |
Image: Image, | |
Circle: Circle, | |
Square: Square, | |
Quad: Quad, | |
Triangle: Triangle | |
} | |
type DrawingFontsTypes = 0 | 1 | 2 | 3 | |
interface DrawingFonts { | |
UI: DrawingFontsTypes, | |
System: DrawingFontsTypes, | |
Plex: DrawingFontsTypes, | |
Monospace: DrawingFontsTypes, | |
} | |
interface DrawingConstructor { | |
new <Type extends keyof DrawingLibValues>(classname: Type): DrawingLibValues[Type] | |
Fonts: DrawingFonts; | |
} | |
declare const Drawing: DrawingConstructor; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment