Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(verse): a sky pad off the agents floor and a courier to fly over the city (#683)

Ruben Lütke99a4ce114121
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.md
index c9145efbc2..c08970c095 100644
--- a/docs/agent-society/office-map.md
+++ b/docs/agent-society/office-map.md
@@ -626,6 +626,73 @@ street of team rooms round an atrium, with commons people use in between.
receives a shadow, traffic is computed on the GPU, and with reduced motion
its clock stands still. Measured 2026-10-14 on an RTX 5070 Ti at
2560 × 1217 px: the city adds about 0.4 ms per frame in the overview.
+- **The sky pad and the courier** (`skyPad.ts`, `SkyPadStructure.tsx`,
+ `SkyCourier.tsx`, agents floor only): the main boulevard runs on through a
+ doorway in the east window wall (the balustrade has the same gap) as a 5 m
+ bridge to a round landing deck of 12 m radius, at floor level, inside the
+ city's empty plaza. The deck is graphite with a gold landing circle,
+ chevrons and a touchdown cross, a breathing cyan light round its rim, glass
+ rails, four light masts (glowing lamps, not light sources) and steel struts
+ back into the tower. The courier
+ stands on it: a chrome and gold starship authored in Blender
+ (`art/studies/sky-pad-courier-study/source/build_courier.py`, three levels
+ of detail exported as glTF into `src/assets/society/courier/`), scaled to
+ about 19 m beside the 1.3 m figures. The bridge and the deck are walkable
+ (the navigation grid reaches beyond `layout.floor` for them, an idle wander
+ never does), the courier is solid, and the full map, the minimap and the
+ overview frame the pad too.
+- **Boarding and flying:** the ship is a station (`ship`, beside its hatch).
+ E there, or a click on the ship once the person stands there, boards it (a
+ click from afar walks over first, as at the elevator). The flight
+ (`courierFlight.ts`) is a rigid body with thrust, lift, pitch, yaw and roll:
+ *arcade* assist (the default) flies where the nose points, banks into
+ turns and levels itself; *simulation* is Newtonian with momentum and
+ drift. Cruise 70 m/s, boost to 150 m/s on a charge that drains and
+ refills, brake. Every tower, the Dodaios tower with its floor, the pad, the
+ street level and the singularity's core are solid (`courierWorld.ts`):
+ the ship bounces off in sub-steps no longer than 1.5 m (no tunnelling at
+ full boost), its shield flashes and the camera shakes. Past the city's
+ edge or above 420 m it is turned back gently. The landing assist flies to
+ a hover point over the pad, turns to the pad's heading and sets the ship
+ down with its gear out; any stick input hands control back. The gear comes
+ down by itself below 14 m over the deck. On the pad, E (or F, or the HUD's
+ button) steps out beside the hatch and the office camera takes over again.
+- **Cameras:** a chase camera behind and above with smoothing, pulled in
+ short of any tower between it and the ship; a cockpit view from the
+ canopy. Wider field of view while boosting.
+- **Effects and sound:** engine flames and an engine light that grow with
+ the throttle, glowing exhaust rings, contrails at high speed, a fresnel
+ shield on impact, dust blown across the deck when landing or lifting off.
+ The engine sound is synthesised with Web Audio (no audio files), placed at
+ the ship and heard from the camera (HRTF panning), pitch-shifted by the
+ relative speed (Doppler), muffled in the cockpit, with a thud on impact.
+ With reduced motion the flames, dust and camera shake stay calm. Not
+ built: a heat-haze distortion and a bloom/lens/motion-blur post-process
+ (the renderer has no post-processing pass; glow comes from emissive and
+ additive materials).
+- **Controls** (defaults; rebindable, kept per browser):
+
+ | Action | Keys | Gamepad |
+ | --- | --- | --- |
+ | Throttle up / down | W / S | right / left trigger |
+ | Turn left / right | A / D | left stick x |
+ | Nose up / down | ↓ / ↑ | left stick y |
+ | Roll left / right | Q / E, ← / → | right stick x |
+ | Rise / sink | Space / C or Ctrl | right stick y |
+ | Boost / brake | Shift / X | A / B |
+ | Flight assist | T | Back |
+ | Camera | V | Y |
+ | Landing assist | L | X |
+ | Step out (landed) | E or F | Start |
+ | Help / settings | H / Esc | — |
+
+ The settings (Esc or the HUD's button) switch the assist and the camera,
+ invert pitch, set the engine volume and rebind any action by pressing a
+ key; "Reset keys" restores the defaults. The flight HUD shows speed,
+ height over the deck (or the street level), throttle, boost charge, the
+ assist and camera, the landing assist, and stepping out once landed. While
+ the courier flies, the office's own H, L and M keys and the walking keys
+ rest. The reception's controls guide lists the courier's default keys.
- **One material language** from the studios to the last room: light plank
oak, limestone and felt on the floor; light oak for timber; dark steel for
metal, with bronze as the one accent; steel-framed clear glass with a
@@ -944,6 +1011,17 @@ The floor now keeps the studio look of §5b and moves into the tower:
free plot) is covered by unit tests for the plan (the stand and its
standing place, the arch at the desk, 1.2 m or more to walk along both
windows) and was then checked in a browser by the orchestrator.
+- Sky pad and courier (2026-10-14): `courierFlight.test.ts` holds the pad
+ (outside the slab on the boulevard's line, walkable from the floor to the
+ hatch, the courier solid, no idle wander onto it, the `ship` checkpoint on
+ the agents floor only), the collision world, the flight (lift-off, arcade
+ holding the nose and levelling, simulation drifting, boost and charge, no
+ passing through a tower at full boost, the autopilot landing from out over
+ the city, handing back on input) and the controls (keys and pad into one
+ input, dead zone, rebinding and its storage). `CampusScene.test.tsx` mounts
+ the pad structure and the east doorway. Checked in Chrome against the dev
+ build: walking out to the pad, boarding, chase and cockpit views over the
+ city, the landing assist starting, stepping out.
- City (2026-10-14): `cityPlan.test.ts` holds the plan for a hall-sized, a
typical and a large floor: deterministic, the plaza empty, every roof
within the roof limit, no two towers on one spot, the crater clear with
diff --git a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb
new file mode 100644
index 0000000000..28239017ef
Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb differ
diff --git a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb
new file mode 100644
index 0000000000..9fda7cc889
Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb differ
diff --git a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb
new file mode 100644
index 0000000000..39e6be1745
Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb differ
diff --git a/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx b/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx
index 881edf8bdc..6c3ed5dda7 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/BuildingShell.tsx
@@ -20,6 +20,7 @@ import { Instances, type Placement } from "./CodingFloorAmbience";
import { Box, GEO, matte, Railing } from "./OfficeFurniture";
import type { OfficeLayout, Rect } from "./officeLayout";
import { SingularityCity } from "./SingularityCity";
+import type { SkyPad } from "./skyPad";
/** The window wall: its height, the mullion pitch, and how far the ceiling edge reaches into the floor. */
export const FACADE = { h: 3.4, pitch: 2.9, soffit: 1.1 } as const;
@@ -34,18 +35,28 @@ const SHELL = {
type Side = "north" | "south" | "west" | "east";
-/** One side's window wall, in its own frame: it runs along +x, the floor lies towards +z. */
-function WindowWall({ length }: { length: number }) {
+/**
+ * One side's window wall, in its own frame: it runs along +x, the floor lies towards +z. An `opening` (a range of
+ * x) is a doorway the full height of the glass: sill and glass stop at its jambs, the head runs on over it.
+ */
+function WindowWall({ length, opening }: { length: number; opening?: readonly [number, number] }) {
const mullions = useMemo<Placement[]>(() => {
const count = Math.max(2, Math.round(length / FACADE.pitch) + 1);
- return Array.from({ length: count }, (_, i) => ({
- position: [-length / 2 + (length * i) / (count - 1), FACADE.h / 2, 0] as [number, number, number], scale: [0.07, FACADE.h, 0.12] as [number, number, number],
- }));
- }, [length]);
+ const at = Array.from({ length: count }, (_, i) => -length / 2 + (length * i) / (count - 1))
+ .filter((x) => !opening || x < opening[0] - 0.3 || x > opening[1] + 0.3);
+ if (opening) at.push(opening[0], opening[1]);
+ return at.map((x) => ({ position: [x, FACADE.h / 2, 0] as [number, number, number], scale: [0.07, FACADE.h, 0.12] as [number, number, number] }));
+ }, [length, opening]);
+ // The runs of sill and glass: the whole length, or the two stretches either side of the doorway.
+ const runs: [number, number][] = opening ? [[-length / 2, opening[0]], [opening[1], length / 2]] : [[-length / 2, length / 2]];
return (
- <group>
- <Box size={[length, 0.22, 0.14]} position={[0, 0.11, 0]} material={SHELL.steel} cast={false} />
- <Box size={[length, FACADE.h - 0.5, 0.03]} position={[0, 0.22 + (FACADE.h - 0.5) / 2, 0]} material={SHELL.glass} cast={false} />
+ <group userData={{ windowWall: true }}>
+ {runs.map(([a, b]) => (
+ <group key={a}>
+ <Box size={[b - a, 0.22, 0.14]} position={[(a + b) / 2, 0.11, 0]} material={SHELL.steel} cast={false} />
+ <Box size={[b - a, FACADE.h - 0.5, 0.03]} position={[(a + b) / 2, 0.22 + (FACADE.h - 0.5) / 2, 0]} material={SHELL.glass} cast={false} />
+ </group>
+ ))}
<Box size={[length, 0.28, 0.2]} position={[0, FACADE.h - 0.14, 0]} material={SHELL.steel} cast={false} />
{/* The ceiling's edge: a pale band running into the floor from the head of the wall. */}
<Box size={[length, 0.1, FACADE.soffit]} position={[0, FACADE.h + 0.05, FACADE.soffit / 2 - 0.1]} material={SHELL.soffit} cast={false} />
@@ -58,7 +69,7 @@ function WindowWall({ length }: { length: number }) {
* The floor's four edges. Each has a window wall and a balustrade; the wall
* shows on the sides the camera looks towards, the balustrade on the others.
*/
-function Edges({ bounds }: { bounds: Rect }) {
+function Edges({ bounds, skyPad }: { bounds: Rect; skyPad?: SkyPad }) {
const { minX, maxX, minZ, maxZ } = bounds;
const cx = (minX + maxX) / 2, cz = (minZ + maxZ) / 2, w = maxX - minX, d = maxZ - minZ;
const walls = useRef<Partial<Record<Side, Group | null>>>({});
@@ -85,15 +96,24 @@ function Edges({ bounds }: { bounds: Rect }) {
{ side: "west", position: [minX + inset, 0, cz], rotationY: Math.PI / 2, length: d - inset * 2, from: [minX + rail, maxZ - rail], to: [minX + rail, minZ + rail] },
{ side: "east", position: [maxX - inset, 0, cz], rotationY: -Math.PI / 2, length: d - inset * 2, from: [maxX - rail, minZ + rail], to: [maxX - rail, maxZ - rail] },
];
+ // The bridge to the sky pad leaves through the east side: a doorway in its wall (the east wall's +x is world +z)
+ // and a gap in its balustrade.
+ const gap = skyPad?.gap;
+ const eastOpening = useMemo(() => (gap ? [gap.minZ - cz, gap.maxZ - cz] as const : undefined), [gap, cz]);
return (
<group>
{sides.map(({ side, position, rotationY, length, from, to }) => (
<group key={side}>
<group ref={(g) => { walls.current[side] = g; }} position={position} rotation={[0, rotationY, 0]} visible={shown.current[side]}>
- <WindowWall length={length} />
+ <WindowWall length={length} opening={side === "east" ? eastOpening : undefined} />
</group>
<group ref={(g) => { rails.current[side] = g; }} visible={!shown.current[side]}>
- <Railing from={from} to={to} />
+ {side === "east" && gap
+ ? <>
+ <Railing from={from} to={[to[0], gap.minZ]} />
+ <Railing from={[from[0], gap.maxZ]} to={to} />
+ </>
+ : <Railing from={from} to={to} />}
</group>
</group>
))}
@@ -105,7 +125,7 @@ export function BuildingShell({ layout, reduced = false }: { layout: OfficeLayou
return (
<group>
<SingularityCity bounds={layout.bounds} reduced={reduced} />
- <Edges bounds={layout.bounds} />
+ <Edges bounds={layout.bounds} skyPad={layout.skyPad} />
</group>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CampusScene.test.tsx b/jarvis/ui/web/frontend/src/components/society/office/CampusScene.test.tsx
index 9ec23d1c2c..eb3affb1cc 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/CampusScene.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/CampusScene.test.tsx
@@ -14,6 +14,7 @@ import { buildHallLayout } from "./hallFloorLayout";
import { buildOfficeLayout, type OfficeAgentInput, type OfficeLayout, type OfficeTeamInput } from "./officeLayout";
import { FurniturePiece, MeetingChairs } from "./OfficeProps";
import { SingularityCity } from "./SingularityCity";
+import { SkyPadStructure } from "./SkyPadStructure";
import { StaticBatch } from "./StaticBatch";
import { ToyFigure } from "./ToyFigure";
import { loadProfile, playerLook } from "./playerProfile";
@@ -215,10 +216,12 @@ describe("campus scene", () => {
let walls = 0;
shell.traverse((child) => {
const box = new Box3().setFromObject(child);
- // A window wall's group: as tall as the façade, on the slab, as long as one of its sides.
- if (child.type !== "Group" || child.children.length !== 5) return;
- if (Math.abs(box.max.y - (FACADE.h + 0.1)) > 0.01) return;
+ // A window wall's group: tagged, as tall as the façade, on the slab, as long as one of its sides.
+ if (!child.userData.windowWall) return;
+ expect(Math.abs(box.max.y - (FACADE.h + 0.1))).toBeLessThan(0.01);
walls += 1;
+ // The east wall has the doorway to the sky pad's bridge: its glass stands in two runs.
+ if (Math.abs((box.min.x + box.max.x) / 2 - maxX) < 0.5) expect(child.children.length).toBe(2 + 3);
expect(inside(child)).toBe(false);
expect(box.min.x).toBeGreaterThanOrEqual(minX - 0.01);
expect(box.max.x).toBeLessThanOrEqual(maxX + 0.01);
@@ -255,6 +258,21 @@ describe("campus scene", () => {
});
});
+ it("builds the sky pad outside the slab's east edge, its deck at floor level, nothing of it inside the floor", async () => {
+ const layout = buildOfficeLayout(staff(5));
+ const pad = layout.skyPad!;
+ const group = await mount(<SkyPadStructure pad={pad} bounds={layout.bounds} reduced onFloorClick={() => undefined} />);
+ group.updateMatrixWorld(true);
+ const box = new Box3().setFromObject(group);
+ expect(box.min.x).toBeGreaterThanOrEqual(layout.bounds.maxX - 0.7);
+ expect(box.max.x).toBeLessThanOrEqual(pad.pad.x + pad.pad.r + 0.5);
+ // The rails and the light masts stand on the deck; nothing rises higher than a mast.
+ expect(box.max.y).toBeLessThan(3.6);
+ let clickable = 0;
+ group.traverse((child) => { if ((child as Mesh).isMesh && (child as unknown as { __r3f?: { handlers?: { onClick?: unknown } } }).__r3f?.handlers?.onClick) clickable += 1; });
+ expect(clickable).toBe(2);
+ });
+
it("tags every room wall run for the camera's cutaway", async () => {
const layout = buildOfficeLayout(staff(5));
const group = await mount(<RoomWalls walls={layout.walls} />);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx b/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx
new file mode 100644
index 0000000000..1368c318e1
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx
@@ -0,0 +1,154 @@
+/**
+ * The pilot's HUD while the courier flies: speed, height, throttle and boost,
+ * the flight assist and camera (both switchable here or by key), the landing
+ * assist, and stepping out once the ship stands on the pad. H shows every
+ * binding; Escape opens the settings, where any key can be rebound, pitch
+ * inverted and the engine's volume set. Theme tokens only, so light and dark
+ * mode both read.
+ */
+import { useEffect, useState } from "react";
+import { useT } from "@/i18n";
+import { DEFAULT_BINDINGS, FLIGHT_ACTIONS, keyLabel, rebind, type FlightAction } from "./courierControls";
+import { FLIGHT } from "./courierFlight";
+import { useCourier } from "./courierStore";
+import "./courierHud.css";
+
+/** The keys of one action as a pilot reads them, each label once (left and right Shift are both "Shift"). */
+function keysLabel(codes: readonly string[]): string {
+ return [...new Set(codes.map(keyLabel))].join(" / ") || "–";
+}
+
+function Meter({ label, value }: { label: string; value: number }) {
+ return (
+ <div className="courier-meter">
+ <span>{label}</span>
+ <i aria-hidden><b style={{ width: `${Math.round(Math.min(1, Math.max(0, value)) * 100)}%` }} /></i>
+ </div>
+ );
+}
+
+export function CourierHud() {
+ const t = useT();
+ const telemetry = useCourier((s) => s.telemetry);
+ const assist = useCourier((s) => s.assist);
+ const view = useCourier((s) => s.view);
+ const helpOpen = useCourier((s) => s.helpOpen);
+ const settingsOpen = useCourier((s) => s.settingsOpen);
+ const bindings = useCourier((s) => s.bindings);
+ const store = useCourier.getState;
+ const kmh = Math.round(telemetry.speed * 3.6);
+ const boostShare = Math.min(1, telemetry.speed / FLIGHT.boost);
+ const keysOf = (action: FlightAction) => keysLabel(bindings[action]);
+ return (
+ <>
+ <div className="courier-hud office-card" data-office-ui role="group" aria-label={t("society.office.flight_hud")}>
+ <div className="courier-speed" aria-live="off">
+ <strong>{kmh}</strong><span>km/h</span>
+ <i className="courier-speed-arc" aria-hidden style={{ ["--share" as string]: boostShare }} />
+ </div>
+ <div className="courier-readouts">
+ <span>{t("society.office.flight_altitude")} <strong>{Math.round(telemetry.altitude)} m</strong></span>
+ <Meter label={t("society.office.flight_throttle")} value={telemetry.throttle} />
+ <Meter label={t("society.office.flight_boost")} value={telemetry.charge} />
+ </div>
+ <div className="courier-actions">
+ <button type="button" className="office-chip" aria-pressed={assist === "simulation"}
+ onClick={() => store().setPrefs({ assist: assist === "arcade" ? "simulation" : "arcade" })}
+ title={`${t("society.office.flight_assist")} (${keysOf("assist")})`}>
+ {t(assist === "arcade" ? "society.office.flight_assist_arcade" : "society.office.flight_assist_simulation")}
+ </button>
+ <button type="button" className="office-chip" onClick={() => store().setPrefs({ view: view === "chase" ? "cockpit" : "chase" })}
+ title={keysOf("camera")}>
+ {t(view === "chase" ? "society.office.flight_view_chase" : "society.office.flight_view_cockpit")}
+ </button>
+ {telemetry.landed
+ ? <button type="button" className="office-chip courier-primary" onClick={() => store().requestExit()}>{t("society.office.flight_leave")}</button>
+ : telemetry.autopilot
+ ? <span className="courier-status">{t("society.office.flight_landing")}</span>
+ : <button type="button" className="office-chip" onClick={() => store().requestLanding()} title={keysOf("land")}>{t("society.office.flight_land")}</button>}
+ <button type="button" className="office-chip" aria-pressed={helpOpen} onClick={() => store().set({ helpOpen: !helpOpen })}>{t("society.office.flight_help")}</button>
+ <button type="button" className="office-chip" onClick={() => store().set({ settingsOpen: true })}>{t("society.office.flight_settings")}</button>
+ </div>
+ {telemetry.landed && <p className="office-hint">{t("society.office.flight_landed_hint").replace("{0}", keysOf("exit"))}</p>}
+ </div>
+ {helpOpen && !settingsOpen && (
+ <div className="courier-help office-card" data-office-ui>
+ <p className="office-subhead">{t("society.office.flight_keys")}</p>
+ <dl>
+ {FLIGHT_ACTIONS.map((action) => (
+ <div key={action}><dt>{t(`society.office.flight_action_${action}`)}</dt><dd><kbd>{keysOf(action)}</kbd></dd></div>
+ ))}
+ </dl>
+ <p className="office-hint">{t("society.office.flight_gamepad")}</p>
+ </div>
+ )}
+ {settingsOpen && <CourierSettings />}
+ </>
+ );
+}
+
+function CourierSettings() {
+ const t = useT();
+ // One selector per choice: the telemetry ticking eight times a second does not redraw the settings.
+ const assist = useCourier((s) => s.assist);
+ const view = useCourier((s) => s.view);
+ const invertPitch = useCourier((s) => s.invertPitch);
+ const volume = useCourier((s) => s.volume);
+ const bindings = useCourier((s) => s.bindings);
+ const store = useCourier.getState;
+ const [capturing, setCapturing] = useState<FlightAction | null>(null);
+ useEffect(() => {
+ if (!capturing) return;
+ const onKey = (event: KeyboardEvent) => {
+ event.preventDefault();
+ event.stopPropagation();
+ if (event.key !== "Escape") store().setBindings(rebind(store().bindings, capturing, event.code));
+ setCapturing(null);
+ };
+ window.addEventListener("keydown", onKey, true);
+ return () => window.removeEventListener("keydown", onKey, true);
+ }, [capturing, store]);
+ return (
+ <div className="courier-settings office-card" role="dialog" aria-modal="false" aria-label={t("society.office.flight_settings")} data-office-ui>
+ <div className="courier-settings-head">
+ <strong>{t("society.office.flight_settings")}</strong>
+ <button type="button" className="office-icon-button" aria-label={t("society.office.flight_close")} onClick={() => store().set({ settingsOpen: false })}>×</button>
+ </div>
+ <div className="courier-settings-row">
+ <span>{t("society.office.flight_assist")}</span>
+ {(["arcade", "simulation"] as const).map((a) => (
+ <button key={a} type="button" className="office-chip" aria-pressed={assist === a} onClick={() => store().setPrefs({ assist: a })}>
+ {t(`society.office.flight_assist_${a}`)}
+ </button>
+ ))}
+ </div>
+ <div className="courier-settings-row">
+ {(["chase", "cockpit"] as const).map((v) => (
+ <button key={v} type="button" className="office-chip" aria-pressed={view === v} onClick={() => store().setPrefs({ view: v })}>
+ {t(`society.office.flight_view_${v}`)}
+ </button>
+ ))}
+ </div>
+ <label className="courier-settings-row">
+ <input type="checkbox" checked={invertPitch} onChange={(e) => store().setPrefs({ invertPitch: e.target.checked })} />
+ <span>{t("society.office.flight_invert")}</span>
+ </label>
+ <label className="courier-settings-row">
+ <span>{t("society.office.flight_volume")}</span>
+ <input type="range" min={0} max={1} step={0.05} value={volume} onChange={(e) => store().setPrefs({ volume: Number(e.target.value) })} />
+ </label>
+ <p className="office-subhead">{t("society.office.flight_keys")}</p>
+ <div className="courier-bindings">
+ {FLIGHT_ACTIONS.map((action) => (
+ <div key={action} className="courier-binding">
+ <span>{t(`society.office.flight_action_${action}`)}</span>
+ <button type="button" className="office-chip" aria-pressed={capturing === action} onClick={() => setCapturing(action)}>
+ {capturing === action ? t("society.office.flight_rebind") : keysLabel(bindings[action])}
+ </button>
+ </div>
+ ))}
+ </div>
+ <button type="button" className="office-link" onClick={() => store().setBindings({ ...DEFAULT_BINDINGS })}>{t("society.office.flight_reset")}</button>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.follow.test.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.follow.test.tsx
index 7dd9a9881e..d106238c17 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.follow.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.follow.test.tsx
@@ -7,6 +7,7 @@ import { FOLLOW_DISTANCE, OfficeCameraRig } from "./OfficeCameraRig";
import { cameraLimitsFor } from "./officeCamera";
import { officeSession, player, useOfficeStore } from "./officeStore";
import { campusOf } from "./officeFixtures";
+import { boundsWithPad } from "./skyPad";
const state = vi.hoisted(() => ({
frames: new Set<(frame: unknown, dt: number) => void>(),
@@ -103,7 +104,8 @@ it("keeps a distance the person zoomed to by hand in the overview", () => {
it("lets the wheel reach the overview of this floor", () => {
render(tree(0));
- expect(state.controls.maxDistance).toBe(cameraLimitsFor(campus.layout.bounds, 1280 / 800).maxDistance);
+ // The floor and the sky pad beside it.
+ expect(state.controls.maxDistance).toBe(cameraLimitsFor(boundsWithPad(campus.layout.bounds, campus.layout.skyPad), 1280 / 800).maxDistance);
expect(state.controls.maxDistance).toBeGreaterThan(100);
});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx
index aa096b1c26..ff73ff46fc 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx
@@ -29,6 +29,8 @@ import { seatOf, wallRect, type OfficeLayout, type WallSegment } from "./officeL
import { cutawayStep, cutawayWalls, wallKey } from "./wallCutaway";
import { useLeadSeat } from "./leadSeat";
import { cameraView, officeSession, player, useOfficeStore } from "./officeStore";
+import { courierSession } from "./courierStore";
+import { boundsWithPad } from "./skyPad";
import "./officeCameraRig.css";
/** Where the camera starts: close behind the character, south-east, looking down. */
@@ -70,7 +72,9 @@ export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; ov
const reduced = useReducedMotion() ?? false;
// The wheel may back away far enough to frame this floor whole, however large it is.
const aspect = size.width / Math.max(1, size.height);
- const limits = useMemo(() => cameraLimitsFor(layout.bounds, aspect), [layout.bounds, aspect]);
+ // The camera frames the slab and the sky pad beside it.
+ const viewBounds = useMemo(() => boundsWithPad(layout.bounds, layout.skyPad), [layout.bounds, layout.skyPad]);
+ const limits = useMemo(() => cameraLimitsFor(viewBounds, aspect), [viewBounds, aspect]);
const lastFocus = useRef(0);
const lastZoom = useRef(0);
// Following resumed far from the character: glide over instead of snapping across the floor.
@@ -81,7 +85,7 @@ export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; ov
const beforeOverview = useRef<number | null>(null);
// A remembered view is only restored where it still makes sense on this floor plan.
const wallRects = useMemo(() => layout.walls.map(wallRect), [layout.walls]);
- const settle = (pose: CameraPose) => settleView(pose, layout.bounds, wallRects);
+ const settle = (pose: CameraPose) => settleView(pose, viewBounds, wallRects);
const backOff = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
useEffect(() => () => clearTimeout(backOff.current), []);
const dive = useRef<{ fromEye: Vector3; toEye: Vector3; fromTarget: Vector3; toTarget: Vector3; t: number } | null>(null);
@@ -214,7 +218,7 @@ export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; ov
if (!active || overview === 0) return;
// Seated in first person the glide would keep the camera in the chair: stand up first.
if (seated.current.blend > 0 || (layout.command && useLeadSeat.getState().seated === layout.command.id)) leaveFirstPerson();
- const home = campusOverview(layout.bounds, size.width / Math.max(1, size.height));
+ const home = campusOverview(viewBounds, size.width / Math.max(1, size.height));
// "Follow me" comes back to the view the person walked in, not to a view from across the campus.
if (controls.current) beforeOverview.current ??= camera.position.distanceTo(controls.current.target);
flight.current = null;
@@ -344,9 +348,10 @@ export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; ov
};
}, [active, limits]);
+ const wasFlying = useRef(false);
// The near plane follows the zoom, or coplanar layers (oak over slab) fight in bands when zoomed out.
useFrame(() => {
- if (!active) return;
+ if (!active || courierSession.flying) return;
const c = controls.current;
const lens = camera as PerspectiveCamera;
if (!c || !lens.isPerspectiveCamera) return;
@@ -360,6 +365,15 @@ export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; ov
if (!active) return;
const c = controls.current;
if (!c) return;
+ // The courier flies the camera itself; on stepping out the orbit picks up behind the person beside the ship.
+ if (courierSession.flying) { c.enabled = false; wasFlying.current = true; return; }
+ if (wasFlying.current) {
+ wasFlying.current = false;
+ c.enabled = true;
+ c.target.set(player.x, 0.9, player.z);
+ camera.position.set(player.x - 9, 8, player.z + 9);
+ c.update();
+ }
// Publish the view for the minimap: where the camera stands and which way it looks.
const lens = camera as unknown as { fov: number; aspect: number };
cameraView.x = camera.position.x; cameraView.z = camera.position.z;
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx
index e7a913b877..adbb30f71a 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx
@@ -24,6 +24,8 @@ import {
import {
agentColour, context2d, offscreenLayer, useElementSize, usePixelRatio, useThemeVersion, useThrottledFrames, type OfficeMapAgent,
} from "./mapHooks";
+import { courierSession } from "./courierStore";
+import { boundsWithPad } from "./skyPad";
export interface OfficeFullMapProps {
open: boolean;
@@ -61,7 +63,8 @@ function useMapKeys(open: boolean, onOpen: () => void, onClose: () => void): voi
}
return;
}
- if (event.code !== "KeyM" || event.repeat || ownsKeyboard(event.target)) return;
+ // The full map stays shut while the courier flies.
+ if (event.code !== "KeyM" || event.repeat || ownsKeyboard(event.target) || courierSession.flying) return;
event.preventDefault();
show();
};
@@ -96,7 +99,8 @@ function FullMapDialog({ onClose, layout, agents, selectedId }: Omit<OfficeFullM
const dpr = usePixelRatio();
const themeVersion = useThemeVersion();
- const grid = useMemo(() => mapGrid(layout.bounds, GRID_COLUMNS), [layout]);
+ // The sheet reaches out over the sky pad too, so the courier is on the map.
+ const grid = useMemo(() => mapGrid(boundsWithPad(layout.bounds, layout.skyPad), GRID_COLUMNS), [layout]);
const gridRect = useMemo<Rect>(() => ({
minX: grid.originX, maxX: grid.originX + grid.columns * grid.cell, minZ: grid.originZ, maxZ: grid.originZ + grid.rows * grid.cell,
}), [grid]);
@@ -127,6 +131,7 @@ function FullMapDialog({ onClose, layout, agents, selectedId }: Omit<OfficeFullM
mission: t("society.office.cp_mission"),
studio: t("society.office.cp_studio"),
levels: t("society.office.cp_levels"),
+ ship: t("society.office.cp_ship"),
};
const roomLabels: Record<RoomKind, string> = {
lead: t("society.office.room_lead"),
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx
index a328025824..cc636f6aeb 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx
@@ -227,6 +227,7 @@ export function OfficeMinimap({ layout, agents, selectedId, onOpenMap }: OfficeM
mission: t("society.office.cp_mission"),
studio: t("society.office.cp_studio"),
levels: t("society.office.cp_levels"),
+ ship: t("society.office.cp_ship"),
};
const roomLabels: Record<RoomKind, string> = {
lead: t("society.office.room_lead"),
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx
index bd78db6f1c..36ec458c6b 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx
@@ -33,6 +33,7 @@ import { useProgression } from "../progression/progressionStore";
import { PERSON_SUBJECT } from "../progression/progressionApi";
import { LevelChip } from "../progression/LevelHud";
import { useDressedFigure } from "../progression/regalia/dress";
+import { useCourier } from "./courierStore";
/** The person's pace: a brisk walk, and a sprint on Shift (m/s). */
export const PLAYER_WALK_SPEED = 2.0;
@@ -156,7 +157,9 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {
const hasBone = useOfficeDog((s) => s.hasBone);
// Seated at Mission Control the camera is the character's eyes: its own figure would block the view.
const firstPerson = useLeadSeat((s) => !!layout.command && s.seated === layout.command.id);
- const { pressed, run, jumpHeld } = useMoveKeys(awake, interact, onJump);
+ // In the courier the keys fly the ship and the character rides inside it, out of sight.
+ const flying = useCourier((s) => s.flying);
+ const { pressed, run, jumpHeld } = useMoveKeys(awake && !flying, interact, onJump);
// A level-up of the person's own: the character hops for joy and waves while it stands.
useEffect(() => useProgression.subscribe((state, prev) => {
if (state.cheerUntil > prev.cheerUntil && !reduced) pressJump(jump);
@@ -178,6 +181,8 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {
}, [grid, layout.spawn, awake]);
useFrame((_, rawDt) => {
+ // Aboard the courier the character goes nowhere: it steps out again beside the hatch (SkyCourier).
+ if (flying) { if (nearbyRef.current) { nearbyRef.current = null; useOfficeStore.getState().setNearby(null); } return; }
const dt = Math.min(rawDt, 0.1);
const store = useOfficeStore.getState();
// Sitting on the lead's chair: hold the seat until the person moves, walks
@@ -300,7 +305,7 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {
return (
<>
<RouteMarker animate={awake && !reduced} />
- <group ref={group} visible={!firstPerson}>
+ <group ref={group} visible={!firstPerson && !flying}>
<mesh ref={ring} rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.02, 0]}>
<ringGeometry args={[0.42, 0.52, 40]} />
<meshBasicMaterial color="#f5b83d" transparent opacity={0.8} side={DoubleSide} depthWrite={false} />
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
index b0578b2ed4..165c3822cb 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
@@ -27,6 +27,8 @@ import { CampusGround } from "./CampusGround";
import { StaticBatch } from "./StaticBatch";
import { BuildingShell } from "./BuildingShell";
import { CITY_BACKDROP } from "./SingularityCity";
+import { SkyCourier } from "./SkyCourier";
+import { SkyPadStructure } from "./SkyPadStructure";
import { ExecutiveDesks, LeadOfficeLight } from "./LeadSuite";
import { LiveMonitors } from "./LiveMonitors";
import { TerminalMonitors } from "./TerminalMonitors";
@@ -234,6 +236,11 @@ function OfficeFloorDressing({ floor, occupants, layout, agents, newcomers, awak
{coding ? <CodingFloorAmbience layout={layout} /> : <AgentsFloorAmbience layout={layout} />}
{/* Every working floor is a floor of the tower: window walls, the tower below, the city outside. */}
<BuildingShell layout={layout} reduced={reduced} />
+ {/* The sky pad outside the east windows, and the courier standing on it. */}
+ {layout.skyPad && <>
+ <SkyPadStructure pad={layout.skyPad} bounds={layout.bounds} reduced={reduced} onFloorClick={onFloorClick} />
+ <SkyCourier layout={layout} reduced={reduced} awake={awake} />
+ </>}
<RoomFloors rooms={layout.rooms} campus={!coding} />
<RoomWalls walls={layout.walls} />
{!batch && signs}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
index 17c67cb02a..67eafa01fc 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
@@ -31,6 +31,8 @@ import { ZOOM_SECONDS } from "./OfficeCameraRig";
import { useDeskChats } from "./useDeskChats";
import type { Point } from "./officeLayout";
import { player, sameSelection, switchFloor, useOfficeStore, type OfficeFloor, type Selection } from "./officeStore";
+import { courierSession, useCourier } from "./courierStore";
+import { CourierHud } from "./CourierHud";
import { agentPositions, seatedAtDesk } from "./walkerRegistry";
import { useCodingFloorOccupants, type PaneOccupant } from "./codingFloor";
import { openPaneSession } from "./codingNavigate";
@@ -327,6 +329,19 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
rideTimer.current = setTimeout(() => setRide((r) => (r?.phase === "closed" ? { ...r, phase: "opening" } : r)), DOORS_HOLD_MAX_MS);
}, DOORS_MS);
}, [ride, reduced]);
+ // E beside the courier on the sky pad, or a click on it, boards it: the flight takes the keys and the camera.
+ const flying = useCourier((s) => s.flying);
+ useEffect(() => {
+ if (!awake || selection?.kind !== "checkpoint" || selection.id !== "ship") return;
+ select(null);
+ // Like the elevator, never from a distance: a click from afar walks the person over to the hatch first.
+ const hatch = layout.checkpoints.find((cp) => cp.id === "ship");
+ if (hatch && Math.hypot(player.x - hatch.x, player.z - hatch.z) > hatch.radius + 0.6) {
+ useOfficeStore.getState().requestWalk({ x: hatch.x, z: hatch.z });
+ return;
+ }
+ useCourier.getState().board();
+ }, [selection, select, awake, layout]);
// E at the elevator, or a click on its floor token, presses the call button instead of opening a panel.
useEffect(() => {
if (!awake || selection?.kind !== "checkpoint" || selection.id !== "elevator") return;
@@ -484,7 +499,8 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
useEffect(() => {
if (!awake) return;
const onKey = (event: KeyboardEvent) => {
- if (event.code !== "KeyH" || event.repeat || event.ctrlKey || event.metaKey || event.altKey) return;
+ // In the courier, H is the pilot's own help.
+ if (event.code !== "KeyH" || event.repeat || event.ctrlKey || event.metaKey || event.altKey || courierSession.flying) return;
const current = useOfficeStore.getState().selection;
// The open directory is a dialog of its own: H closes it again unless the person is typing in it.
if (isReception(current) ? typesText(event.target) : ownsKeyboard(event.target)) return;
@@ -507,7 +523,8 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
useEffect(() => {
if (!awake) return;
const onKey = (event: KeyboardEvent) => {
- if (event.code !== "KeyL" || event.repeat || event.ctrlKey || event.metaKey || event.altKey) return;
+ // In the courier, L is the landing assist.
+ if (event.code !== "KeyL" || event.repeat || event.ctrlKey || event.metaKey || event.altKey || courierSession.flying) return;
const levels = useProgression.getState();
if (ownsKeyboard(event.target) && !levels.panel) return;
if (useOfficeStore.getState().selection?.kind === "arcade") return;
@@ -680,14 +697,15 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
{/* Bottom centre: the one prompt, a station's short answer, and the controls for a first visit. */}
<div className="office-hud office-hud-bottom">
- {promptLine && promptTarget && !selection && !picking && !ride && (
+ {promptLine && promptTarget && !selection && !picking && !ride && !flying && (
<StationPrompt line={promptLine} compact={compact} onUse={() => select(promptTarget)} />
)}
<div role="status" aria-live="polite">{notice && <p className="office-card office-notice" data-office-ui>{notice}</p>}</div>
- {!compact && !hintsSeen && !selection && !picking && !ride && (
+ {!compact && !hintsSeen && !selection && !picking && !ride && !flying && (
<ControlHints onDismiss={() => useOfficeSettings.getState().set({ hintsSeen: true })} />
)}
</div>
+ {flying && <CourierHud />}
{diving && <div className="office-dive-fade" aria-hidden />}
{picking && !ride && <ElevatorPanel floor={floor} onPick={pickFloor} onClose={closePicker} />}
{ride && <ElevatorDoors from={ride.from} to={ride.to} phase={ride.phase} />}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx b/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx
new file mode 100644
index 0000000000..c1c7c00fb3
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx
@@ -0,0 +1,635 @@
+/**
+ * The courier: the chrome starship on the sky pad, and the person's flight in
+ * it. Parked, it stands on its gear beside the bridge; the ship station
+ * (stations.ts) boards it. Flying, this component owns the camera (chase or
+ * cockpit), reads the keys and a gamepad, steps the flight (courierFlight.ts)
+ * against the city (courierWorld.ts), and drives the ship's looks: gear,
+ * engine glow and flames, the engine light, contrails at speed, the shield's
+ * flash on impact, dust on the deck when it lands or lifts, and the engine
+ * sound (courierAudio.ts). With reduced motion the flames and dust stay calm
+ * and the camera does not shake.
+ *
+ * The model comes in three levels of detail from the art study
+ * (art/studies/sky-pad-courier-study); its chrome and gold reflect a small
+ * environment of the city's night built once per renderer.
+ */
+import { Component, Suspense, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
+import { useGLTF } from "@react-three/drei";
+import { useFrame, useThree } from "@react-three/fiber";
+import {
+ AdditiveBlending, BackSide, BufferAttribute, BufferGeometry, Color, ConeGeometry, DoubleSide, Float32BufferAttribute, Group, LOD, Mesh,
+ MeshBasicMaterial, MeshStandardMaterial, Object3D, PerspectiveCamera, PMREMGenerator, PointLight, RepeatWrapping, Scene, ShaderMaterial,
+ SphereGeometry, Vector3, type Material, type Texture, type WebGLRenderer, type WebGLRenderTarget,
+} from "three";
+import courierNear from "@/assets/society/courier/courier-lod0.glb";
+import courierMid from "@/assets/society/courier/courier-lod1.glb";
+import courierFar from "@/assets/society/courier/courier-lod2.glb";
+import { planCity } from "./cityPlan";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { CourierEngineSound } from "./courierAudio";
+import { FLIGHT_ACTIONS, flightInput, PAD_PRESSES, PRESS_ACTIONS, type FlightAction, type PadState } from "./courierControls";
+import { engageAutopilot, FLIGHT, forwardOf, heightOverDeck, NO_INPUT, parkedState, stepFlight, type FlightState } from "./courierFlight";
+import { courierSession, useCourier } from "./courierStore";
+import { buildCourierWorld, rayDistance } from "./courierWorld";
+import { CAMERA_FOV } from "./officeCamera";
+import type { OfficeLayout } from "./officeLayout";
+import { ownsKeyboard } from "./OfficePlayer";
+import { player as playerBody, useOfficeStore } from "./officeStore";
+import { COURIER, type SkyPad } from "./skyPad";
+import { COURIER_GROUP } from "./stations";
+
+/** Authored geometry the runtime drives (model units = authored metres): where the gear retracts to, the exhausts, the pod tails. */
+const MODEL = {
+ gearTravel: 1.9,
+ exhausts: [[-6.6, -0.25, 12.6], [6.6, -0.25, 12.6]] as const,
+ tails: [[-6.6, -0.25, 17.2], [6.6, -0.25, 17.2]] as const,
+ shield: [8.6, 4.2, 19] as const,
+} as const;
+
+/** Chase camera: behind and above the ship (world metres), and where it looks. Cockpit: the pilot's eyes. */
+const CHASE = { back: 22, up: 6, lookAhead: 24, stiffness: 5 } as const;
+const COCKPIT = { up: 1.55, forward: -4.2 } as const;
+const FLIGHT_FOV = { cruise: 60, boost: 72 } as const;
+
+// ---------------------------------------------------------------------------
+// Materials
+// ---------------------------------------------------------------------------
+
+/** The city's night as a small environment for the chrome: violet sky, a gold glow on one side, dark streets with lights. */
+function cityEnvironment(gl: WebGLRenderer): WebGLRenderTarget {
+ const scene = new Scene();
+ const geometry = new SphereGeometry(50, 48, 24);
+ const colours: number[] = [];
+ const pos = geometry.getAttribute("position");
+ // Brighter than the real night, so the chrome reads as silver at every angle: a steel-blue dome, a pale horizon.
+ const top = new Color("#4f5d7c"), horizon = new Color("#c3c8d6"), below = new Color("#2b2840"), glow = new Color("#ffc27a"), c = new Color();
+ for (let i = 0; i < pos.count; i += 1) {
+ const y = pos.getY(i) / 50, x = pos.getX(i) / 50, z = pos.getZ(i) / 50;
+ if (y > 0) c.copy(horizon).lerp(top, Math.min(1, y * 1.3)); else c.copy(horizon).lerp(below, Math.min(1, -y * 2.5));
+ // The singularity's glow, low in the north.
+ const toGlow = Math.max(0, -z * 0.95 - x * 0.3) * Math.exp(-Math.abs(y) * 4);
+ c.lerp(glow, Math.min(0.8, toGlow ** 3));
+ colours.push(c.r, c.g, c.b);
+ }
+ geometry.setAttribute("color", new Float32BufferAttribute(colours, 3));
+ scene.add(new Mesh(geometry, new MeshBasicMaterial({ vertexColors: true, side: BackSide })));
+ // A few bright panels for the city's lights to glint in the hull.
+ const lamp = new MeshBasicMaterial({ color: "#ffe6c4" });
+ for (let i = 0; i < 14; i += 1) {
+ const a = (i / 14) * Math.PI * 2, panel = new Mesh(new SphereGeometry(1.6, 8, 6), lamp);
+ panel.position.set(Math.cos(a) * 40, -6 - (i % 3) * 5, Math.sin(a) * 40);
+ scene.add(panel);
+ }
+ const pmrem = new PMREMGenerator(gl);
+ const target = pmrem.fromScene(scene, 0.02);
+ pmrem.dispose();
+ scene.traverse((o) => { if (o instanceof Mesh) { o.geometry.dispose(); (o.material as Material).dispose(); } });
+ return target;
+}
+
+/** Hull panels: thin seams the chrome's bump map carries, so the surface reads as built and not cast. */
+function panelTexture(): Texture | null {
+ const tex = cachedCanvasTexture("courier:panels", 512, 512, (ctx, w, h) => {
+ ctx.fillStyle = "#ffffff";
+ ctx.fillRect(0, 0, w, h);
+ ctx.strokeStyle = "#9a9a9a";
+ ctx.lineWidth = 2;
+ let seed = 0x5eed;
+ const rand = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
+ for (let y = 0; y < h; y += 64) {
+ ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(w, y); ctx.stroke();
+ for (let x = rand() * 90; x < w; x += 70 + rand() * 90) { ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y + 64); ctx.stroke(); }
+ }
+ // Rivet rows and a few hatches.
+ ctx.fillStyle = "#8a8a8a";
+ for (let y = 8; y < h; y += 64) for (let x = 6; x < w; x += 12) ctx.fillRect(x, y, 2, 2);
+ });
+ if (tex) { tex.wrapS = tex.wrapT = RepeatWrapping; tex.repeat.set(2.5, 2.5); }
+ return tex;
+}
+
+interface CourierMaterials {
+ byName: Record<string, Material>;
+ glow: MeshBasicMaterial;
+ all: Material[];
+}
+
+function courierMaterials(env: Texture): CourierMaterials {
+ const panels = panelTexture();
+ const chrome = new MeshStandardMaterial({ color: "#dfe3ea", metalness: 1, roughness: 0.16, envMap: env, envMapIntensity: 1.1, bumpMap: panels, bumpScale: 0.12 });
+ const gold = new MeshStandardMaterial({ color: "#d6a64e", metalness: 1, roughness: 0.24, envMap: env, envMapIntensity: 1.2 });
+ const graphite = new MeshStandardMaterial({ color: "#16181e", metalness: 0.6, roughness: 0.42, envMap: env });
+ const glass = new MeshStandardMaterial({ color: "#0b1526", metalness: 0.9, roughness: 0.04, envMap: env, envMapIntensity: 1.6 });
+ const glow = new MeshBasicMaterial({ color: "#6fd8ff", toneMapped: false });
+ const strip = new MeshBasicMaterial({ color: "#8be9ff", toneMapped: false });
+ return {
+ byName: { Chrome: chrome, Gold: gold, Graphite: graphite, CanopyGlass: glass, EngineGlow: glow, LightStrip: strip },
+ glow,
+ all: [chrome, gold, graphite, glass, glow, strip],
+ };
+}
+
+const GEAR_NAME = /^Gear_(Nose|Left|Right)\.?\d*$/;
+
+/** A level of detail, cloned, re-dressed in the shared materials; returns its gear nodes with their rest heights. */
+function dress(source: Object3D, materials: CourierMaterials): { root: Object3D; gear: { node: Object3D; y: number }[] } {
+ const root = source.clone(true);
+ const gear: { node: Object3D; y: number }[] = [];
+ root.traverse((o) => {
+ if (GEAR_NAME.test(o.name)) gear.push({ node: o, y: o.position.y });
+ if (o instanceof Mesh) {
+ const name = (o.material as Material).name.replace(/\.\d+$/, "");
+ o.material = materials.byName[name] ?? materials.byName.Chrome;
+ o.castShadow = true;
+ o.receiveShadow = true;
+ }
+ });
+ return { root, gear };
+}
+
+// ---------------------------------------------------------------------------
+// Effects
+// ---------------------------------------------------------------------------
+
+const FLAME_VERTEX = /* glsl */ `
+ varying vec2 vUv;
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
+`;
+const FLAME_FRAGMENT = /* glsl */ `
+ uniform float uTime, uPower;
+ varying vec2 vUv;
+ void main() {
+ // The cone's base sits at the nozzle, its point trails behind; uv.y is 0 at the base and 1 at the point.
+ float along = 1.0 - vUv.y;
+ float flicker = 0.85 + 0.15 * sin(uTime * 43.0 + vUv.x * 30.0) * sin(uTime * 17.0);
+ vec3 hot = vec3(0.85, 0.97, 1.0) * 3.0, cool = vec3(0.25, 0.55, 1.0) * 1.4;
+ vec3 col = mix(cool, hot, pow(along, 2.0)) * pow(along, 1.4) * uPower * flicker;
+ gl_FragColor = vec4(col, 1.0);
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ }
+`;
+
+const SHIELD_VERTEX = /* glsl */ `
+ varying vec3 vNormalW; varying vec3 vWorld; varying vec3 vLocal;
+ void main() {
+ vLocal = position;
+ vec4 w = modelMatrix * vec4(position, 1.0); vWorld = w.xyz;
+ vNormalW = normalize(mat3(modelMatrix) * normal);
+ gl_Position = projectionMatrix * viewMatrix * w;
+ }
+`;
+const SHIELD_FRAGMENT = /* glsl */ `
+ uniform float uTime, uStrength;
+ varying vec3 vNormalW; varying vec3 vWorld; varying vec3 vLocal;
+ void main() {
+ vec3 V = normalize(cameraPosition - vWorld);
+ float fres = pow(1.0 - abs(dot(normalize(vNormalW), V)), 2.6);
+ float bands = 0.6 + 0.4 * sin(vLocal.z * 2.4 - uTime * 6.0);
+ vec3 col = vec3(0.35, 0.85, 1.0) * fres * bands * uStrength * 2.2;
+ gl_FragColor = vec4(col, 1.0);
+ #include <tonemapping_fragment>
+ #include <colorspace_fragment>
+ }
+`;
+
+const TRAIL_POINTS = 26;
+
+/** A contrail behind one pod tail: a camera-facing ribbon through the tail's recent positions. */
+class Trail {
+ readonly geometry = new BufferGeometry();
+ /** A ring of pooled points, newest at `head`; `count` of them are in use. */
+ private readonly points = Array.from({ length: TRAIL_POINTS }, () => new Vector3());
+ private readonly ages = new Float32Array(TRAIL_POINTS);
+ private head = 0;
+ private count = 0;
+ private readonly pos = new Float32Array(TRAIL_POINTS * 2 * 3);
+ private readonly fade = new Float32Array(TRAIL_POINTS * 2);
+ constructor() {
+ this.geometry.setAttribute("position", new BufferAttribute(this.pos, 3));
+ this.geometry.setAttribute("aFade", new BufferAttribute(this.fade, 1));
+ const index: number[] = [];
+ for (let i = 0; i < TRAIL_POINTS - 1; i += 1) { const a = i * 2; index.push(a, a + 1, a + 2, a + 1, a + 3, a + 2); }
+ this.geometry.setIndex(index);
+ }
+ private at(i: number): Vector3 { return this.points[(this.head - i + TRAIL_POINTS) % TRAIL_POINTS]; }
+ update(tip: Vector3, strength: number, dt: number, camera: Vector3, v: { side: Vector3; dir: Vector3; cam: Vector3 }) {
+ for (let i = 0; i < TRAIL_POINTS; i += 1) this.ages[i] += dt;
+ if (this.count === 0 || this.at(0).distanceTo(tip) > 1.4) {
+ this.head = (this.head + 1) % TRAIL_POINTS;
+ this.points[this.head].copy(tip);
+ this.ages[this.head] = 0;
+ this.count = Math.min(TRAIL_POINTS, this.count + 1);
+ } else {
+ this.at(0).copy(tip);
+ }
+ for (let i = 0; i < TRAIL_POINTS; i += 1) {
+ const used = i < this.count;
+ const p = used ? this.at(i) : this.at(0);
+ const q = i + 1 < this.count ? this.at(i + 1) : p;
+ v.dir.subVectors(p, q);
+ if (v.dir.lengthSq() < 1e-6) v.dir.set(0, 0, 1);
+ v.cam.subVectors(camera, p).normalize();
+ v.side.crossVectors(v.dir.normalize(), v.cam).normalize().multiplyScalar(0.12 + i * 0.006);
+ const o = i * 6;
+ this.pos[o] = p.x + v.side.x; this.pos[o + 1] = p.y + v.side.y; this.pos[o + 2] = p.z + v.side.z;
+ this.pos[o + 3] = p.x - v.side.x; this.pos[o + 4] = p.y - v.side.y; this.pos[o + 5] = p.z - v.side.z;
+ // Fading with age and along the trail, and gone where it would pass right by the camera.
+ const near = Math.min(1, Math.max(0, (camera.distanceTo(p) - 8) / 20));
+ const age = this.ages[(this.head - i + TRAIL_POINTS) % TRAIL_POINTS];
+ const alpha = used ? strength * Math.max(0, 1 - age / 1.2) * (1 - i / TRAIL_POINTS) * near : 0;
+ this.fade[i * 2] = alpha; this.fade[i * 2 + 1] = alpha;
+ }
+ (this.geometry.getAttribute("position") as BufferAttribute).needsUpdate = true;
+ (this.geometry.getAttribute("aFade") as BufferAttribute).needsUpdate = true;
+ }
+ clear() { this.count = 0; this.fade.fill(0); (this.geometry.getAttribute("aFade") as BufferAttribute).needsUpdate = true; }
+}
+
+const TRAIL_MATERIAL_SOURCE = {
+ vertexShader: /* glsl */ `attribute float aFade; varying float vFade; void main() { vFade = aFade; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`,
+ fragmentShader: /* glsl */ `varying float vFade; void main() { gl_FragColor = vec4(vec3(0.75, 0.85, 1.0) * vFade * 0.4, 1.0); }`,
+};
+
+const DUST_COUNT = 220;
+
+// ---------------------------------------------------------------------------
+// The component
+// ---------------------------------------------------------------------------
+
+export function SkyCourier({ layout, reduced, awake }: { layout: OfficeLayout; reduced: boolean; awake: boolean }) {
+ // A model that fails to load leaves the pad empty instead of taking the floor down with it.
+ return (
+ <CourierBoundary>
+ <Suspense fallback={null}>
+ {layout.skyPad && <Courier layout={layout} pad={layout.skyPad} reduced={reduced} awake={awake} />}
+ </Suspense>
+ </CourierBoundary>
+ );
+}
+
+class CourierBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {
+ state = { failed: false };
+ static getDerivedStateFromError() { return { failed: true }; }
+ componentDidCatch(error: unknown) { console.warn("the courier could not be shown", error); }
+ render() { return this.state.failed ? null : this.props.children; }
+}
+
+function Courier({ layout, pad, reduced, awake }: { layout: OfficeLayout; pad: SkyPad; reduced: boolean; awake: boolean }) {
+ const gl = useThree((s) => s.gl);
+ const camera = useThree((s) => s.camera) as PerspectiveCamera;
+ const gltfs = useGLTF([courierNear, courierMid, courierFar]);
+ // The environment is a render target of its own: built in an effect, so its disposal pairs with its creation.
+ const [env, setEnv] = useState<WebGLRenderTarget | null>(null);
+ useEffect(() => {
+ const target = cityEnvironment(gl);
+ setEnv(target);
+ return () => target.dispose();
+ }, [gl]);
+ const materials = useMemo(() => (env ? courierMaterials(env.texture) : null), [env]);
+ useEffect(() => () => { for (const m of materials?.all ?? []) m.dispose(); }, [materials]);
+ const levels = useMemo(() => {
+ if (!materials) return null;
+ const dressed = gltfs.map((g) => dress(g.scene, materials));
+ const l = new LOD();
+ l.addLevel(dressed[0].root, 0);
+ l.addLevel(dressed[1].root, 70);
+ l.addLevel(dressed[2].root, 170);
+ return { lod: l, gear: dressed.flatMap((lvl) => lvl.gear) };
+ }, [gltfs, materials]);
+
+ // Keyed on the pad's numbers, not its object: every rebuilt floor plan (a new agent, a team change) passes a new
+ // one, and that must neither rebuild the city's colliders nor end a flight.
+ const padRef = useRef(pad);
+ padRef.current = pad;
+ const { minX, maxX, minZ, maxZ } = layout.bounds;
+ const hx = pad.ship.x, hz = pad.ship.z, hh = pad.ship.heading, padR = pad.pad.r;
+ const home = useMemo(() => ({ x: hx, z: hz, heading: hh }), [hx, hz, hh]);
+ const world = useMemo(() => {
+ const bounds = { minX, maxX, minZ, maxZ };
+ return buildCourierWorld(planCity(bounds), bounds, padRef.current);
+ }, [minX, maxX, minZ, maxZ, hx, hz, padR]);
+ const state = useRef<FlightState>(parkedState(home));
+ const ship = useRef<Group>(null);
+
+ // Effects.
+ const flameGeometry = useMemo(() => new ConeGeometry(0.75, 1, 18, 1, true).rotateX(Math.PI / 2).translate(0, 0, 0.5), []);
+ const flameMaterial = useMemo(() => new ShaderMaterial({
+ uniforms: { uTime: { value: 0 }, uPower: { value: 0 } }, vertexShader: FLAME_VERTEX, fragmentShader: FLAME_FRAGMENT,
+ transparent: true, depthWrite: false, blending: AdditiveBlending, side: DoubleSide,
+ }), []);
+ const shieldGeometry = useMemo(() => new SphereGeometry(1, 40, 20), []);
+ const shieldMaterial = useMemo(() => new ShaderMaterial({
+ uniforms: { uTime: { value: 0 }, uStrength: { value: 0 } }, vertexShader: SHIELD_VERTEX, fragmentShader: SHIELD_FRAGMENT,
+ transparent: true, depthWrite: false, blending: AdditiveBlending,
+ }), []);
+ const trails = useMemo(() => [new Trail(), new Trail()], []);
+ const trailMaterial = useMemo(() => new ShaderMaterial({ ...TRAIL_MATERIAL_SOURCE, transparent: true, depthWrite: false, blending: AdditiveBlending, side: DoubleSide }), []);
+ const dust = useMemo(() => {
+ const geometry = new BufferGeometry();
+ geometry.setAttribute("position", new BufferAttribute(new Float32Array(DUST_COUNT * 3), 3));
+ const material = new ShaderMaterial({
+ uniforms: { uSize: { value: 220 } },
+ vertexShader: /* glsl */ `attribute float aLife; uniform float uSize; varying float vLife; void main() { vLife = aLife; vec4 mv = modelViewMatrix * vec4(position, 1.0); gl_PointSize = uSize * (0.4 + aLife) / -mv.z; gl_Position = projectionMatrix * mv; }`,
+ fragmentShader: /* glsl */ `varying float vLife; void main() { vec2 q = gl_PointCoord * 2.0 - 1.0; float a = exp(-dot(q, q) * 3.0) * vLife * 0.35; gl_FragColor = vec4(vec3(0.62, 0.6, 0.66) * a, 1.0); }`,
+ transparent: true, depthWrite: false, blending: AdditiveBlending,
+ });
+ geometry.setAttribute("aLife", new BufferAttribute(new Float32Array(DUST_COUNT), 1));
+ return { geometry, material, velocity: new Float32Array(DUST_COUNT * 3), life: new Float32Array(DUST_COUNT), next: 0, alive: 0 };
+ }, []);
+ useEffect(() => () => {
+ flameGeometry.dispose(); flameMaterial.dispose(); shieldGeometry.dispose(); shieldMaterial.dispose(); trailMaterial.dispose();
+ for (const t of trails) t.geometry.dispose();
+ dust.geometry.dispose(); dust.material.dispose();
+ }, [flameGeometry, flameMaterial, shieldGeometry, shieldMaterial, trails, trailMaterial, dust]);
+ const flames = useRef<(Mesh | null)[]>([]);
+ const shield = useRef<Mesh>(null);
+ const light = useRef<PointLight>(null);
+
+ // Flight session: held keys, gamepad presses, the sound, the camera's own smoothing.
+ const flying = useCourier((s) => s.flying);
+ // The keys and the sound belong to a flight on screen: another section or a hidden window gets its keys back.
+ const live = flying && awake;
+ const held = useRef(new Set<string>());
+ const padPressed = useRef(new Set<number>());
+ const sound = useRef<CourierEngineSound | null>(null);
+ const camPos = useRef(new Vector3());
+ const camVel = useRef(new Vector3());
+ const camPrev = useRef(new Vector3());
+ const telemetryClock = useRef(0);
+ const lastImpact = useRef(0);
+ const landRequest = useCourier((s) => s.landRequest);
+ const exitRequest = useCourier((s) => s.exitRequest);
+
+ // The model is on the pad: from now on the person can board.
+ useEffect(() => {
+ if (!levels) return;
+ useCourier.getState().setReady(true);
+ return () => useCourier.getState().setReady(false);
+ }, [levels]);
+
+ /** The office camera's lens again, after the flight's wider one. */
+ const restoreCamera = () => {
+ camera.fov = CAMERA_FOV; camera.near = 0.2; camera.updateProjectionMatrix();
+ for (const t of trails) t.clear();
+ };
+ const leaveShip = () => {
+ // Step out beside the hatch, facing the ship; the office camera takes over again.
+ const { board } = padRef.current;
+ playerBody.x = board.x; playerBody.z = board.z; playerBody.heading = board.facing;
+ playerBody.path = []; playerBody.moving = false;
+ restoreCamera();
+ useCourier.getState().disembark();
+ useOfficeStore.getState().setFollow(true);
+ };
+ const leaveRef = useRef(leaveShip);
+ leaveRef.current = leaveShip;
+
+ useEffect(() => {
+ if (landRequest > 0) engageAutopilot(state.current);
+ }, [landRequest]);
+ useEffect(() => {
+ if (exitRequest > 0 && state.current.landed && courierSession.flying) leaveRef.current();
+ }, [exitRequest]);
+
+ useEffect(() => {
+ if (!live) return;
+ camPos.current.copy(camera.position);
+ camPrev.current.copy(camera.position);
+ let engine: CourierEngineSound | null = null;
+ try {
+ engine = new CourierEngineSound();
+ engine.resume();
+ } catch (error) {
+ // No Web Audio (an old engine, a locked-down WebView): the flight goes on in silence.
+ console.warn("courier sound unavailable", error);
+ }
+ sound.current = engine;
+ const press = (action: FlightAction) => {
+ const store = useCourier.getState();
+ const s = state.current;
+ if (action === "assist") store.setPrefs({ assist: store.assist === "arcade" ? "simulation" : "arcade" });
+ else if (action === "camera") store.setPrefs({ view: store.view === "chase" ? "cockpit" : "chase" });
+ else if (action === "land") engageAutopilot(s);
+ else if (action === "help") store.set({ helpOpen: !store.helpOpen });
+ else if (action === "exit" && s.landed) leaveRef.current();
+ };
+ const down = (event: KeyboardEvent) => {
+ const store = useCourier.getState();
+ // Escape opens and closes the flight settings, wherever focus sits in them.
+ if (event.key === "Escape") {
+ store.set({ settingsOpen: !store.settingsOpen });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if (ownsKeyboard(event.target) || store.settingsOpen) return;
+ // A modifier is a binding of its own (Ctrl sinks by default); held with another key it is a shortcut.
+ const isModifier = /^(Control|Alt|Meta|OS)/.test(event.code);
+ if (!isModifier && (event.ctrlKey || event.metaKey || event.altKey)) return;
+ const action = FLIGHT_ACTIONS.find((a) => store.bindings[a].includes(event.code));
+ // E is "use" everywhere in the office: standing on the pad, it also steps out.
+ if (event.code === "KeyE" && state.current.landed && !event.repeat) { leaveRef.current(); event.preventDefault(); event.stopPropagation(); return; }
+ if (!action) return;
+ event.preventDefault();
+ event.stopPropagation();
+ if (PRESS_ACTIONS.has(action)) { if (!event.repeat) press(action); return; }
+ held.current.add(event.code);
+ };
+ const up = (event: KeyboardEvent) => { held.current.delete(event.code); };
+ const blur = () => held.current.clear();
+ window.addEventListener("keydown", down, true);
+ window.addEventListener("keyup", up, true);
+ window.addEventListener("blur", blur);
+ pressHandler.current = press;
+ return () => {
+ window.removeEventListener("keydown", down, true);
+ window.removeEventListener("keyup", up, true);
+ window.removeEventListener("blur", blur);
+ held.current.clear();
+ engine?.close();
+ sound.current = null;
+ pressHandler.current = null;
+ };
+ }, [live, camera]);
+ const pressHandler = useRef<((action: FlightAction) => void) | null>(null);
+
+ // Leaving the floor or the map mid-flight: the ship is parked again, the person stands beside it, the lens is
+ // the office's again.
+ useEffect(() => () => {
+ if (courierSession.flying) leaveRef.current();
+ }, []);
+
+ useEffect(() => {
+ if (!import.meta.env.DEV || typeof window === "undefined") return;
+ // Dev-only: the live flight state, for runtime checks of the effects and the camera.
+ Object.assign(window, { __courier: { state: () => state.current, store: useCourier } });
+ }, []);
+
+ const _v = useMemo(() => ({ a: new Vector3(), b: new Vector3(), c: new Vector3(), f: new Vector3(), u: new Vector3(), side: new Vector3(), dir: new Vector3(), cam: new Vector3() }), []);
+
+ useFrame(({ clock }, rawDt) => {
+ const g = ship.current;
+ if (!g || !awake) return;
+ const dt = Math.min(rawDt, 0.1);
+ const s = state.current;
+ const store = useCourier.getState();
+ if (flying) {
+ // Gamepad: the first connected pad, its press buttons on their rising edge.
+ let gamepad: PadState | null = null;
+ try {
+ const pads = typeof navigator !== "undefined" && navigator.getGamepads ? navigator.getGamepads() : [];
+ for (const p of pads) if (p && p.connected) { gamepad = p; break; }
+ } catch (error) {
+ // A permissions policy may forbid gamepads; the keyboard still flies. Said once, not every frame.
+ if (!gamepadWarned.current) { console.warn("gamepads unavailable", error); gamepadWarned.current = true; }
+ }
+ if (gamepad) {
+ for (const [button, action] of PAD_PRESSES) {
+ const isDown = gamepad.buttons[button]?.pressed ?? false;
+ if (isDown && !padPressed.current.has(button)) pressHandler.current?.(action);
+ if (isDown) padPressed.current.add(button); else padPressed.current.delete(button);
+ }
+ }
+ const input = store.settingsOpen ? NO_INPUT : flightInput(held.current, store.bindings, gamepad, store.invertPitch);
+ stepFlight(s, input, dt, store.assist, world, home);
+ if (s.impact > lastImpact.current + 6 && sound.current) sound.current.impact(s.impact);
+ lastImpact.current = s.impact;
+ flyCamera(dt, input.boost && s.charge > 0.02);
+ sound.current?.update({
+ throttle: s.throttle, boost: input.boost && s.charge > 0.02,
+ ship: s.p, shipVelocity: s.v, listener: camera.position, listenerVelocity: camVel.current,
+ forward: _v.f.set(0, 0, -1).applyQuaternion(camera.quaternion), up: _v.u.set(0, 1, 0).applyQuaternion(camera.quaternion),
+ inside: store.view === "cockpit", volume: store.volume,
+ });
+ telemetryClock.current += dt;
+ if (telemetryClock.current > 0.12) {
+ telemetryClock.current = 0;
+ const overDeck = heightOverDeck(s, home);
+ store.set({
+ telemetry: {
+ speed: s.v.length(), throttle: s.throttle, charge: s.charge,
+ altitude: Number.isFinite(overDeck) ? Math.max(0, overDeck) : s.p.y - world.ground,
+ overPad: Number.isFinite(overDeck), landed: s.landed, autopilot: s.autopilot,
+ canLand: !s.landed && !s.autopilot,
+ },
+ });
+ }
+ } else if (!s.landed || s.p.distanceToSquared(_v.a.set(home.x, COURIER.standHeight, home.z)) > 1e-4) {
+ // Not flown (stepped out, or left mid-air by a floor change): back on the pad.
+ state.current = parkedState(home);
+ }
+
+ // Place the ship and dress it for its state.
+ const st = state.current;
+ g.position.copy(st.p);
+ g.quaternion.copy(st.q);
+ if (levels) for (const { node, y } of levels.gear) node.position.y = y + (1 - st.gear) * MODEL.gearTravel;
+ const power = st.landed ? 0.12 : 0.25 + st.throttle * 0.75;
+ materials?.glow.color.setRGB(0.25 + power * 0.6, 0.55 + power * 0.45, 1).multiplyScalar(0.6 + power * 1.8);
+ flameMaterial.uniforms.uTime.value = reduced ? 0 : clock.elapsedTime;
+ flameMaterial.uniforms.uPower.value = st.landed ? 0 : 0.35 + st.throttle * 0.9;
+ for (const f of flames.current) if (f) f.scale.set(1, 1, st.landed ? 0.01 : 2 + st.throttle * 7);
+ if (light.current) light.current.intensity = st.landed ? 0 : 10 + st.throttle * 50;
+ shieldMaterial.uniforms.uTime.value = clock.elapsedTime;
+ shieldMaterial.uniforms.uStrength.value = st.shield;
+ if (shield.current) shield.current.visible = st.shield > 0.01;
+ if (flying) updateTrails(dt);
+ if (flying || dust.alive > 0) updateDust(dt);
+ });
+ const gamepadWarned = useRef(false);
+
+ function flyCamera(dt: number, boosting: boolean) {
+ const s = state.current, store = useCourier.getState();
+ const f = forwardOf(s.q, _v.f), u = _v.u.set(0, 1, 0).applyQuaternion(s.q);
+ if (store.view === "cockpit") {
+ camera.position.copy(s.p).addScaledVector(u, COCKPIT.up).addScaledVector(f, -COCKPIT.forward);
+ camera.quaternion.copy(s.q);
+ // The chase camera starts from here when the pilot switches back.
+ camPos.current.copy(camera.position);
+ } else {
+ // Behind the tail and above it, looking past the nose.
+ const want = _v.a.copy(s.p).addScaledVector(f, -CHASE.back).add(_v.b.set(0, CHASE.up, 0));
+ // Never through a tower: pull in to just short of whatever stands between the ship and the camera.
+ const from = _v.b.copy(s.p).add(_v.c.set(0, 2, 0));
+ const dir = _v.c.copy(want).sub(from);
+ const reach = dir.length();
+ dir.normalize();
+ const free = rayDistance(world, from, dir, reach);
+ if (free < reach) want.copy(from).addScaledVector(dir, Math.max(2, free - 1.5));
+ camPos.current.lerp(want, 1 - Math.exp(-CHASE.stiffness * dt));
+ camera.position.copy(camPos.current);
+ camera.up.set(0, 1, 0);
+ camera.lookAt(_v.b.copy(s.p).addScaledVector(f, CHASE.lookAhead).addScaledVector(u, 1.5));
+ }
+ // The listener's own speed, for the Doppler shift: measured before any shake.
+ camVel.current.copy(camera.position).sub(camPrev.current).divideScalar(Math.max(dt, 1e-3));
+ camPrev.current.copy(camera.position);
+ if (store.view === "chase" && !reduced && s.impact > 4) {
+ camera.position.add(_v.b.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).multiplyScalar(s.impact * 0.02));
+ }
+ const fov = boosting ? FLIGHT_FOV.boost : FLIGHT_FOV.cruise;
+ camera.fov += (fov - camera.fov) * Math.min(1, dt * 3);
+ camera.near = 0.3;
+ camera.far = 1400;
+ camera.updateProjectionMatrix();
+ }
+
+ function updateTrails(dt: number) {
+ const s = state.current;
+ const strength = Math.max(0, Math.min(1, (s.v.length() - FLIGHT.cruise * 0.6) / (FLIGHT.cruise * 0.6)));
+ for (let i = 0; i < MODEL.tails.length; i += 1) {
+ const tail = MODEL.tails[i];
+ const tip = _v.a.set(tail[0], tail[1], tail[2]).multiplyScalar(COURIER.scale).applyQuaternion(s.q).add(s.p);
+ trails[i].update(tip, strength, dt, camera.position, _v);
+ }
+ }
+
+ function updateDust(dt: number) {
+ const s = state.current;
+ const pos = dust.geometry.getAttribute("position") as BufferAttribute;
+ const life = dust.geometry.getAttribute("aLife") as BufferAttribute;
+ const above = heightOverDeck(s, home);
+ // Thrust washing over the deck while the ship is low and not standing still on it.
+ const wash = flying && !s.landed && above < 16 ? (1 - above / 16) : 0;
+ const spawn = reduced ? 0 : Math.floor(wash * 90 * dt * 10);
+ for (let k = 0; k < spawn; k += 1) {
+ const i = dust.next; dust.next = (dust.next + 1) % DUST_COUNT;
+ const a = Math.random() * Math.PI * 2, r = 2 + Math.random() * 3;
+ pos.setXYZ(i, s.p.x + Math.cos(a) * r, 0.2, s.p.z + Math.sin(a) * r);
+ const speed = 6 + Math.random() * 8;
+ dust.velocity[i * 3] = Math.cos(a) * speed; dust.velocity[i * 3 + 1] = 0.6 + Math.random() * 1.4; dust.velocity[i * 3 + 2] = Math.sin(a) * speed;
+ dust.life[i] = 1;
+ }
+ let alive = 0;
+ for (let i = 0; i < DUST_COUNT; i += 1) {
+ if (dust.life[i] <= 0) { life.setX(i, 0); continue; }
+ alive += 1;
+ dust.life[i] = Math.max(0, dust.life[i] - dt * 0.8);
+ pos.setXYZ(i, pos.getX(i) + dust.velocity[i * 3] * dt, pos.getY(i) + dust.velocity[i * 3 + 1] * dt, pos.getZ(i) + dust.velocity[i * 3 + 2] * dt);
+ dust.velocity[i * 3] *= 1 - dt * 0.9; dust.velocity[i * 3 + 2] *= 1 - dt * 0.9;
+ life.setX(i, dust.life[i]);
+ }
+ dust.alive = alive;
+ pos.needsUpdate = true;
+ life.needsUpdate = true;
+ }
+
+ if (!levels) return null;
+ return (
+ <>
+ <group ref={ship} name={COURIER_GROUP} visible>
+ <group scale={COURIER.scale}>
+ <primitive object={levels.lod} />
+ {MODEL.exhausts.map((p, i) => (
+ <mesh key={i} ref={(m) => { flames.current[i] = m; }} geometry={flameGeometry} material={flameMaterial} position={p} renderOrder={6} frustumCulled={false} />
+ ))}
+ <pointLight ref={light} position={[0, 0, 14]} color="#7fd8ff" distance={40} decay={2} intensity={0} />
+ <mesh ref={shield} geometry={shieldGeometry} material={shieldMaterial} scale={MODEL.shield as unknown as [number, number, number]} visible={false} renderOrder={7} />
+ </group>
+ </group>
+ {trails.map((t, i) => <mesh key={i} geometry={t.geometry} material={trailMaterial} frustumCulled={false} renderOrder={5} />)}
+ <points geometry={dust.geometry} material={dust.material} frustumCulled={false} renderOrder={5} />
+ </>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/SkyPadStructure.tsx b/jarvis/ui/web/frontend/src/components/society/office/SkyPadStructure.tsx
new file mode 100644
index 0000000000..f893ac1c5d
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/SkyPadStructure.tsx
@@ -0,0 +1,156 @@
+/**
+ * The sky pad's structure (skyPad.ts has its plan): the bridge that carries
+ * the boulevard out through the east windows, the round landing deck with its
+ * markings, a ring of light round its rim, four light masts, glass rails, and
+ * the steel that holds it all out from the tower. The deck and the bridge take
+ * clicks like the floor, so the person can walk out by pointing.
+ */
+import { useEffect, useMemo, useRef } from "react";
+import { useFrame, type ThreeEvent } from "@react-three/fiber";
+import { CylinderGeometry, MeshBasicMaterial, MeshStandardMaterial, RingGeometry, type Mesh } from "three";
+import { cachedCanvasTexture } from "./canvasMaterials";
+import { Box, GEO, matte, Railing } from "./OfficeFurniture";
+import type { Rect } from "./officeLayout";
+import { SKY_PAD, type SkyPad } from "./skyPad";
+
+const PAD_PAINT = {
+ deck: "#1d2129",
+ seam: "#2b313b",
+ ring: "#d4a94e",
+ mark: "#e8ecf2",
+ glow: "#5fe3ff",
+} as const;
+
+let deckTop: MeshStandardMaterial | null = null;
+/** The deck's face: graphite plates, the gold landing circle, the chevrons that lead in and the touchdown cross. */
+function deckMaterial(): MeshStandardMaterial {
+ if (deckTop) return deckTop;
+ const map = cachedCanvasTexture("skypad:deck", 1024, 1024, (ctx, w, h) => {
+ const c = w / 2;
+ ctx.fillStyle = PAD_PAINT.deck;
+ ctx.fillRect(0, 0, w, h);
+ // Plates: a radial and ring pattern of thin seams.
+ ctx.strokeStyle = PAD_PAINT.seam;
+ ctx.lineWidth = 3;
+ for (let r = 90; r < c; r += 90) { ctx.beginPath(); ctx.arc(c, c, r, 0, Math.PI * 2); ctx.stroke(); }
+ for (let i = 0; i < 24; i += 1) {
+ const a = (i / 24) * Math.PI * 2;
+ ctx.beginPath(); ctx.moveTo(c + Math.cos(a) * 90, c + Math.sin(a) * 90); ctx.lineTo(c + Math.cos(a) * c, c + Math.sin(a) * c); ctx.stroke();
+ }
+ // The landing circle and an inner ring, in gold.
+ ctx.strokeStyle = PAD_PAINT.ring;
+ ctx.lineWidth = 16;
+ ctx.beginPath(); ctx.arc(c, c, c * 0.78, 0, Math.PI * 2); ctx.stroke();
+ ctx.lineWidth = 6;
+ ctx.beginPath(); ctx.arc(c, c, c * 0.7, 0, Math.PI * 2); ctx.stroke();
+ // Chevrons on four sides, pointing in.
+ ctx.fillStyle = PAD_PAINT.mark;
+ for (let i = 0; i < 4; i += 1) {
+ ctx.save();
+ ctx.translate(c, c);
+ ctx.rotate((i * Math.PI) / 2);
+ for (let k = 0; k < 3; k += 1) {
+ const y = c * 0.86 + k * 26;
+ ctx.beginPath(); ctx.moveTo(-34, y + 14); ctx.lineTo(0, y - 6); ctx.lineTo(34, y + 14); ctx.lineTo(34, y + 24); ctx.lineTo(0, y + 4); ctx.lineTo(-34, y + 24); ctx.closePath(); ctx.fill();
+ }
+ ctx.restore();
+ }
+ // The touchdown mark: a thin cross with a ring.
+ ctx.strokeStyle = PAD_PAINT.mark;
+ ctx.lineWidth = 8;
+ ctx.beginPath(); ctx.moveTo(c - 70, c); ctx.lineTo(c + 70, c); ctx.moveTo(c, c - 70); ctx.lineTo(c, c + 70); ctx.stroke();
+ ctx.lineWidth = 5;
+ ctx.beginPath(); ctx.arc(c, c, 46, 0, Math.PI * 2); ctx.stroke();
+ });
+ deckTop = new MeshStandardMaterial({ color: map ? "#ffffff" : PAD_PAINT.deck, map, roughness: 0.55, metalness: 0.35 });
+ return deckTop;
+}
+
+const STEEL = matte("#2a2e35", { roughness: 0.4, metalness: 0.6 });
+const GOLD = matte("#c39a4a", { roughness: 0.3, metalness: 0.85 });
+const BRIDGE_DECK = matte("#262b33", { roughness: 0.6, metalness: 0.3 });
+const GLOW = new MeshBasicMaterial({ color: PAD_PAINT.glow, toneMapped: false });
+const LAMP = new MeshBasicMaterial({ color: "#fff3d6", toneMapped: false });
+
+const SEGMENTS = 64;
+
+/** The rim's glass rail as straight runs round the disc, open where the bridge arrives. */
+function rimRuns(pad: SkyPad): [[number, number], [number, number]][] {
+ const { x, z, r } = pad.pad;
+ const rr = r - 0.25, half = SKY_PAD.bridgeWidth / 2 + 0.3;
+ const runs: [[number, number], [number, number]][] = [];
+ const count = 28;
+ for (let i = 0; i < count; i += 1) {
+ const a0 = (i / count) * Math.PI * 2, a1 = ((i + 1) / count) * Math.PI * 2;
+ const p0: [number, number] = [x + Math.cos(a0) * rr, z + Math.sin(a0) * rr], p1: [number, number] = [x + Math.cos(a1) * rr, z + Math.sin(a1) * rr];
+ // The bridge comes in from the west (the building's side).
+ const westOfRim = (p: [number, number]) => p[0] < x && Math.abs(p[1] - z) < half + 0.6;
+ if (westOfRim(p0) || westOfRim(p1)) continue;
+ runs.push([p0, p1]);
+ }
+ return runs;
+}
+
+export function SkyPadStructure({ pad, bounds, reduced, onFloorClick }: {
+ pad: SkyPad; bounds: Rect; reduced: boolean; onFloorClick: (event: ThreeEvent<MouseEvent>) => void;
+}) {
+ const { x, z, r } = pad.pad;
+ const deckGeometry = useMemo(() => new CylinderGeometry(r, r * 0.94, SKY_PAD.thickness, SEGMENTS), [r]);
+ const glowGeometry = useMemo(() => new RingGeometry(r - 0.12, r + 0.05, SEGMENTS * 2).rotateX(-Math.PI / 2), [r]);
+ const runs = useMemo(() => rimRuns(pad), [pad]);
+ const glow = useRef<Mesh>(null);
+ useFrame(({ clock }) => {
+ // The rim's light breathes slowly; with reduced motion it simply stays on.
+ if (glow.current && !reduced) (glow.current.material as MeshBasicMaterial).opacity = 0.75 + 0.25 * Math.sin(clock.elapsedTime * 1.4);
+ });
+ const glowMaterial = useMemo(() => {
+ const m = GLOW.clone();
+ m.transparent = true;
+ return m;
+ }, []);
+ useEffect(() => () => { deckGeometry.dispose(); glowGeometry.dispose(); glowMaterial.dispose(); }, [deckGeometry, glowGeometry, glowMaterial]);
+ const bridgeX0 = bounds.maxX, bridgeX1 = x - r + 0.6;
+ const bridgeLength = bridgeX1 - bridgeX0, bridgeMid = (bridgeX0 + bridgeX1) / 2;
+ const masts = [Math.PI / 4, (3 * Math.PI) / 4, (5 * Math.PI) / 4, (7 * Math.PI) / 4].map((a) => [x + Math.cos(a) * (r - 0.9), z + Math.sin(a) * (r - 0.9)] as const);
+ return (
+ <group>
+ {/* The bridge: deck, gold kerbs, glass rails and the girder under it. */}
+ <mesh geometry={GEO.box} material={BRIDGE_DECK} position={[bridgeMid, -0.25, z]} scale={[bridgeLength, 0.5, SKY_PAD.bridgeWidth]} receiveShadow onClick={onFloorClick} />
+ {[-1, 1].map((side) => (
+ <group key={side}>
+ <Box size={[bridgeLength, 0.08, 0.16]} position={[bridgeMid, 0.04, z + side * (SKY_PAD.bridgeWidth / 2 - 0.08)]} material={GOLD} cast={false} />
+ <Railing from={[bridgeX0 + 0.1, z + side * (SKY_PAD.bridgeWidth / 2 - 0.2)]} to={[bridgeX1, z + side * (SKY_PAD.bridgeWidth / 2 - 0.2)]} />
+ </group>
+ ))}
+ <Box size={[bridgeLength, 1.4, 1.2]} position={[bridgeMid, -1.2, z]} material={STEEL} cast={false} />
+
+ {/* The deck: its painted face on top, steel round its edge, a gold band at its lip. */}
+ <mesh geometry={deckGeometry} material={STEEL} position={[x, -SKY_PAD.thickness / 2, z]} receiveShadow />
+ <mesh position={[x, 0.004, z]} rotation={[-Math.PI / 2, 0, 0]} receiveShadow onClick={onFloorClick} material={deckMaterial()}>
+ <circleGeometry args={[r - 0.05, SEGMENTS]} />
+ </mesh>
+ <mesh ref={glow} geometry={glowGeometry} material={glowMaterial} position={[x, 0.012, z]} />
+ {runs.map(([from, to], i) => <Railing key={i} from={from} to={to} height={0.9} />)}
+
+ {/* Four light masts round the rim: glowing lamps, no light sources (a light per mast would cost every lit
+ material of the floor a recompile on arrival and a share of every pixel). */}
+ {masts.map(([mx, mz], i) => (
+ <group key={i} position={[mx, 0, mz]}>
+ <mesh geometry={GEO.cyl} material={STEEL} position={[0, 1.6, 0]} scale={[0.09, 3.2, 0.09]} />
+ <mesh geometry={GEO.box} material={LAMP} position={[0, 3.25, 0]} scale={[0.36, 0.14, 0.36]} />
+ </group>
+ ))}
+
+ {/* The cantilever: two raking struts from under the deck back into the tower, and a ring beam under the rim. */}
+ {[-1, 1].map((side) => {
+ const fromX = x - r * 0.3, fromZ = z + side * r * 0.45, toX = bounds.maxX - 0.15, toZ = z + side * 5, drop = 22;
+ const dx = toX - fromX, dz = toZ - fromZ, length = Math.hypot(dx, drop, dz);
+ return (
+ <mesh key={side} geometry={GEO.box} material={STEEL} position={[(fromX + toX) / 2, -SKY_PAD.thickness - drop / 2, (fromZ + toZ) / 2]}
+ rotation={[0, -Math.atan2(dz, dx), Math.atan2(-drop, Math.hypot(dx, dz))]} scale={[length, 0.9, 0.9]} />
+ );
+ })}
+ <mesh geometry={GEO.cyl} material={STEEL} position={[x, -SKY_PAD.thickness - 1.2, z]} scale={[r * 0.55, 2.4, r * 0.55]} />
+ </group>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/campusLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/campusLayout.ts
index 496bf3dbcc..5fdf30019d 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/campusLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/campusLayout.ts
@@ -41,6 +41,7 @@ import {
type OfficeAgentInput, type OfficeLayout, type OfficeTeamInput, type Point, type Rect, type Room, type RoomKind,
type Spot, type SpotKind, type SpotPose, type Studio, type WallSegment,
} from "./officeLayout";
+import { skyPadFor } from "./skyPad";
/**
* The campus grid, in metres. A cell holds one studio; two cells stand
@@ -399,11 +400,12 @@ export function buildCampusLayout(agents: readonly OfficeAgentInput[], teams: re
}
// ------------------------------------------------------ streets and plaza
- // An olive tree closes every street at both windows.
+ // An olive tree closes every street at both windows, except the main boulevard's east end: it runs on as the
+ // bridge to the sky pad.
const streetZ = [northMaxZ + CAMPUS.street / 2, ...rowZ.map((z, r) => (r === plazaAfter ? plazaZ : z + rowDepth[r] + CAMPUS.street / 2))];
streetZ.forEach((z, i) => {
add(olive(`olive-west-${i}`, planMinX - 0.8, z));
- add(olive(`olive-east-${i}`, planMaxX + 0.8, z));
+ if (z !== plazaZ) add(olive(`olive-east-${i}`, planMaxX + 0.8, z));
});
rowZ.forEach((z, r) => {
const z1 = z + rowDepth[r], zc = (z + z1) / 2;
@@ -629,6 +631,18 @@ export function buildCampusLayout(agents: readonly OfficeAgentInput[], teams: re
piece("spawn-terminal", "spawnTerminal", "floor", plaza.x, plaza.z),
);
+ // ---------------------------------------------------------------- the sky pad
+ const floor: Rect = {
+ // The navigation grid starts at this corner. Desks stand on a 0.85 m raster from their studio's centre, so
+ // the place beside a chair would fall exactly on a cell boundary for every other cluster width; an eighth
+ // of a cell keeps all of them clear of one.
+ minX: planMinX - FLOOR_EDGE + RAIL_CLEARANCE - GRID_NUDGE, maxX: planMaxX + FLOOR_EDGE - RAIL_CLEARANCE,
+ minZ: topZ - FLOOR_EDGE + RAIL_CLEARANCE, maxZ: bottomZ + FLOOR_EDGE - RAIL_CLEARANCE,
+ };
+ const bounds: Rect = { minX: planMinX - FLOOR_EDGE, maxX: planMaxX + FLOOR_EDGE, minZ: topZ - FLOOR_EDGE, maxZ: bottomZ + FLOOR_EDGE };
+ // The main boulevard runs on through the east windows as a bridge to the landing platform.
+ const skyPad = skyPadFor(bounds, floor, plazaZ);
+
// ------------------------------------------------------------- checkpoints
const elevator = furniture.find((f) => f.id === "elevator")!;
// The spawn point's ring surrounds the terminal; "walk there" and newcomers stand south of it, facing the screen.
@@ -648,6 +662,8 @@ export function buildCampusLayout(agents: readonly OfficeAgentInput[], teams: re
{ id: "break", room: "break", x: barX, z: bz0 + 2.0, radius: 1.6 },
// The elevator's doors face east into the lobby; its checkpoint is the floor in front of them.
{ id: "elevator", room: "reception", x: elevator.x + 0.95, z: elevator.z, radius: 1.0 },
+ // Out on the sky pad, beside the courier's hatch.
+ { id: "ship", room: "floor", x: skyPad.board.x, z: skyPad.board.z, radius: 1.6 },
];
// --------------------------------------------------------------- obstacles
@@ -669,6 +685,8 @@ export function buildCampusLayout(agents: readonly OfficeAgentInput[], teams: re
...rooms.filter((r) => !r.walled).flatMap(archPosts).map((p) => ({
minX: p.x - ARCH.post / 2, maxX: p.x + ARCH.post / 2, minZ: p.z - ARCH.post / 2, maxZ: p.z + ARCH.post / 2,
})),
+ // The courier on its pad.
+ skyPad.shipRect,
];
return {
@@ -677,14 +695,6 @@ export function buildCampusLayout(agents: readonly OfficeAgentInput[], teams: re
rooms, walls, furniture, spots, checkpoints, obstacles,
// The person starts in front of the elevator.
spawn: { x: rx0 + 1.4, z: bottomZ - 2.6 },
- arrival,
- floor: {
- // The navigation grid starts at this corner. Desks stand on a 0.85 m raster from their studio's centre, so
- // the place beside a chair would fall exactly on a cell boundary for every other cluster width; an eighth
- // of a cell keeps all of them clear of one.
- minX: planMinX - FLOOR_EDGE + RAIL_CLEARANCE - GRID_NUDGE, maxX: planMaxX + FLOOR_EDGE - RAIL_CLEARANCE,
- minZ: topZ - FLOOR_EDGE + RAIL_CLEARANCE, maxZ: bottomZ + FLOOR_EDGE - RAIL_CLEARANCE,
- },
- bounds: { minX: planMinX - FLOOR_EDGE, maxX: planMaxX + FLOOR_EDGE, minZ: topZ - FLOOR_EDGE, maxZ: bottomZ + FLOOR_EDGE },
+ arrival, floor, bounds, skyPad,
};
}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/cityShaders.ts b/jarvis/ui/web/frontend/src/components/society/office/cityShaders.ts
index 83cd65b137..e624cc19da 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/cityShaders.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/cityShaders.ts
@@ -512,9 +512,13 @@ export function skyMaterial(uniforms: CityUniforms): ShaderMaterial {
vec3 dir = normalize(vWorld - cameraPosition);
vec3 col = skyAt(dir);
// Faint stars above the horizon only.
- vec2 cellS = floor(vec2(atan(dir.z, dir.x) * 220.0, dir.y * 220.0));
- float star = step(0.9965, hash12(cellS)) * smoothstep(0.02, 0.2, dir.y);
- col += vec3(star) * 0.5;
+ // A star is a small dot inside some of the cells of a grid over the sky, never the whole cell.
+ vec2 sky = vec2(atan(dir.z, dir.x) * 220.0, dir.y * 220.0);
+ vec2 cellS = floor(sky);
+ vec2 inCell = fract(sky) - 0.5 - (vec2(hash12(cellS + 3.1), hash12(cellS + 7.7)) - 0.5) * 0.6;
+ float dot_ = 1.0 - smoothstep(0.04, 0.12, length(inCell));
+ float star = step(0.9965, hash12(cellS)) * dot_ * smoothstep(0.02, 0.2, dir.y) * (0.4 + 0.6 * hash12(cellS + 1.3));
+ col += vec3(star) * 0.9;
gl_FragColor = vec4(col, 1.0);
${OUTPUT}
}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierAudio.ts b/jarvis/ui/web/frontend/src/components/society/office/courierAudio.ts
new file mode 100644
index 0000000000..baa4479584
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierAudio.ts
@@ -0,0 +1,183 @@
+/**
+ * The courier's engine sound, synthesised (no audio files): a low hum and a
+ * filtered rush that rise with the throttle, a hiss for the boost, a thud on
+ * impact. It is placed in space at the ship and heard from the camera, so it
+ * pans with the view; its pitch shifts with the speed between the two
+ * (Doppler); in the cockpit a low-pass makes it the muffled inside of the hull.
+ *
+ * The audio context starts on boarding (a key press or a click, so the
+ * browser allows it) and is closed again on leaving the ship.
+ */
+const SPEED_OF_SOUND = 343;
+
+export interface EngineFrame {
+ throttle: number;
+ boost: boolean;
+ /** Ship and listener positions and velocities, world metres and metres per second. */
+ ship: { x: number; y: number; z: number };
+ shipVelocity: { x: number; y: number; z: number };
+ listener: { x: number; y: number; z: number };
+ listenerVelocity: { x: number; y: number; z: number };
+ /** The listener's forward and up, for the panning. */
+ forward: { x: number; y: number; z: number };
+ up: { x: number; y: number; z: number };
+ inside: boolean;
+ volume: number;
+}
+
+/** The pitch factor heard for a source moving relative to a listener (classic Doppler, clamped). */
+export function dopplerFactor(frame: Pick<EngineFrame, "ship" | "shipVelocity" | "listener" | "listenerVelocity">): number {
+ const dx = frame.ship.x - frame.listener.x, dy = frame.ship.y - frame.listener.y, dz = frame.ship.z - frame.listener.z;
+ const d = Math.hypot(dx, dy, dz);
+ if (d < 1e-3) return 1;
+ const ux = dx / d, uy = dy / d, uz = dz / d;
+ // Speeds along the line from listener to source; positive = moving away from the other.
+ const source = frame.shipVelocity.x * ux + frame.shipVelocity.y * uy + frame.shipVelocity.z * uz;
+ const listener = frame.listenerVelocity.x * ux + frame.listenerVelocity.y * uy + frame.listenerVelocity.z * uz;
+ const factor = (SPEED_OF_SOUND + listener) / (SPEED_OF_SOUND + source);
+ return Math.min(1.6, Math.max(0.6, factor));
+}
+
+export class CourierEngineSound {
+ private ctx: AudioContext;
+ private master!: GainNode;
+ private panner!: PannerNode;
+ private muffle!: BiquadFilterNode;
+ private hum!: OscillatorNode;
+ private hum2!: OscillatorNode;
+ private humGain!: GainNode;
+ private rushFilter!: BiquadFilterNode;
+ private rushGain!: GainNode;
+ private hissGain!: GainNode;
+
+ constructor() {
+ const Ctx = window.AudioContext ?? (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext;
+ const ctx = new Ctx();
+ this.ctx = ctx;
+ try {
+ this.build(ctx);
+ } catch (error) {
+ // Half a graph is no use: close the context so it does not linger, and let the caller go on in silence.
+ void ctx.close().catch((closeError) => console.warn("courier sound context did not close", closeError));
+ throw error;
+ }
+ }
+
+ private build(ctx: AudioContext): void {
+ this.master = ctx.createGain();
+ this.master.gain.value = 0;
+ this.muffle = ctx.createBiquadFilter();
+ this.muffle.type = "lowpass";
+ this.muffle.frequency.value = 18000;
+ this.panner = ctx.createPanner();
+ this.panner.panningModel = "HRTF";
+ this.panner.distanceModel = "inverse";
+ this.panner.refDistance = 12;
+ this.panner.rolloffFactor = 0.8;
+ this.panner.connect(this.muffle).connect(this.master).connect(ctx.destination);
+
+ // The hum: two detuned oscillators, a saw and a square an octave up.
+ this.humGain = ctx.createGain();
+ this.humGain.gain.value = 0;
+ const humFilter = ctx.createBiquadFilter();
+ humFilter.type = "lowpass";
+ humFilter.frequency.value = 900;
+ this.hum = ctx.createOscillator();
+ this.hum.type = "sawtooth";
+ this.hum.frequency.value = 48;
+ this.hum2 = ctx.createOscillator();
+ this.hum2.type = "square";
+ this.hum2.frequency.value = 97;
+ this.hum.connect(humFilter);
+ this.hum2.connect(humFilter);
+ humFilter.connect(this.humGain).connect(this.panner);
+
+ // The rush and the boost's hiss: one looping noise buffer, two filters.
+ const noise = ctx.createBufferSource();
+ const buffer = ctx.createBuffer(1, ctx.sampleRate * 2, ctx.sampleRate);
+ const data = buffer.getChannelData(0);
+ for (let i = 0; i < data.length; i += 1) data[i] = Math.random() * 2 - 1;
+ noise.buffer = buffer;
+ noise.loop = true;
+ this.rushFilter = ctx.createBiquadFilter();
+ this.rushFilter.type = "bandpass";
+ this.rushFilter.Q.value = 0.7;
+ this.rushGain = ctx.createGain();
+ this.rushGain.gain.value = 0;
+ noise.connect(this.rushFilter).connect(this.rushGain).connect(this.panner);
+ const hissFilter = ctx.createBiquadFilter();
+ hissFilter.type = "highpass";
+ hissFilter.frequency.value = 3500;
+ this.hissGain = ctx.createGain();
+ this.hissGain.gain.value = 0;
+ noise.connect(hissFilter).connect(this.hissGain).connect(this.panner);
+
+ this.hum.start();
+ this.hum2.start();
+ noise.start();
+ }
+
+ update(frame: EngineFrame): void {
+ const t = this.ctx.currentTime, glide = 0.08;
+ const doppler = dopplerFactor(frame);
+ const th = frame.throttle;
+ this.master.gain.setTargetAtTime(frame.volume * 0.5, t, 0.3);
+ this.hum.frequency.setTargetAtTime((44 + th * 40) * doppler, t, glide);
+ this.hum2.frequency.setTargetAtTime((89 + th * 82) * doppler, t, glide);
+ this.humGain.gain.setTargetAtTime(0.18 + th * 0.22, t, glide);
+ this.rushFilter.frequency.setTargetAtTime((300 + th * 1400) * doppler, t, glide);
+ this.rushGain.gain.setTargetAtTime(0.05 + th * 0.35, t, glide);
+ this.hissGain.gain.setTargetAtTime(frame.boost ? 0.16 : 0, t, 0.15);
+ this.muffle.frequency.setTargetAtTime(frame.inside ? 700 : 18000, t, 0.2);
+ setPosition(this.panner, frame.ship, t);
+ const l = this.ctx.listener;
+ if (l.positionX) {
+ l.positionX.setTargetAtTime(frame.listener.x, t, 0.03);
+ l.positionY.setTargetAtTime(frame.listener.y, t, 0.03);
+ l.positionZ.setTargetAtTime(frame.listener.z, t, 0.03);
+ l.forwardX.setTargetAtTime(frame.forward.x, t, 0.03);
+ l.forwardY.setTargetAtTime(frame.forward.y, t, 0.03);
+ l.forwardZ.setTargetAtTime(frame.forward.z, t, 0.03);
+ l.upX.setTargetAtTime(frame.up.x, t, 0.03);
+ l.upY.setTargetAtTime(frame.up.y, t, 0.03);
+ l.upZ.setTargetAtTime(frame.up.z, t, 0.03);
+ } else {
+ // Older engines: the deprecated setters.
+ l.setPosition(frame.listener.x, frame.listener.y, frame.listener.z);
+ l.setOrientation(frame.forward.x, frame.forward.y, frame.forward.z, frame.up.x, frame.up.y, frame.up.z);
+ }
+ }
+
+ /** A thud for an impact of this speed (m/s); the master gain already carries the pilot's volume. */
+ impact(speed: number): void {
+ const t = this.ctx.currentTime;
+ const osc = this.ctx.createOscillator();
+ const gain = this.ctx.createGain();
+ osc.type = "triangle";
+ osc.frequency.setValueAtTime(90, t);
+ osc.frequency.exponentialRampToValueAtTime(30, t + 0.4);
+ gain.gain.setValueAtTime(Math.min(0.8, speed / 40), t);
+ gain.gain.exponentialRampToValueAtTime(0.001, t + 0.5);
+ osc.connect(gain).connect(this.muffle);
+ osc.start(t);
+ osc.stop(t + 0.55);
+ }
+
+ resume(): void {
+ if (this.ctx.state === "suspended") void this.ctx.resume().catch((error) => console.warn("courier sound could not start", error));
+ }
+
+ close(): void {
+ void this.ctx.close().catch((error) => console.warn("courier sound did not close cleanly", error));
+ }
+}
+
+function setPosition(panner: PannerNode, p: { x: number; y: number; z: number }, t: number) {
+ if (panner.positionX) {
+ panner.positionX.setTargetAtTime(p.x, t, 0.03);
+ panner.positionY.setTargetAtTime(p.y, t, 0.03);
+ panner.positionZ.setTargetAtTime(p.z, t, 0.03);
+ } else {
+ panner.setPosition(p.x, p.y, p.z);
+ }
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts b/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts
new file mode 100644
index 0000000000..3ef9c6ae3b
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts
@@ -0,0 +1,116 @@
+/**
+ * The courier's controls: the actions a pilot has, their default keys, the
+ * pilot's own rebinding (kept in this browser), and how held keys and a
+ * gamepad become one FlightInput. Pure and tested.
+ */
+import type { FlightInput } from "./courierFlight";
+
+export const FLIGHT_ACTIONS = [
+ "throttleUp", "throttleDown", "pitchUp", "pitchDown", "yawLeft", "yawRight", "rollLeft", "rollRight",
+ "liftUp", "liftDown", "boost", "brake", "assist", "camera", "land", "exit", "help",
+] as const;
+export type FlightAction = (typeof FLIGHT_ACTIONS)[number];
+
+/** Continuous actions are read while held; the rest fire once per press. */
+export const PRESS_ACTIONS: ReadonlySet<FlightAction> = new Set(["assist", "camera", "land", "exit", "help"]);
+
+export type FlightBindings = Record<FlightAction, string[]>;
+
+export const DEFAULT_BINDINGS: FlightBindings = {
+ throttleUp: ["KeyW"], throttleDown: ["KeyS"],
+ pitchUp: ["ArrowDown"], pitchDown: ["ArrowUp"],
+ yawLeft: ["KeyA"], yawRight: ["KeyD"],
+ rollLeft: ["KeyQ", "ArrowLeft"], rollRight: ["KeyE", "ArrowRight"],
+ liftUp: ["Space"], liftDown: ["KeyC", "ControlLeft"],
+ boost: ["ShiftLeft", "ShiftRight"], brake: ["KeyX"],
+ assist: ["KeyT"], camera: ["KeyV"], land: ["KeyL"], exit: ["KeyF"], help: ["KeyH"],
+};
+
+const STORAGE_KEY = "dodaios.verse.courier.bindings";
+
+/** The pilot's bindings: the defaults with whatever this browser remembers laid over them. */
+export function loadBindings(storage: Pick<Storage, "getItem"> | null = safeStorage()): FlightBindings {
+ const out: FlightBindings = { ...DEFAULT_BINDINGS };
+ try {
+ const raw = storage?.getItem(STORAGE_KEY);
+ if (!raw) return out;
+ const saved = JSON.parse(raw) as Partial<Record<string, unknown>>;
+ for (const action of FLIGHT_ACTIONS) {
+ const keys = saved[action];
+ if (Array.isArray(keys) && keys.every((k) => typeof k === "string")) out[action] = keys as string[];
+ }
+ } catch (error) {
+ // A corrupt entry falls back to the defaults; the pilot can rebind again.
+ console.warn("courier bindings unreadable, using the defaults", error);
+ }
+ return out;
+}
+
+export function saveBindings(bindings: FlightBindings, storage: Pick<Storage, "setItem"> | null = safeStorage()): void {
+ try {
+ storage?.setItem(STORAGE_KEY, JSON.stringify(bindings));
+ } catch (error) {
+ // Private windows and blocked storage keep the binding for this visit only.
+ console.warn("courier bindings not saved", error);
+ }
+}
+
+function safeStorage(): Storage | null {
+ try {
+ return typeof window !== "undefined" ? window.localStorage : null;
+ } catch {
+ return null; // Storage access itself can throw where site data is blocked; then nothing is remembered.
+ }
+}
+
+/** Bind `code` to `action` alone: it leaves every other action it was on, and replaces the action's keys. */
+export function rebind(bindings: FlightBindings, action: FlightAction, code: string): FlightBindings {
+ const out = {} as FlightBindings;
+ for (const a of FLIGHT_ACTIONS) out[a] = bindings[a].filter((k) => k !== code);
+ out[action] = [code];
+ return out;
+}
+
+/** A key code as a pilot reads it ("KeyW" → "W", "ArrowUp" → "↑", "ShiftLeft" → "Shift"). */
+export function keyLabel(code: string): string {
+ if (code.startsWith("Key")) return code.slice(3);
+ if (code.startsWith("Digit")) return code.slice(5);
+ const named: Record<string, string> = {
+ ArrowUp: "↑", ArrowDown: "↓", ArrowLeft: "←", ArrowRight: "→", Space: "Space",
+ ShiftLeft: "Shift", ShiftRight: "Shift", ControlLeft: "Ctrl", ControlRight: "Ctrl", AltLeft: "Alt", AltRight: "Alt",
+ };
+ return named[code] ?? code;
+}
+
+/** The subset of a Gamepad this module reads (standard mapping). */
+export interface PadState { axes: readonly number[]; buttons: readonly { value: number; pressed: boolean }[] }
+
+const DEAD_ZONE = 0.15;
+function stick(v: number | undefined): number {
+ const x = v ?? 0;
+ return Math.abs(x) < DEAD_ZONE ? 0 : (x - Math.sign(x) * DEAD_ZONE) / (1 - DEAD_ZONE);
+}
+
+/**
+ * One FlightInput from the held keys and an optional gamepad: left stick pitch and yaw, right stick roll and
+ * lift, the triggers the throttle, A boost, B brake. Keys and pad add up and are clamped.
+ */
+export function flightInput(held: ReadonlySet<string>, bindings: FlightBindings, pad: PadState | null, invertPitch: boolean): FlightInput {
+ const on = (action: FlightAction) => (bindings[action].some((k) => held.has(k)) ? 1 : 0);
+ const axis = (plus: FlightAction, minus: FlightAction) => on(plus) - on(minus);
+ const b = (i: number) => pad?.buttons[i]?.value ?? 0;
+ const clamp = (v: number) => Math.max(-1, Math.min(1, v));
+ const pitch = clamp(axis("pitchUp", "pitchDown") + stick(pad?.axes[1]));
+ return {
+ throttle: clamp(axis("throttleUp", "throttleDown") + b(7) - b(6)),
+ pitch: invertPitch ? -pitch : pitch,
+ yaw: clamp(axis("yawRight", "yawLeft") + stick(pad?.axes[0])),
+ roll: clamp(axis("rollRight", "rollLeft") + stick(pad?.axes[2])),
+ lift: clamp(axis("liftUp", "liftDown") - stick(pad?.axes[3])),
+ boost: on("boost") === 1 || (pad?.buttons[0]?.pressed ?? false),
+ brake: on("brake") === 1 || (pad?.buttons[1]?.pressed ?? false),
+ };
+}
+
+/** Gamepad buttons that fire a press action: X lands, Y switches the camera, Back the assist, Start leaves the ship. */
+export const PAD_PRESSES: readonly [number, FlightAction][] = [[2, "land"], [3, "camera"], [8, "assist"], [9, "exit"]];
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts
new file mode 100644
index 0000000000..c547ef0bc5
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts
@@ -0,0 +1,203 @@
+import { describe, expect, it } from "vitest";
+import { Vector3 } from "three";
+import { GROUND_Y, planCity } from "./cityPlan";
+import { DEFAULT_BINDINGS, flightInput, keyLabel, loadBindings, rebind, saveBindings } from "./courierControls";
+import { engageAutopilot, FLIGHT, forwardOf, NO_INPUT, parkedState, stepFlight, type FlightInput, type FlightState } from "./courierFlight";
+import { buildCourierWorld, rayDistance, sphereContact } from "./courierWorld";
+import { buildOfficeLayout } from "./officeLayout";
+import { buildNavGrid, findPath, isWalkable, randomWalkablePoint } from "./officeNav";
+import { COURIER, onSkyPad } from "./skyPad";
+
+const staff = Array.from({ length: 8 }, (_, i) => ({ agentId: `a${i}`, name: `Agent ${i}`, tier: "specialist" as const, providerLabel: "x", state: "idle" as const, createdMs: i }));
+const layout = buildOfficeLayout(staff);
+const pad = layout.skyPad!;
+const world = buildCourierWorld(planCity(layout.bounds), layout.bounds, pad);
+const home = pad.ship;
+
+function fly(s: FlightState, input: Partial<FlightInput>, seconds: number, assist: "arcade" | "simulation" = "arcade") {
+ for (let t = 0; t < seconds; t += 1 / 60) stepFlight(s, { ...NO_INPUT, ...input }, 1 / 60, assist, world, home);
+ return s;
+}
+
+describe("the sky pad", () => {
+ it("stands out of the agents floor's east side on the boulevard's line, outside the slab", () => {
+ expect(pad.pad.x - pad.pad.r).toBeGreaterThan(layout.bounds.maxX);
+ expect(pad.gap.minZ).toBeGreaterThan(layout.bounds.minZ);
+ expect(pad.gap.maxZ).toBeLessThan(layout.bounds.maxZ);
+ // The courier fits on the deck.
+ expect(Math.hypot(COURIER.span / 2, COURIER.length / 2)).toBeLessThan(pad.pad.r);
+ });
+
+ it("is walkable from the floor to the hatch, and its courier is solid", () => {
+ const grid = buildNavGrid(layout);
+ expect(isWalkable(grid, pad.board)).toBe(true);
+ expect(onSkyPad(pad, { x: pad.pad.x, z: pad.pad.z })).toBe(true);
+ expect(isWalkable(grid, { x: pad.pad.x, z: pad.pad.z })).toBe(false);
+ // Off the rim and beside the bridge is air.
+ expect(isWalkable(grid, { x: pad.pad.x + pad.pad.r + 1, z: pad.pad.z })).toBe(false);
+ expect(isWalkable(grid, { x: (layout.bounds.maxX + pad.bridge.maxX) / 2, z: pad.gap.maxZ + 2 })).toBe(false);
+ const path = findPath(grid, layout.spawn, pad.board);
+ expect(path).not.toBeNull();
+ expect(path!.length).toBeGreaterThan(1);
+ });
+
+ it("never sends an idle wanderer out onto the pad", () => {
+ const grid = buildNavGrid(layout);
+ let seed = 7;
+ const rng = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
+ for (let i = 0; i < 300; i += 1) {
+ const p = randomWalkablePoint(grid, rng)!;
+ expect(p.x).toBeLessThanOrEqual(layout.floor.maxX);
+ }
+ });
+
+ it("offers the courier as a checkpoint beside its hatch, nowhere else", () => {
+ const ship = layout.checkpoints.filter((c) => c.id === "ship");
+ expect(ship).toHaveLength(1);
+ expect(ship[0].x).toBeCloseTo(pad.board.x);
+ expect(buildOfficeLayout([]).skyPad).toBeDefined();
+ expect(buildOfficeLayout(staff, { variant: "coding" }).skyPad).toBeUndefined();
+ });
+});
+
+describe("the courier's world", () => {
+ it("is solid where the city is and free in the plaza's air", () => {
+ expect(sphereContact(world, pad.pad.x, 40, pad.pad.z, 2)).toBeNull();
+ expect(sphereContact(world, pad.pad.x, GROUND_Y + 1, pad.pad.z, 2)).not.toBeNull();
+ // Inside the office: pushed out.
+ const c = (layout.bounds.minX + layout.bounds.maxX) / 2;
+ expect(sphereContact(world, c, 1.5, (layout.bounds.minZ + layout.bounds.maxZ) / 2, 2)).not.toBeNull();
+ });
+
+ it("measures how far a ray runs before it meets the city", () => {
+ const down = rayDistance(world, { x: pad.pad.x, y: 50, z: pad.pad.z }, { x: 0, y: -1, z: 0 }, 1000);
+ expect(down).toBeCloseTo(50, 0);
+ });
+});
+
+describe("the courier's flight", () => {
+ it("stands on the pad until it is told to lift off, then climbs", () => {
+ const s = parkedState(home);
+ fly(s, {}, 1);
+ expect(s.landed).toBe(true);
+ expect(s.p.y).toBeCloseTo(COURIER.standHeight);
+ fly(s, { lift: 1 }, 2);
+ expect(s.landed).toBe(false);
+ expect(s.p.y).toBeGreaterThan(COURIER.standHeight + 5);
+ });
+
+ it("in arcade, flies where its nose points at the throttle's speed and levels its wings", () => {
+ const s = parkedState(home);
+ fly(s, { lift: 1 }, 3);
+ fly(s, { throttle: 1 }, 4);
+ fly(s, {}, 4);
+ const nose = forwardOf(s.q);
+ expect(s.v.length()).toBeGreaterThan(FLIGHT.cruise * 0.8);
+ expect(s.v.clone().normalize().dot(nose)).toBeGreaterThan(0.95);
+ // Wings level: the right wing's height is near zero.
+ expect(Math.abs(new Vector3(1, 0, 0).applyQuaternion(s.q).y)).toBeLessThan(0.1);
+ });
+
+ it("in simulation, keeps drifting the old way after a turn", () => {
+ const s = parkedState(home);
+ fly(s, { lift: 1 }, 3, "simulation");
+ fly(s, { throttle: 1 }, 3, "simulation");
+ fly(s, { throttle: -1 }, 2, "simulation");
+ const before = s.v.clone().normalize();
+ fly(s, { yaw: 1 }, 1.2, "simulation");
+ const nose = forwardOf(s.q);
+ // The nose turned, the velocity mostly did not.
+ expect(before.dot(nose)).toBeLessThan(0.9);
+ expect(s.v.clone().normalize().dot(before)).toBeGreaterThan(0.95);
+ });
+
+ it("boosts past cruise speed and spends its charge doing so", () => {
+ const s = parkedState(home);
+ fly(s, { lift: 1 }, 3);
+ fly(s, { throttle: 1, boost: true }, 3);
+ expect(s.v.length()).toBeGreaterThan(FLIGHT.cruise * 1.2);
+ expect(s.charge).toBeLessThan(0.6);
+ });
+
+ it("never passes through a tower, even at full boost, and flashes its shield", () => {
+ const s = parkedState(home);
+ const tower = planCity(layout.bounds).towers.find((t) => t.h > 120 && Math.hypot(t.x - home.x, t.z - home.z) > 150)!;
+ // Aim at the tower from 120 m out at its mid height.
+ const at = new Vector3(tower.x, GROUND_Y + tower.h / 2, tower.z);
+ s.landed = false;
+ s.p.set(tower.x + 120, at.y, tower.z);
+ s.q.setFromAxisAngle(new Vector3(0, 1, 0), Math.PI / 2);
+ s.throttle = 1;
+ let crossed = false, flashed = false;
+ for (let i = 0; i < 400; i += 1) {
+ stepFlight(s, { ...NO_INPUT, throttle: 1, boost: true }, 1 / 60, "simulation", world, home);
+ if (s.p.x < tower.x) crossed = true;
+ if (s.shield > 0.2) flashed = true;
+ }
+ expect(crossed).toBe(false);
+ expect(flashed).toBe(true);
+ });
+
+ it("lands itself on the pad from out over the city, gear down", () => {
+ const s = parkedState(home);
+ s.landed = false; s.gear = 0;
+ s.p.set(home.x + 200, 30, home.z - 150);
+ s.q.setFromAxisAngle(new Vector3(0, 1, 0), 2.1);
+ engageAutopilot(s);
+ for (let i = 0; i < 60 * 90 && !s.landed; i += 1) stepFlight(s, NO_INPUT, 1 / 60, "arcade", world, home);
+ expect(s.landed).toBe(true);
+ expect(s.p.distanceTo(new Vector3(home.x, COURIER.standHeight, home.z))).toBeLessThan(0.01);
+ expect(s.gear).toBeCloseTo(1, 1);
+ });
+
+ it("lands itself from deep in the city, under the pad and beside the tower too", () => {
+ for (const [dx, y, dz] of [[0, -60, 0], [-30, -120, 0], [180, -200, 90]] as const) {
+ const s = parkedState(home);
+ s.landed = false; s.gear = 0;
+ s.p.set(home.x + dx, y, home.z + dz);
+ engageAutopilot(s);
+ for (let i = 0; i < 60 * 150 && !s.landed; i += 1) stepFlight(s, NO_INPUT, 1 / 60, "arcade", world, home);
+ expect(s.landed, `from ${dx},${y},${dz}`).toBe(true);
+ }
+ });
+
+ it("lets an impact's shake and flash fade while it lands itself and while it stands", () => {
+ const s = parkedState(home);
+ s.impact = 40; s.shield = 1;
+ fly(s, {}, 2);
+ expect(s.impact).toBe(0);
+ expect(s.shield).toBe(0);
+ });
+
+ it("hands the controls back the moment the pilot touches them", () => {
+ const s = parkedState(home);
+ s.landed = false; s.p.set(home.x + 100, 40, home.z);
+ engageAutopilot(s);
+ stepFlight(s, { ...NO_INPUT, yaw: 1 }, 1 / 60, "arcade", world, home);
+ expect(s.autopilot).toBeNull();
+ });
+});
+
+describe("the courier's controls", () => {
+ it("reads held keys and a gamepad into one input", () => {
+ const input = flightInput(new Set(["KeyW", "KeyA"]), DEFAULT_BINDINGS, { axes: [0, 0, 0.9, 0], buttons: [{ value: 1, pressed: true }] }, false);
+ expect(input.throttle).toBe(1);
+ expect(input.yaw).toBe(-1);
+ expect(input.roll).toBeGreaterThan(0.8);
+ expect(input.boost).toBe(true);
+ // A resting stick inside the dead zone is nothing.
+ expect(flightInput(new Set(), DEFAULT_BINDINGS, { axes: [0.1, -0.1, 0, 0], buttons: [] }, false).yaw).toBe(0);
+ });
+
+ it("rebinds a key to one action and remembers it", () => {
+ const next = rebind(DEFAULT_BINDINGS, "boost", "KeyW");
+ expect(next.boost).toEqual(["KeyW"]);
+ expect(next.throttleUp).toEqual([]);
+ const store = new Map<string, string>();
+ saveBindings(next, { setItem: (k, v) => store.set(k, v) });
+ expect(loadBindings({ getItem: (k) => store.get(k) ?? null }).boost).toEqual(["KeyW"]);
+ expect(loadBindings({ getItem: () => "{broken" }).boost).toEqual(DEFAULT_BINDINGS.boost);
+ expect(keyLabel("KeyW")).toBe("W");
+ expect(keyLabel("ArrowUp")).toBe("↑");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts
new file mode 100644
index 0000000000..7196e49a9a
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts
@@ -0,0 +1,280 @@
+/**
+ * The courier's flight: a small rigid-body model with thrust, lift, pitch, yaw
+ * and roll, two assist modes, boost and brake, collisions with the city, and an
+ * autopilot that lands it on the sky pad. Pure and tested; the scene drives it
+ * once per frame (SkyCourier.tsx).
+ *
+ * Frame: the ship's nose is its local -z, its top +y, its right +x (as the
+ * exported model). Speeds are metres per second at the Verse's scale.
+ *
+ * - Arcade assist (the default): the ship flies where it points. Its velocity
+ * is pulled towards the nose times the throttle's speed, it banks into turns
+ * and levels itself when the stick is let go.
+ * - Simulation: Newtonian. Thrust accelerates along the nose, the ship keeps
+ * its momentum and drifts; only light rotational dampers help.
+ */
+import { Quaternion, Vector3 } from "three";
+import { sphereContact, type CourierWorld } from "./courierWorld";
+import { COURIER } from "./skyPad";
+
+export type FlightAssist = "arcade" | "simulation";
+
+export interface FlightInput {
+ /** -1..1: the throttle lever moves at its rate while held. */
+ throttle: number;
+ pitch: number;
+ yaw: number;
+ roll: number;
+ /** -1..1: vertical thrusters, up and down. */
+ lift: number;
+ boost: boolean;
+ brake: boolean;
+}
+
+export const NO_INPUT: FlightInput = { throttle: 0, pitch: 0, yaw: 0, roll: 0, lift: 0, boost: false, brake: false };
+
+export type AutopilotPhase = "approach" | "hover" | "descend";
+
+export interface FlightState {
+ p: Vector3;
+ v: Vector3;
+ q: Quaternion;
+ /** Body rates in radians per second: x pitch, y yaw, z roll. */
+ w: Vector3;
+ /** 0..1, the throttle lever. */
+ throttle: number;
+ /** 0 retracted .. 1 down. */
+ gear: number;
+ /** 0..1 boost charge, spent while boosting and recharged after. */
+ charge: number;
+ /** 0..1 shield flash after an impact, fading. */
+ shield: number;
+ /** Speed of the last impact (m/s), for the sound and the camera's shake; fades. */
+ impact: number;
+ landed: boolean;
+ autopilot: AutopilotPhase | null;
+ /** The autopilot's watch: the closest it came to its target, and how long it has gone without getting closer. */
+ apBest: number;
+ apStuck: number;
+}
+
+export const FLIGHT = {
+ cruise: 70,
+ boost: 150,
+ /** Thrust along the nose (m/s²) in simulation, and the boost's factor on it. */
+ thrust: 24,
+ boostFactor: 2.4,
+ lift: 14,
+ /** Body rate at full stick (rad/s): pitch, yaw, roll. */
+ rates: [1.1, 0.75, 1.9] as const,
+ /** How fast arcade pulls the velocity onto the nose (1/s), and the simulation's linear drag. */
+ grip: 1.7,
+ drag: 0.025,
+ /** The throttle lever's travel per second at full input. */
+ leverRate: 0.6,
+ /** Boost charge spent and regained per second. */
+ boostDrain: 0.22,
+ boostRecharge: 0.12,
+ /** Below this height over the deck the gear comes down. */
+ gearHeight: 14,
+ /** The autopilot's hover height above the pad, the speed it approaches with and how fast it sinks. */
+ hover: 16,
+ approach: 45,
+ sink: 3.2,
+ /** Over every roof of the city (the tallest far ones stay below +45 m) and over the office: the approach's height. */
+ safeHeight: 60,
+} as const;
+
+/** Collision spheres along the keel (local z, metres) and their radius. */
+export const KEEL = { offsets: [-6.2, -2.1, 2.1, 6.2], radius: 1.7 } as const;
+
+const _f = new Vector3(), _u = new Vector3(), _r = new Vector3(), _t = new Vector3(), _a = new Vector3(), _q = new Quaternion(), _s = new Vector3();
+
+/** A ship standing on the pad, nose along `heading` (0 = -z, turning towards -x as it grows). */
+export function parkedState(pad: { x: number; z: number; heading: number }): FlightState {
+ return {
+ p: new Vector3(pad.x, COURIER.standHeight, pad.z),
+ v: new Vector3(), q: new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), pad.heading), w: new Vector3(),
+ throttle: 0, gear: 1, charge: 1, shield: 0, impact: 0, landed: true, autopilot: null, apBest: Infinity, apStuck: 0,
+ };
+}
+
+export function forwardOf(q: Quaternion, out = new Vector3()): Vector3 {
+ return out.set(0, 0, -1).applyQuaternion(q);
+}
+
+function axes(q: Quaternion) {
+ forwardOf(q, _f);
+ _u.set(0, 1, 0).applyQuaternion(q);
+ _r.set(1, 0, 0).applyQuaternion(q);
+}
+
+/** Advance the flight by dt seconds (callers pass at most 0.1 s). */
+export function stepFlight(s: FlightState, raw: FlightInput, dt: number, assist: FlightAssist, world: CourierWorld,
+ pad: { x: number; z: number; heading: number }): FlightState {
+ let input = raw;
+ // The shield's flash and the impact fade in every state: flying, landing itself or standing on the pad.
+ s.shield = Math.max(0, s.shield - dt * 1.6);
+ s.impact = Math.max(0, s.impact - dt * 30);
+ if (s.autopilot) {
+ // Any stick or lever input hands the ship back to the pilot.
+ if (raw.throttle || raw.pitch || raw.yaw || raw.roll || raw.lift || raw.boost) s.autopilot = null;
+ else return autopilot(s, dt, world, pad);
+ }
+ if (s.landed) {
+ // Standing on the pad: only a lift or the throttle takes off.
+ if (input.lift > 0.1 || input.throttle > 0.1) { s.landed = false; s.v.set(0, 4, 0); }
+ else { s.v.set(0, 0, 0); s.w.set(0, 0, 0); s.throttle = 0; return s; }
+ }
+ s.throttle = Math.min(1, Math.max(0, s.throttle + input.throttle * FLIGHT.leverRate * dt));
+ if (input.brake) s.throttle = Math.max(0, s.throttle - 1.5 * dt);
+ const boosting = input.boost && s.charge > 0.02;
+ s.charge = Math.min(1, Math.max(0, s.charge + (boosting ? -FLIGHT.boostDrain : FLIGHT.boostRecharge) * dt));
+ axes(s.q);
+
+ // Rotation: body rates follow the stick (arcade snaps, simulation accelerates and is damped).
+ const target = _t.set(input.pitch * FLIGHT.rates[0], -input.yaw * FLIGHT.rates[1], -input.roll * FLIGHT.rates[2]);
+ if (assist === "arcade") {
+ // Bank into a turn, and level the wings when the stick is let go (the right wing's height is the bank).
+ const bank = Math.asin(Math.max(-1, Math.min(1, _r.y)));
+ const wanted = -input.yaw * 0.5;
+ if (!input.roll) target.z += (wanted - bank) * 2.2;
+ // Level the nose a little when no pitch is held, so the horizon comes back.
+ if (!input.pitch) target.x += -Math.asin(Math.max(-1, Math.min(1, _f.y))) * 0.6;
+ s.w.lerp(target, 1 - Math.exp(-8 * dt));
+ } else {
+ s.w.addScaledVector(_a.copy(target).sub(s.w), 1 - Math.exp(-3 * dt));
+ }
+ const turn = _q.setFromAxisAngle(_s.set(s.w.x, s.w.y, s.w.z).normalize(), s.w.length() * dt);
+ if (s.w.lengthSq() > 1e-10) s.q.multiply(turn).normalize();
+ axes(s.q);
+
+ // Translation.
+ const top = boosting ? FLIGHT.boost : FLIGHT.cruise;
+ if (assist === "arcade") {
+ const want = _t.copy(_f).multiplyScalar(s.throttle * top).addScaledVector(_u, input.lift * FLIGHT.lift);
+ s.v.lerp(want, 1 - Math.exp(-FLIGHT.grip * (boosting ? 1.4 : 1) * dt));
+ } else {
+ s.v.addScaledVector(_f, s.throttle * FLIGHT.thrust * (boosting ? FLIGHT.boostFactor : 1) * dt);
+ s.v.addScaledVector(_u, input.lift * FLIGHT.lift * dt);
+ s.v.multiplyScalar(Math.exp(-FLIGHT.drag * dt));
+ if (s.v.length() > FLIGHT.boost * 1.1) s.v.setLength(FLIGHT.boost * 1.1);
+ }
+ if (input.brake) s.v.multiplyScalar(Math.exp(-2.2 * dt));
+ move(s, dt, world);
+ steerHome(s, dt, world);
+ s.gear += ((heightOverDeck(s, pad) < FLIGHT.gearHeight ? 1 : 0) - s.gear) * Math.min(1, dt * 1.5);
+ return s;
+}
+
+/** Height of the ship's middle over the pad's deck while above it; Infinity elsewhere. */
+export function heightOverDeck(s: FlightState, pad: { x: number; z: number }): number {
+ return Math.hypot(s.p.x - pad.x, s.p.z - pad.z) < 30 ? s.p.y - COURIER.standHeight : Infinity;
+}
+
+/** Move by v·dt in sub-steps no longer than 1.5 m, pushing out of anything solid and bouncing off it. */
+function move(s: FlightState, dt: number, world: CourierWorld) {
+ const steps = Math.max(1, Math.ceil((s.v.length() * dt) / 1.5));
+ const h = dt / steps;
+ for (let i = 0; i < steps; i += 1) {
+ s.p.addScaledVector(s.v, h);
+ for (const offset of KEEL.offsets) {
+ _s.set(0, 0, offset).applyQuaternion(s.q).add(s.p);
+ const hit = sphereContact(world, _s.x, _s.y, _s.z, KEEL.radius);
+ if (!hit) continue;
+ s.p.x += hit.nx * hit.depth; s.p.y += hit.ny * hit.depth; s.p.z += hit.nz * hit.depth;
+ const into = s.v.x * hit.nx + s.v.y * hit.ny + s.v.z * hit.nz;
+ if (into < 0) {
+ // Bounce off with a little give, and lose speed along the surface too.
+ s.v.x -= 1.35 * into * hit.nx; s.v.y -= 1.35 * into * hit.ny; s.v.z -= 1.35 * into * hit.nz;
+ s.v.multiplyScalar(0.8);
+ s.shield = Math.min(1, s.shield + Math.min(1, -into / 25) + 0.15);
+ s.impact = Math.max(s.impact, -into);
+ }
+ }
+ }
+}
+
+/** Beyond the city's edge or above its ceiling the ship is turned back gently. */
+function steerHome(s: FlightState, dt: number, world: CourierWorld) {
+ const dx = s.p.x - world.centre.x, dz = s.p.z - world.centre.z, d = Math.hypot(dx, dz);
+ if (d > world.border) s.v.addScaledVector(_t.set(-dx / d, 0, -dz / d), (d - world.border) * 0.8 * dt);
+ if (s.p.y > world.ceiling) s.v.y -= (s.p.y - world.ceiling) * 0.8 * dt;
+}
+
+/** Start the autopilot that brings the ship home to the pad. */
+export function engageAutopilot(s: FlightState): void {
+ if (s.landed) return;
+ s.autopilot = "approach";
+ s.apBest = Infinity;
+ s.apStuck = 0;
+}
+
+/**
+ * The landing: climb to the safe height first, cross over to the pad there, come down to a hover point over it,
+ * turn to the pad's heading and sink onto the deck with the gear down. Collisions still count on the way. A watch
+ * notices when the ship stops getting closer (under the pad, against the tower) and sidesteps outwards before it
+ * climbs on.
+ */
+function autopilot(s: FlightState, dt: number, world: CourierWorld, pad: { x: number; z: number; heading: number }): FlightState {
+ const hover = _a.set(pad.x, COURIER.standHeight + FLIGHT.hover, pad.z);
+ const to = _t.copy(hover).sub(s.p);
+ const distance = to.length();
+ const flat = Math.hypot(to.x, to.z);
+ if (s.autopilot === "approach") {
+ if (distance < s.apBest - 0.5) { s.apBest = distance; s.apStuck = 0; } else s.apStuck += dt;
+ const want = _r;
+ if (s.apStuck > 4) {
+ // Stuck: out and away from the pad's middle (out from under it, off the tower's wall), then on again.
+ const out = _u.set(s.p.x - pad.x, 0, s.p.z - pad.z);
+ if (out.lengthSq() < 1) out.set(1, 0, 0);
+ want.copy(out.normalize()).multiplyScalar(18);
+ if (s.apStuck > 7) { s.apStuck = 0; s.apBest = distance; }
+ } else if (flat > 25 && s.p.y < FLIGHT.safeHeight - 3) {
+ // Climb first, barely moving sideways, so nothing of the city stands between the ship and the pad.
+ want.set(to.x, 0, to.z).normalize().multiplyScalar(3).add(_u.set(0, 22, 0));
+ } else if (flat > 25) {
+ // Across at the safe height.
+ want.set(to.x, 0, to.z).normalize().multiplyScalar(Math.min(FLIGHT.approach, flat * 0.7 + 2));
+ want.y = (FLIGHT.safeHeight - s.p.y) * 1.2;
+ } else {
+ want.copy(to).normalize().multiplyScalar(Math.min(FLIGHT.approach, distance * 0.7 + 2));
+ }
+ s.v.lerp(want, 1 - Math.exp(-1.5 * dt));
+ if (distance < 3 && s.v.length() < 4) s.autopilot = "hover";
+ } else {
+ s.v.lerp(_t.set(hover.x - s.p.x, 0, hover.z - s.p.z).multiplyScalar(1.5), 1 - Math.exp(-3 * dt));
+ if (s.autopilot === "hover") {
+ s.v.y += (hover.y - s.p.y) * 2 * dt - s.v.y * 2 * dt;
+ if (alignedTo(s, pad.heading) && flat < 1) s.autopilot = "descend";
+ } else {
+ const above = s.p.y - COURIER.standHeight;
+ s.v.y = -Math.min(FLIGHT.sink, Math.max(0.4, above * 0.6));
+ if (above < 0.05) {
+ s.p.set(pad.x, COURIER.standHeight, pad.z);
+ s.q.setFromAxisAngle(_s.set(0, 1, 0), pad.heading);
+ s.v.set(0, 0, 0); s.w.set(0, 0, 0);
+ s.landed = true; s.autopilot = null; s.throttle = 0; s.gear = 1;
+ return s;
+ }
+ }
+ }
+ // Turn to fly level towards the target (or to the pad's heading once there), wings level.
+ const heading = s.autopilot === "approach" && flat > 8 ? Math.atan2(-(hover.x - s.p.x), -(hover.z - s.p.z)) : pad.heading;
+ s.q.slerp(_q.setFromAxisAngle(_s.set(0, 1, 0), heading), 1 - Math.exp(-1.6 * dt));
+ s.w.set(0, 0, 0);
+ s.throttle += (Math.min(1, s.v.length() / FLIGHT.cruise) - s.throttle) * Math.min(1, dt * 2);
+ move(s, dt, world);
+ s.gear += ((heightOverDeck(s, pad) < FLIGHT.gearHeight ? 1 : 0) - s.gear) * Math.min(1, dt * 1.5);
+ return s;
+}
+
+function alignedTo(s: FlightState, heading: number): boolean {
+ const target = _q.setFromAxisAngle(_s.set(0, 1, 0), heading);
+ return s.q.angleTo(target) < 0.05;
+}
+
+/** Ground speed for the HUD (m/s). */
+export function speedOf(s: FlightState): number {
+ return s.v.length();
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierHud.css b/jarvis/ui/web/frontend/src/components/society/office/courierHud.css
new file mode 100644
index 0000000000..305bddef09
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierHud.css
@@ -0,0 +1,30 @@
+/* The courier's flight HUD: theme tokens only, so light and dark mode both read. */
+.courier-hud { position:absolute; z-index:40; left:50%; bottom:16px; transform:translateX(-50%); display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; padding:10px 14px; max-width:calc(100% - 28px); font-size:12px; }
+.courier-speed { position:relative; display:flex; align-items:baseline; gap:4px; min-width:92px; }
+.courier-speed strong { font-size:28px; font-weight:700; font-variant-numeric:tabular-nums; line-height:1; }
+.courier-speed span { color:hsl(var(--muted-foreground)); }
+.courier-speed-arc { position:absolute; left:0; right:0; bottom:-5px; height:3px; border-radius:2px; background:linear-gradient(90deg, hsl(var(--primary)) calc(var(--share) * 100%), hsl(var(--border)) 0); }
+.courier-readouts { display:flex; flex-direction:column; gap:4px; min-width:150px; }
+.courier-readouts strong { font-variant-numeric:tabular-nums; }
+.courier-meter { display:grid; grid-template-columns:62px 1fr; align-items:center; gap:6px; color:hsl(var(--muted-foreground)); }
+.courier-meter i { display:block; height:5px; border-radius:3px; background:hsl(var(--secondary)); overflow:hidden; }
+.courier-meter b { display:block; height:100%; background:hsl(var(--primary)); transition:width .12s linear; }
+.courier-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
+.courier-status { color:hsl(var(--muted-foreground)); }
+.courier-primary { background:hsl(var(--primary)); color:hsl(var(--primary-foreground)); border-color:transparent; }
+.courier-hud .office-hint { flex-basis:100%; }
+.courier-help { position:absolute; z-index:40; right:14px; bottom:16px; width:min(300px, calc(100% - 28px)); max-height:calc(100% - 120px); overflow:auto; padding:12px 14px; font-size:12px; }
+.courier-help dl { display:flex; flex-direction:column; gap:4px; margin:8px 0; }
+.courier-help dl > div { display:flex; justify-content:space-between; gap:12px; }
+.courier-help dt { color:hsl(var(--muted-foreground)); }
+.courier-help dd { margin:0; }
+.courier-help kbd { font:inherit; font-size:11px; padding:1px 6px; border:1px solid hsl(var(--border)); border-radius:5px; background:hsl(var(--background)); }
+.courier-settings { position:absolute; z-index:50; left:50%; top:50%; transform:translate(-50%, -50%); width:min(420px, calc(100% - 28px)); max-height:calc(100% - 40px); overflow:auto; display:flex; flex-direction:column; gap:10px; padding:14px 16px; font-size:13px; }
+.courier-settings-head { display:flex; justify-content:space-between; align-items:center; }
+.courier-settings-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
+.courier-settings-row input[type="range"] { flex:1; accent-color:hsl(var(--primary)); }
+.courier-settings-row input[type="checkbox"] { accent-color:hsl(var(--primary)); }
+.courier-bindings { display:grid; grid-template-columns:1fr; gap:4px; }
+.courier-binding { display:flex; justify-content:space-between; align-items:center; gap:10px; }
+.courier-binding span { color:hsl(var(--muted-foreground)); }
+@media (max-width:600px) { .courier-hud { bottom:10px; gap:8px; } .courier-help { display:none; } }
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts b/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts
new file mode 100644
index 0000000000..1a63ec20b3
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts
@@ -0,0 +1,111 @@
+/**
+ * The courier's session: whether the person is flying it, the pilot's choices
+ * (camera, assist, pitch, sound, key bindings) and what the HUD shows. The
+ * choices are per viewer and kept in this browser; the flight itself lives in
+ * the scene (SkyCourier.tsx) and publishes a telemetry snapshot a few times a
+ * second for the HUD.
+ */
+import { create } from "zustand";
+import { loadBindings, saveBindings, type FlightBindings } from "./courierControls";
+import type { AutopilotPhase, FlightAssist } from "./courierFlight";
+
+export type CourierView = "chase" | "cockpit";
+
+export interface CourierTelemetry {
+ speed: number;
+ throttle: number;
+ charge: number;
+ /** Metres over the pad's deck while above it, else over the street level. */
+ altitude: number;
+ overPad: boolean;
+ landed: boolean;
+ autopilot: AutopilotPhase | null;
+ /** Near enough the pad for the landing assist. */
+ canLand: boolean;
+}
+
+const PREFS_KEY = "dodaios.verse.courier.prefs";
+
+interface CourierPrefs { view: CourierView; assist: FlightAssist; invertPitch: boolean; volume: number }
+
+const DEFAULT_PREFS: CourierPrefs = { view: "chase", assist: "arcade", invertPitch: false, volume: 0.6 };
+
+function loadPrefs(): CourierPrefs {
+ try {
+ const raw = typeof window !== "undefined" ? window.localStorage.getItem(PREFS_KEY) : null;
+ if (!raw) return DEFAULT_PREFS;
+ const saved = JSON.parse(raw) as Partial<CourierPrefs>;
+ return {
+ view: saved.view === "cockpit" ? "cockpit" : "chase",
+ assist: saved.assist === "simulation" ? "simulation" : "arcade",
+ invertPitch: saved.invertPitch === true,
+ volume: typeof saved.volume === "number" ? Math.min(1, Math.max(0, saved.volume)) : DEFAULT_PREFS.volume,
+ };
+ } catch (error) {
+ console.warn("courier preferences unreadable, using the defaults", error);
+ return DEFAULT_PREFS;
+ }
+}
+
+function savePrefs(prefs: CourierPrefs) {
+ try {
+ window.localStorage.setItem(PREFS_KEY, JSON.stringify(prefs));
+ } catch (error) {
+ // Blocked storage keeps the choice for this visit only.
+ console.warn("courier preferences not saved", error);
+ }
+}
+
+interface CourierState extends CourierPrefs {
+ flying: boolean;
+ /** The ship stands loaded on its pad; boarding waits for it. */
+ ready: boolean;
+ bindings: FlightBindings;
+ helpOpen: boolean;
+ settingsOpen: boolean;
+ telemetry: CourierTelemetry;
+ /** Bumped when the pilot asks for the landing assist, or to step out, from the HUD (the keys act in the scene). */
+ landRequest: number;
+ exitRequest: number;
+ board: () => void;
+ disembark: () => void;
+ setPrefs: (patch: Partial<CourierPrefs>) => void;
+ setBindings: (bindings: FlightBindings) => void;
+ set: (patch: Partial<Pick<CourierState, "helpOpen" | "settingsOpen" | "telemetry">>) => void;
+ requestLanding: () => void;
+ requestExit: () => void;
+ setReady: (ready: boolean) => void;
+}
+
+const IDLE: CourierTelemetry = { speed: 0, throttle: 0, charge: 1, altitude: 0, overPad: true, landed: true, autopilot: null, canLand: false };
+
+export const useCourier = create<CourierState>((set, get) => ({
+ ...loadPrefs(),
+ flying: false,
+ ready: false,
+ bindings: loadBindings(),
+ helpOpen: false,
+ settingsOpen: false,
+ telemetry: IDLE,
+ landRequest: 0,
+ exitRequest: 0,
+ board: () => {
+ if (!get().ready) return;
+ courierSession.flying = true;
+ set({ flying: true, telemetry: IDLE });
+ },
+ disembark: () => { courierSession.flying = false; set({ flying: false, settingsOpen: false, helpOpen: false, telemetry: IDLE }); },
+ setPrefs: (patch) => {
+ set(patch);
+ const { view, assist, invertPitch, volume } = get();
+ savePrefs({ view, assist, invertPitch, volume });
+ },
+ setBindings: (bindings) => { saveBindings(bindings); set({ bindings }); },
+ set: (patch) => set(patch),
+ requestLanding: () => set((s) => ({ landRequest: s.landRequest + 1 })),
+ requestExit: () => set((s) => ({ exitRequest: s.exitRequest + 1 })),
+ setReady: (ready) => set({ ready }),
+}));
+
+/** Read every frame by the camera rig and the character: no subscription, no render. */
+export const courierSession = { flying: false };
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierWorld.ts b/jarvis/ui/web/frontend/src/components/society/office/courierWorld.ts
new file mode 100644
index 0000000000..2a63fd8720
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierWorld.ts
@@ -0,0 +1,165 @@
+/**
+ * What the courier can hit while it flies: every tower of the city, the
+ * Dodaios tower itself and the floor on top of it, the sky pad and its
+ * bridge, the street level, the singularity's core, and a soft border round
+ * the city. Pure and tested.
+ *
+ * The ship is a row of spheres along its keel (courierFlight.ts); a collider
+ * pushes each sphere out along the nearest surface normal. Towers are looked
+ * up in a coarse spatial hash, so a step costs a handful of box tests.
+ */
+import { GROUND_Y, SINGULARITY, type CityPlan } from "./cityPlan";
+import type { Rect } from "./officeLayout";
+import type { SkyPad } from "./skyPad";
+import { SKY_PAD } from "./skyPad";
+
+export interface Box3D { minX: number; maxX: number; minY: number; maxY: number; minZ: number; maxZ: number }
+
+export interface CourierWorld {
+ boxes: Box3D[];
+ /** Cell size of the spatial hash and the boxes in each cell (indices into `boxes`), keyed by `cellKey`. */
+ cell: number;
+ hash: Map<number, number[]>;
+ /** Per box, the query that last looked at it: a box in several cells is tested once per query, with no set. */
+ stamp: Int32Array;
+ query: number;
+ /** Spheres that cannot be entered (the singularity's core). */
+ spheres: { x: number; y: number; z: number; r: number }[];
+ ground: number;
+ /** The city's middle and the radius and height the ship is turned back at. */
+ centre: { x: number; z: number };
+ border: number;
+ ceiling: number;
+}
+
+export interface Contact { nx: number; ny: number; nz: number; depth: number }
+
+/** The floor and its window walls stand this high over the slab; the ship cannot fly through the office. */
+const OFFICE_HEIGHT = 4.2;
+const HASH_CELL = 40;
+
+/** One number per hash cell (the city spans far less than ±50 000 cells). */
+function cellKey(i: number, j: number): number {
+ return (i + 50_000) * 100_000 + (j + 50_000);
+}
+
+function addBox(world: CourierWorld, box: Box3D) {
+ const index = world.boxes.push(box) - 1;
+ for (let i = Math.floor(box.minX / world.cell); i <= Math.floor(box.maxX / world.cell); i += 1) {
+ for (let j = Math.floor(box.minZ / world.cell); j <= Math.floor(box.maxZ / world.cell); j += 1) {
+ const key = cellKey(i, j);
+ const list = world.hash.get(key);
+ if (list) list.push(index); else world.hash.set(key, [index]);
+ }
+ }
+}
+
+export function buildCourierWorld(plan: CityPlan, bounds: Rect, skyPad?: SkyPad): CourierWorld {
+ const world: CourierWorld = {
+ boxes: [], cell: HASH_CELL, hash: new Map(), stamp: new Int32Array(0), query: 0, spheres: [], ground: GROUND_Y,
+ centre: plan.centre, border: 760, ceiling: 420,
+ };
+ for (const t of plan.towers) {
+ // Prisms and spires are boxed by their full footprint whatever their turn; a tower is never thinner than that.
+ const half = Math.max(t.w, t.d) / 2;
+ addBox(world, { minX: t.x - half, maxX: t.x + half, minY: GROUND_Y, maxY: GROUND_Y + t.h, minZ: t.z - half, maxZ: t.z + half });
+ }
+ // The Dodaios tower and the floor on it, office and window walls included.
+ addBox(world, { ...bounds, minY: GROUND_Y, maxY: OFFICE_HEIGHT });
+ if (skyPad) {
+ const { pad, bridge } = skyPad;
+ addBox(world, { minX: bounds.maxX, maxX: bridge.maxX, minY: -SKY_PAD.thickness, maxY: 0, minZ: skyPad.gap.minZ, maxZ: skyPad.gap.maxZ });
+ // The pad's deck as the box inside its disc (the ship lands on its middle; the rim is open air).
+ const inner = pad.r * Math.SQRT1_2;
+ addBox(world, { minX: pad.x - inner, maxX: pad.x + inner, minY: -SKY_PAD.thickness, maxY: 0, minZ: pad.z - inner, maxZ: pad.z + inner });
+ }
+ world.spheres.push({ ...plan.singularity, r: SINGULARITY.core * 1.15 });
+ world.stamp = new Int32Array(world.boxes.length);
+ return world;
+}
+
+/** The one contact `sphereContact` hands out; callers read it before the next query. */
+const CONTACT: Contact = { nx: 0, ny: 0, nz: 0, depth: 0 };
+
+/**
+ * The deepest contact of a sphere with the world, or null when it is free. Runs a few dozen times a frame in
+ * flight, so it allocates nothing: the result is a shared object, valid until the next call.
+ */
+export function sphereContact(world: CourierWorld, x: number, y: number, z: number, r: number): Contact | null {
+ let found = false;
+ const consider = (nx: number, ny: number, nz: number, depth: number) => {
+ if (depth > 0 && (!found || depth > CONTACT.depth)) { CONTACT.nx = nx; CONTACT.ny = ny; CONTACT.nz = nz; CONTACT.depth = depth; found = true; }
+ };
+ // Street level.
+ consider(0, 1, 0, world.ground + r - y);
+ const query = ++world.query;
+ for (let i = Math.floor((x - r) / world.cell); i <= Math.floor((x + r) / world.cell); i += 1) {
+ for (let j = Math.floor((z - r) / world.cell); j <= Math.floor((z + r) / world.cell); j += 1) {
+ const list = world.hash.get(cellKey(i, j));
+ if (!list) continue;
+ for (const index of list) {
+ if (world.stamp[index] === query) continue;
+ world.stamp[index] = query;
+ const b = world.boxes[index];
+ const px = Math.max(b.minX, Math.min(x, b.maxX)), py = Math.max(b.minY, Math.min(y, b.maxY)), pz = Math.max(b.minZ, Math.min(z, b.maxZ));
+ const dx = x - px, dy = y - py, dz = z - pz;
+ const d = Math.hypot(dx, dy, dz);
+ if (d > 1e-6) {
+ if (d < r) consider(dx / d, dy / d, dz / d, r - d);
+ continue;
+ }
+ // The centre is inside the box: out through the nearest face.
+ let nx = -1, ny = 0, nz = 0, gap = x - b.minX;
+ if (b.maxX - x < gap) { nx = 1; ny = 0; nz = 0; gap = b.maxX - x; }
+ if (y - b.minY < gap) { nx = 0; ny = -1; nz = 0; gap = y - b.minY; }
+ if (b.maxY - y < gap) { nx = 0; ny = 1; nz = 0; gap = b.maxY - y; }
+ if (z - b.minZ < gap) { nx = 0; ny = 0; nz = -1; gap = z - b.minZ; }
+ if (b.maxZ - z < gap) { nx = 0; ny = 0; nz = 1; gap = b.maxZ - z; }
+ consider(nx, ny, nz, gap + r);
+ }
+ }
+ }
+ for (const s of world.spheres) {
+ const dx = x - s.x, dy = y - s.y, dz = z - s.z, d = Math.hypot(dx, dy, dz) || 1e-6;
+ consider(dx / d, dy / d, dz / d, s.r + r - d);
+ }
+ return found ? CONTACT : null;
+}
+
+/** How far along a ray (origin, unit direction) the first box lies, up to `max`; `max` when nothing is hit. */
+export function rayDistance(world: CourierWorld, o: { x: number; y: number; z: number }, d: { x: number; y: number; z: number }, max: number): number {
+ let best = max;
+ if (d.y < -1e-6) best = Math.min(best, (world.ground - o.y) / d.y);
+ const query = ++world.query;
+ const steps = Math.ceil(max / world.cell) + 1;
+ for (let s = 0; s <= steps; s += 1) {
+ const t = Math.min(max, s * world.cell);
+ const cx = Math.floor((o.x + d.x * t) / world.cell), cz = Math.floor((o.z + d.z * t) / world.cell);
+ for (let i = cx - 1; i <= cx + 1; i += 1) {
+ for (let j = cz - 1; j <= cz + 1; j += 1) {
+ for (const index of world.hash.get(cellKey(i, j)) ?? []) {
+ if (world.stamp[index] === query) continue;
+ world.stamp[index] = query;
+ const hit = rayBox(world.boxes[index], o, d);
+ if (hit !== null && hit < best) best = hit;
+ }
+ }
+ }
+ }
+ return Math.max(0, best);
+}
+
+function rayBox(b: Box3D, o: { x: number; y: number; z: number }, d: { x: number; y: number; z: number }): number | null {
+ let t0 = 0, t1 = Infinity;
+ for (const [origin, dir, lo, hi] of [[o.x, d.x, b.minX, b.maxX], [o.y, d.y, b.minY, b.maxY], [o.z, d.z, b.minZ, b.maxZ]] as const) {
+ if (Math.abs(dir) < 1e-9) {
+ if (origin < lo || origin > hi) return null;
+ } else {
+ let a = (lo - origin) / dir, c = (hi - origin) / dir;
+ if (a > c) [a, c] = [c, a];
+ t0 = Math.max(t0, a); t1 = Math.min(t1, c);
+ if (t0 > t1) return null;
+ }
+ }
+ return t0;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/minimap.ts b/jarvis/ui/web/frontend/src/components/society/office/minimap.ts
index eeef6c2096..4407e5320b 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/minimap.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/minimap.ts
@@ -10,6 +10,7 @@
* transforms, clamping, bearings, grid labels and hit-testing are unit-tested
* and the drawing takes any 2D context (an offscreen layer or a test recorder).
*/
+import type { SkyPad } from "./skyPad";
import { CHECKPOINT_GOLD, DEPARTMENT_TINTS, ROOM_FLOOR_COLOURS } from "./officePalette";
import {
FURNITURE_SIZE, allDesks, deskRect, footprint, roomAt,
@@ -393,9 +394,9 @@ export const STATE_RING: Record<MinimapAgentState, string> = {
};
/** Checkpoint icon per checkpoint kind, for the maps' gold badges. */
-export const CHECKPOINT_ICON_KEYS: Record<CheckpointKind, "spawn" | "plus" | "list" | "team" | "shirt" | "star" | "coffee" | "elevator" | "target" | "sparkle" | "trophy"> = {
+export const CHECKPOINT_ICON_KEYS: Record<CheckpointKind, "spawn" | "plus" | "list" | "team" | "shirt" | "star" | "coffee" | "elevator" | "target" | "sparkle" | "trophy" | "ship"> = {
spawn: "spawn", launch: "spawn", create: "plus", manage: "list", team: "team", wardrobe: "shirt", lead: "star", break: "coffee", elevator: "elevator", mission: "target",
- studio: "sparkle", levels: "trophy",
+ studio: "sparkle", levels: "trophy", ship: "ship",
};
/** Stroke-only icons in a 24 × 24 box. */
@@ -410,6 +411,7 @@ const ICON_PATHS: Record<(typeof CHECKPOINT_ICON_KEYS)[CheckpointKind], string>
elevator: "M5 3h14v18H5zM9 10l3-3 3 3M9 14l3 3 3-3",
target: "M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18zM12 8a4 4 0 1 1 0 8a4 4 0 1 1 0-8zM12 1v4M12 19v4M1 12h4M19 12h4",
sparkle: "M10 3l1.6 5.4L17 10l-5.4 1.6L10 17l-1.6-5.4L3 10l5.4-1.6zM18 14l.8 2.2L21 17l-2.2.8L18 20l-.8-2.2L15 17l2.2-.8z",
+ ship: "M12 2.5c3 2.6 4.4 6.4 4.4 10.4v4.6l-4.4 2.5-4.4-2.5v-4.6c0-4 1.4-7.8 4.4-10.4zM7.6 14l-3.1 3v3l3.1-1.5M16.4 14l3.1 3v3l-3.1-1.5M12 9.5h.01",
trophy: "M7 4h10v5a5 5 0 0 1-10 0V4zM7 6H4.5a2.5 2.5 0 0 0 2.6 3.6M17 6h2.5a2.5 2.5 0 0 1-2.6 3.6M12 14v3M8 20h8M9.5 17h5",
};
@@ -483,6 +485,7 @@ export function drawFloorArt(ctx: Ctx, layout: OfficeLayout, t: MapTransform, ar
ctx.strokeStyle = MAP_PAINT.slabEdge;
ctx.lineWidth = 1.5;
ctx.stroke();
+ if (layout.skyPad) drawSkyPad(ctx, layout.skyPad, t);
ctx.fillStyle = MAP_PAINT.floor;
rectPath(ctx, t, layout.floor, 0.4);
@@ -881,3 +884,33 @@ export function drawMapLabel(ctx: Ctx, text: string, x: number, y: number, px: n
ctx.fillStyle = MAP_PAINT.label;
ctx.fillText(text, x, y);
}
+
+/** The sky pad outside the east windows: its bridge, the deck with its gold landing circle, and the courier on it. */
+function drawSkyPad(ctx: CanvasRenderingContext2D, pad: SkyPad, t: MapTransform): void {
+ const deck = worldToMap(t, pad.pad), r = pad.pad.r * t.scale;
+ ctx.fillStyle = MAP_PAINT.slab;
+ const a = worldToMap(t, { x: pad.bridge.minX, z: pad.gap.minZ }), b = worldToMap(t, { x: pad.pad.x, z: pad.gap.maxZ });
+ ctx.fillRect(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.abs(b.x - a.x), Math.abs(b.y - a.y));
+ ctx.beginPath();
+ ctx.arc(deck.x, deck.y, r, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.strokeStyle = MAP_PAINT.slabEdge;
+ ctx.lineWidth = 1.5;
+ ctx.stroke();
+ ctx.strokeStyle = CHECKPOINT_GOLD.rim;
+ ctx.lineWidth = Math.max(1, t.scale * 0.25);
+ ctx.beginPath();
+ ctx.arc(deck.x, deck.y, r * 0.78, 0, Math.PI * 2);
+ ctx.stroke();
+ // The courier: a slim lozenge along its heading (north).
+ const nose = worldToMap(t, { x: pad.ship.x, z: pad.shipRect.minZ + 0.6 }), tail = worldToMap(t, { x: pad.ship.x, z: pad.shipRect.maxZ - 0.6 });
+ const half = ((pad.shipRect.maxX - pad.shipRect.minX) / 4) * t.scale;
+ ctx.fillStyle = "#d7dce4";
+ ctx.beginPath();
+ ctx.moveTo(nose.x, nose.y);
+ ctx.lineTo(nose.x + half, (nose.y + tail.y) / 2);
+ ctx.lineTo(tail.x, tail.y);
+ ctx.lineTo(nose.x - half, (nose.y + tail.y) / 2);
+ ctx.closePath();
+ ctx.fill();
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeControls.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeControls.test.ts
index 3c06fd233a..0df4ecb636 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeControls.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeControls.test.ts
@@ -20,7 +20,9 @@ describe("office controls guide", () => {
it("keeps control ids unique and every group filled", () => {
const ids = OFFICE_CONTROLS.map((c) => c.id);
expect(new Set(ids).size).toBe(ids.length);
- for (const group of CONTROL_GROUPS) expect(controlsFor(group, "coding").length).toBeGreaterThan(0);
+ for (const group of CONTROL_GROUPS) expect(controlsFor(group, "agents").length).toBeGreaterThan(0);
+ // The courier stands on the agents floor's sky pad only.
+ for (const group of CONTROL_GROUPS) expect(controlsFor(group, "coding").length > 0).toBe(group !== "fly");
});
it("drops the lead chair on the coding floor", () => {
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts b/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts
index 03a4f03394..5772025181 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts
@@ -9,7 +9,7 @@
import type { OfficeFloor } from "./officeStore";
-export type ControlGroup = "move" | "camera" | "interact" | "map" | "arcade";
+export type ControlGroup = "move" | "camera" | "interact" | "map" | "fly" | "arcade";
export interface OfficeControl {
id: string;
@@ -19,7 +19,7 @@ export interface OfficeControl {
agentsOnly?: boolean;
}
-export const CONTROL_GROUPS: readonly ControlGroup[] = ["move", "camera", "interact", "map", "arcade"];
+export const CONTROL_GROUPS: readonly ControlGroup[] = ["move", "camera", "interact", "map", "fly", "arcade"];
export type MouseGesture = "click" | "double" | "drag" | "right_drag" | "wheel";
@@ -43,6 +43,20 @@ export const OFFICE_CONTROLS: readonly OfficeControl[] = [
{ id: "minimap_focus", group: "map", keys: [["mouse:click"]] },
{ id: "minimap_walk", group: "map", keys: [["mouse:double"]] },
{ id: "minimap_zoom", group: "map", keys: [["mouse:wheel"]] },
+ // The courier's default keys (courierControls.ts); a pilot's own bindings show in the flight HUD's help.
+ { id: "fly_board", group: "fly", keys: [["E"]], agentsOnly: true },
+ { id: "fly_throttle", group: "fly", keys: [["W", "S"]], agentsOnly: true },
+ { id: "fly_turn", group: "fly", keys: [["A", "D"]], agentsOnly: true },
+ { id: "fly_pitch", group: "fly", keys: [["ArrowUp", "ArrowDown"]], agentsOnly: true },
+ { id: "fly_roll", group: "fly", keys: [["Q", "E"], ["ArrowLeft", "ArrowRight"]], agentsOnly: true },
+ { id: "fly_lift", group: "fly", keys: [["Space", "C"]], agentsOnly: true },
+ { id: "fly_boost", group: "fly", keys: [["Shift"]], agentsOnly: true },
+ { id: "fly_brake", group: "fly", keys: [["X"]], agentsOnly: true },
+ { id: "fly_assist", group: "fly", keys: [["T"]], agentsOnly: true },
+ { id: "fly_camera", group: "fly", keys: [["V"]], agentsOnly: true },
+ { id: "fly_land", group: "fly", keys: [["L"]], agentsOnly: true },
+ { id: "fly_leave", group: "fly", keys: [["E"], ["F"]], agentsOnly: true },
+ { id: "fly_settings", group: "fly", keys: [["Esc"]], agentsOnly: true },
{ id: "arcade_play", group: "arcade", keys: [["E"]] },
{ id: "arcade_start", group: "arcade", keys: [["Enter"], ["Space"]] },
{ id: "arcade_action", group: "arcade", keys: [["Space"], ["J"]] },
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts
index ae2743e8ea..5f3b907f74 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts
@@ -134,7 +134,7 @@ describe("office layout", () => {
expect(plain.variant).toBe("agents");
expect(plain.rooms.map((r) => r.kind)).toEqual(["lead", "team", "wardrobe", "reception", "break"]);
// The spawn point creates agents, the reception desk is the one directory and help station; the hall has its own floor.
- expect(plain.checkpoints.map((c) => c.id)).toEqual(["spawn", "manage", "team", "wardrobe", "lead", "break", "elevator"]);
+ expect(plain.checkpoints.map((c) => c.id)).toEqual(["spawn", "manage", "team", "wardrobe", "lead", "break", "elevator", "ship"]);
for (const kind of ["levelWall", "studioStage", "rewardPedestal", "levelGuide", "agentTotem"] as const) {
expect(plain.furniture.some((f) => f.kind === kind), kind).toBe(false);
}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
index 428be2f060..ff85278ce6 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts
@@ -31,6 +31,7 @@ import { translate } from "@/i18n";
import { PRODUCT_NAME } from "@/lib/branding";
import type { AgentRunState, AgentTier } from "../data";
import type { AgentsAmbienceItem } from "./agentsAmbience";
+import type { SkyPad } from "./skyPad";
import { buildCampusLayout } from "./campusLayout";
import { codingAmbience } from "./codingAmbience";
@@ -139,9 +140,10 @@ export interface WallSegment { x1: number; z1: number; x2: number; z2: number; r
* "manage" is the agents floor's reception desk: the one directory and help station.
* "studio" (the dais) and "levels" (the service guide) are the Level Hall floor's.
* "create" is no longer placed on any floor; the kind stays for the maps' label tables.
+ * "ship" is the courier on the agents floor's sky pad: board it and fly.
*/
export type CheckpointKind = "spawn" | "launch" | "create" | "manage" | "team" | "wardrobe" | "lead" | "break" | "elevator" | "mission"
- | "studio" | "levels";
+ | "studio" | "levels" | "ship";
/** A place the person can walk to (or click from afar) to act. "floor" = the open office, outside every room. */
export interface Checkpoint extends Point {
@@ -377,6 +379,8 @@ export interface OfficeLayout {
floor: Rect;
/** The whole slab, railing included. */
bounds: Rect;
+ /** Agents floor: the landing platform outside the east windows, walkable beyond `floor`. Absent on the other floors. */
+ skyPad?: SkyPad;
}
/** Desk pitch along a row and the depth of one bench (two rows back to back plus chairs). */
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeNav.ts b/jarvis/ui/web/frontend/src/components/society/office/officeNav.ts
index 2d0b3da9c3..e997dfaadf 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeNav.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeNav.ts
@@ -8,6 +8,7 @@
* search on a full floor costs well under a few milliseconds.
*/
import type { OfficeLayout, Point, Rect } from "./officeLayout";
+import { onSkyPad, skyPadExtent } from "./skyPad";
/** Half the shoulder width of a walking figure, in metres. */
export const WALKER_RADIUS = 0.28;
@@ -22,6 +23,11 @@ export interface NavGrid {
originZ: number;
/** 1 = blocked, 0 = walkable; index = row * cols + col. */
blocked: Uint8Array;
+ /**
+ * The floor inside the railing. The grid may reach beyond it (the sky pad); an idle wander stays on the floor.
+ * Absent on grids built by hand in tests.
+ */
+ home?: Rect;
}
/** A snapped approach may end at most this far from a blocked target. */
@@ -33,19 +39,24 @@ const SQRT2 = Math.SQRT2;
export function buildNavGrid(layout: OfficeLayout, opts: { cell?: number; radius?: number } = {}): NavGrid {
const cell = opts.cell ?? 0.2;
const radius = opts.radius ?? WALKER_RADIUS;
- const { floor } = layout;
- const cols = Math.max(1, Math.ceil((floor.maxX - floor.minX) / cell));
- const rows = Math.max(1, Math.ceil((floor.maxZ - floor.minZ) / cell));
- const originX = floor.minX;
- const originZ = floor.minZ;
+ const { floor, skyPad } = layout;
+ // The grid covers the floor and, on the agents floor, the bridge and the pad outside the east windows.
+ const extent = skyPad ? skyPadExtent(skyPad) : floor;
+ const minX = Math.min(floor.minX, extent.minX), maxX = Math.max(floor.maxX, extent.maxX);
+ const minZ = Math.min(floor.minZ, extent.minZ), maxZ = Math.max(floor.maxZ, extent.maxZ);
+ const cols = Math.max(1, Math.ceil((maxX - minX) / cell));
+ const rows = Math.max(1, Math.ceil((maxZ - minZ) / cell));
+ const originX = minX;
+ const originZ = minZ;
const blocked = new Uint8Array(cols * rows);
- // Cells whose centre lies outside the walkable floor.
+ // Cells whose centre lies outside the walkable floor (and off the pad).
for (let r = 0; r < rows; r += 1) {
const cz = originZ + (r + 0.5) * cell;
for (let c = 0; c < cols; c += 1) {
const cx = originX + (c + 0.5) * cell;
- if (cx < floor.minX || cx > floor.maxX || cz < floor.minZ || cz > floor.maxZ) blocked[r * cols + c] = 1;
+ const onFloor = cx >= floor.minX && cx <= floor.maxX && cz >= floor.minZ && cz <= floor.maxZ;
+ if (!onFloor && !(skyPad && onSkyPad(skyPad, { x: cx, z: cz }))) blocked[r * cols + c] = 1;
}
}
// Cells whose centre lies inside an inflated obstacle.
@@ -59,7 +70,7 @@ export function buildNavGrid(layout: OfficeLayout, opts: { cell?: number; radius
for (let c = c0; c <= c1; c += 1) blocked[r * cols + c] = 1;
}
}
- return { cell, cols, rows, originX, originZ, blocked };
+ return { cell, cols, rows, originX, originZ, blocked, home: floor };
}
function colOf(grid: NavGrid, x: number): number {
@@ -376,7 +387,7 @@ export function findPath(grid: NavGrid, from: Point, to: Point): Point[] | null
}
/** A uniformly drawn walkable cell centre (inside `within` when given), or null after a bounded number of tries. */
-export function randomWalkablePoint(grid: NavGrid, rng: () => number, within?: Rect): Point | null {
+export function randomWalkablePoint(grid: NavGrid, rng: () => number, within: Rect | undefined = grid.home): Point | null {
const minX = Math.max(grid.originX, within?.minX ?? -Infinity);
const maxX = Math.min(grid.originX + grid.cols * grid.cell, within?.maxX ?? Infinity);
const minZ = Math.max(grid.originZ, within?.minZ ?? -Infinity);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts b/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts
new file mode 100644
index 0000000000..dfa7932087
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts
@@ -0,0 +1,98 @@
+/**
+ * The sky pad: a landing platform that stands out of the agents floor on its
+ * east side. The main boulevard runs on across the window line as a bridge to
+ * a round pad in the open air, where the courier stands ready to board. Pure
+ * and tested; the drawing is SkyPadStructure.tsx, the ship and its flight
+ * SkyCourier.tsx with courierFlight.ts.
+ *
+ * Everything here lies outside the slab (`layout.bounds`), inside the city's
+ * empty plaza, at floor level: the pad's top is the floor's top (y = 0).
+ */
+import type { Point, Rect } from "./officeLayout";
+
+export const SKY_PAD = {
+ /** The bridge: as wide as the boulevard, this long between the slab's edge and the pad's rim. */
+ bridgeWidth: 5,
+ bridgeLength: 9,
+ /** The pad's radius and the depth of its deck. */
+ radius: 12,
+ thickness: 0.9,
+ /** How far inside a rail a walker's centre stays (as on the slab). */
+ railClearance: 0.65,
+} as const;
+
+/** The courier's size on the pad (metres): its authored 30 m scaled to the Verse's people. */
+export const COURIER = {
+ scale: 0.6,
+ /** Length and span (pods included) at that scale, and the clearance a walker keeps from it. */
+ length: 19.4,
+ span: 9.3,
+ clearance: 0.6,
+ /** The hull's middle above the deck when it stands on its gear (authored 1.35 m belly + 2.3 m gear, scaled). */
+ standHeight: (1.35 * 0.78 + 2.3) * 0.6,
+} as const;
+
+export interface SkyPad {
+ side: "east";
+ /** The walkable deck of the bridge (a walker's centre may stand anywhere in it). */
+ bridge: Rect;
+ /** The pad's centre and its full radius; walkers keep `railClearance` from the rim. */
+ pad: Point & { r: number };
+ /** Where the courier stands: the pad's centre, nose to the north (heading in radians, 0 = facing -z). */
+ ship: Point & { heading: number };
+ /** The courier's footprint on the deck, solid for walkers. */
+ shipRect: Rect;
+ /** The place beside the courier's hatch where the person boards (and steps out again). */
+ board: Point & { facing: number };
+ /** The opening the bridge cuts into the floor's east rail and window wall, as a z range. */
+ gap: { minZ: number; maxZ: number };
+}
+
+/**
+ * The pad for a slab whose boulevard runs along z = `boulevardZ`: a bridge out of the east edge on that line,
+ * the pad beyond it.
+ */
+export function skyPadFor(bounds: Rect, floor: Rect, boulevardZ: number): SkyPad {
+ const half = SKY_PAD.bridgeWidth / 2;
+ const padX = bounds.maxX + SKY_PAD.bridgeLength + SKY_PAD.radius;
+ const shipRect = {
+ minX: padX - COURIER.span / 2 - COURIER.clearance, maxX: padX + COURIER.span / 2 + COURIER.clearance,
+ minZ: boulevardZ - COURIER.length / 2 - COURIER.clearance, maxZ: boulevardZ + COURIER.length / 2 + COURIER.clearance,
+ };
+ return {
+ side: "east",
+ bridge: {
+ // From inside the floor's walkable edge (so the two grids join) to a metre onto the pad.
+ minX: floor.maxX - 0.4, maxX: bounds.maxX + SKY_PAD.bridgeLength + 1,
+ minZ: boulevardZ - half + SKY_PAD.railClearance, maxZ: boulevardZ + half - SKY_PAD.railClearance,
+ },
+ pad: { x: padX, z: boulevardZ, r: SKY_PAD.radius },
+ ship: { x: padX, z: boulevardZ, heading: 0 },
+ shipRect,
+ // Beside the hatch on the courier's west flank, facing it: the first thing the bridge leads to.
+ board: { x: shipRect.minX - 0.9, z: boulevardZ + 1.2, facing: Math.PI / 2 },
+ gap: { minZ: boulevardZ - half, maxZ: boulevardZ + half },
+ };
+}
+
+/** Whether a walker's centre may stand at p on the pad or its bridge (the courier excluded). */
+export function onSkyPad(pad: SkyPad, p: Point): boolean {
+ const { bridge } = pad;
+ if (p.x >= bridge.minX && p.x <= bridge.maxX && p.z >= bridge.minZ && p.z <= bridge.maxZ) return true;
+ return Math.hypot(p.x - pad.pad.x, p.z - pad.pad.z) <= pad.pad.r - SKY_PAD.railClearance;
+}
+
+/** The rectangle round the bridge and the pad. */
+export function skyPadExtent(pad: SkyPad): Rect {
+ return {
+ minX: Math.min(pad.bridge.minX, pad.pad.x - pad.pad.r), maxX: pad.pad.x + pad.pad.r,
+ minZ: Math.min(pad.bridge.minZ, pad.pad.z - pad.pad.r), maxZ: Math.max(pad.bridge.maxZ, pad.pad.z + pad.pad.r),
+ };
+}
+
+/** The slab and, where there is one, the sky pad: what the camera frames and the full map shows. */
+export function boundsWithPad(bounds: Rect, pad?: SkyPad): Rect {
+ if (!pad) return bounds;
+ const e = skyPadExtent(pad);
+ return { minX: Math.min(bounds.minX, e.minX), maxX: Math.max(bounds.maxX, e.maxX), minZ: Math.min(bounds.minZ, e.minZ), maxZ: Math.max(bounds.maxZ, e.maxZ) };
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/stationIcons.tsx b/jarvis/ui/web/frontend/src/components/society/office/stationIcons.tsx
index aa6c4531e5..06cd58f556 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/stationIcons.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/stationIcons.tsx
@@ -1,10 +1,10 @@
/** The icon each station wears in the HUD's places menu and in the reception's directory. */
-import { ArrowUpDown, Coffee, ConciergeBell, Radar, Shirt, Sparkles, SquareTerminal, Star, Trophy, UserPlus, Users, type LucideIcon } from "lucide-react";
+import { ArrowUpDown, Coffee, ConciergeBell, Radar, Rocket, Shirt, Sparkles, SquareTerminal, Star, Trophy, UserPlus, Users, type LucideIcon } from "lucide-react";
import type { StationIcon } from "./stations";
const ICONS: Record<StationIcon, LucideIcon> = {
spawn: UserPlus, launch: SquareTerminal, reception: ConciergeBell, team: Users, wardrobe: Shirt, lead: Star, break: Coffee,
- elevator: ArrowUpDown, mission: Radar, studio: Sparkles, levels: Trophy,
+ elevator: ArrowUpDown, mission: Radar, studio: Sparkles, levels: Trophy, ship: Rocket,
};
export function StationGlyph({ icon, size = 16 }: { icon: StationIcon; size?: number }) {
diff --git a/jarvis/ui/web/frontend/src/components/society/office/stations.ts b/jarvis/ui/web/frontend/src/components/society/office/stations.ts
index 0d118a9e13..4467c28b89 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/stations.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/stations.ts
@@ -11,7 +11,7 @@
import { FURNITURE_SIZE, type Checkpoint, type Furniture, type FurnitureKind, type OfficeLayout, type Point } from "./officeLayout";
import type { Selection } from "./officeStore";
-export type StationIcon = "spawn" | "launch" | "reception" | "team" | "wardrobe" | "lead" | "break" | "elevator" | "mission" | "studio" | "levels";
+export type StationIcon = "spawn" | "launch" | "reception" | "team" | "wardrobe" | "lead" | "break" | "elevator" | "mission" | "studio" | "levels" | "ship";
/** A box in world space: centre, size (x-extent × height × z-extent before rotation) and rotation about +y. */
export interface StationBox { x: number; y: number; z: number; w: number; h: number; d: number; rotationY: number }
@@ -59,7 +59,7 @@ const STATION_PROPS: Readonly<Record<string, readonly FurnitureKind[]>> = {
const STATION_ICONS: Readonly<Record<string, StationIcon>> = {
spawn: "spawn", launch: "launch", manage: "reception", team: "team", wardrobe: "wardrobe", lead: "lead", break: "break",
- elevator: "elevator", mission: "mission", studio: "studio", levels: "levels",
+ elevator: "elevator", mission: "mission", studio: "studio", levels: "levels", ship: "ship",
};
/** A flat piece (a stage, a pad) still needs something a pointer can hit. */
@@ -67,6 +67,9 @@ const MIN_HIT_HEIGHT = 0.12;
/** The lead desk's click target is its visitor-side front panel, so the monitors and the chair keep their own clicks. */
const DESK_FRONT = { h: 0.74, d: 0.1, gap: 0.04 } as const;
const DEFAULT_LEAD_DESK = { w: 2.4, d: 1.05 } as const;
+/** The scene group of the courier on its pad (the ship station's object). */
+export const COURIER_GROUP = "courier";
+
/** How far in front of a studio board the person stands, and how far around that spot E reaches. */
export const BOARD_STAND_M = 1.05;
export const BOARD_REACH_M = 1.25;
@@ -130,6 +133,18 @@ function checkpointStation(layout: OfficeLayout, checkpoint: Checkpoint): Statio
}),
};
}
+ if (checkpoint.id === "ship" && layout.skyPad) {
+ // The courier itself is the station: its scene group lights up and its body takes the click.
+ const { shipRect } = layout.skyPad;
+ return {
+ ...base,
+ objects: [COURIER_GROUP],
+ hits: [{
+ x: (shipRect.minX + shipRect.maxX) / 2, y: 2, z: (shipRect.minZ + shipRect.maxZ) / 2,
+ w: shipRect.maxX - shipRect.minX, h: 4, d: shipRect.maxZ - shipRect.minZ, rotationY: 0,
+ }],
+ };
+ }
const prop = propFor(layout, checkpoint);
return { ...base, objects: prop ? [`prop:${prop.id}`] : [], hits: prop ? [boxOf(prop)] : [] };
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index 97a00cf1f3..c2cac40169 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -1222,7 +1222,21 @@
"tab_places": "Orte",
"set_hints": "Steuerungshinweise",
"set_hints_hint": "Die kurze Einführung in die Steuerung wieder auf der Karte zeigen.",
- "set_hints_action": "Wieder zeigen"
+ "set_hints_action": "Wieder zeigen",
+ "group_fly": "Kurierschiff",
+ "ctl_fly_board": "Auf dem Sky-Pad ins Kurierschiff steigen",
+ "ctl_fly_throttle": "Schub",
+ "ctl_fly_turn": "Drehen",
+ "ctl_fly_pitch": "Nase hoch und runter",
+ "ctl_fly_roll": "Rollen",
+ "ctl_fly_lift": "Steigen und sinken",
+ "ctl_fly_boost": "Boost",
+ "ctl_fly_brake": "Bremsen",
+ "ctl_fly_assist": "Flugassistent wechseln",
+ "ctl_fly_camera": "Kamera wechseln",
+ "ctl_fly_land": "Auf dem Pad landen",
+ "ctl_fly_leave": "Aussteigen (gelandet)",
+ "ctl_fly_settings": "Flugeinstellungen und Tasten"
},
"coding_title": "Coding-Etage",
"coding_empty": "Kein Coding-Agent läuft. Starte einen in der IDE, dann bekommt er hier einen Schreibtisch.",
@@ -1569,7 +1583,49 @@
"status_unavailable": "Kosten nicht verfügbar",
"status_loading": "wird geladen…",
"status_top_models": "TOP-MODELLE",
- "status_net": "NETZ"
+ "status_net": "NETZ",
+ "cp_ship": "Kurierschiff",
+ "use_ship": "Ins Kurierschiff steigen",
+ "flight_speed": "Tempo",
+ "flight_altitude": "Höhe",
+ "flight_throttle": "Schub",
+ "flight_boost": "Boost",
+ "flight_assist": "Flugassistent",
+ "flight_assist_arcade": "Arcade",
+ "flight_assist_simulation": "Simulation",
+ "flight_view_chase": "Verfolgerkamera",
+ "flight_view_cockpit": "Cockpit",
+ "flight_land": "Auf dem Pad landen",
+ "flight_landing": "Landet auf dem Pad …",
+ "flight_leave": "Aussteigen",
+ "flight_landed_hint": "Gelandet. E oder {0} drücken, um auszusteigen.",
+ "flight_help": "Steuerung",
+ "flight_settings": "Einstellungen",
+ "flight_rebind": "Taste drücken …",
+ "flight_reset": "Tasten zurücksetzen",
+ "flight_invert": "Nicken umkehren",
+ "flight_volume": "Triebwerkslautstärke",
+ "flight_close": "Schließen",
+ "flight_gamepad": "Gamepad: linker Stick nicken und gieren, rechter Stick rollen und steigen, Trigger Schub, A Boost, B Bremse, X landen, Y Kamera, Start aussteigen.",
+ "flight_hud": "Flug",
+ "flight_keys": "Tasten",
+ "flight_action_throttleUp": "Schub erhöhen",
+ "flight_action_throttleDown": "Schub verringern",
+ "flight_action_pitchUp": "Nase hoch",
+ "flight_action_pitchDown": "Nase runter",
+ "flight_action_yawLeft": "Links drehen",
+ "flight_action_yawRight": "Rechts drehen",
+ "flight_action_rollLeft": "Links rollen",
+ "flight_action_rollRight": "Rechts rollen",
+ "flight_action_liftUp": "Steigen",
+ "flight_action_liftDown": "Sinken",
+ "flight_action_boost": "Boost",
+ "flight_action_brake": "Bremsen",
+ "flight_action_assist": "Flugassistent wechseln",
+ "flight_action_camera": "Kamera wechseln",
+ "flight_action_land": "Auf dem Pad landen",
+ "flight_action_exit": "Aussteigen (gelandet)",
+ "flight_action_help": "Steuerung zeigen"
},
"arcade": {
"play_prompt": "{0} spielen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index c98b353645..81199c8fb2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -1222,7 +1222,21 @@
"tab_places": "Places",
"set_hints": "Control hints",
"set_hints_hint": "Show the short introduction to the controls on the map again.",
- "set_hints_action": "Show again"
+ "set_hints_action": "Show again",
+ "group_fly": "Courier",
+ "ctl_fly_board": "Board the courier on the sky pad",
+ "ctl_fly_throttle": "Throttle",
+ "ctl_fly_turn": "Turn",
+ "ctl_fly_pitch": "Nose up and down",
+ "ctl_fly_roll": "Roll",
+ "ctl_fly_lift": "Rise and sink",
+ "ctl_fly_boost": "Boost",
+ "ctl_fly_brake": "Brake",
+ "ctl_fly_assist": "Switch flight assist",
+ "ctl_fly_camera": "Switch camera",
+ "ctl_fly_land": "Land on the pad",
+ "ctl_fly_leave": "Step out (landed)",
+ "ctl_fly_settings": "Flight settings and keys"
},
"coding_title": "Coding floor",
"coding_empty": "No coding agent is running. Start one in the IDE and it takes a desk here.",
@@ -1569,7 +1583,49 @@
"status_unavailable": "spend unavailable",
"status_loading": "loading…",
"status_top_models": "TOP MODELS",
- "status_net": "NET"
+ "status_net": "NET",
+ "cp_ship": "Courier",
+ "use_ship": "Board the courier",
+ "flight_speed": "Speed",
+ "flight_altitude": "Altitude",
+ "flight_throttle": "Throttle",
+ "flight_boost": "Boost",
+ "flight_assist": "Flight assist",
+ "flight_assist_arcade": "Arcade",
+ "flight_assist_simulation": "Simulation",
+ "flight_view_chase": "Chase camera",
+ "flight_view_cockpit": "Cockpit",
+ "flight_land": "Land on the pad",
+ "flight_landing": "Landing on the pad…",
+ "flight_leave": "Step out",
+ "flight_landed_hint": "On the pad. Press E or {0} to step out.",
+ "flight_help": "Controls",
+ "flight_settings": "Settings",
+ "flight_rebind": "Press a key…",
+ "flight_reset": "Reset keys",
+ "flight_invert": "Invert pitch",
+ "flight_volume": "Engine volume",
+ "flight_close": "Close",
+ "flight_gamepad": "Gamepad: left stick pitch and yaw, right stick roll and lift, triggers throttle, A boost, B brake, X land, Y camera, Start step out.",
+ "flight_hud": "Flight",
+ "flight_keys": "Keys",
+ "flight_action_throttleUp": "Throttle up",
+ "flight_action_throttleDown": "Throttle down",
+ "flight_action_pitchUp": "Nose up",
+ "flight_action_pitchDown": "Nose down",
+ "flight_action_yawLeft": "Turn left",
+ "flight_action_yawRight": "Turn right",
+ "flight_action_rollLeft": "Roll left",
+ "flight_action_rollRight": "Roll right",
+ "flight_action_liftUp": "Rise",
+ "flight_action_liftDown": "Sink",
+ "flight_action_boost": "Boost",
+ "flight_action_brake": "Brake",
+ "flight_action_assist": "Switch flight assist",
+ "flight_action_camera": "Switch camera",
+ "flight_action_land": "Land on the pad",
+ "flight_action_exit": "Step out (landed)",
+ "flight_action_help": "Show the controls"
},
"arcade": {
"play_prompt": "Play {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index 135c9b7654..d9ecfcb0fc 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -1222,7 +1222,21 @@
"tab_places": "Lugares",
"set_hints": "Pistas de control",
"set_hints_hint": "Volver a mostrar en el mapa la breve introducción a los controles.",
- "set_hints_action": "Mostrar de nuevo"
+ "set_hints_action": "Mostrar de nuevo",
+ "group_fly": "Nave mensajera",
+ "ctl_fly_board": "Subir a la nave en la plataforma",
+ "ctl_fly_throttle": "Empuje",
+ "ctl_fly_turn": "Girar",
+ "ctl_fly_pitch": "Morro arriba y abajo",
+ "ctl_fly_roll": "Alabear",
+ "ctl_fly_lift": "Subir y bajar",
+ "ctl_fly_boost": "Turbo",
+ "ctl_fly_brake": "Frenar",
+ "ctl_fly_assist": "Cambiar asistente de vuelo",
+ "ctl_fly_camera": "Cambiar cámara",
+ "ctl_fly_land": "Aterrizar en la plataforma",
+ "ctl_fly_leave": "Bajar (aterrizada)",
+ "ctl_fly_settings": "Ajustes de vuelo y teclas"
},
"coding_title": "Planta de código",
"coding_empty": "No hay ningún agente de código en marcha. Inicia uno en el IDE y ocupará un escritorio aquí.",
@@ -1569,7 +1583,49 @@
"status_unavailable": "gastos no disponibles",
"status_loading": "cargando…",
"status_top_models": "MODELOS PRINCIPALES",
- "status_net": "RED"
+ "status_net": "RED",
+ "cp_ship": "Nave mensajera",
+ "use_ship": "Subir a la nave",
+ "flight_speed": "Velocidad",
+ "flight_altitude": "Altitud",
+ "flight_throttle": "Empuje",
+ "flight_boost": "Turbo",
+ "flight_assist": "Asistente de vuelo",
+ "flight_assist_arcade": "Arcade",
+ "flight_assist_simulation": "Simulación",
+ "flight_view_chase": "Cámara de persecución",
+ "flight_view_cockpit": "Cabina",
+ "flight_land": "Aterrizar en la plataforma",
+ "flight_landing": "Aterrizando en la plataforma…",
+ "flight_leave": "Bajar",
+ "flight_landed_hint": "En la plataforma. Pulsa E o {0} para bajar.",
+ "flight_help": "Controles",
+ "flight_settings": "Ajustes",
+ "flight_rebind": "Pulsa una tecla…",
+ "flight_reset": "Restablecer teclas",
+ "flight_invert": "Invertir cabeceo",
+ "flight_volume": "Volumen del motor",
+ "flight_close": "Cerrar",
+ "flight_gamepad": "Mando: stick izquierdo cabeceo y guiñada, stick derecho alabeo y ascenso, gatillos empuje, A turbo, B freno, X aterrizar, Y cámara, Start bajar.",
+ "flight_hud": "Vuelo",
+ "flight_keys": "Teclas",
+ "flight_action_throttleUp": "Más empuje",
+ "flight_action_throttleDown": "Menos empuje",
+ "flight_action_pitchUp": "Morro arriba",
+ "flight_action_pitchDown": "Morro abajo",
+ "flight_action_yawLeft": "Girar a la izquierda",
+ "flight_action_yawRight": "Girar a la derecha",
+ "flight_action_rollLeft": "Alabear a la izquierda",
+ "flight_action_rollRight": "Alabear a la derecha",
+ "flight_action_liftUp": "Subir",
+ "flight_action_liftDown": "Bajar altura",
+ "flight_action_boost": "Turbo",
+ "flight_action_brake": "Frenar",
+ "flight_action_assist": "Cambiar asistente de vuelo",
+ "flight_action_camera": "Cambiar cámara",
+ "flight_action_land": "Aterrizar en la plataforma",
+ "flight_action_exit": "Bajar (aterrizada)",
+ "flight_action_help": "Mostrar controles"
},
"arcade": {
"play_prompt": "Jugar a {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json b/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json
index a5b7737ebf..afacc180e2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json
@@ -1222,7 +1222,21 @@
"tab_places": "Locais",
"set_hints": "Dicas de controlo",
"set_hints_hint": "Mostrar de novo a breve introdução aos controlos no mapa.",
- "set_hints_action": "Mostrar de novo"
+ "set_hints_action": "Mostrar de novo",
+ "group_fly": "Nave mensageira",
+ "ctl_fly_board": "Embarcar na nave na plataforma",
+ "ctl_fly_throttle": "Propulsão",
+ "ctl_fly_turn": "Virar",
+ "ctl_fly_pitch": "Nariz para cima e para baixo",
+ "ctl_fly_roll": "Rolar",
+ "ctl_fly_lift": "Subir e descer",
+ "ctl_fly_boost": "Turbo",
+ "ctl_fly_brake": "Travar",
+ "ctl_fly_assist": "Mudar assistente de voo",
+ "ctl_fly_camera": "Mudar câmara",
+ "ctl_fly_land": "Aterrar na plataforma",
+ "ctl_fly_leave": "Sair (aterrada)",
+ "ctl_fly_settings": "Definições de voo e teclas"
},
"coding_title": "Piso de programação",
"coding_empty": "Não há nenhum agente de programação a correr. Inicia um no IDE e ele ocupa aqui uma secretária.",
@@ -1569,7 +1583,49 @@
"status_unavailable": "gastos indisponíveis",
"status_loading": "a carregar…",
"status_top_models": "PRINCIPAIS MODELOS",
- "status_net": "REDE"
+ "status_net": "REDE",
+ "cp_ship": "Nave mensageira",
+ "use_ship": "Embarcar na nave",
+ "flight_speed": "Velocidade",
+ "flight_altitude": "Altitude",
+ "flight_throttle": "Propulsão",
+ "flight_boost": "Turbo",
+ "flight_assist": "Assistente de voo",
+ "flight_assist_arcade": "Arcade",
+ "flight_assist_simulation": "Simulação",
+ "flight_view_chase": "Câmara de perseguição",
+ "flight_view_cockpit": "Cockpit",
+ "flight_land": "Aterrar na plataforma",
+ "flight_landing": "A aterrar na plataforma…",
+ "flight_leave": "Sair",
+ "flight_landed_hint": "Na plataforma. Prima E ou {0} para sair.",
+ "flight_help": "Controlos",
+ "flight_settings": "Definições",
+ "flight_rebind": "Prima uma tecla…",
+ "flight_reset": "Repor teclas",
+ "flight_invert": "Inverter arfagem",
+ "flight_volume": "Volume do motor",
+ "flight_close": "Fechar",
+ "flight_gamepad": "Comando: manípulo esquerdo arfagem e guinada, manípulo direito rolamento e subida, gatilhos propulsão, A turbo, B travão, X aterrar, Y câmara, Start sair.",
+ "flight_hud": "Voo",
+ "flight_keys": "Teclas",
+ "flight_action_throttleUp": "Mais propulsão",
+ "flight_action_throttleDown": "Menos propulsão",
+ "flight_action_pitchUp": "Nariz para cima",
+ "flight_action_pitchDown": "Nariz para baixo",
+ "flight_action_yawLeft": "Virar à esquerda",
+ "flight_action_yawRight": "Virar à direita",
+ "flight_action_rollLeft": "Rolar à esquerda",
+ "flight_action_rollRight": "Rolar à direita",
+ "flight_action_liftUp": "Subir",
+ "flight_action_liftDown": "Descer",
+ "flight_action_boost": "Turbo",
+ "flight_action_brake": "Travar",
+ "flight_action_assist": "Mudar assistente de voo",
+ "flight_action_camera": "Mudar câmara",
+ "flight_action_land": "Aterrar na plataforma",
+ "flight_action_exit": "Sair (aterrada)",
+ "flight_action_help": "Mostrar controlos"
},
"arcade": {
"play_prompt": "Jogar {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json
index e441c94fa5..c4232a6544 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json
@@ -1222,7 +1222,21 @@
"tab_places": "地点",
"set_hints": "操作提示",
"set_hints_hint": "在地图上再次显示简短的操作介绍。",
- "set_hints_action": "再次显示"
+ "set_hints_action": "再次显示",
+ "group_fly": "信使飞船",
+ "ctl_fly_board": "在停机平台登上飞船",
+ "ctl_fly_throttle": "推力",
+ "ctl_fly_turn": "转向",
+ "ctl_fly_pitch": "抬头和低头",
+ "ctl_fly_roll": "横滚",
+ "ctl_fly_lift": "上升和下降",
+ "ctl_fly_boost": "加速",
+ "ctl_fly_brake": "刹车",
+ "ctl_fly_assist": "切换飞行辅助",
+ "ctl_fly_camera": "切换视角",
+ "ctl_fly_land": "降落到平台",
+ "ctl_fly_leave": "下船(已降落)",
+ "ctl_fly_settings": "飞行设置和按键"
},
"coding_title": "编程楼层",
"coding_empty": "没有正在运行的编程智能体。在 IDE 中启动一个,它就会在这里占一个工位。",
@@ -1569,7 +1583,49 @@
"status_unavailable": "支出不可用",
"status_loading": "加载中…",
"status_top_models": "热门模型",
- "status_net": "网络"
+ "status_net": "网络",
+ "cp_ship": "信使飞船",
+ "use_ship": "登上飞船",
+ "flight_speed": "速度",
+ "flight_altitude": "高度",
+ "flight_throttle": "推力",
+ "flight_boost": "加速",
+ "flight_assist": "飞行辅助",
+ "flight_assist_arcade": "街机",
+ "flight_assist_simulation": "模拟",
+ "flight_view_chase": "追踪视角",
+ "flight_view_cockpit": "驾驶舱",
+ "flight_land": "降落到平台",
+ "flight_landing": "正在降落到平台…",
+ "flight_leave": "下船",
+ "flight_landed_hint": "已停在平台上。按 E 或 {0} 下船。",
+ "flight_help": "操作",
+ "flight_settings": "设置",
+ "flight_rebind": "请按一个键…",
+ "flight_reset": "重置按键",
+ "flight_invert": "反转俯仰",
+ "flight_volume": "引擎音量",
+ "flight_close": "关闭",
+ "flight_gamepad": "手柄:左摇杆俯仰和偏航,右摇杆横滚和升降,扳机推力,A 加速,B 刹车,X 降落,Y 视角,Start 下船。",
+ "flight_hud": "飞行",
+ "flight_keys": "按键",
+ "flight_action_throttleUp": "增加推力",
+ "flight_action_throttleDown": "减少推力",
+ "flight_action_pitchUp": "抬头",
+ "flight_action_pitchDown": "低头",
+ "flight_action_yawLeft": "向左转",
+ "flight_action_yawRight": "向右转",
+ "flight_action_rollLeft": "向左横滚",
+ "flight_action_rollRight": "向右横滚",
+ "flight_action_liftUp": "上升",
+ "flight_action_liftDown": "下降",
+ "flight_action_boost": "加速",
+ "flight_action_brake": "刹车",
+ "flight_action_assist": "切换飞行辅助",
+ "flight_action_camera": "切换视角",
+ "flight_action_land": "降落到平台",
+ "flight_action_exit": "下船(已降落)",
+ "flight_action_help": "显示操作"
},
"arcade": {
"play_prompt": "玩 {0}",