feat: build articulated crow flight v2
This commit is contained in:
+19
-5
@@ -904,7 +904,7 @@ async function mountCity(id: string) {
|
||||
minFlightAltitude: 20,
|
||||
maxFlightAltitude: 1_500,
|
||||
...(access.subject === null
|
||||
? { camera: { distance: 1.55, height: 1.35, targetHeight: 0.18, lookAhead: 0 } }
|
||||
? { camera: { distance: 2.55, height: 1.2, targetHeight: 0.1, lookAhead: 1.3 } }
|
||||
: {}),
|
||||
},
|
||||
...(id === "california"
|
||||
@@ -1763,7 +1763,7 @@ function renderLegend() {
|
||||
: flying
|
||||
? `${cityLabel}, following your electric aircraft. Use W A S D to fly or P to resume assisted flight.`
|
||||
: exploring
|
||||
? `${cityLabel}, following your ${city.actorState()?.kind ?? "actor"}. Use W A S D to move.`
|
||||
? `${cityLabel}, following your ${city.actorState()?.kind ?? "actor"}. Use W A S D to move, Q and E for altitude, and G to glide.`
|
||||
: `Map of ${cityLabel}, seen from above. Drag to orbit, scroll to zoom.`,
|
||||
);
|
||||
}
|
||||
@@ -1774,7 +1774,17 @@ function renderLegend() {
|
||||
officePlan?.setActiveView(office?.current() ?? null);
|
||||
renderOfficeBadge();
|
||||
if (driveControls) driveControls.hidden = !routeDriveIsActive();
|
||||
if (walkControls) walkControls.hidden = !(walking || exploring || flying);
|
||||
if (walkControls) {
|
||||
walkControls.hidden = !(walking || exploring || flying);
|
||||
walkControls.setAttribute(
|
||||
"aria-label",
|
||||
flying
|
||||
? "Aircraft flight controls"
|
||||
: exploring && city.actorState()?.kind === "crow"
|
||||
? "Crow flight controls"
|
||||
: "Walking controls",
|
||||
);
|
||||
}
|
||||
for (const control of walkControls?.querySelectorAll<HTMLButtonElement>("[data-walk-key]") ?? []) {
|
||||
control.textContent = flying
|
||||
? control.dataset.aircraftLabel ?? control.textContent
|
||||
@@ -1786,6 +1796,9 @@ function renderLegend() {
|
||||
for (const control of walkControls?.querySelectorAll<HTMLElement>(".aircraft-only") ?? []) {
|
||||
control.hidden = !flying;
|
||||
}
|
||||
for (const control of walkControls?.querySelectorAll<HTMLElement>(".crow-only") ?? []) {
|
||||
control.hidden = inside || flying || city.actorState()?.kind !== "crow";
|
||||
}
|
||||
if (driveHint) driveHint.hidden = inside || cityId !== "california" || flying;
|
||||
if (walkHint) {
|
||||
walkHint.hidden = !(inside || city.actorState() || city.aircraftState());
|
||||
@@ -1793,7 +1806,7 @@ function renderLegend() {
|
||||
? "WASD fly · P assisted · R reset"
|
||||
: inside
|
||||
? "V walk · WASD move"
|
||||
: "V explore · WASD move";
|
||||
: "V explore · WASD · Q/E altitude · G glide";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3107,6 +3120,7 @@ function publishCityActorActions(): boolean {
|
||||
sprint: heldDriveKeys.has(" "),
|
||||
climb: (heldDriveKeys.has("e") || heldDriveKeys.has(" ") ? 1 : 0) -
|
||||
(heldDriveKeys.has("q") ? 1 : 0),
|
||||
glide: heldDriveKeys.has("g"),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -3275,7 +3289,7 @@ window.addEventListener("keydown", (event) => {
|
||||
const lower = event.key.toLowerCase();
|
||||
if (
|
||||
lower === "w" || lower === "a" || lower === "s" || lower === "d" ||
|
||||
lower === "q" || lower === "e" || event.key === " "
|
||||
lower === "q" || lower === "e" || lower === "g" || event.key === " "
|
||||
) {
|
||||
heldDriveKeys.add(event.key === " " ? " " : lower);
|
||||
if (publishVehicleActions()) {
|
||||
|
||||
Reference in New Issue
Block a user