16 lines
1.1 KiB
JavaScript
16 lines
1.1 KiB
JavaScript
// Собирает Luau-файл для Studio: модели скамеек и фонтана (bbmodel-to-luau.js) + tools/lobby-fix3.lua.
|
|
// node tools/lobby-fix3.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', 'lobby-fix3-full.lua');
|
|
const models = { bench: 'lobby_bench', bench_flowers: 'lobby_bench_flowers', fountain: 'lobby_fountain' };
|
|
let code = '-- СГЕНЕРИРОВАНО tools/lobby-fix3.js\nlocal BUILD = {}\n';
|
|
for (const [key, file] of Object.entries(models)) {
|
|
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: 'inherit' });
|
|
code += `BUILD.${key} = (function()\n${fs.readFileSync(lua, 'utf8')}\nend)()\n`;
|
|
}
|
|
fs.writeFileSync(out, code + fs.readFileSync(path.join(__dirname, 'lobby-fix3.lua'), 'utf8'), 'utf8');
|
|
console.log('->', out);
|