// Снимки HUD на ПК и в эмуляторе телефонов: node tools/mcp/hud-shots.js // Для каждого устройства: Play у точки появления → HUD → окно «Сумка» → окно «Гильдия» → стоп. // Сохраняет _<устройство>_{hud,bag,guild}.jpg const fs = require('fs'), path = require('path'), os = require('os'), { execFileSync } = require('child_process'); const prefix = process.argv[2]; const DEVICES = [['pc', null], ['iphone_se', 'iphone_7'], ['android', 'generic_handheld_720'], ['iphone_14', 'iphone_14'], ['android_20x9', 'samsung_galaxy_a16'], ['tablet', 'samsung_galaxy_tab_a8']]; const press = key => ({ tool: 'user_keyboard_input', args: { datamodel_type: 'Client', actions: [{ action: 'keyPress', key_code: key }] }, waitAfter: 1500 }); const only = process.argv[3]; // pc | iphone_se | android — снять только это устройство fs.writeFileSync(path.join(os.tmpdir(), 'hud-stop.json'), JSON.stringify([{ tool: 'start_stop_play', args: { is_start: false }, waitAfter: 1500 }])); execFileSync('node', [path.join(__dirname, 'run.js'), path.join(os.tmpdir(), 'hud-stop.json')]); for (const [name, dev] of DEVICES.filter(d => !only || d[0] === only)) { const sim = dev ? `local s = game:GetService("StudioDeviceSimulatorService") s:SetDeviceAsync("${dev}") task.wait(0.3) pcall(function() s:SetOrientationAsync(Enum.ScreenOrientation.LandscapeLeft) end) task.wait(0.3) return tostring(workspace.CurrentCamera.ViewportSize)` : `local s = game:GetService("StudioDeviceSimulatorService") pcall(function() s:StopSimulationAsync() end) task.wait(0.3) return tostring(workspace.CurrentCamera.ViewportSize)`; const steps = [ { tool: 'execute_luau', args: { datamodel_type: 'Edit', code: sim } }, { tool: 'start_stop_play', args: { is_start: true }, waitAfter: 22000 }, { tool: 'screen_capture', args: { capture_id: 'Hud' } }, press('B'), { tool: 'screen_capture', args: { capture_id: 'Bag' } }, press('G'), { tool: 'screen_capture', args: { capture_id: 'Guild' } }, { tool: 'get_console_output' }, { tool: 'start_stop_play', args: { is_start: false } }, ]; const tmp = path.join(os.tmpdir(), 'hud-shots.json'); fs.writeFileSync(tmp, JSON.stringify(steps)); const res = execFileSync('node', [path.join(__dirname, 'run.js'), tmp], { encoding: 'utf8', maxBuffer: 1 << 26 }); const kinds = ['hud', 'bag', 'guild']; let i = 0; for (const m of res.matchAll(/IMAGE (.+\.jpe?g)/g)) fs.renameSync(m[1].trim(), `${prefix}_${name}_${kinds[i++]}.jpg`); const errs = res.split('\n').filter(l => /error|Error|ERROR/.test(l) && !/TexturePack|not authorized|MaterialVariant|Kiosk/.test(l)); console.log(name, res.match(/=== execute_luau\n(.+)/)?.[1] || '', 'снимков', i, errs.length ? '\n ' + errs.join('\n ') : ''); } // вернуть обычный экран fs.writeFileSync(path.join(os.tmpdir(), 'hud-off.json'), JSON.stringify([{ tool: 'execute_luau', args: { datamodel_type: 'Edit', code: 'pcall(function() game:GetService("StudioDeviceSimulatorService"):StopSimulationAsync() end) return 1' } }])); execFileSync('node', [path.join(__dirname, 'run.js'), path.join(os.tmpdir(), 'hud-off.json')]);