@armoury/fivem-framework-common 1.0.48 → 1.0.53
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/dist/cjs/decorators/command.decorator.js +1 -2
- package/dist/cjs/decorators/event-listener.decorator.js +5 -1
- package/dist/cjs/decorators/key-binding.decorator.js +11 -4
- package/dist/esm/decorators/command.decorator.js +1 -2
- package/dist/esm/decorators/event-listener.decorator.js +5 -1
- package/dist/esm/decorators/key-binding.decorator.js +12 -5
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -48,6 +48,8 @@ var EVENT_DIRECTIONS;
|
|
|
48
48
|
})(EVENT_DIRECTIONS || (exports.EVENT_DIRECTIONS = EVENT_DIRECTIONS = {}));
|
|
49
49
|
// TODO: Refactor this, so resources can add to it
|
|
50
50
|
exports.DEFAULT_EVENTS = {
|
|
51
|
+
/** Language */
|
|
52
|
+
onLanguageChangedUnsafe: 'armoury:unsafe:language:change:done',
|
|
51
53
|
/** Blips */
|
|
52
54
|
onBlipCreate: 'armoury:safe:blip:created',
|
|
53
55
|
onBlipCreateUnsafe: 'armoury:unsafe:blip:created',
|
|
@@ -55,9 +57,11 @@ exports.DEFAULT_EVENTS = {
|
|
|
55
57
|
onPlayerSessionCreated: 'armoury:session-created',
|
|
56
58
|
onPlayerSessionUpdated: 'armoury:session-updated',
|
|
57
59
|
onPlayerSessionDestroyed: 'armoury:session-destroyed',
|
|
58
|
-
/** Accounts */
|
|
60
|
+
/** Accounts (TODO: Move into armoury roleplay gamemode) */
|
|
59
61
|
onAccountCreated: 'armoury:account-created',
|
|
60
62
|
onAccountAuthenticated: 'armoury:account-authenticated',
|
|
63
|
+
/** Characters (TODO: Move into armoury roleplay gamemode) */
|
|
64
|
+
onPlayerLoggedIntoCharacter: 'armoury:character-logged-into',
|
|
61
65
|
/** Connection */
|
|
62
66
|
onPlayerConnect: 'playerJoining',
|
|
63
67
|
onPlayerDisconnect: 'playerDropped',
|
|
@@ -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);
|
|
@@ -43,6 +43,8 @@ export var EVENT_DIRECTIONS;
|
|
|
43
43
|
})(EVENT_DIRECTIONS || (EVENT_DIRECTIONS = {}));
|
|
44
44
|
// TODO: Refactor this, so resources can add to it
|
|
45
45
|
export const DEFAULT_EVENTS = {
|
|
46
|
+
/** Language */
|
|
47
|
+
onLanguageChangedUnsafe: 'armoury:unsafe:language:change:done',
|
|
46
48
|
/** Blips */
|
|
47
49
|
onBlipCreate: 'armoury:safe:blip:created',
|
|
48
50
|
onBlipCreateUnsafe: 'armoury:unsafe:blip:created',
|
|
@@ -50,9 +52,11 @@ export const DEFAULT_EVENTS = {
|
|
|
50
52
|
onPlayerSessionCreated: 'armoury:session-created',
|
|
51
53
|
onPlayerSessionUpdated: 'armoury:session-updated',
|
|
52
54
|
onPlayerSessionDestroyed: 'armoury:session-destroyed',
|
|
53
|
-
/** Accounts */
|
|
55
|
+
/** Accounts (TODO: Move into armoury roleplay gamemode) */
|
|
54
56
|
onAccountCreated: 'armoury:account-created',
|
|
55
57
|
onAccountAuthenticated: 'armoury:account-authenticated',
|
|
58
|
+
/** Characters (TODO: Move into armoury roleplay gamemode) */
|
|
59
|
+
onPlayerLoggedIntoCharacter: 'armoury:character-logged-into',
|
|
56
60
|
/** Connection */
|
|
57
61
|
onPlayerConnect: 'playerJoining',
|
|
58
62
|
onPlayerDisconnect: 'playerDropped',
|
|
@@ -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
|
}
|