aboutsummaryrefslogtreecommitdiff
path: root/views/script/game_global.js
blob: 4e6de21391d00d2d10ba82301753476e7c14d8d2 (plain)
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
40
41
42
43
44
45
$("#box").fadeOut(0);
$("#bg").fadeOut(0);
setTimeout(() => {
    $("#box").fadeIn(500);
    $("#bg").fadeIn(500);
}, 200)

global.startgame = () => {
    keysEnabled = true;
    $("#credits").fadeOut(200)
    Sound.intro();

    setTimeout(() => {
        started = true;
    }, 1700)

    setTimeout(() => {
        if (location.search === "?sp") {
            enableAI();
        }
    }, 1200)
}

startHooks.push(() => {
    global.hitshow = false;
    global.started = false;
    keysEnabled = false;

    $("body").focus();

    if (!online) {
        setTimeout(startgame, 7000)
    }

    if (online && role === "host") {
        setTimeout(() => {
            clientWriter(JSON.stringify({
                _type: "ipc",
                action: "gameIsReady",
                message: null
            }) + "|")
            startgame();
        }, 7000)
    }
})