|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
/**
|
|
|
|
|
* One-shot: fill every manifest enemy.<slug>.south missing pixellabObjectId (PixelLab API v2).
|
|
|
|
|
* One-shot: fill every south-facing manifest enemy entry missing pixellabObjectId (PixelLab API v2).
|
|
|
|
|
* Keys: legacy `enemy.<slug>.south` or `enemy.<slug>` with rotation/file `*.south.png`.
|
|
|
|
|
* Requires PIXELLAB_API_TOKEN.
|
|
|
|
|
*
|
|
|
|
|
* node scripts/pixellab-fill-missing-south-one-shot.mjs
|
|
|
|
|
@ -158,9 +159,16 @@ async function runPool(concurrency, items, fn) {
|
|
|
|
|
await Promise.all(workers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** `enemy.<type_slug>` or legacy `enemy.<type_slug>.south` → DB `enemies.type` slug */
|
|
|
|
|
function textureKeyToEnemyTypeSlug(texKey) {
|
|
|
|
|
let rest = texKey.startsWith('enemy.') ? texKey.slice('enemy.'.length) : texKey;
|
|
|
|
|
if (rest.endsWith('.south')) rest = rest.slice(0, -'.south'.length);
|
|
|
|
|
return rest;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @returns {{ slug: string, body: object } | { error: string }} */
|
|
|
|
|
function prepareCreateBody(texKey, textures, byType) {
|
|
|
|
|
const slug = texKey.slice('enemy.'.length, -'.south'.length);
|
|
|
|
|
const slug = textureKeyToEnemyTypeSlug(texKey);
|
|
|
|
|
const row = byType.get(slug);
|
|
|
|
|
if (!row) return { error: `No SQL row ${slug}` };
|
|
|
|
|
const refKey = ARCHETYPE_REF[row.archetype];
|
|
|
|
|
@ -243,7 +251,14 @@ async function main() {
|
|
|
|
|
const { textures } = manifest;
|
|
|
|
|
|
|
|
|
|
const missing = Object.keys(textures)
|
|
|
|
|
.filter((k) => k.startsWith('enemy.') && k.endsWith('.south') && !textures[k].pixellabObjectId)
|
|
|
|
|
.filter((k) => {
|
|
|
|
|
if (!k.startsWith('enemy.') || textures[k].pixellabObjectId) return false;
|
|
|
|
|
if (k.endsWith('.south')) return true;
|
|
|
|
|
const e = textures[k];
|
|
|
|
|
if (e.rotation === 'south') return true;
|
|
|
|
|
const f = e.file || '';
|
|
|
|
|
return f.endsWith('.south.png');
|
|
|
|
|
})
|
|
|
|
|
.sort();
|
|
|
|
|
|
|
|
|
|
if (missing.length === 0) {
|
|
|
|
|
|