feat: unify life-sim play controls
This commit is contained in:
@@ -18,6 +18,12 @@ const VIEWPORTS = {
|
||||
};
|
||||
const SCENES = {
|
||||
california: { host: "tera.lumbridgecorp.com", ready: () => document.getElementById("boot")?.hidden === true && document.querySelectorAll("#chapters .chapter").length > 0 },
|
||||
"california-drive": {
|
||||
host: "tera.lumbridgecorp.com",
|
||||
ready: () => document.getElementById("boot")?.hidden === true && document.querySelectorAll("#chapters .chapter").length > 1,
|
||||
activate: () => document.querySelectorAll("#chapters .chapter")[1]?.click(),
|
||||
active: () => document.querySelector("[data-control-mode='drive']")?.getAttribute("aria-pressed") === "true" && document.getElementById("play-hud")?.hidden === false,
|
||||
},
|
||||
office: { host: "office.lumbridgecorp.com", ready: () => document.getElementById("boot")?.hidden === true && document.getElementById("enter")?.textContent?.includes("Back to the city") === true },
|
||||
};
|
||||
|
||||
@@ -211,6 +217,10 @@ async function measure(browser, port, sceneName, viewportName, budget, requestLo
|
||||
})).catch(() => null);
|
||||
throw new Error(`scene readiness timed out: ${JSON.stringify({ state, consoleErrors, requests: requestLog.slice(before) })}`, { cause: error });
|
||||
}
|
||||
if (scene.activate) {
|
||||
await page.evaluate(scene.activate);
|
||||
await page.waitForFunction(scene.active, null, { timeout: readyTimeoutMs });
|
||||
}
|
||||
await page.waitForTimeout(warmupMs);
|
||||
await page.evaluate(() => {
|
||||
const state = globalThis.__teraPerformanceBudget;
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
"desktop": { "p95FrameIntervalMs": 16.7, "maxDrawCalls": 650, "maxTriangles": 750000 },
|
||||
"mobile": { "p95FrameIntervalMs": 33.3, "maxDrawCalls": 650, "maxTriangles": 750000 }
|
||||
},
|
||||
"california-drive": {
|
||||
"desktop": { "p95FrameIntervalMs": 16.7, "maxDrawCalls": 650, "maxTriangles": 750000 },
|
||||
"mobile": { "p95FrameIntervalMs": 33.3, "maxDrawCalls": 650, "maxTriangles": 750000 }
|
||||
},
|
||||
"office": {
|
||||
"desktop": { "p95FrameIntervalMs": 16.7, "maxDrawCalls": 550, "maxTriangles": 550000 },
|
||||
"mobile": { "p95FrameIntervalMs": 33.3, "maxDrawCalls": 550, "maxTriangles": 550000 }
|
||||
|
||||
Reference in New Issue
Block a user