3D-рыбы, диковинки, экономика v3
This commit is contained in:
1 parent
087e9b0d9b
commit
3ad192d26e
161 files changed
+567804
-1184
No files matched your search
@@ -0,0 +1,24 @@
|
||||
// Собирает tools/fish-models-full.lua: модели рыб из assets/fish/<папка>/*.bbmodel → ReplicatedStorage.FishModels.
|
||||
// node tools/build-fish-models.js (все папки assets/fish/*)
|
||||
// Запуск результата в Studio (Edit). Повторный запуск заменяет шаблоны с теми же id, остальные не трогает.
|
||||
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', 'fish-models-full.lua');
|
||||
const tmp = path.join(require('os').tmpdir(), 'fishmodels');
|
||||
fs.mkdirSync(tmp, { recursive: true });
|
||||
let code = '-- СГЕНЕРИРОВАНО tools/build-fish-models.js\nlocal BUILD = {}\n';
|
||||
const fishDir = path.join(ROOT, 'assets', 'fish');
|
||||
let n = 0;
|
||||
for (const sub of fs.readdirSync(fishDir)) {
|
||||
const dir = path.join(fishDir, sub);
|
||||
if (!fs.statSync(dir).isDirectory()) continue;
|
||||
for (const f of fs.readdirSync(dir).filter(x => x.endsWith('.bbmodel'))) {
|
||||
const id = f.slice(0, -8), lua = path.join(tmp, id + '.lua');
|
||||
execFileSync('node', [path.join(__dirname, 'bbmodel-to-luau.js'), path.join(dir, f), path.join(dir, id + '_palette.png'), lua, id], { stdio: 'ignore' });
|
||||
code += `BUILD[${JSON.stringify(id)}] = (function()\n${fs.readFileSync(lua, 'utf8')}\nend)()\n`;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
code += fs.readFileSync(path.join(__dirname, 'build-fish-models.lua'), 'utf8');
|
||||
fs.writeFileSync(out, code, 'utf8');
|
||||
console.log('->', out, n, 'моделей', (code.length / 1024).toFixed(0) + ' KB');
|
||||
Reference in new issue
Block a user