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

15
ts-lua/types/2take1.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
/**
* Menu Functions
* @public
*/
declare namespace lua2take1 {
type Player = number;
type Entity = number;
type Ped = number;
type Vehicle = number;
type Group = number;
type Hash = number;
type Ptfx = number;
type Any = number;
type Thread = number;
}

9
ts-lua/types/D3D.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* D3D Functions
* @public
*/
declare namespace d3d {
}

9
ts-lua/types/Hooks.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* Hook Functions
* @public
*/
declare namespace hook {
}

9
ts-lua/types/Input.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* Input Functions
* @public
*/
declare namespace input {
}

45
ts-lua/types/Menu.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
/**
* Menu Functions
* @public
*/
declare namespace menu {
/**
* @param parent integer
*/
export function add_feature(name: string, type: string, parent: number, script_handler: (feat: Feat) => void): Feat;
/**
* @param id int
*/
export function delete_feature(id: number): boolean;
export function set_menu_can_navigate(): void;
export function get_version(): void;
/**
* @param parent integer
*/
export function add_player_feature(name: string, type: string, parent: number, script_handler: (feat: Feat) => void): PlayerFeat
/**
* @param i uint32_t
*/
export function get_player_feature(i: number): PlayerFeat
/**
* @param mode int
*/
export function is_threading_mode(mode: number): boolean
/**
* @privateRemarks callback declaration may be wrong
*/
export function create_thread(callback: () => void, context: any): lua2take1.Thread
export function has_thread_finished(id: lua2take1.Thread): boolean
export function delete_thread(id: lua2take1.Thread): boolean
}

10
ts-lua/types/RAGE/AI.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* AI Functions
* @public
*/
declare namespace ai {
}

10
ts-lua/types/RAGE/Audio.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Audio Functions
* @public
*/
declare namespace audio {
}

10
ts-lua/types/RAGE/Cam.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Cam Functions
* @public
*/
declare namespace cam {
}

10
ts-lua/types/RAGE/Control.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Control Functions
* @public
*/
declare namespace control {
}

10
ts-lua/types/RAGE/Cutscene.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Cutscene Functions
* @public
*/
declare namespace cutscene {
}

10
ts-lua/types/RAGE/Decorator.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Decorator Functions
* @public
*/
declare namespace decorator {
}

10
ts-lua/types/RAGE/Entity.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Entity Functions
* @public
*/
declare namespace entity {
}

10
ts-lua/types/RAGE/Fire.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Fire Functions
* @public
*/
declare namespace fire {
}

10
ts-lua/types/RAGE/Gameplay.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Gameplay Functions
* @public
*/
declare namespace gameplay {
}

10
ts-lua/types/RAGE/Graphics.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Graphics Functions
* @public
*/
declare namespace graphics {
}

10
ts-lua/types/RAGE/Interior.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Interior Functions
* @public
*/
declare namespace interior {
}

10
ts-lua/types/RAGE/Network.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Network Functions
* @public
*/
declare namespace network {
}

10
ts-lua/types/RAGE/Object.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Object Functions
* @public
*/
declare namespace object {
}

10
ts-lua/types/RAGE/Ped.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Ped Functions
* @public
*/
declare namespace ped {
}

10
ts-lua/types/RAGE/Player.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Player Functions
* @public
*/
declare namespace player {
}

10
ts-lua/types/RAGE/Script.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Script Functions
* @public
*/
declare namespace script {
}

10
ts-lua/types/RAGE/ScriptDraw.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* ScriptDraw Functions
* @public
*/
declare namespace scriptdraw {
}

10
ts-lua/types/RAGE/Stats.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Stats Functions
* @public
*/
declare namespace stats {
}

10
ts-lua/types/RAGE/Streaming.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Streaming Functions
* @public
*/
declare namespace streaming {
}

10
ts-lua/types/RAGE/System.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* System Functions
* @public
*/
declare namespace system {
}

10
ts-lua/types/RAGE/Time.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Time Functions
* @public
*/
declare namespace time {
}

10
ts-lua/types/RAGE/UI.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* UI Functions
* @public
*/
declare namespace ui {
}

10
ts-lua/types/RAGE/Utils.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Utils Functions
* @public
*/
declare namespace utils {
}

10
ts-lua/types/RAGE/Vehicle.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Vehicle Functions
* @public
*/
declare namespace vehicle {
}

10
ts-lua/types/RAGE/Water.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Water Functions
* @public
*/
declare namespace water {
}

10
ts-lua/types/RAGE/Weapon.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Weapon Functions
* @public
*/
declare namespace weapon {
}

10
ts-lua/types/RAGE/Worldprobe.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/**
* Worldprobe Functions
* @public
*/
declare namespace worldprobe {
}

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;
}