Completed
Push — master ( 1b9c43...bfe222 )
by Andres
31s
created

build_scripts/generate_unlocks.js   A

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 21
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
wmc 2
c 1
b 0
f 0
nc 3
mnd 2
bc 2
fnc 0
dl 0
loc 21
rs 10
bpm 0
cpm 0
noi 0
1
/* eslint-env node */
2
/*jslint node: true */
3
'use strict';
4
5
const jsonfile = require('jsonfile');
6
7
let unlocks = jsonfile.readFileSync('build/data/unlocks.json');
8
let elements = jsonfile.readFileSync('build/data/elements.json');
9
10
for(let element in elements){
11
  if(elements[element].disabled){
12
    continue;
13
  }
14
15
  // Generate element unlocks
16
  unlocks[element] = {
17
    condition: 'player.elements.'+element+'.unlocked'
18
  };
19
}
20
21
jsonfile.writeFileSync('build/data/unlocks.json', unlocks, {
22
  spaces: 2
23
});
24