@nativewrappers/fivem 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,10 @@ export declare const LoadAnimDict: (animDict: string, waitTime?: number) => Prom
11
11
  * @param waitTime how long to wait for the dictionary to load
12
12
  * @returns if the animation successfully loaded, if the animation failed to load it will return an array of animations that failed to load
13
13
  */
14
- export declare const LoadAnimDictArray: (animDict: string[], waitTime?: number) => Promise<[boolean, string[] | null]>;
14
+ export declare const LoadAnimDictArray: (animDict: string[], waitTime?: number) => Promise<[
15
+ boolean,
16
+ string[] | null
17
+ ]>;
15
18
  /**
16
19
  * A utility to unload multiple animation dictionary
17
20
  * @param animDict the animation dictionaries to unload
@@ -1,35 +1,15 @@
1
1
  import { Player } from './entities/Player';
2
- /** @typedef {(player: Player, ...args: any[]) => void} NetEvent */
3
2
  export type NetEvent = (player: Player, ...args: any[]) => void;
4
3
  export declare class Events {
5
- /**
6
- * @public
7
- * @static
8
- * @returns {void}
9
- */
10
4
  static cancel(): void;
11
- /**
12
- * @public
13
- * @static
14
- * @returns {boolean}
15
- */
16
5
  static wasCanceled(): boolean;
17
- /**
18
- * @public
19
- * @static
20
- */
21
6
  static get InvokingResource(): string;
22
7
  /**
23
8
  * An onNet wrapper that properly converts the type into the correct type
24
- * @public
25
- * @default (eventName: string, event: import("/home/skaggs/projects/fivem/server/src/Events").NetEvent) => void
26
9
  */
27
10
  onNet: (eventName: string, event: NetEvent) => void;
28
11
  /**
29
12
  * An on wrapper that properly converts the classes
30
- * @public
31
- * @default (eventName: string, event: import("/home/skaggs/projects/fivem/server/src/Events").NetEvent) => void
32
13
  */
33
14
  on: (eventName: string, event: NetEvent) => void;
34
15
  }
35
- /** @typedef {(player: Player, ...args: any[]) => void} NetEvent */
@@ -3,10 +3,6 @@ import { Ped, Prop, Vehicle, Entity } from './entities';
3
3
  import { Player } from './entities/Player';
4
4
  import { ClassTypes } from './enum/ClassTypes';
5
5
  import { Vector2, Vector3, Vector4 } from './utils';
