forked from liamcottle/atlas-for-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_items.js
33 lines (24 loc) · 836 Bytes
/
process_items.js
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
/**
* This script is used to combine all of the item meta .json files from
* the Rust game directory "<drive>:\SteamLibrary\steamapps\common\Rust\Bundles\items"
* into a single items.json file to be used in this project.
*/
const fs = require('fs');
var items = [];
// iterate each file in current directory
fs.readdirSync('.').forEach(file => {
// check if file is item meta file
if(file.endsWith('.json')){
// read item meta
var item = JSON.parse(fs.readFileSync(file));
// push item meta we want to keep
items.push({
id: item.itemid,
shortname: item.shortname,
name: item.Name,
description: item.Description,
});
}
});
// write formatted json to items.json
fs.writeFileSync('items.json', JSON.stringify(items, null, 4));