lenix 1.7.19 → 1.7.21
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/blip.ts +2 -2
- package/client/cam.ts +0 -2
- package/client/control.ts +6 -6
- package/client/index.ts +0 -1
- package/client/nearest.ts +3 -4
- package/client/nui.ts +6 -2
- package/client/pool.ts +0 -1
- package/nui/on.ts +0 -1
- package/nui/trigger.ts +1 -1
- package/package.json +1 -1
- /package/{client → shared}/timer.ts +0 -0
package/client/blip.ts
CHANGED
package/client/cam.ts
CHANGED
|
@@ -64,7 +64,6 @@ const toggleCam = ({
|
|
|
64
64
|
}) => {
|
|
65
65
|
setTimeout(() => {
|
|
66
66
|
SetCamActive(cam, state)
|
|
67
|
-
// deno-lint-ignore no-boolean-literal-for-arguments
|
|
68
67
|
RenderScriptCams(state, state, delay, true, state)
|
|
69
68
|
DoScreenFadeIn(fadeIn)
|
|
70
69
|
}, delay)
|
|
@@ -89,7 +88,6 @@ const create = ({
|
|
|
89
88
|
rotationOrder = details?.rotationOrder ?? 0
|
|
90
89
|
|
|
91
90
|
DoScreenFadeOut(fadeOut)
|
|
92
|
-
// deno-lint-ignore no-boolean-literal-for-arguments
|
|
93
91
|
const cam = CreateCamWithParams(
|
|
94
92
|
'DEFAULT_SCRIPTED_CAMERA',
|
|
95
93
|
coords[0],
|
package/client/control.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { pool } from './pool'
|
|
|
4
4
|
export interface Bind {
|
|
5
5
|
event: keyof typeof EVENTS,
|
|
6
6
|
key: keyof typeof CONTROLS,
|
|
7
|
-
|
|
7
|
+
onEvent: () => void,
|
|
8
8
|
type: keyof typeof TYPES,
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -115,7 +115,7 @@ const binds = new Set<Bind>()
|
|
|
115
115
|
const on = ({
|
|
116
116
|
event,
|
|
117
117
|
key,
|
|
118
|
-
cb,
|
|
118
|
+
onEvent: cb,
|
|
119
119
|
type = 'player',
|
|
120
120
|
}: Omit<Bind, 'event' | 'type'> & {
|
|
121
121
|
type?: Bind['type']
|
|
@@ -125,7 +125,7 @@ const on = ({
|
|
|
125
125
|
asserts(CONTROLS[key], `Could not find key<${key}>`)
|
|
126
126
|
|
|
127
127
|
binds.add({
|
|
128
|
-
event, key, cb, type
|
|
128
|
+
event, key, onEvent: cb, type
|
|
129
129
|
})
|
|
130
130
|
}
|
|
131
131
|
const disable = ({
|
|
@@ -137,7 +137,7 @@ const disable = ({
|
|
|
137
137
|
asserts(CONTROLS[key], `Could not find key<${key}>`)
|
|
138
138
|
|
|
139
139
|
binds.add({
|
|
140
|
-
event: 'disable', key,
|
|
140
|
+
event: 'disable', key, onEvent: () => {}, type
|
|
141
141
|
})
|
|
142
142
|
}
|
|
143
143
|
const enable = ({
|
|
@@ -149,11 +149,11 @@ const enable = ({
|
|
|
149
149
|
asserts(CONTROLS[key], `Could not find key<${key}>`)
|
|
150
150
|
|
|
151
151
|
binds.add({
|
|
152
|
-
event: 'enable', key,
|
|
152
|
+
event: 'enable', key, onEvent: () => {}, type
|
|
153
153
|
})
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
pool(() => binds.forEach(({ event, key, cb, type }) => {
|
|
156
|
+
pool(() => binds.forEach(({ event, key, onEvent: cb, type }) => {
|
|
157
157
|
for (const index of CONTROLS[key]) {
|
|
158
158
|
if (!EVENTS[event](TYPES[type], index, true)) continue
|
|
159
159
|
cb()
|
package/client/index.ts
CHANGED
package/client/nearest.ts
CHANGED
|
@@ -48,10 +48,9 @@ const player = (
|
|
|
48
48
|
|
|
49
49
|
if (playerId !== PlayerPedId() || includePlayer) {
|
|
50
50
|
const playerPed = GetPlayerPed(playerId)
|
|
51
|
-
// deno-lint-ignore no-boolean-literal-for-arguments
|
|
52
51
|
const vehicle = GetVehiclePedIsIn(playerPed, false)
|
|
53
52
|
const playerCoords: Vec3 = vehicle === 0
|
|
54
|
-
? client.entity.coords(
|
|
53
|
+
? client.entity.coords(playerPed, true)
|
|
55
54
|
: GetWorldPositionOfEntityBone(playerPed, 0) as Vec3
|
|
56
55
|
|
|
57
56
|
const distance = Vdist(
|
|
@@ -85,14 +84,14 @@ const player = (
|
|
|
85
84
|
* Finds the nearest vehicle around an entity.
|
|
86
85
|
*/
|
|
87
86
|
const vehicle = (entity: number, radialSpace: number): number | undefined => {
|
|
88
|
-
const coords: Vec3 = client.entity.coords(
|
|
87
|
+
const coords: Vec3 = client.entity.coords(entity, true)
|
|
89
88
|
const vehicles = GetGamePool('CVehicle') as number[]
|
|
90
89
|
|
|
91
90
|
let closest: number | undefined
|
|
92
91
|
let closestDistance = radialSpace
|
|
93
92
|
|
|
94
93
|
for (const vehicle of vehicles) {
|
|
95
|
-
const vehCoords: Vec3 = client.entity.coords(
|
|
94
|
+
const vehCoords: Vec3 = client.entity.coords(vehicle, true)
|
|
96
95
|
const x = coords[0] - vehCoords[0]
|
|
97
96
|
const y = coords[1] - vehCoords[1]
|
|
98
97
|
const z = coords[2] - vehCoords[2]
|
package/client/nui.ts
CHANGED
|
@@ -23,10 +23,14 @@ export const onNui = <T extends Request<unknown, string, object>>(
|
|
|
23
23
|
id: T[1],
|
|
24
24
|
cb: (data: T[2]) => T[0] | Promise<T[0]>
|
|
25
25
|
): void => {
|
|
26
|
-
RegisterNuiCallback(id, (
|
|
26
|
+
RegisterNuiCallback(id, async (
|
|
27
27
|
data: T[2],
|
|
28
28
|
reply: (_: unknown) => void
|
|
29
29
|
) => {
|
|
30
|
-
|
|
30
|
+
try {
|
|
31
|
+
reply(await cb(data))
|
|
32
|
+
} catch(e) {
|
|
33
|
+
throw e
|
|
34
|
+
}
|
|
31
35
|
})
|
|
32
36
|
}
|
package/client/pool.ts
CHANGED
package/nui/on.ts
CHANGED
|
@@ -6,7 +6,6 @@ interface Listener<T extends unknown[]> {
|
|
|
6
6
|
}
|
|
7
7
|
const events = new Map<string, Set<Listener<unknown[]>>>()
|
|
8
8
|
|
|
9
|
-
// deno-lint-ignore no-window no-window-prefix no-unused-vars
|
|
10
9
|
const handler = (event: MessageEvent) => {
|
|
11
10
|
const { id, params } = event.data
|
|
12
11
|
const callbacks = events.get(id)
|
package/nui/trigger.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const triggerNui = async <T extends Request<unknown, string, object>>(
|
|
|
15
15
|
headers: {
|
|
16
16
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
17
17
|
},
|
|
18
|
-
body: JSON.stringify(data
|
|
18
|
+
body: JSON.stringify(data)
|
|
19
19
|
})
|
|
20
20
|
return await response.json()
|
|
21
21
|
} catch (e) {
|
package/package.json
CHANGED
|
File without changes
|