lenix 1.8.3 → 1.8.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.
package/client/client.ts CHANGED
@@ -63,12 +63,11 @@ export const client = {
63
63
  y: number,
64
64
  z: number,
65
65
  h?: number,
66
- clearArea = false,
67
- alive = true,
68
- deadDisable = false,
69
- ragdol = false
66
+ keepTasks = false,
67
+ keepIK = false,
68
+ doWarp = false
70
69
  ) => {
71
- SetEntityCoords(entity, x, y, z, alive, deadDisable, ragdol, clearArea)
70
+ SetEntityCoordsNoOffset(entity, x, y, z, keepTasks, keepIK, doWarp)
72
71
  h && SetEntityHeading(entity, h)
73
72
  },
74
73
 
@@ -154,12 +153,11 @@ export const client = {
154
153
  y: number,
155
154
  z: number,
156
155
  h?: number,
157
- clearArea?: boolean,
158
- alive?: boolean,
159
- deadDisable?: boolean,
160
- ragdol?: boolean
156
+ keepTasks = false,
157
+ keepIK = false,
158
+ doWarp = false
161
159
  ) {
162
- return client.entity.teleport(this.entity(), x, y, z, h, clearArea, alive, deadDisable, ragdol)
160
+ return client.entity.teleport(this.entity(), x, y, z, h, keepTasks, keepIK, doWarp)
163
161
  },
164
162
 
165
163
  /* */
package/nui/fetch.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { NuiFetchGeneric, Request } from '../shared/types.ts'
2
+ import { palette } from '../shared/palette.ts'
2
3
 
3
4
  declare function GetParentResourceName(): string
4
5
 
@@ -23,21 +24,34 @@ export const fetchNui = async <T extends NuiFetchGeneric>(
23
24
  }
24
25
  }
25
26
 
26
- export const fetchNuiServer = <T extends NuiFetchGeneric>(
27
+ export const fetchNuiServer = async <T extends NuiFetchGeneric>(
27
28
  id: T[1],
28
29
  requestData: T[2],
29
30
  timeout?: number,
30
- ): Promise<T[0]> => fetchNui<Request<T[0], '__nuiServer', {
31
- id: T[1]
32
- data: {
33
- timeout?: number
34
- requestData: T[2]
35
- }
36
- }>>(
37
- '__nuiServer', {
38
- id,
39
- data: {
40
- timeout,
41
- requestData,
31
+ ): Promise<T[0]> => {
32
+ const { data, error } = await fetchNui<Request<{
33
+ data: T[0] | null
34
+ error: string | null
35
+ }, '__nuiServer', {
36
+ id: T[1]
37
+ data: {
38
+ timeout?: number
39
+ requestData: T[2]
40
+ }
41
+ }>>(
42
+ '__nuiServer', {
43
+ id,
44
+ data: {
45
+ timeout,
46
+ requestData,
47
+ }
48
+ })
49
+ if (error) {
50
+ const typeofError = typeof error
51
+ if (typeofError === 'string') throw error
52
+
53
+ console.log(palette('wine', `Expected 'error' typeof 'string', got ${error} typeof ${typeofError}`))
42
54
  }
43
- })
55
+
56
+ return data
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lenix",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "Typed FiveM utilities for client, server, shared, and NUI scripts",
5
5
  "author": "Lenix",
6
6
  "license": "MIT",
package/server/nui.ts CHANGED
@@ -15,10 +15,16 @@ export const onNuiServer = <T extends NuiFetchGeneric>(
15
15
  const clientSource = source
16
16
 
17
17
  try {
18
- const result = await cb(clientSource, parameters)
19
- emitNet(`lenix/nui:${id}`, clientSource, requestId, result)
18
+ const data = await cb(clientSource, parameters)
19
+ emitNet(`lenix/nui:${id}`, clientSource, requestId, {
20
+ data,
21
+ error: null
22
+ })
20
23
  } catch (error) {
21
- emitNet(`lenix/nui:${id}`, clientSource, requestId)
24
+ emitNet(`lenix/nui:${id}`, clientSource, requestId, {
25
+ data: null,
26
+ error
27
+ })
22
28
  throw error
23
29
  }
24
30
  })
package/shared/repeat.ts CHANGED
@@ -23,7 +23,7 @@ export function repeat <T>(
23
23
  return
24
24
  }
25
25
 
26
- if (!result !== equal) return
26
+ if (result !== equal) return
27
27
 
28
28
  resolve(equal ?? result)
29
29
  clearInterval(interval)