godot-kit 1.0.1774034713 → 1.0.1774066940
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/lib/cli-game.js +2 -2
- package/lib/dashboard.js +8 -7
- package/package.json +1 -1
package/lib/cli-game.js
CHANGED
|
@@ -85,13 +85,13 @@ function registerGameCommands(program) {
|
|
|
85
85
|
|
|
86
86
|
gm.command('call <path> <method> [args...]').description('Call a method on a node')
|
|
87
87
|
.action((path, method, args) => run(async () => {
|
|
88
|
-
let parsedArgs = []; if (args && args.length) { try {
|
|
88
|
+
let parsedArgs = []; if (args && args.length) { try { const p = JSON.parse(args[0]); parsedArgs = Array.isArray(p) ? p : [p]; } catch { parsedArgs = args; } }
|
|
89
89
|
pj(await gamePost('/call', { path, method, args: parsedArgs }));
|
|
90
90
|
}));
|
|
91
91
|
|
|
92
92
|
gm.command('signal <path> <sig> [args...]').description('Emit a signal on a node')
|
|
93
93
|
.action((path, sig, args) => run(async () => {
|
|
94
|
-
let parsedArgs = []; if (args && args.length) { try {
|
|
94
|
+
let parsedArgs = []; if (args && args.length) { try { const p = JSON.parse(args[0]); parsedArgs = Array.isArray(p) ? p : [p]; } catch { parsedArgs = args; } }
|
|
95
95
|
pj(await gamePost('/signal', { path, signal: sig, args: parsedArgs }));
|
|
96
96
|
}));
|
|
97
97
|
|
package/lib/dashboard.js
CHANGED
|
@@ -22,16 +22,16 @@ function dims() {
|
|
|
22
22
|
return { W, H, HALF: Math.floor(W / 2), TREE_H: H - LOG_H - 4 };
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function renderTree(node, lines, depth, max) {
|
|
25
|
+
function renderTree(node, lines, depth, max, half) {
|
|
26
26
|
if (lines.length >= max) return;
|
|
27
27
|
const indent = ' '.repeat(depth);
|
|
28
|
-
lines.push(truncate(`${indent}[${node.class}] ${node.name}`,
|
|
29
|
-
(node.children || []).forEach(c => renderTree(c, lines, depth + 1, max));
|
|
28
|
+
lines.push(truncate(`${indent}[${node.class}] ${node.name}`, half - 4));
|
|
29
|
+
(node.children || []).forEach(c => renderTree(c, lines, depth + 1, max, half));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function renderPerf(perf) {
|
|
32
|
+
function renderPerf(perf, half) {
|
|
33
33
|
const keys = ['fps','process_ms','physics_ms','memory_static','objects','nodes','draw_calls','video_mem'];
|
|
34
|
-
return keys.map(k => truncate(`${k}: ${typeof perf[k] === 'number' ? perf[k].toFixed(1) : (perf[k] || 'N/A')}`,
|
|
34
|
+
return keys.map(k => truncate(`${k}: ${typeof perf[k] === 'number' ? perf[k].toFixed(1) : (perf[k] || 'N/A')}`, half - 4));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async function runDashboard() {
|
|
@@ -45,13 +45,14 @@ async function runDashboard() {
|
|
|
45
45
|
|
|
46
46
|
async function refresh() {
|
|
47
47
|
try {
|
|
48
|
+
const { HALF, TREE_H } = dims();
|
|
48
49
|
const [tree, perf, logs] = await Promise.all([
|
|
49
50
|
gameGet('/tree').catch(() => null),
|
|
50
51
|
gameGet('/perf').catch(() => null),
|
|
51
52
|
gameGet('/logs').catch(() => null),
|
|
52
53
|
]);
|
|
53
|
-
if (tree && tree.tree) { treeLines = []; renderTree(tree.tree, treeLines, 0, TREE_H - 2); }
|
|
54
|
-
if (perf) perfLines = renderPerf(perf);
|
|
54
|
+
if (tree && tree.tree) { treeLines = []; renderTree(tree.tree, treeLines, 0, TREE_H - 2, HALF); }
|
|
55
|
+
if (perf) perfLines = renderPerf(perf, HALF);
|
|
55
56
|
if (logs && logs.logs) {
|
|
56
57
|
logs.logs.forEach(l => { if (!seenLogs.has(l)) { seenLogs.add(l); logLines.push(l); } });
|
|
57
58
|
if (logLines.length > LOG_H - 2) logLines = logLines.slice(-(LOG_H - 2));
|
package/package.json
CHANGED