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(society): the Plugin Docks move into the house ring, taking two north-west slots

rubenluetke10-beep27edda23b6c4
diff --git a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
index 7cb4b4df51..cacf9d4cc8 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
@@ -15,7 +15,7 @@ import * as SkeletonUtils from "three/examples/jsm/utils/SkeletonUtils.js";
import pluginDocksUrl from "@/assets/society/world/kit/plugin-docks.glb";
import { useCameraStore } from "./cameraStore";
-import { buildIsland, groundY, tileToWorld, type PlaceId } from "./islandLayout";
+import { buildIsland, groundY, type KitPlace } from "./islandLayout";
import { createToonRamp } from "./worldMaterials";
/** Every kit file the registry knows. Adding a building = adding a row. */
@@ -24,9 +24,9 @@ export const KIT_URLS = {
} as const;
export type KitId = keyof typeof KIT_URLS;
-/** Where each kit building stands and which place it is. */
-export const KIT_PLACEMENTS: ReadonlyArray<{ kit: KitId; place: PlaceId; rotation: number }> = [
- { kit: "plugin-docks", place: "plugins", rotation: 0 },
+/** Which kit file stands at which kit place; the pose comes from the island layout. */
+export const KIT_PLACEMENTS: ReadonlyArray<{ kit: KitId; place: KitPlace }> = [
+ { kit: "plugin-docks", place: "plugins" },
];
/** Emission above this strength renders unlit (a lamp, a neon tube), below it stays a lit toon. */
@@ -56,14 +56,12 @@ function restyle(root: Object3D, ramp: ReturnType<typeof createToonRamp>): void
export function KitBuilding({
kit,
place,
- rotation,
onClick,
selected,
}: {
kit: KitId;
- place: PlaceId;
- rotation: number;
- onClick?: (place: PlaceId) => void;
+ place: KitPlace;
+ onClick?: (place: KitPlace) => void;
selected?: boolean;
}) {
const { scene } = useGLTF(KIT_URLS[kit]);
@@ -95,8 +93,7 @@ export function KitBuilding({
}, [hover, gl, onClick]);
const { map, content } = buildIsland();
- const [tx, tz] = content.places[place].tile;
- const [x, z] = tileToWorld(tx, tz);
+ const { x, z, rotation } = content.kitPoses[place];
const y = groundY(map, x, z);
const click = (e: ThreeEvent<MouseEvent>) => {
diff --git a/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx b/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
index 705eaa32c3..2735fe254b 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
@@ -181,7 +181,7 @@ export function Landmarks({
return (
<group>
{KIT_PLACEMENTS.map((k) => (
- <KitBuilding key={k.kit} kit={k.kit} place={k.place} rotation={k.rotation} onClick={onHubClick} selected={openHub === k.place} />
+ <KitBuilding key={k.kit} kit={k.kit} place={k.place} onClick={onHubClick} selected={openHub === k.place} />
))}
<Workshop kit={kit} />
<Archive kit={kit} />
diff --git a/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx b/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
index ec5b38df07..e07e441442 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
@@ -27,8 +27,9 @@ export function PlaceLabels() {
return (
<group>
{(Object.keys(content.places) as PlaceId[]).map((id) => {
+ const pose = id in content.kitPoses ? content.kitPoses[id as keyof typeof content.kitPoses] : null;
const [tx, tz] = content.places[id].tile;
- const [x, z] = tileToWorld(tx, tz);
+ const [x, z] = pose ? [pose.x, pose.z] : tileToWorld(tx, tz);
const y = groundY(map, x, z) + LABEL_Y[id];
return (
<Html key={id} position={[x, y, z]} center zIndexRange={[20, 5]} style={{ pointerEvents: "none" }}>
diff --git a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
index b67d805e5f..919e921b35 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
@@ -5,6 +5,7 @@ import {
DOCK_TILES,
FIELD_TILES,
HEDGE_RING_TILES,
+ HOUSE_RING_TILES,
ISLAND_FIELDS,
ISLAND_TILES,
LEVEL_Y,
@@ -85,7 +86,7 @@ describe("islandLayout", () => {
it("opens a paved square in the middle with a ring of houses around it", () => {
const { map, content } = island;
expect(map.kind[tileIndex(map, CENTER_TILE + 5, CENTER_TILE + 5)]).toBe(TileKind.plaza);
- expect(content.houses.length).toBe(12);
+ expect(content.houses.length).toBe(10); // 12 slots, two taken by the Plugin Docks
for (const h of content.houses) {
const r = Math.hypot(h.x, h.z) / 2;
expect(r).toBeGreaterThan(PLAZA_RADIUS_TILES);
@@ -99,6 +100,19 @@ describe("islandLayout", () => {
}
});
+ it("puts the Plugin Docks on the house ring, facing the square, with a reachable stand", () => {
+ const { map, content } = island;
+ const pose = content.kitPoses.plugins;
+ expect(Math.hypot(pose.x, pose.z) / 2).toBeCloseTo(HOUSE_RING_TILES, 5);
+ const fx = Math.sin(pose.rotation);
+ const fz = Math.cos(pose.rotation);
+ expect(fx * -pose.x + fz * -pose.z).toBeGreaterThan(0); // the front points at the centre
+ const [sx, sz] = content.places.plugins.standTile;
+ expect(isWalkable(map, sx, sz)).toBe(true);
+ const [bx, bz] = worldToTile(pose.x, pose.z);
+ expect(isWalkable(map, bx, bz)).toBe(false); // the footprint is blocked
+ });
+
it("leaves the four gates open in the hedge ring", () => {
const { content } = island;
const r = HEDGE_RING_TILES * 2;
diff --git a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
index 0488b2fd30..7525acf292 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
@@ -163,6 +163,34 @@ export interface IslandContent {
panels: Post[];
/** Greenhouses in the gardens quarter. */
greenhouses: Post[];
+ /** Where World Kit buildings stand (metres) and how they turn; the front faces local +z. */
+ kitPoses: Record<KitPlace, KitPose>;
+}
+
+/** Places that are World Kit buildings sitting IN the house ring (world-masterplan-v2.md §5). */
+export type KitPlace = "plugins";
+
+export interface KitPose {
+ x: number;
+ z: number;
+ rotation: number;
+}
+
+/**
+ * Ring slots (of 16) a kit building takes over instead of houses. The Plugin
+ * Docks are 16 m wide, a house slot is ~15 m of arc, so the docks take two
+ * neighbouring north-west slots and stand centred between them.
+ */
+export const RING_KIT_SLOTS: Record<KitPlace, readonly number[]> = { plugins: [13, 14] };
+
+/** Pose of a building centred on the given ring slots, front toward the square. */
+export function ringPose(slots: readonly number[], radiusTiles = HOUSE_RING_TILES): KitPose {
+ const mean = slots.reduce((a, b) => a + b, 0) / slots.length;
+ const angle = (mean / 16) * Math.PI * 2; // clockwise from north
+ const r = radiusTiles * TILE_M;
+ const x = Math.sin(angle) * r;
+ const z = -Math.cos(angle) * r;
+ return { x, z, rotation: Math.atan2(-x, -z) };
}
// ---------------------------------------------------------------------------
@@ -280,8 +308,14 @@ const PLACE_TILES: Record<PlaceId, [number, number]> = {
lighthouse: [CENTER_TILE + 62, CENTER_TILE],
gardens: [CENTER_TILE + 30, CENTER_TILE + 34],
solar: [CENTER_TILE - 32, CENTER_TILE - 32],
- // The Plugin Docks: first World Kit building, north of the west spoke.
- plugins: [CENTER_TILE - 42, CENTER_TILE - 9],
+ // The Plugin Docks stand in the house ring (RING_KIT_SLOTS); this tile is the ring pose's tile.
+ plugins: (() => {
+ const p = ringPose(RING_KIT_SLOTS.plugins);
+ return [Math.floor(p.x / TILE_M + CENTER_TILE), Math.floor(p.z / TILE_M + CENTER_TILE)] as [
+ number,
+ number,
+ ];
+ })(),
};
/** Half extents (tiles) of the flat plots each place is built on. */
@@ -294,7 +328,7 @@ const PLOT_HALF: Record<PlaceId, [number, number]> = {
lighthouse: [3, 3],
gardens: [9, 7],
solar: [8, 6],
- plugins: [6, 5],
+ plugins: [0, 0], // no flat plot of its own: it sits on the village plateau
};
/** Building footprints (half extents, tiles) that block walking. */
@@ -303,7 +337,6 @@ const BUILDING_HALF: Partial<Record<PlaceId, [number, number]>> = {
archive: [3, 3],
workshop: [6, 3],
lighthouse: [1, 1],
- plugins: [4, 3],
};
/** Where the dock reaches into the bay: from the harbor plot southward. */
@@ -478,8 +511,10 @@ function placeHouses(): HousePlot[] {
const houses: HousePlot[] = [];
const variants: HouseVariant[] = ["solar-barrel", "garden-roof", "glass-loft"];
const slots = 16;
+ const taken = new Set(Object.values(RING_KIT_SLOTS).flat());
for (let k = 0; k < slots; k++) {
if (k % 4 === 0) continue; // N, E, S, W are gates (N also holds the hub)
+ if (taken.has(k)) continue; // a kit building stands here
const angle = (k / slots) * Math.PI * 2; // clockwise from north
const r = HOUSE_RING_TILES * TILE_M;
const x = Math.sin(angle) * r;
@@ -642,8 +677,14 @@ function buildPlaces(map: IslandMap): Record<PlaceId, Place> {
lighthouse: place("lighthouse", [PLACE_TILES.lighthouse[0] - 3, C], Math.PI / 2),
gardens: place("gardens", [PLACE_TILES.gardens[0], PLACE_TILES.gardens[1]], 0),
solar: place("solar", [PLACE_TILES.solar[0] + 1, PLACE_TILES.solar[1] + 8], Math.PI),
- // In front of the docks' bays, facing the building (north).
- plugins: place("plugins", [PLACE_TILES.plugins[0], PLACE_TILES.plugins[1] + 5], Math.PI),
+ // In front of the docks' bays (7.5 m toward the square), facing the building.
+ plugins: (() => {
+ const p = ringPose(RING_KIT_SLOTS.plugins);
+ const fx = Math.sin(p.rotation);
+ const fz = Math.cos(p.rotation);
+ const tile = worldToTile(p.x + fx * 7.5, p.z + fz * 7.5);
+ return place("plugins", tile, p.rotation + Math.PI);
+ })(),
};
void facingCentre;
// Make sure every stand tile is walkable — a place nobody can reach is a bug.
@@ -685,12 +726,18 @@ export function buildIsland(): Island {
buildVillage(map);
const houses = placeHouses();
blockHouses(map, houses);
+ const kitPoses: Record<KitPlace, KitPose> = { plugins: ringPose(RING_KIT_SLOTS.plugins) };
+ // The docks' footprint (8 x 5 tiles) blocks walking like a house does.
+ blockHouses(map, [{ ...kitPoses.plugins, w: 8, d: 5, variant: "glass-loft", seed: 0 }]);
blockSquareFurniture(map);
const { hedges, lamps } = placeRingFurniture(map);
const { panels, greenhouses } = placeQuarterFurniture(map);
const trees = placeTrees(map);
const places = buildPlaces(map);
- cached = { map, content: { places, houses, trees, hedges, lamps, panels, greenhouses } };
+ cached = {
+ map,
+ content: { places, houses, trees, hedges, lamps, panels, greenhouses, kitPoses },
+ };
return cached;
}