17 lines
1.2 KiB
JavaScript
17 lines
1.2 KiB
JavaScript
// Собирает Luau-файл для Studio: сад Гильдии и пасхалки (bbmodel-to-luau.js) + tools/build-guild-garden2.lua.
|
|
// node tools/build-guild-garden2.js <out.lua>
|
|
const fs = require('fs'), path = require('path'), { execFileSync } = require('child_process');
|
|
const ROOT = path.join(__dirname, '..');
|
|
const out = process.argv[2] || path.join(ROOT, 'tools', 'guild-garden2-full.lua');
|
|
let code = '-- СГЕНЕРИРОВАНО tools/build-guild-garden2.js\nlocal BUILD = {}\n';
|
|
for (const [key, file] of [['garden', 'guild_garden_v2'], ['sword', 'egg_sword_stone'], ['door', 'egg_round_door'], ['duck', 'egg_rubber_duck'], ['capy', 'egg_capybara']]) {
|
|
const lua = path.join(ROOT, 'tools', 'lobby-models', file + '.lua');
|
|
execFileSync('node', [path.join(__dirname, 'bbmodel-to-luau.js'), path.join(ROOT, 'assets', 'props', file + '.bbmodel'),
|
|
path.join(ROOT, 'assets', 'props', file + '_palette.png'), lua, file], { stdio: 'ignore' });
|
|
code += `BUILD.${key} = (function()\n${fs.readFileSync(lua, 'utf8')}\nend)()\n`;
|
|
}
|
|
code += fs.readFileSync(path.join(__dirname, 'build-guild-garden2.lua'), 'utf8');
|
|
fs.writeFileSync(out, code, 'utf8');
|
|
console.log('->', out, (code.length / 1024).toFixed(0) + ' KB');
|
|
|