This commit is contained in:
2021-06-27 20:27:03 -05:00
commit cbd4520e12
42 changed files with 1836 additions and 0 deletions

103
structs/Feat.d.ts vendored Normal file
View File

@@ -0,0 +1,103 @@
/**
* a feature from the menu
* @public
*/
declare class Feat {
/**
* only for testing,
*
* @param type "debug"
*
* @example
*
* new Feat("debug")
*
*/
constructor(type: "debug");
/**
* feature on/off boolean
*/
public get on(): boolean;
public set on(on: boolean);
readonly parent: Feat|null;
/**
* Only for parents
*/
readonly children: Feat[];
/**
* Only for parents
*/
readonly child_count: number;
readonly type: number;
/**
* Ids will be recycled after the feature is deleted
*/
readonly id: number;
/**
* value for integer features
*/
public get value_i(): integer;
public set value_i(value_i: integer);
/**
* min value
*/
public get min_1(): integer;
public set min_1(min_1: integer);
/**
* max value
*/
public get max_i(): integer;
public set max_i(max_i: integer);
/**
* step size
*/
public get mod_i(): integer;
public set mod_i(mod_i: integer);
/**
* deprecated
*
* @deprecated
*/
public get threaded(): boolean;
public set threaded(threaded: boolean);
public get name(): string;
public set name(name: string);
/**
* d3d handler
*
* @privateRemarks
*
* it's only defined as `any` because I don't understand the d3d handler function enough
*/
public get renderer(): any;
public set renderer(renderer: any);
/**
* show/hide feature
*/
public get hidden(): boolean;
public set hidden(hidden: boolean);
/**
* additional context passed to script handlers
*/
public get data(): any;
public set data(data: any);
public toggle(): Feat;
}

24
structs/MenuKey.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
/**
*
* @public
*/
declare class MenuKey {
/**
* vector of virtual keys
*/
readonly keys: table<uint32_t>;
public push_vk(virtualKeyCode: uint32_t): void;
public push_str(key: string): boolean;
public pop(): void;
public clear(): void;
public is_down(): boolean;
public is_down_stepped(): boolean;
}

42
structs/PlayerFeat.d.ts vendored Normal file
View File

@@ -0,0 +1,42 @@
/**
* a player feature
* @public
*/
declare class PlayerFeat {
/**
* only for testing,
*
* @param type "debug"
*
* @example
*
* new Feat("debug")
*
*/
constructor(type: "debug");
readonly feats: Feat[];
readonly id: number;
readonly parent_id: number;
/**
* deprecated
*/
public get threaded(): boolean;
public set threaded(threaded: boolean);
/**
* Make sure you set the renderer with the PlayerFeat function, and not the Feat function. Otherwise the handler will not receive the player id in the second param.
*
* @privateRemarks
*
* it's only defined as `any` because I don't understand the d3d handler function enough
*
*/
public get renderer(): any;
public set renderer(renderer: any);
}

27
structs/Regex.d.ts vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
*
* @public
*/
declare class Regex {
/**
* only for testing,
*
* @param type "debug"
*
* @example
*
* new Feat("debug")
*
*/
constructor(type: "debug");
readonly pattern: string;
constructor(pattern: string);
public search(subject: string): RegexResult;
public __tostring(): string;
}

39
structs/RegexResult.d.ts vendored Normal file
View File

@@ -0,0 +1,39 @@
/**
*
* @privateRemarks
*
* example directly translated from the api docs and is untested
*
* I also don't know if javascript's regex will work
*
* @example
*
* let r = new Regex("^(test123)"),
* s = "test123 abcd 345345",
* m = r.search(r, s)
*
* if (m.count > 0)
* ui.notify_above_map(m.matches[1], "Lua regex", 140)
*
* @public
*/
declare class RegexResult {
/**
* only for testing,
*
* @param type "debug"
*
* @example
*
* new Feat("debug")
*/
constructor(type: "debug");
readonly count: integer;
readonly matches: string[];
public __tostring(): string;
}

33
structs/v2.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
/**
* a 2x1 matrix
* @public
* @noSelf
*/
declare class v2 {
readonly x: float;
readonly y: float;
/**
* **instanciating this class with `new` will break the lua**
* @deprecated
*/
constructor(x: float, y: float);
public __add(val: v2|v3|float): v2;
public __sub(val: v2|v3|float): v2;
public __mul(val: v2|v3|float): v2;
public __div(val: v2|v3|float): v2;
public __eq(val: v2): boolean;
public __lt(val: v2): boolean;
public __le(val: v2): boolean;
public __tostring(): string
public magnitude(val: v2|null): float;
}
/**
* @noSelf
*/
declare function v2(x: float, y: float): v2

54
structs/v3.d.ts vendored Normal file
View File

@@ -0,0 +1,54 @@
/**
* a 3x1 matrix
*
* @privateRemarks
*
* example directly translated from the api docs and is untested
*
* @example
*
* let player_id = player.player_id(),
* player_ped = player.get_player_ped(player_id),
* pos = player.get_player_coords(player_id),
* rot = entity.get_entity_rotation(player_ped),
* dir = rot
*
* dir.transformRotToDir()
* dir *= 4
* pos += dir
*
* @public
* @noSelf
*/
declare class v3 {
readonly x: float;
readonly y: float;
readonly z: float;
/**
* **instanciating this class with `new` will break the lua**
* @deprecated
*/
constructor(x: float, y: float, z: float);
public __add(val: v2|v3|float): v3;
public __sub(val: v2|v3|float): v3;
public __mul(val: v2|v3|float): v3;
public __div(val: v2|v3|float): v3;
public __eq(val: v2): boolean;
public __lt(val: v2): boolean;
public __le(val: v2): boolean;
public __tostring(): string
public magnitude(val: v3|null): float;
public transformRotToDir(): void;
public radToDeg(): void;
public degToRad(): void;
}
/**
* @noSelf
*/
declare function v3(x: float, y: float, z: float): v3