20 lines
1.4 KiB
JavaScript
20 lines
1.4 KiB
JavaScript
// Собирает один Luau-файл для Studio: модели лавок лобби из .bbmodel (через bbmodel-to-luau.js)
|
|
// + tools/build-lobby-shops.lua. Результат выполняют в Studio в режиме редактирования (Command Bar / Studio MCP).
|
|
// node tools/build-lobby-shops.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-shops-full.lua');
|
|
const models = { fish_buyer: 'lobby_fish_buyer', premium: 'lobby_premium', bait: 'lobby_bait', leaderboard: 'lobby_leaderboard' };
|
|
const dir = path.join(ROOT, 'tools', 'lobby-models');
|
|
fs.mkdirSync(dir, { recursive: true });
|
|
let code = '-- СГЕНЕРИРОВАНО tools/build-lobby-shops.js\nlocal BUILD = {}\n';
|
|
for (const [key, file] of Object.entries(models)) {
|
|
const lua = path.join(dir, 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`;
|
|
}
|
|
code += fs.readFileSync(path.join(__dirname, 'build-lobby-shops.lua'), 'utf8');
|
|
fs.writeFileSync(out, code, 'utf8');
|
|
console.log('->', out, Math.round(code.length / 1024) + ' KB');
|