aboutsummaryrefslogtreecommitdiff
path: root/modding/resources.js
blob: 73019019df1af4569b562f993841e6ef1fb2bad0 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const fs = require('fs');

global.resources = {
    music: {},
    sfx: {},
    races: {},
    cars: {},
    scenario: {
        voice: {},
        averi: {}
    }
};

music_list = fs.readdirSync("./music");
for (index in music_list) {
    music = music_list[index];
    name = music.split(".")[0];
    resources.music[name] = {
        file: KartikRoot + "/music/" + music,
        original: true
    };
}

sfx_list = fs.readdirSync("./sfx");
for (index in sfx_list) {
    sfx = sfx_list[index];
    name = sfx.split(".")[0];
    if (sfx.split(".")[1] === "mp3") {
        resources.sfx[name] = KartikRoot + "/sfx/" + sfx;
    }
}

races_list = fs.readdirSync("./race/circuits");
for (index in races_list) {
    races = races_list[index];
    name = races.split(".")[0];
    if (races.split(".")[1] === "html") {
        resources.races[name] = "./race/circuits/" + races;
    }
}

cars_list = fs.readdirSync("./race/models");
for (index in cars_list) {
    cars = cars_list[index];
    name = cars.split(".")[0];
    resources.cars[name] = KartikRoot + "/race/models/" + cars;
}

scvoice_list = fs.readdirSync("./scenario/voice");
for (index in scvoice_list) {
    scvoice = scvoice_list[index];
    name = scvoice.split(".")[0];
    resources.scenario.voice[name] = KartikRoot + "/scenario/voice/" + scvoice;
}

scchar_list = fs.readdirSync("./scenario/character");
for (index in scchar_list) {
    scchar = scchar_list[index];
    name = scchar.split(".")[0];
    resources.scenario.averi[name] = KartikRoot + "/scenario/character/" + scchar;
}

if (typeof building !== "undefined" && building) {
    global.targetResources = JSON.stringify(resources);
}