- Position is now { x, y, z }; higher z draws on top, ties keep hierarchy order
- Viewport sorts the objects layer deterministically (syncDrawOrder)
- Inspector shows a Z field; asset properties that differ from the schema
default are marked bold with a reset button (ResetAssetPropertyCommand)
- isModified() helper, unit tests, E2E checks and seed updated
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
49 lines
1.7 KiB
JavaScript
49 lines
1.7 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Resets the demo project to the state tools/e2e.mjs expects (the e2e run mutates it).
|
|
* Usage: PATH=/opt/node22/bin:$PATH node tools/seed-demo.mjs <projectId> [baseUrl]
|
|
*/
|
|
const projectId = process.argv[2];
|
|
const baseUrl = process.argv[3] ?? 'https://nockal.com/game-maker/';
|
|
if (!projectId) {
|
|
console.error('usage: node tools/seed-demo.mjs <projectId> [baseUrl]');
|
|
process.exit(2);
|
|
}
|
|
|
|
const project = {
|
|
formatVersion: 1,
|
|
id: projectId,
|
|
name: 'Demo project',
|
|
activeSceneId: 'scene1',
|
|
assets: [
|
|
{
|
|
id: 'scene1',
|
|
type: 'scene',
|
|
name: 'Level 1',
|
|
props: { backgroundColor: 0x22252c },
|
|
objects: [
|
|
{ id: 'o1', assetId: 'crate', name: '', position: { x: -150, y: 0, z: 0 }, overrides: {} },
|
|
{ id: 'o2', assetId: 'crate', name: 'Blue crate', position: { x: 120, y: -80, z: 0 }, overrides: { width: 140, color: 0x4488ff } },
|
|
{ id: 'o3', assetId: 'cam', name: '', position: { x: 0, y: 0, z: 0 }, overrides: {} },
|
|
],
|
|
},
|
|
{ id: 'crate', type: 'sprite', name: 'Crate', props: { width: 100, height: 60, color: 0xe0553f } },
|
|
{ id: 'cam', type: 'camera', name: 'Main camera', props: { width: 640, height: 360, zoom: 1 } },
|
|
],
|
|
};
|
|
|
|
const url = `${baseUrl}api/index.php?r=projects/${projectId}`;
|
|
const current = await fetch(url);
|
|
if (!current.ok) {
|
|
console.error(`GET failed: ${current.status}`);
|
|
process.exit(1);
|
|
}
|
|
const { revision } = await current.json();
|
|
const res = await fetch(url, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ revision, project }) });
|
|
const body = await res.json();
|
|
if (!res.ok) {
|
|
console.error('PUT failed', res.status, body);
|
|
process.exit(1);
|
|
}
|
|
console.log(`seeded ${projectId} → revision ${body.revision}`);
|