-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathunlockChat.js
More file actions
39 lines (36 loc) · 920 Bytes
/
unlockChat.js
File metadata and controls
39 lines (36 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import eventManager from 'src/utils/eventManager.js';
import VarStore from 'src/utils/VarStore.js';
import { global } from 'src/utils/global.js';
const unpause = VarStore(false);
eventManager.on('Chat:focused', () => {
const game = global('game', {
throws: false,
});
if (game && game.input) {
if (!game.paused) {
game.paused = unpause.set(true);
}
const keyboard = game.input.keyboard;
if (keyboard.disableGlobalCapture) {
keyboard.disableGlobalCapture();
} else {
keyboard.enabled = false;
}
}
});
eventManager.on('Chat:unfocused', () => {
const game = global('game', {
throws: false,
});
if (game && game.input) {
if (unpause.get()) {
game.paused = false;
}
const keyboard = game.input.keyboard;
if (keyboard.enableGlobalCapture) {
keyboard.enableGlobalCapture();
} else {
keyboard.enabled = true;
}
}
});