cortico-world-extra-actions 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/webui.js +6 -4
- package/package.json +1 -1
- package/src/world.js +7 -0
- package/tools/verify_installed.mjs +8 -3
package/dist/webui.js
CHANGED
|
@@ -495,7 +495,7 @@ const panel = {
|
|
|
495
495
|
if (!state.library.ok) {
|
|
496
496
|
noteEl.hidden = false;
|
|
497
497
|
noteEl.className = 'ea-note bad';
|
|
498
|
-
const smallLib = state.library.ok && state.library.count < 20
|
|
498
|
+
const smallLib = state.library.ok && (state.library.present ?? state.library.count) < 20
|
|
499
499
|
? `<b>当前动作库只有 ${state.library.count} 段</b>(插件自带的示例)。想要全部 105 段:去 <a href="https://github.com/MOYU-AI-Lab/cortico-world-extra-actions/releases" target="_blank" rel="noreferrer">Releases 页</a> 下载 <code>shenshen-action-library.zip</code>,解压后点「选择动作库位置…」指到里面的 <code>深深-动作库</code>(选它的上一级也行,会自动定位)。<br>`
|
|
500
500
|
: '';
|
|
501
501
|
noteEl.innerHTML = smallLib + `动作库目录没找到:<code>${esc(state.library.dir || '未设置')}</code> —— 点「自动寻找动作库…」让它自己找,或用「选择动作库…」指到那个文件夹。`;
|
|
@@ -547,9 +547,11 @@ const panel = {
|
|
|
547
547
|
const p = state.figures?.find((f) => f.id === packId);
|
|
548
548
|
installed = new Set(p?.extra?.ids ?? []);
|
|
549
549
|
selected = new Set([...installed].filter((id) => catalog.actions.some((a) => a.id === id && a.word && a.present !== false)).slice(0, MAX_SELECTED));
|
|
550
|
+
const haveSeg = state.library.present ?? state.library.count;
|
|
550
551
|
libEl.textContent = state.library.ok
|
|
551
|
-
? `${
|
|
552
|
-
|
|
552
|
+
? `${haveSeg} / ${state.library.count} 段可用 ${state.library.dir}`
|
|
553
|
+
+ (state.library.imported ? `(自定义 ${state.library.imported})` : '')
|
|
554
|
+
: '动作库未设置(可放在任意盘)';
|
|
553
555
|
renderPack(); renderChips(); renderList(); renderInstalled(); renderSum(); renderNote();
|
|
554
556
|
}
|
|
555
557
|
|
|
@@ -597,7 +599,7 @@ const panel = {
|
|
|
597
599
|
const p = state.figures?.find((f) => f.id === packId);
|
|
598
600
|
selected = new Set(r.copied.concat(r.skipped).filter((id) => catalog.actions.some((a) => a.id === id && a.present !== false)));
|
|
599
601
|
say(`已写入 ${r.count} 段,${mb(r.bytes)};词表 +${r.vocab.added.length} −${r.vocab.removed.length};去装扮页重新点一下这个形象才会生效`);
|
|
600
|
-
libEl.textContent = state.library.ok ? `${state.library.count} 段可用` : '
|
|
602
|
+
libEl.textContent = state.library.ok ? `${state.library.present ?? state.library.count} / ${state.library.count} 段可用` : '动作库未设置(可放在任意盘)';
|
|
601
603
|
renderPack(); packSel.value = packId; renderList(); renderInstalled(); renderSum(); renderNote();
|
|
602
604
|
if (p) p.extra = { ids: [...selected], count: r.count, bytes: r.bytes, updatedAt: r.updatedAt };
|
|
603
605
|
} else if (act === 'prune') {
|
package/package.json
CHANGED
package/src/world.js
CHANGED
|
@@ -66,8 +66,12 @@ export class ExtraActionsWorld {
|
|
|
66
66
|
pkgDir: join(HERE, '..'),
|
|
67
67
|
figuresDir: () => this.figuresDir(),
|
|
68
68
|
dataDir: this.dataDir,
|
|
69
|
+
botDir: this.botDir,
|
|
69
70
|
libraryDir: () => this.libraryDir(),
|
|
70
71
|
saveSettings: (patch) => this.saveSettings(patch),
|
|
72
|
+
// 没有形象包就完全没法用:至少铺一个空壳(4 段身体状态、词表空)。
|
|
73
|
+
// 动作库仍然不碰 —— 放哪个盘由用户在面板里选。
|
|
74
|
+
seedPack: true,
|
|
71
75
|
log: (msg, extra) => host?.log?.info?.(msg, extra),
|
|
72
76
|
});
|
|
73
77
|
if (seeded.pack || seeded.library) this.bustCatalog();
|
|
@@ -387,7 +391,10 @@ export class ExtraActionsWorld {
|
|
|
387
391
|
library: {
|
|
388
392
|
dir: libraryDir,
|
|
389
393
|
ok: libOk,
|
|
394
|
+
// count 是"目录里一共 105 条",present 是"这一段库里真的有帧"
|
|
390
395
|
count: merged.count,
|
|
396
|
+
present: merged.present,
|
|
397
|
+
missing: merged.missing,
|
|
391
398
|
words: merged.words,
|
|
392
399
|
imported: merged.actions.filter((a) => !this.bundleIds().has(a.id)).length,
|
|
393
400
|
categories: [...new Set(merged.actions.map((a) => a.category))]
|
|
@@ -58,11 +58,13 @@ console.log('extra :', ex.join(', '));
|
|
|
58
58
|
check(voc.length === ex.length && ex.every((w) => voc.includes(w)), 'figure.json vocab == the ticked set');
|
|
59
59
|
check(extraIdx.length === 0 || ex.length === 3, '额外动作段数: ' + ex.length + (ex.length ? '' : '(空包)'));
|
|
60
60
|
|
|
61
|
-
/* every ticked module has its frames */
|
|
61
|
+
/* every ticked module has its frames (or a single-file anim.webp) */
|
|
62
62
|
let bad = [];
|
|
63
63
|
for (const e of extraIdx) {
|
|
64
64
|
const d = join(pack, ...e.clip.split('/'));
|
|
65
|
-
const
|
|
65
|
+
const names = readdirSync(d);
|
|
66
|
+
if (names.includes('anim.webp')) continue; // 单文件动画模块:整段一个文件
|
|
67
|
+
const n = names.filter((f) => /^f_\d{4}\.webp$/.test(f)).length;
|
|
66
68
|
if (n !== e.frames) bad.push(`${e.word}: ${n}/${e.frames}`);
|
|
67
69
|
}
|
|
68
70
|
check(bad.length === 0, 'frames present' + (bad.length ? ': ' + bad.join('; ') : ''));
|
|
@@ -71,7 +73,10 @@ check(bad.length === 0, 'frames present' + (bad.length ? ': ' + bad.join('; ') :
|
|
|
71
73
|
const roleClips = index.filter((e) => Array.isArray(e.roles) && e.roles.length);
|
|
72
74
|
const missingRoles = roleClips.filter((e) => {
|
|
73
75
|
const d = join(pack, ...e.clip.split('/'));
|
|
74
|
-
|
|
76
|
+
if (!existsSync(d)) return true;
|
|
77
|
+
const names = readdirSync(d);
|
|
78
|
+
if (names.includes('anim.webp')) return false;
|
|
79
|
+
return names.filter((f) => /^f_\d{4}\.webp$/.test(f)).length !== e.frames;
|
|
75
80
|
});
|
|
76
81
|
check(missingRoles.length === 0, 'state clips the player needs are intact: ' + roleClips.map((e) => e.id).join(','));
|
|
77
82
|
|