lenix 1.8.11 → 1.8.13
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 +1 -1
- package/client/control.ts +103 -103
- package/package.json +2 -2
package/client/client.ts
CHANGED
package/client/control.ts
CHANGED
|
@@ -13,119 +13,121 @@ const EVENTS = {
|
|
|
13
13
|
hold: IsControlPressed,
|
|
14
14
|
release: IsControlJustReleased,
|
|
15
15
|
released: IsControlReleased,
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
disabledPress: IsDisabledControlJustPressed,
|
|
18
|
+
disabledHold: IsDisabledControlPressed,
|
|
19
|
+
disabledRelease: IsDisabledControlJustReleased,
|
|
20
|
+
disabledReleased: IsDisabledControlReleased,
|
|
21
|
+
|
|
17
22
|
disable: DisableControlAction,
|
|
18
23
|
enable: EnableControlAction,
|
|
24
|
+
disableAll: DisableAllControlActions,
|
|
25
|
+
enableAll: EnableAllControlActions,
|
|
19
26
|
}
|
|
20
27
|
export const TYPES = {
|
|
21
28
|
player: 0,
|
|
22
29
|
camera: 1,
|
|
23
30
|
frontend: 2,
|
|
24
31
|
} as const
|
|
32
|
+
// TODO: add [PAUSE, END, SNAPSHOT, 0, i, j, o, LWIN, RWIN, NUMPAD[1-3], MULTIPLY, DECIMAL, DIVIDE, NUMPADEQUALS, NUMPADENTER, F[4, 13-24], NUMLOCK, SCROLL, RMENU, SEMICOLON, PLUS, SLASH, BACKSLASH, APOSTROPHE, , mouse axis, extra mouse bns, scrollwheels]
|
|
33
|
+
// NONE: [3, 5, 7, 28, 53, 65, 93, 94, 156, 193, 226, 227, 228, 230, 231, 239, 240, 247, 248, 258, 259, 260, 265, 292, 293, 294, 295]
|
|
25
34
|
export const CONTROLS = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"K": [311],
|
|
106
|
-
"U": [303],
|
|
107
|
-
"F1": [288],
|
|
108
|
-
"F2": [289],
|
|
109
|
-
"F11": [344],
|
|
110
|
-
"SCROLLWHEEL BUTTON (PRESS)": [27, 348]
|
|
35
|
+
MOUSE_LEFT: [18, 24, 69, 92, 106, 122, 135, 142, 144, 176, 223, 229, 237, 257, 329, 346],
|
|
36
|
+
D: [9, 20, 35, 59, 64, 90, 134, 146, 148, 195, 218, 235, 266, 267, 278, 279, 339, 342],
|
|
37
|
+
S: [8, 31, 33, 72, 78, 88, 130, 139, 149, 151, 196, 219, 233, 268, 269, 302],
|
|
38
|
+
SPACE: [18, 22, 55, 76, 102, 143, 179, 203, 216, 255, 298, 321, 328, 353],
|
|
39
|
+
MOUSE_RIGHT: [25, 68, 70, 91, 114, 177, 222, 225, 238, 330, 331, 347],
|
|
40
|
+
E: [38, 46, 51, 54, 86, 103, 119, 153, 184, 206, 350, 351, 355, 356],
|
|
41
|
+
LCONTROL: [36, 60, 62, 132, 210, 224, 280, 281, 326, 341, 343],
|
|
42
|
+
LBRACKET: [39, 41, 43, 100, 116, 274, 275, 276, 277, 312],
|
|
43
|
+
X: [73, 105, 120, 154, 186, 252, 323, 337, 345, 354, 357],
|
|
44
|
+
LSHIFT: [21, 61, 131, 155, 209, 254, 340, 352],
|
|
45
|
+
Q: [44, 52, 85, 138, 141, 152, 205, 264],
|
|
46
|
+
W: [32, 71, 77, 87, 129, 136, 150, 232],
|
|
47
|
+
A: [34, 63, 89, 133, 147, 234, 338],
|
|
48
|
+
F: [23, 49, 75, 144, 145, 185, 251],
|
|
49
|
+
DELETE: [178, 214, 256, 296, 297],
|
|
50
|
+
RETURN: [18, 176, 191, 201, 215],
|
|
51
|
+
R: [45, 80, 140, 250, 263, 310],
|
|
52
|
+
TAB: [37, 192, 204, 211, 349],
|
|
53
|
+
NUMPAD6: [107, 109, 123, 125],
|
|
54
|
+
NUMPAD5: [110, 112, 126, 128],
|
|
55
|
+
RBRACKET: [40, 42, 197, 313],
|
|
56
|
+
ESCAPE: [177, 200, 202, 322],
|
|
57
|
+
C: [26, 79, 253, 319, 324],
|
|
58
|
+
LEFT: [174, 189, 190, 308],
|
|
59
|
+
CAPITAL: [137, 171, 217],
|
|
60
|
+
PAGEDOWN: [11, 207, 317],
|
|
61
|
+
MOUSE_MIDDLE: [27, 348],
|
|
62
|
+
UP: [27, 172, 188, 300],
|
|
63
|
+
PAGEUP: [10, 208, 316],
|
|
64
|
+
V: [0, 236, 320, 325],
|
|
65
|
+
DOWN: [173, 187, 299],
|
|
66
|
+
G: [47, 183, 58, 113],
|
|
67
|
+
H: [74, 101, 104, 304],
|
|
68
|
+
BACK: [177, 194, 202],
|
|
69
|
+
RIGHT: [175, 307],
|
|
70
|
+
SUBTRACT: [96, 315],
|
|
71
|
+
NUMPAD4: [108, 124],
|
|
72
|
+
NUMPAD8: [111, 127],
|
|
73
|
+
HOME: [212, 213],
|
|
74
|
+
Z: [20, 48],
|
|
75
|
+
B: [19, 305],
|
|
76
|
+
M: [244, 301],
|
|
77
|
+
T: [245, 309],
|
|
78
|
+
N: [249, 306],
|
|
79
|
+
LMENU: [19],
|
|
80
|
+
PERIOD: [81],
|
|
81
|
+
COMMA: [82],
|
|
82
|
+
EQUALS: [83],
|
|
83
|
+
MINUS: [84],
|
|
84
|
+
ADD: [97, 314],
|
|
85
|
+
NUMPAD7: [117],
|
|
86
|
+
NUMPAD9: [118],
|
|
87
|
+
INSERT: [121],
|
|
88
|
+
NUMPADENTER: [201],
|
|
89
|
+
GRAVE: [243],
|
|
90
|
+
1: [157],
|
|
91
|
+
2: [158],
|
|
92
|
+
6: [159],
|
|
93
|
+
3: [160],
|
|
94
|
+
7: [161],
|
|
95
|
+
8: [162],
|
|
96
|
+
9: [163],
|
|
97
|
+
4: [164],
|
|
98
|
+
5: [165],
|
|
99
|
+
L: [182],
|
|
100
|
+
P: [199],
|
|
101
|
+
Y: [246],
|
|
102
|
+
U: [303],
|
|
103
|
+
K: [311],
|
|
104
|
+
F1: [288],
|
|
105
|
+
F2: [289],
|
|
106
|
+
F3: [170],
|
|
107
|
+
F5: [166, 318, 327],
|
|
108
|
+
F6: [167],
|
|
109
|
+
F7: [168],
|
|
110
|
+
F8: [169],
|
|
111
|
+
F9: [56],
|
|
112
|
+
F10: [57],
|
|
113
|
+
F11: [344],
|
|
111
114
|
} as const
|
|
112
115
|
|
|
116
|
+
|
|
113
117
|
const binds = new Set<Bind>()
|
|
114
118
|
|
|
115
119
|
const on = ({
|
|
116
120
|
event,
|
|
117
121
|
key,
|
|
118
|
-
onEvent
|
|
122
|
+
onEvent,
|
|
119
123
|
type = 'player',
|
|
120
|
-
}:
|
|
121
|
-
|
|
122
|
-
} & {
|
|
123
|
-
event: Exclude<Bind['event'], 'disable' | 'enable'>
|
|
124
|
+
}: Bind & {
|
|
125
|
+
event: Extract<Bind['event'], 'press' | 'hold' | 'release' | 'released' | 'disabledPress' | 'disabledHold' | 'disabledRelease' | 'disabledReleased'>
|
|
124
126
|
}) => {
|
|
125
127
|
asserts(CONTROLS[key], `Could not find key<${key}>`)
|
|
126
128
|
|
|
127
129
|
const bind = {
|
|
128
|
-
event, key, onEvent
|
|
130
|
+
event, key, onEvent, type
|
|
129
131
|
}
|
|
130
132
|
binds.add(bind)
|
|
131
133
|
|
|
@@ -134,35 +136,33 @@ const on = ({
|
|
|
134
136
|
const disable = ({
|
|
135
137
|
key,
|
|
136
138
|
type = 'player',
|
|
137
|
-
}:
|
|
139
|
+
}: {
|
|
140
|
+
key: Bind['key'] | true
|
|
138
141
|
type?: Bind['type']
|
|
139
142
|
}) => {
|
|
140
|
-
asserts(CONTROLS[key], `Could not find key<${key}>`)
|
|
141
|
-
|
|
142
143
|
binds.add({
|
|
143
|
-
event: 'disable', key
|
|
144
|
+
event: key === true ? 'disableAll' : 'disable', key: 'A' /* anything */, onEvent: () => {}, type
|
|
144
145
|
})
|
|
145
146
|
}
|
|
146
147
|
const enable = ({
|
|
147
148
|
key,
|
|
148
149
|
type = 'player',
|
|
149
|
-
}:
|
|
150
|
+
}: {
|
|
151
|
+
key: Bind['key'] | true
|
|
150
152
|
type?: Bind['type']
|
|
151
153
|
}) => {
|
|
152
|
-
asserts(CONTROLS[key], `Could not find key<${key}>`)
|
|
153
|
-
|
|
154
154
|
binds.add({
|
|
155
|
-
event: 'enable', key
|
|
155
|
+
event: key === true ? 'enableAll' : 'enable', key: 'A' /* anything */, onEvent: () => {}, type
|
|
156
156
|
})
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
pool(() =>
|
|
160
|
-
for (const index of CONTROLS[key]) {
|
|
159
|
+
pool(() => {
|
|
160
|
+
for (const { event, key, onEvent: cb, type } of binds) for (const index of CONTROLS[key]) {
|
|
161
161
|
if (!EVENTS[event](TYPES[type], index, true)) continue
|
|
162
162
|
cb()
|
|
163
163
|
break
|
|
164
164
|
}
|
|
165
|
-
})
|
|
165
|
+
})
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* @beta This API is in beta. Use with caution.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lenix",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.13",
|
|
4
4
|
"description": "Typed FiveM utilities for client, server, shared, and NUI scripts",
|
|
5
5
|
"author": "Lenix",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"typescript": "^5"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@lenix/lenix": "npm:@jsr/lenix__lenix@1.8.
|
|
50
|
+
"@lenix/lenix": "npm:@jsr/lenix__lenix@1.8.20"
|
|
51
51
|
}
|
|
52
52
|
}
|