-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgame.js
More file actions
34 lines (30 loc) · 1003 Bytes
/
game.js
File metadata and controls
34 lines (30 loc) · 1003 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
import eventManager from 'src/utils/eventManager.js';
import onPage from 'src/utils/onPage.js';
import { debug } from 'src/utils/debug.js';
import wrap from 'src/utils/2.pokemon.js';
import { globalSet } from 'src/utils/global.js';
import { window } from 'src/utils/1.variables.js';
function gameHook() {
debug('Playing Game');
eventManager.singleton.emit('GameStart');
eventManager.singleton.emit('PlayingGame');
eventManager.on(':preload', () => {
function callGameHooks(data, original) {
const run = !eventManager.cancelable.emit('PreGameEvent', data).canceled;
if (run) {
wrap(() => original(data));
}
eventManager.emit('GameEvent', data);
}
function hookEvent(event) {
callGameHooks(event, this.super);
}
if (undefined !== window.bypassQueueEvents) {
globalSet('runEvent', hookEvent);
globalSet('bypassQueueEvent', hookEvent);
} else {
debug('Update your code yo');
}
});
}
onPage('Game', gameHook);