new UI, unify map/demo/live architecture more, cleanup

This commit is contained in:
Brian Beck 2026-03-12 16:25:04 -07:00
parent d9b5e30831
commit 4741f59582
146 changed files with 5477 additions and 3005 deletions

View file

@ -215,7 +215,9 @@ for (const rel of weaponModels) {
});
if (mpIdx === -1) {
console.log(`${name}: NO Mountpoint node. Nodes: [${nodeNames.join(", ")}]`);
console.log(
`${name}: NO Mountpoint node. Nodes: [${nodeNames.join(", ")}]`,
);
continue;
}

View file

@ -111,10 +111,10 @@ function fmt(v: number[]): string {
async function main() {
const playerBuf = await fs.readFile(
"docs/base/@vl2/shapes.vl2/shapes/light_male.glb"
"docs/base/@vl2/shapes.vl2/shapes/light_male.glb",
);
const weaponBuf = await fs.readFile(
"docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb"
"docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb",
);
const playerDoc = parseGlb(playerBuf);

View file

@ -26,7 +26,9 @@ async function run({
try {
await fs.stat(oggFile);
continue; // .ogg already exists, skip
} catch { /* expected */ }
} catch {
/* expected */
}
}
inputFiles.push(wavFile);
}

View file

@ -72,7 +72,7 @@ function printNodeTree(
doc: GltfDocument,
nodeIndex: number,
depth: number,
visited: Set<number>
visited: Set<number>,
): void {
if (visited.has(nodeIndex)) return;
visited.add(nodeIndex);
@ -101,12 +101,16 @@ function printNodeTree(
// Only show scale if non-identity
const s = node.scale;
if (s && (s[0] !== 1 || s[1] !== 1 || s[2] !== 1)) {
console.log(`${indent} S: ${formatVec3(node.scale as [number, number, number])}`);
console.log(
`${indent} S: ${formatVec3(node.scale as [number, number, number])}`,
);
}
// Show matrix if present
if (node.matrix) {
console.log(`${indent} Matrix: [${node.matrix.map((n) => n.toFixed(4)).join(", ")}]`);
console.log(
`${indent} Matrix: [${node.matrix.map((n) => n.toFixed(4)).join(", ")}]`,
);
}
if (node.children) {
@ -130,18 +134,20 @@ async function inspectGlb(filePath: string): Promise<void> {
const skinCount = doc.skins?.length ?? 0;
const animCount = doc.animations?.length ?? 0;
console.log(`Nodes: ${nodeCount}, Meshes: ${meshCount}, Skins: ${skinCount}, Animations: ${animCount}`);
console.log(
`Nodes: ${nodeCount}, Meshes: ${meshCount}, Skins: ${skinCount}, Animations: ${animCount}`,
);
// Show skins (skeletons)
if (doc.skins && doc.skins.length > 0) {
console.log(`\n--- Skins ---`);
for (let i = 0; i < doc.skins.length; i++) {
const skin = doc.skins[i];
console.log(`Skin ${i}: "${skin.name ?? "(unnamed)"}" - ${skin.joints.length} joints`);
console.log(` Root skeleton node: ${skin.skeleton ?? "unset"}`);
console.log(
` Joint node indices: [${skin.joints.join(", ")}]`
`Skin ${i}: "${skin.name ?? "(unnamed)"}" - ${skin.joints.length} joints`,
);
console.log(` Root skeleton node: ${skin.skeleton ?? "unset"}`);
console.log(` Joint node indices: [${skin.joints.join(", ")}]`);
}
}
@ -150,7 +156,9 @@ async function inspectGlb(filePath: string): Promise<void> {
console.log(`\n--- Animations ---`);
for (let i = 0; i < doc.animations.length; i++) {
const anim = doc.animations[i];
console.log(` [${i}] "${anim.name ?? "(unnamed)"}" (${anim.channels?.length ?? 0} channels)`);
console.log(
` [${i}] "${anim.name ?? "(unnamed)"}" (${anim.channels?.length ?? 0} channels)`,
);
}
}
@ -178,7 +186,18 @@ async function inspectGlb(filePath: string): Promise<void> {
}
// Highlight interesting nodes
const keywords = ["eye", "mount", "hand", "cam", "head", "weapon", "muzzle", "node", "jet", "contrail"];
const keywords = [
"eye",
"mount",
"hand",
"cam",
"head",
"weapon",
"muzzle",
"node",
"jet",
"contrail",
];
const interesting: { index: number; name: string; node: GltfNode }[] = [];
if (doc.nodes) {
for (let i = 0; i < doc.nodes.length; i++) {
@ -191,7 +210,9 @@ async function inspectGlb(filePath: string): Promise<void> {
}
if (interesting.length > 0) {
console.log(`\n--- Interesting Nodes (matching: ${keywords.join(", ")}) ---`);
console.log(
`\n--- Interesting Nodes (matching: ${keywords.join(", ")}) ---`,
);
for (const { index, name, node } of interesting) {
console.log(` [${index}] "${name}"`);
console.log(` Translation: ${formatVec3(node.translation)}`);
@ -199,13 +220,17 @@ async function inspectGlb(filePath: string): Promise<void> {
console.log(` Rotation: ${formatQuat(node.rotation)}`);
}
if (node.scale) {
console.log(` Scale: ${formatVec3(node.scale as [number, number, number])}`);
console.log(
` Scale: ${formatVec3(node.scale as [number, number, number])}`,
);
}
// Find parent
if (doc.nodes) {
for (let j = 0; j < doc.nodes.length; j++) {
if (doc.nodes[j].children?.includes(index)) {
console.log(` Parent: [${j}] "${doc.nodes[j].name || "(unnamed)"}"`);
console.log(
` Parent: [${j}] "${doc.nodes[j].name || "(unnamed)"}"`,
);
break;
}
}
@ -218,7 +243,9 @@ async function inspectGlb(filePath: string): Promise<void> {
if (doc.nodes) {
for (let i = 0; i < doc.nodes.length; i++) {
const node = doc.nodes[i];
console.log(` [${i}] "${node.name || "(unnamed)"}" T:${formatVec3(node.translation)}`);
console.log(
` [${i}] "${node.name || "(unnamed)"}" T:${formatVec3(node.translation)}`,
);
}
}
}

View file

@ -38,7 +38,9 @@ if (!demoPath) {
console.error();
console.error("Options:");
console.error(" --no-headless Show the browser window");
console.error(" --wait, -w <s> Seconds to wait after loading (default: 10)");
console.error(
" --wait, -w <s> Seconds to wait after loading (default: 10)",
);
console.error(" --screenshot, -s Take a screenshot after loading");
console.error();
console.error("Examples:");

View file

@ -185,7 +185,9 @@ async function downloadAccount(
const trimmed = buffer.trim();
if (trimmed === "RECOVERERROR") {
reject(new Error("Auth server returned RECOVERERROR (malformed request)"));
reject(
new Error("Auth server returned RECOVERERROR (malformed request)"),
);
return;
}
if (trimmed === "NOTFOUND") {
@ -202,7 +204,11 @@ async function downloadAccount(
// Line 2: EXP: <encrypted_private_exponent>
const lines = trimmed.split("\n");
if (lines.length < 2) {
reject(new Error(`Unexpected response from auth server: ${trimmed.slice(0, 200)}`));
reject(
new Error(
`Unexpected response from auth server: ${trimmed.slice(0, 200)}`,
),
);
return;
}
@ -300,7 +306,9 @@ async function main() {
const existingLines = await readEnvLines(envFilePath);
const updatedLines = updateEnvLines(
existingLines.length > 0 ? existingLines : ["# Generated by scripts/t2-login.ts"],
existingLines.length > 0
? existingLines
: ["# Generated by scripts/t2-login.ts"],
{
T2_ACCOUNT_NAME: username,
T2_ACCOUNT_PASSWORD: password,

View file

@ -9,8 +9,7 @@
import { queryServerList } from "../relay/masterQuery.js";
const MASTER_SERVER =
process.env.T2_MASTER_SERVER || "master.tribesnext.com";
const MASTER_SERVER = process.env.T2_MASTER_SERVER || "master.tribesnext.com";
async function main() {
console.log(`Master server: ${MASTER_SERVER}`);
@ -27,10 +26,7 @@ async function main() {
console.log(`Found ${servers.length} server(s):\n`);
// Print as a table
const nameWidth = Math.max(
11,
...servers.map((s) => s.name.length),
);
const nameWidth = Math.max(11, ...servers.map((s) => s.name.length));
const header = [
"Server Name".padEnd(nameWidth),
"Map".padEnd(20),