6
- /**
7
- * @param {...any} [args]
8
- * @returns {any[]}
9
- */
10
6
  const getClassFromArguments = (...args) => {
11
7
  const newArgs = [];
12
8
  for (const arg of args) {
@@ -54,8 +50,6 @@ export class Events {
54
50
  constructor() {
55
51
  /**
56
52
  * An onNet wrapper that properly converts the type into the correct type
57
- * @public
58
- * @default (eventName: string, event: import("/home/skaggs/projects/fivem/server/src/Events").NetEvent) => void
59
53
  */
60
54
  this.onNet = (eventName, event) => {
61
55
  onNet(eventName, (...args) => {
@@ -65,8 +59,6 @@ export class Events {
65
59
  };
66
60
  /**
67
61
  * An on wrapper that properly converts the classes
68
- * @public
69
- * @default (eventName: string, event: import("/home/skaggs/projects/fivem/server/src/Events").NetEvent) => void
70
62
  */
71
63
  this.on = (eventName, event) => {
72
64
  on(eventName, (...args) => {
@@ -75,28 +67,13 @@ export class Events {
75
67
  });
76
68
  };
77
69
  }
78
- /**
79
- * @public
80
- * @static
81
- * @returns {void}
82
- */
83
70
  static cancel() {
84
71
  CancelEvent();
85
72
  }
86
- /**
87
- * @public
88
- * @static
89
- * @returns {boolean}
90
- */
91
73
  static wasCanceled() {
92
74
  return WasEventCanceled();
93
75
  }
94
- /**
95
- * @public
96
- * @static
97
- */
98
76
  static get InvokingResource() {
99
77
  return GetInvokingResource();
100
78
  }
101
79
  }
102
- /** @typedef {(player: Player, ...args: any[]) => void} NetEvent */
@@ -1,56 +1,25 @@
1
1
  import { Player } from './entities/Player';
2
2
  export declare abstract class Game {
3
- /**
4
- * @public
5
- * @static
6
- * @default Map<any, any>
7
- */
8
3
  static hashCache: Map<string, number>;
9
4
  /**
10
5
  * Calculate the Jenkins One At A Time (joaat) has from the given string.
11
- * @public
12
- * @static
13
- * @param {string} input The input string to calculate the hash
14
- * @returns {number}
6
+ *
7
+ * @param input The input string to calculate the hash
15
8
  */
16
9
  static generateHash(input: string): number;
17
10
  /**
18
11
  * Gets how many milliseconds the game has been open this session
19
- * @public
20
- * @static
21
12
  */
22
13
  static get GameTime(): number;
23
- /**
24
- * @public
25
- * @static
26
- */
27
14
  static get GameBuild(): number;
28
- /**
29
- * @public
30
- * @static
31
- */
32
15
  static get GameName(): string;
33
- /**
34
- * @public
35
- * @static
36
- * @param {string} name
37
- * @param {(player: Player, args: any[]) => void} handler
38
- * @param {boolean} [restricted=false]
39
- * @returns {void}
40
- */
41
16
  static registerCommand(name: string, handler: (player: Player, args: any[]) => void, restricted?: boolean): void;
42
- /**
43
- * @public
44
- * @static
45
- */
46
17
  static get RegisteredCommands(): [{
47
18
  name: string;
48
19
  }];
49
20
  /**
50
21
  * Get an iterable list of players currently on the server.
51
- * @public
52
- * @static
53
- * @returns {IterableIterator<Player>} Iterable list of Player objects.
22
+ * @returns Iterable list of Player objects.
54
23
  */
55
24
  static PlayerList(): IterableIterator<Player>;
56
25
  }
@@ -2,10 +2,8 @@ import { Player } from './entities/Player';
2
2
  export class Game {
3
3
  /**
4
4
  * Calculate the Jenkins One At A Time (joaat) has from the given string.
5
- * @public
6
- * @static
7
- * @param {string} input The input string to calculate the hash
8
- * @returns {number}
5
+ *
6
+ * @param input The input string to calculate the hash
9
7
  */
10
8
  static generateHash(input) {
11
9
  if (typeof input === 'undefined') {
@@ -20,34 +18,16 @@ export class Game {
20
18
  }
21
19
  /**
22
20
  * Gets how many milliseconds the game has been open this session
23
- * @public
24
- * @static
25
21
  */
26
22
  static get GameTime() {
27
23
  return GetGameTimer();
28
24
  }
29
- /**
30
- * @public
31
- * @static
32
- */
33
25
  static get GameBuild() {
34
26
  return GetGameBuildNumber();
35
27
  }
36
- /**
37
- * @public
38
- * @static
39
- */
40
28
  static get GameName() {
41
29
  return GetGameName();
42
30
  }
43
- /**
44
- * @public
45
- * @static
46
- * @param {string} name
47
- * @param {(player: Player, args: any[]) => void} handler
48
- * @param {boolean} [restricted=false]
49
- * @returns {void}
50
- */
51
31
  static registerCommand(name,
52
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
33
  handler, restricted = false) {
@@ -58,18 +38,12 @@ export class Game {
58
38
  handler(player, args);
59
39
  }, restricted);
60
40
  }
61
- /**
62
- * @public
63
- * @static
64
- */
65
41
  static get RegisteredCommands() {
66
42
  return GetRegisteredCommands();
67
43
  }
68
44
  /**
69
45
  * Get an iterable list of players currently on the server.
70
- * @public
71
- * @static
72
- * @returns {IterableIterator<Player>} Iterable list of Player objects.
46
+ * @returns Iterable list of Player objects.
73
47
  */
74
48
  static *PlayerList() {
75
49
  for (const id of getPlayers()) {
@@ -78,9 +52,4 @@ export class Game {
78
52
  }
79
53
  }
80
54
  // A map containing generated hashes.
81
- /**
82
- * @public
83
- * @static
84
- * @default Map<any, any>
85
- */
86
55
  Game.hashCache = new Map();
@@ -1,9 +1,3 @@
1
- /**
2
- * @typedef {Object} StateBagChangeHandler
3
- */
4
1
  export interface StateBagChangeHandler<T> {
5
2
  (bagName: string, key: string, value: T, reserved: number, replicated: boolean): void;
6
3
  }
7
- /**
8
- * @typedef {Object} StateBagChangeHandler
9
- */
@@ -1,4 +1 @@
1
1
  export {};
2
- /**
3
- * @typedef {Object} StateBagChangeHandler
4
- */
@@ -7,109 +7,36 @@ import { Vector4 } from '../utils';
7
7
  import { Vector3 } from '../utils';
8
8
  export declare class BaseEntity {
9
9
  protected handle: number;
10
- /**
11
- * @protected
12
- * @default import("/home/skaggs/projects/fivem/server/src/enum/ClassTypes").ClassTypes.Entity
13
- */
14
10
  protected type: ClassTypes;
15
11
  constructor(handle: number);
16
- /**
17
- * @public
18
- */
19
12
  get State(): StateBagInterface;
20
- /**
21
- * @public
22
- */
23
13
  get Handle(): number;
24
- /**
25
- * @public
26
- */
27
14
  get Owner(): number;
28
- /**
29
- * @public
30
- */
31
15
  get FirstOwner(): number;
32
- /**
33
- * @public
34
- */
35
16
  get Exists(): boolean;
36
- /**
37
- * @public
38
- */
39
17
  get AttachedTo(): number;
40
- /**
41
- * @public
42
- */
43
18
  get Position(): Vector3;
44
- /**
45
- * @public
46
- */
47
19
  get Heading(): number;
48
- /**
49
- * @public
50
- */
51
20
  get PositionAndHeading(): Vector4;
52
- /**
53
- * @public
54
- */
55
21
  get Health(): number;
56
- /**
57
- * @public
58
- */
59
22
  get MaxHealth(): number;
60
- /**
61
- * @public
62
- */
63
23
  get Model(): Hash;
64
- /**
65
- * @public
66
- */
67
24
  get PopulationType(): PopulationType;
68
- /**
69
- * @public
70
- */
71
25
  get Rotation(): Vector3;
72
- /**
73
- * @public
74
- */
75
26
  get RotationVelocity(): Vector3;
76
- /**
77
- * @public
78
- */
79
27
  get RoutingBucket(): number;
80
28
  /**
81
29
  * @returns The script that made the entity
82
- * @public
83
30
  */
84
31
  get Script(): string;
85
- /**
86
- * @public
87
- */
88
32
  get Speed(): number;
89
- /**
90
- * @public
91
- */
92
33
  get Type(): eEntityType;
93
34
  /**
94
35
  * @returns the entitys velocity, if the entity is a ped it will return Vector3(0, 0, 0)
95
- * @public
96
36
  */
97
37
  get Velocity(): Vector3;
98
- /**
99
- * @public
100
- */
101
38
  get IsVisible(): boolean;
102
- /**
103
- * @public
104
- */
105
39
  get NetworkId(): number;
106
- /**
107
- * @public
108
- */
109
40
  get IsNoLongerNeeded(): boolean;
110
- /**
111
- * @public
112
- * @returns {void}
113
- */
114
41
  delete(): void;
115
42
  }
@@ -5,156 +5,83 @@ import { Vector3 } from '../utils';
5
5
  export class BaseEntity {
6
6
  constructor(handle) {
7
7
  this.handle = handle;
8
- /**
9
- * @protected
10
- * @default import("/home/skaggs/projects/fivem/server/src/enum/ClassTypes").ClassTypes.Entity
11
- */
12
8
  this.type = ClassTypes.Entity;
13
9
  }
14
- /**
15
- * @public
16
- */
17
10
  get State() {
18
11
  return cfx.Entity(this.handle).state;
19
12
  }
20
- /**
21
- * @public
22
- */
23
13
  get Handle() {
24
14
  return this.handle;
25
15
  }
26
- /**
27
- * @public
28
- */
29
16
  get Owner() {
30
17
  return NetworkGetEntityOwner(this.handle);
31
18
  }
32
- /**
33
- * @public
34
- */
35
19
  get FirstOwner() {
36
20
  return NetworkGetFirstEntityOwner(this.handle);
37
21
  }
38
- /**
39
- * @public
40
- */
41
22
  get Exists() {
42
23
  return this.handle !== 0 && DoesEntityExist(this.handle);
43
24
  }
44
- /**
45
- * @public
46
- */
47
25
  get AttachedTo() {
48
26
  return GetEntityAttachedTo(this.handle);
49
27
  }
50
- /**
51
- * @public
52
- */
53
28
  get Position() {
54
29
  return Vector3.fromArray(GetEntityCoords(this.handle));
55
30
  }
56
- /**
57
- * @public
58
- */
59
31
  get Heading() {
60
32
  return GetEntityHeading(this.handle);
61
33
  }
62
- /**
63
- * @public
64
- */
65
34
  get PositionAndHeading() {
66
35
  return Vector4.fromArray([...GetEntityCoords(this.handle), GetEntityHeading(this.handle)]);
67
36
  }
68
- /**
69
- * @public
70
- */
71
37
  get Health() {
72
38
  return GetEntityHealth(this.handle);
73
39
  }
74
- /**
75
- * @public
76
- */
77
40
  get MaxHealth() {
78
41
  return GetEntityMaxHealth(this.handle);
79
42
  }
80
- /**
81
- * @public
82
- */
83
43
  get Model() {
84
44
  return GetEntityModel(this.handle);
85
45
  }
86
- /**
87
- * @public
88
- */
89
46
  get PopulationType() {
90
47
  return GetEntityPopulationType(this.handle);
91
48
  }
92
- /**
93
- * @public
94
- */
95
49
  get Rotation() {
96
50
  return Vector3.fromArray(GetEntityRotation(this.handle));
97
51
  }
98
- /**
99
- * @public
100
- */
101
52
  get RotationVelocity() {
102
53
  return Vector3.fromArray(GetEntityRotationVelocity(this.handle));
103
54
  }
104
- /**
105
- * @public
106
- */
107
55
  get RoutingBucket() {
108
56
  return GetEntityRoutingBucket(this.handle);
109
57
  }
110
58
  /**
111
59
  * @returns The script that made the entity
112
- * @public
113
60
  */
114
61
  get Script() {
115
62
  return GetEntityScript(this.handle);
116
63
  }
117
- /**
118
- * @public
119
- */
120
64
  get Speed() {
121
65
  return GetEntitySpeed(this.handle);
122
66
  }
123
- /**
124
- * @public
125
- */
126
67
  get Type() {
127
68
  return GetEntityType(this.handle);
128
69
  }
129
70
  /**
130
71
  * @returns the entitys velocity, if the entity is a ped it will return Vector3(0, 0, 0)
131
- * @public
132
72
  */
133
73
  get Velocity() {
134
74
  return Vector3.fromArray(GetEntityVelocity(this.handle));
135
75
  }
136
- /**
137
- * @public
138
- */
139
76
  get IsVisible() {
140
77
  return IsEntityVisible(this.handle);
141
78
  }
142
- /**
143
- * @public
144
- */
145
79
  get NetworkId() {
146
80
  return NetworkGetNetworkIdFromEntity(this.handle);
147
81
  }
148
- /**
149
- * @public
150
- */
151
82
  get IsNoLongerNeeded() {
152
83
  return HasEntityBeenMarkedAsNoLongerNeeded(this.handle);
153
84
  }
154
- /**
155
- * @public
156
- * @returns {void}
157
- */
158
85
  delete() {
159
86
  DeleteEntity(this.handle);
160
87
  }
@@ -1,18 +1,5 @@
1
1
  import { BaseEntity } from './BaseEntity';
2
- /** @extends BaseEntity */
3
2
  export declare class Entity extends BaseEntity {
4
- /**
5
- * @public
6
- * @static
7
- * @param {number} netId
8
- * @returns {Entity}
9
- */
10
3
  static fromNetworkId(netId: number): Entity;
11
- /**
12
- * @public
13
- * @static
14
- * @param {number} handle
15
- * @returns {Entity}
16
- */
17
4
  static fromHandle(handle: number): Entity;
18
5
  }
@@ -1,21 +1,8 @@
1
1
  import { BaseEntity } from './BaseEntity';
2
- /** @extends BaseEntity */
3
2
  export class Entity extends BaseEntity {
4
- /**
5
- * @public
6
- * @static
7
- * @param {number} netId
8
- * @returns {Entity}
9
- */
10
3
  static fromNetworkId(netId) {
11
4
  return new Entity(NetworkGetEntityFromNetworkId(netId));
12
5
  }
13
- /**
14
- * @public
15
- * @static
16
- * @param {number} handle
17
- * @returns {Entity}
18
- */
19
6
  static fromHandle(handle) {
20
7
  return new Entity(handle);
21
8
  }
@@ -1,87 +1,27 @@
1
1
  import { ClassTypes } from '../enum/ClassTypes';
2
2
  import { Hash } from '../type/Hash';
3
3
  import { BaseEntity } from './BaseEntity';
4
- /** @extends BaseEntity */
5
4
  export declare class Ped extends BaseEntity {
6
- /**
7
- * @protected
8
- * @default import("/home/skaggs/projects/fivem/server/src/enum/ClassTypes").ClassTypes.Ped
9
- */
10
5
  protected type: ClassTypes;
11
6
  constructor(handle: number);
12
7
  /**
13
8
  * Get an interable list of peds currently on the server
14
- * @public
15
- * @static
16
- * @returns {IterableIterator<Ped>} Iterable list of Peds.
9
+ * @returns Iterable list of Peds.
17
10
  */
18
11
  static AllPeds(): IterableIterator<Ped>;
19
- /**
20
- * @public
21
- * @static
22
- * @param {number} netId
23
- * @returns {Ped}
24
- */
25
12
  static fromNetworkId(netId: number): Ped;
26
- /**
27
- * @public
28
- * @static
29
- * @param {number} handle
30
- * @returns {Ped}
31
- */
32
13
  static fromHandle(handle: number): Ped;
33
- /**
34
- * @public
35
- */
36
14
  get Armour(): number;
37
- /**
38
- * @public
39
- */
40
15
  get CauseOfDeath(): Hash;
41
- /**
42
- * @public
43
- */
44
16
  get DesiredHeading(): number;
45
- /**
46
- * @public
47
- */
48
17
  get MaxHealth(): number;
49
- /**
50
- * @public
51
- */
52
18
  get TaskCommand(): Hash;
53
- /**
54
- * @public
55
- */
56
19
  get TaskStage(): number;
57
- /**
58
- * @public
59
- */
60
20
  get LastSourceOfDamage(): number;
61
- /**
62
- * @public
63
- */
64
21
  get DeathCause(): number;
65
- /**
66
- * @public
67
- */
68
22
  get Weapon(): Hash;
69
- /**
70
- * @public
71
- */
72
23
  get Vehicle(): number;
73
- /**
74
- * @public
75
- */
76
24
  get LastVehicle(): number;
77
- /**
78
- * @public
79
- */
80
25
  get IsPlayer(): boolean;
81
- /**
82
- * @public
83
- * @param {number} index
84
- * @returns {number}
85
- */
86
26
  specificTaskType(index: number): number;
87
27
  }