lenix 1.8.3 → 1.8.5
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 +8 -10
- package/nui/fetch.ts +31 -14
- package/package.json +1 -1
- package/server/nui.ts +9 -3
- package/shared/repeat.ts +1 -1
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
ragdol = false
|
|
66
|
+
keepTasks = false,
|
|
67
|
+
keepIK = false,
|
|
68
|
+
doWarp = false
|
|
70
69
|
) => {
|
|
71
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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,
|
|
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,37 @@ 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]> =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'__nuiServer', {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
): Promise<T[0]> => {
|
|
32
|
+
const { data, error } = await fetchNui<Request<{
|
|
33
|
+
data: T[0]
|
|
34
|
+
error: null
|
|
35
|
+
} | {
|
|
36
|
+
data: null
|
|
37
|
+
error: string
|
|
38
|
+
}, '__nuiServer', {
|
|
39
|
+
id: T[1]
|
|
40
|
+
data: {
|
|
41
|
+
timeout?: number
|
|
42
|
+
requestData: T[2]
|
|
43
|
+
}
|
|
44
|
+
}>>(
|
|
45
|
+
'__nuiServer', {
|
|
46
|
+
id,
|
|
47
|
+
data: {
|
|
48
|
+
timeout,
|
|
49
|
+
requestData,
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
if (error !== null) {
|
|
53
|
+
const typeofError = typeof error
|
|
54
|
+
if (typeofError === 'string') throw error
|
|
55
|
+
|
|
56
|
+
throw `Expected 'error' typeof 'string', got ${error} typeof ${typeofError}`
|
|
42
57
|
}
|
|
43
|
-
|
|
58
|
+
|
|
59
|
+
return data
|
|
60
|
+
}
|
package/package.json
CHANGED
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
|
|
19
|
-
emitNet(`lenix/nui:${id}`, clientSource, requestId,
|
|
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
|
})
|