20 lines
1.4 KiB
JavaScript
20 lines
1.4 KiB
JavaScript
// Собирает Luau-файл для Studio: модели декора и рыбок (bbmodel-to-luau.js) + tools/lobby-fix8.lua.
|
|
// node tools/lobby-fix8.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-fix8-full.lua');
|
|
const names = ['chicken', 'chicken_peck', 'cat_sit_ginger', 'cat_sit_gray', 'cat_lie_ginger', 'cat_lie_gray', 'flowerbed', 'flowerpot',
|
|
'well', 'haystack', 'cart', 'nets', 'boat', 'signpost', 'bunting', 'crates_barrels'];
|
|
const models = {};
|
|
for (const n of names) models[n] = 'decor_' + n;
|
|
for (const n of ['fish_gold', 'fish_koi', 'fish_carp', 'fish_roach']) models[n] = n;
|
|
let code = '-- СГЕНЕРИРОВАНО tools/lobby-fix8.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: 'ignore' });
|
|
code += `BUILD.${key} = (function()\n${fs.readFileSync(lua, 'utf8')}\nend)()\n`;
|
|
}
|
|
fs.writeFileSync(out, code + fs.readFileSync(path.join(__dirname, 'lobby-fix8.lua'), 'utf8'), 'utf8');
|
|
console.log('->', out, Math.round(code.length / 1024) + ' KB');
|