SOURCE / PINNED RELEASE
Made of little things.
Napplet Machines V8
- Release
- b3f614e739f0…
- Author-recorded commit
- 534f19acb4ba…
- License
- LICENSE
- Author’s source reference
- nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-b5572362d4a
Archive hash verified: 0f7feb97e2c3d336…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
import { mkdir } from 'node:fs/promises';
export default async ({ players, check }) => {
const { page, frame } = players[0];
const element = await frame.frameElement();
await mkdir('.napplet-space/promotion', { recursive: true });
const resize = async (w, h) => {
await page.setViewportSize({ width: w, height: h });
await element.evaluate(
(el, { w, h }) =>
Object.assign(el.style, {
position: 'fixed',
left: '0',
top: '0',
width: w + 'px',
height: h + 'px',
minHeight: '0',
border: '0',
zIndex: '9999',
}),
{ w, h },
);
await frame.waitForFunction(
({ w, h }) => innerWidth === w && innerHeight === h,
{ w, h },
);
};
await resize(960, 600);
console.log(
'Recording start button:',
await frame.locator('#raceButton').boundingBox(),
);
await resize(1200, 750);
await frame.getByRole('button', { name: 'Race with AI' }).click();
await frame.waitForFunction(
() => document.querySelector('#scene').dataset.countdown === '0',
);
await frame.locator('#scene').focus();
await page.keyboard.down('w');
await page.waitForTimeout(800);
await page.keyboard.up('w');
await element.screenshot({ path: 'preview.png' });
check(
'cover captures active gameplay',
Number(await frame.locator('#speed').innerText()) > 0,
);
await frame.locator('#exitRace').click();
await frame.getByRole('button', { name: 'Workshop', exact: false }).click();
await frame.locator('#widthInput').fill('5');
await frame.locator('#widthInput').dispatchEvent('input');
const box = await frame.locator('#plan').boundingBox(),
scale = Math.min(box.width, box.height) / 145;
await page.mouse.click(
box.x + box.width / 2 + 25 * scale,
box.y + box.height / 2 - 26 * scale,
);
await frame.locator('#widthInput').fill('16');
await frame.locator('#widthInput').dispatchEvent('input');
await frame.locator('#wallThicknessInput').fill('2');
await frame.locator('#wallThicknessInput').dispatchEvent('input');
await frame.locator('#editorPanel').evaluate((el) => (el.scrollTop = 0));
await page.waitForTimeout(150);
await element.screenshot({ path: '.napplet-space/promotion/editor.png' });
};
