Lobby 3d
This commit is contained in:
1 parent
fd5e92d0f5
commit
9f898c04dd
415 files changed
+6241617
-633464
No files matched your search
@@ -0,0 +1,42 @@
|
||||
// Снимки окон: node tools/mcp/window-shots.js <prefix> <pc|phone> <окно[:вкладка][@рыб]> ...
|
||||
// Например: node tools/mcp/window-shots.js assets/reference/ui2 phone bag:fish@0 bag:fish@7 bag:dex@7 worlds
|
||||
// Окна открываются атрибутом DevOpen (работает только в Studio), рыба в сумке — атрибутом DevFakeBag.
|
||||
// Сохраняет <prefix>_<окно>[_вкладка][_N]_<устройство>.jpg
|
||||
const fs = require('fs'), path = require('path'), os = require('os'), { execFileSync } = require('child_process');
|
||||
const [prefix, device, ...views] = process.argv.slice(2);
|
||||
const DEV = { pc: null, phone: 'iphone_7', android: 'generic_handheld_720' }[device];
|
||||
const run = steps => {
|
||||
const tmp = path.join(os.tmpdir(), 'win-shots-' + process.pid + '.json');
|
||||
fs.writeFileSync(tmp, JSON.stringify(steps));
|
||||
const res = execFileSync('node', [path.join(__dirname, 'run.js'), tmp], { encoding: 'utf8', maxBuffer: 1 << 26 });
|
||||
fs.unlinkSync(tmp);
|
||||
return res;
|
||||
};
|
||||
run([{ tool: 'start_stop_play', args: { is_start: false }, waitAfter: 1500 }]);
|
||||
const sim = DEV
|
||||
? `local s = game:GetService("StudioDeviceSimulatorService") s:SetDeviceAsync("${DEV}") task.wait(0.3) pcall(function() s:SetOrientationAsync(Enum.ScreenOrientation.LandscapeLeft) end) return 1`
|
||||
: `pcall(function() game:GetService("StudioDeviceSimulatorService"):StopSimulationAsync() end) return 1`;
|
||||
const steps = [
|
||||
{ tool: 'execute_luau', args: { datamodel_type: 'Edit', code: sim } },
|
||||
{ tool: 'start_stop_play', args: { is_start: true }, waitAfter: 20000 },
|
||||
// без ввода игровое окно Studio может не рисовать 3D (мир и превью моделей чёрные) — «будим» его клавишей
|
||||
{ tool: 'user_keyboard_input', args: { datamodel_type: 'Client', actions: [{ action: 'keyPress', key_code: 'RightShift' }] }, waitAfter: 1500 },
|
||||
{ tool: 'execute_luau', args: { datamodel_type: 'Server', code: 'local p = game.Players:GetPlayers()[1] p:SetAttribute("Tutorial", 4) return 1' }, waitAfter: 800 },
|
||||
{ tool: 'user_keyboard_input', args: { datamodel_type: 'Client', actions: [{ action: 'keyPress', key_code: 'RightShift' }] }, waitAfter: 1500 },
|
||||
];
|
||||
const names = [];
|
||||
for (const v of views) {
|
||||
const [win, n] = v.split('@');
|
||||
const fish = n === undefined ? 0 : Number(n);
|
||||
steps.push({ tool: 'execute_luau', args: { datamodel_type: 'Server', code: `local p = game.Players:GetPlayers()[1]
|
||||
p:SetAttribute("DevOpen", "") p:SetAttribute("DevFakeBag", ${fish}) task.wait(0.2) p:SetAttribute("DevOpen", ${JSON.stringify(win)}) return 1` }, waitAfter: 2500 });
|
||||
steps.push({ tool: 'screen_capture', args: { capture_id: 'Win' } });
|
||||
names.push(win.replace(':', '_') + (n !== undefined && fish > 0 ? '_' + fish : ''));
|
||||
}
|
||||
steps.push({ tool: 'get_console_output' }, { tool: 'start_stop_play', args: { is_start: false } });
|
||||
steps.push({ tool: 'execute_luau', args: { datamodel_type: 'Edit', code: 'pcall(function() game:GetService("StudioDeviceSimulatorService"):StopSimulationAsync() end) return 1' } });
|
||||
const res = run(steps);
|
||||
let i = 0;
|
||||
for (const m of res.matchAll(/IMAGE (.+\.jpe?g)/g)) fs.renameSync(m[1].trim(), `${prefix}_${names[i++]}_${device}.jpg`);
|
||||
const errs = res.split('\n').filter(l => /error|Error|ERROR|Stack|attempt to/.test(l) && !/TexturePack|not authorized|MaterialVariant|LowPolyFlat|Kiosk/.test(l));
|
||||
console.log('снимков', i, errs.length ? '\n ' + errs.join('\n ') : 'ошибок нет');
|
||||
Reference in new issue
Block a user