cortico-world-extra-actions 0.3.11 → 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 +24 -4
- package/package.json +1 -1
- package/src/world.js +7 -0
- package/tools/verify_installed.mjs +8 -3
package/dist/webui.js
CHANGED
|
@@ -174,6 +174,14 @@ const CSS = `<style>
|
|
|
174
174
|
.ea-foot .ea-actions{display:flex;gap:8px;flex-wrap:wrap}
|
|
175
175
|
|
|
176
176
|
/* 消息行 */
|
|
177
|
+
.ea-guide{display:flex;gap:8px;flex-wrap:wrap;align-items:flex-start;padding:10px 12px;margin:0 0 12px;
|
|
178
|
+
border:1px solid var(--ea-line);border-radius:12px;background:var(--ea-paper);font-size:12px;line-height:1.5}
|
|
179
|
+
.ea-guide>b{color:var(--ea-ink);font-weight:650;white-space:nowrap;padding-top:1px}
|
|
180
|
+
.ea-guide .s{display:flex;flex-direction:column;gap:1px;min-width:0;max-width:230px}
|
|
181
|
+
.ea-guide .s i{font-style:normal;display:inline-grid;place-items:center;width:15px;height:15px;border-radius:50%;
|
|
182
|
+
background:var(--ea-acc);color:#fff;font-size:10px;font-weight:700;margin-right:4px}
|
|
183
|
+
.ea-guide .s .d{color:var(--ea-dim);font-size:11px;padding-left:19px}
|
|
184
|
+
.ea-guide .a{color:var(--ea-dim);opacity:.6;padding-top:1px}
|
|
177
185
|
.ea-msg{font-size:12.5px;min-height:18px;color:var(--ea-dim);transition:color .15s}
|
|
178
186
|
.ea-msg.bad{color:var(--ea-danger)}
|
|
179
187
|
.ea-msg.ok{color:var(--ea-ok)}
|
|
@@ -229,6 +237,16 @@ const panel = {
|
|
|
229
237
|
<span class="ea-badge" data-role="badge"><span class="dot"></span>准备中</span>
|
|
230
238
|
</div>
|
|
231
239
|
</div>
|
|
240
|
+
<div class="ea-guide">
|
|
241
|
+
<b>四步就能用</b>
|
|
242
|
+
<span class="s"><i>1</i>选动作库<span class="d">没有完整库就点上面「自动寻找动作库…」,或把解压出来的「深深-动作库」选进来</span></span>
|
|
243
|
+
<span class="a">›</span>
|
|
244
|
+
<span class="s"><i>2</i>勾动作<span class="d">勾中的才会写进形象包,没勾的桌宠不会做</span></span>
|
|
245
|
+
<span class="a">›</span>
|
|
246
|
+
<span class="s"><i>3</i>保存到形象包<span class="d">右下角那个绿色按钮</span></span>
|
|
247
|
+
<span class="a">›</span>
|
|
248
|
+
<span class="s"><i>4</i>装扮页重新点一下形象<span class="d">插件不碰桌宠,这一步才会真正生效</span></span>
|
|
249
|
+
</div>
|
|
232
250
|
<div class="ea-bar">
|
|
233
251
|
<select class="ea-sel" data-role="pack"></select>
|
|
234
252
|
<input class="ea-inp" data-role="q" placeholder="搜名字 / id…">
|
|
@@ -477,7 +495,7 @@ const panel = {
|
|
|
477
495
|
if (!state.library.ok) {
|
|
478
496
|
noteEl.hidden = false;
|
|
479
497
|
noteEl.className = 'ea-note bad';
|
|
480
|
-
const smallLib = state.library.ok && state.library.count < 20
|
|
498
|
+
const smallLib = state.library.ok && (state.library.present ?? state.library.count) < 20
|
|
481
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>`
|
|
482
500
|
: '';
|
|
483
501
|
noteEl.innerHTML = smallLib + `动作库目录没找到:<code>${esc(state.library.dir || '未设置')}</code> —— 点「自动寻找动作库…」让它自己找,或用「选择动作库…」指到那个文件夹。`;
|
|
@@ -529,9 +547,11 @@ const panel = {
|
|
|
529
547
|
const p = state.figures?.find((f) => f.id === packId);
|
|
530
548
|
installed = new Set(p?.extra?.ids ?? []);
|
|
531
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;
|
|
532
551
|
libEl.textContent = state.library.ok
|
|
533
|
-
? `${
|
|
534
|
-
|
|
552
|
+
? `${haveSeg} / ${state.library.count} 段可用 ${state.library.dir}`
|
|
553
|
+
+ (state.library.imported ? `(自定义 ${state.library.imported})` : '')
|
|
554
|
+
: '动作库未设置(可放在任意盘)';
|
|
535
555
|
renderPack(); renderChips(); renderList(); renderInstalled(); renderSum(); renderNote();
|
|
536
556
|
}
|
|
537
557
|
|
|
@@ -579,7 +599,7 @@ const panel = {
|
|
|
579
599
|
const p = state.figures?.find((f) => f.id === packId);
|
|
580
600
|
selected = new Set(r.copied.concat(r.skipped).filter((id) => catalog.actions.some((a) => a.id === id && a.present !== false)));
|
|
581
601
|
say(`已写入 ${r.count} 段,${mb(r.bytes)};词表 +${r.vocab.added.length} −${r.vocab.removed.length};去装扮页重新点一下这个形象才会生效`);
|
|
582
|
-
libEl.textContent = state.library.ok ? `${state.library.count} 段可用` : '
|
|
602
|
+
libEl.textContent = state.library.ok ? `${state.library.present ?? state.library.count} / ${state.library.count} 段可用` : '动作库未设置(可放在任意盘)';
|
|
583
603
|
renderPack(); packSel.value = packId; renderList(); renderInstalled(); renderSum(); renderNote();
|
|
584
604
|
if (p) p.extra = { ids: [...selected], count: r.count, bytes: r.bytes, updatedAt: r.updatedAt };
|
|
585
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
|
|