@armoury/fivem-framework-common 1.0.48 → 1.0.49
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.
|
@@ -15,8 +15,7 @@ function Commands(target, _prototype, providers) {
|
|
|
15
15
|
.forEach((mapping) => {
|
|
16
16
|
var _a;
|
|
17
17
|
const rawCommandName = mapping.key.split('_').slice(2).join('_');
|
|
18
|
-
const
|
|
19
|
-
const commandName = `${keybinding ? '+' : ''}` + rawCommandName.toLowerCase() + (((_a = mapping.value) === null || _a === void 0 ? void 0 : _a.suffix) || '');
|
|
18
|
+
const commandName = rawCommandName.toLowerCase() + (((_a = mapping.value) === null || _a === void 0 ? void 0 : _a.suffix) || '');
|
|
20
19
|
if (!Cfx.Client.IsDuplicityVersion()) {
|
|
21
20
|
Cfx.Client.RegisterCommand(commandName, (_source, args, _raw) => {
|
|
22
21
|
mapping.target[rawCommandName].apply(mapping.target, args);
|
|
@@ -14,16 +14,23 @@ function KeyBinding(data) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
function KeyBindings(target, _prototype, providers) {
|
|
17
|
-
|
|
17
|
+
if (Cfx.Client.IsDuplicityVersion()) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const mappings = decorator_utils_1.DecoratorUtils.map(target, _prototype, providers !== null && providers !== void 0 ? providers : []);
|
|
21
|
+
mappings
|
|
18
22
|
.filter((mapping) => mapping.key.startsWith('arm_keybinding_'))
|
|
19
23
|
.forEach((mapping) => {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
24
|
+
var _a, _b, _c, _d, _e;
|
|
21
25
|
const keybindingName = mapping.key.split('_').slice(2).join('_');
|
|
22
|
-
const
|
|
26
|
+
const commandMapping = mappings.find((entry) => entry.target === mapping.target && entry.key === `arm_command_${keybindingName}`);
|
|
27
|
+
const command = ((_a = mapping.value) === null || _a === void 0 ? void 0 : _a.command)
|
|
28
|
+
? mapping.value.command.toLowerCase()
|
|
29
|
+
: keybindingName.toLowerCase() + (((_b = commandMapping === null || commandMapping === void 0 ? void 0 : commandMapping.value) === null || _b === void 0 ? void 0 : _b.suffix) || '');
|
|
23
30
|
if (!command) {
|
|
24
31
|
console.error(`Could not find any relevant command for key binding ${keybindingName}`);
|
|
25
32
|
return;
|
|
26
33
|
}
|
|
27
|
-
Cfx.Client.RegisterKeyMapping(
|
|
34
|
+
Cfx.Client.RegisterKeyMapping(command, (_c = mapping.value) === null || _c === void 0 ? void 0 : _c.description, (_d = mapping.value) === null || _d === void 0 ? void 0 : _d.defaultMapper, (_e = mapping.value) === null || _e === void 0 ? void 0 : _e.key);
|
|
28
35
|
});
|
|
29
36
|
}
|
|
@@ -11,8 +11,7 @@ export function Commands(target, _prototype, providers) {
|
|
|
11
11
|
.forEach((mapping) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const rawCommandName = mapping.key.split('_').slice(2).join('_');
|
|
14
|
-
const
|
|
15
|
-
const commandName = `${keybinding ? '+' : ''}` + rawCommandName.toLowerCase() + (((_a = mapping.value) === null || _a === void 0 ? void 0 : _a.suffix) || '');
|
|
14
|
+
const commandName = rawCommandName.toLowerCase() + (((_a = mapping.value) === null || _a === void 0 ? void 0 : _a.suffix) || '');
|
|
16
15
|
if (!Cfx.Client.IsDuplicityVersion()) {
|
|
17
16
|
Cfx.Client.RegisterCommand(commandName, (_source, args, _raw) => {
|
|
18
17
|
mapping.target[rawCommandName].apply(mapping.target, args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DecoratorUtils } from
|
|
1
|
+
import { DecoratorUtils } from './decorator.utils';
|
|
2
2
|
export function KeyBinding(data) {
|
|
3
3
|
return function (target, propertyKey) {
|
|
4
4
|
Reflect.defineMetadata(`arm_keybinding_${propertyKey}`, {
|
|
@@ -10,16 +10,23 @@ export function KeyBinding(data) {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
export function KeyBindings(target, _prototype, providers) {
|
|
13
|
-
|
|
13
|
+
if (Cfx.Client.IsDuplicityVersion()) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const mappings = DecoratorUtils.map(target, _prototype, providers !== null && providers !== void 0 ? providers : []);
|
|
17
|
+
mappings
|
|
14
18
|
.filter((mapping) => mapping.key.startsWith('arm_keybinding_'))
|
|
15
19
|
.forEach((mapping) => {
|
|
16
|
-
var _a, _b, _c, _d;
|
|
20
|
+
var _a, _b, _c, _d, _e;
|
|
17
21
|
const keybindingName = mapping.key.split('_').slice(2).join('_');
|
|
18
|
-
const
|
|
22
|
+
const commandMapping = mappings.find((entry) => entry.target === mapping.target && entry.key === `arm_command_${keybindingName}`);
|
|
23
|
+
const command = ((_a = mapping.value) === null || _a === void 0 ? void 0 : _a.command)
|
|
24
|
+
? mapping.value.command.toLowerCase()
|
|
25
|
+
: keybindingName.toLowerCase() + (((_b = commandMapping === null || commandMapping === void 0 ? void 0 : commandMapping.value) === null || _b === void 0 ? void 0 : _b.suffix) || '');
|
|
19
26
|
if (!command) {
|
|
20
27
|
console.error(`Could not find any relevant command for key binding ${keybindingName}`);
|
|
21
28
|
return;
|
|
22
29
|
}
|
|
23
|
-
Cfx.Client.RegisterKeyMapping(
|
|
30
|
+
Cfx.Client.RegisterKeyMapping(command, (_c = mapping.value) === null || _c === void 0 ? void 0 : _c.description, (_d = mapping.value) === null || _d === void 0 ? void 0 : _d.defaultMapper, (_e = mapping.value) === null || _e === void 0 ? void 0 : _e.key);
|
|
24
31
|
});
|
|
25
32
|
}
|