Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 25 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /* eslint-env node */ |
||
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 | // Generate element unlocks |
||
12 | unlocks[element] = { |
||
13 | 'condition': ['(() => {', |
||
14 | 'for(let resource of data.elements.'+element+'.includes){', |
||
15 | ' if(player.resources[resource] !== null){', |
||
16 | ' return true;', |
||
17 | ' }', |
||
18 | '}', |
||
19 | 'return false;', |
||
20 | '})()' |
||
21 | ] |
||
22 | }; |
||
23 | } |
||
24 | |||
25 | jsonfile.writeFileSync('build/data/unlocks.json', unlocks, { |
||
26 | spaces: 2 |
||
27 | }); |
||
28 |