jackz revised this gist . Go to revision
No changes
Jackz revised this gist . Go to revision
1 file changed, 20 insertions
convert_animations_to_lua.js(file created)
@@ -0,0 +1,20 @@ | |||
1 | + | const fs = require('fs') | |
2 | + | ||
3 | + | let version = "2.0" | |
4 | + | ||
5 | + | fs.readFile('./animations.txt', 'utf-8', (err, data) => { | |
6 | + | if(err) { | |
7 | + | console.error(err) | |
8 | + | process.exit(1) | |
9 | + | } | |
10 | + | const animations = [] | |
11 | + | const lines = data.trim().split("\n") | |
12 | + | lines.forEach(line => { | |
13 | + | const [group, anim] = line.split(" ") | |
14 | + | animations.push({group, anim}) | |
15 | + | }) | |
16 | + | const animLine = animations.map(a => `\t{ "${a.group}", "${a.anim}" },`).join("\n") | |
17 | + | fs.writeFile('./animations.lua', `ANIMATIONS_INDEX_VERSION = "${version}"\nANIMATIONS = {\n${animLine}\n}`, (err) => { | |
18 | + | if(err) console.error('write err', err) | |
19 | + | }) | |
20 | + | }) |
Newer
Older