This commit is contained in:
2021-06-23 21:29:51 -05:00
parent 3b0ee59f47
commit 655edc3d16
45 changed files with 963 additions and 0 deletions

117
ts-lua/types/structs/Feat.d.ts vendored Normal file
View File

@@ -0,0 +1,117 @@
/**
* 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
*
* @remarks integer
*/
public get value_i(): number;
public set value_i(value_i: number);
/**
* min value
*
* @remarks integer
*/
public get min_1(): number;
public set min_1(min_1: number);
/**
* max value
*
* @remarks integer
*/
public get max_i(): number;
public set max_i(max_i: number);
/**
* step size
*
* @remarks integer
*/
public get mod_i(): number;
public set mod_i(mod_i: number);
/**
* 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 featur
*
*/
public get hidden(): boolean;
public set hidden(hidden: boolean);
/**
* additional context passed to script handlers
*/
public get data(): any;
public set data(data: any);
/**
*
* @returns Feat
*/
public toggle(): Feat;
}

29
ts-lua/types/structs/MenuKey.d.ts vendored Normal file
View File

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

42
ts-lua/types/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
ts-lua/types/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;
}

44
ts-lua/types/structs/RegexResult.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
/**
*
* @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");
/**
*
* @remarks integer
*/
readonly count: number;
readonly matches: string[];
public __tostring(): string;
}

64
ts-lua/types/structs/v2.d.ts vendored Normal file
View File

@@ -0,0 +1,64 @@
/**
* a 2x1 matrix
* @public
*/
declare class v2 {
/**
*
* @remarks float
*/
readonly x: number;
/**
*
* @remarks float
*/
readonly y: number;
/**
*
* @param x float
* @param y float
*/
constructor(x?: number, y?: number);
/**
*
* @param val float
*/
public __add(val: v2|v3|number): v2;
/**
*
* @param val float
*/
public __sub(val: v2|v3|number): v2;
/**
*
* @param val float
*/
public __mul(val: v2|v3|number): v2;
/**
*
* @param val float
*/
public __div(val: v2|v3|number): v2;
public __eq(val: v2): boolean;
public __lt(val: v2): boolean;
public __le(val: v2): boolean;
public __tostring(): string
/**
*
* @returns float
*/
public magnitude(val: v2|null): number;
}

102
ts-lua/types/structs/v3.d.ts vendored Normal file
View File

@@ -0,0 +1,102 @@
/**
* 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
*/
declare class v3 {
/**
*
* @remarks float
*/
readonly x: number;
/**
*
* @remarks float
*/
readonly y: number;
/**
*
* @remarks float
*/
readonly z: number;
/**
*
* @param x float
* @param y float
* @param z float
*/
constructor(x?: number, y?: number, z?: number);
/**
*
* @param val float
*/
public __add(val: v2|v3|number): v3;
/**
*
* @param val float
*/
public __sub(val: v2|v3|number): v3;
/**
*
* @param val float
*/
public __mul(val: v2|v3|number): v3;
/**
*
* @param val float
*/
public __div(val: v2|v3|number): v3;
public __eq(val: v2): boolean;
public __lt(val: v2): boolean;
public __le(val: v2): boolean;
public __tostring(): string
/**
*
* @returns float
*/
public magnitude(val: v3|null): number;
/**
*
* @privateRemarks
*
* I don't understand this methough function enough to even try to test this in typescript
*
*/
public transformRotToDir(): void;
public radToDeg(): void;
public degToRad(): void;
}