A town simulation in pale isometric line art, implemented with Ritmo ECS and PixiJs 3D
Unify building proportions and add before-after model review
SandroMaglione5486feacba2f
diff --git a/README.md b/README.mdindex 3c01f60..5dae581 100644--- a/README.md+++ b/README.md@@ -130,6 +130,10 @@ different on every cell.The carpenter and building upgrades can be inspected in the model review.+The complete proportion comparison is at `/proportion-review.html`: 36 building+appearances and nine shared-prop examples, with the approved originals beside+the revised geometry. Both sides share a camera and an unchanged walker.+Turn, zoom, choose one scale across the catalogue, or save a comparison PNG.Run `pnpm dev`, then open `/model-review.html?collection=handoff` to turn the models, comparescaffolding as materials arrive, and download their GLBs.diff --git a/docs/pr20-models.md b/docs/pr20-models.mdindex 78d6742..0fc5768 100644--- a/docs/pr20-models.md+++ b/docs/pr20-models.md@@ -6,7 +6,7 @@ Rotation, elevation, PNG sheets and individual GLB exports work in thisview. The models use the same close framing as the other building collections.The carpenter is an open timber workshop with a boarded store door,-28-pixel eaves and a 38-pixel ridge, matching the bakery and weaver. Its bench, vice, tools, sawhorse,+28-pixel eaves and a 38-pixel ridge. Its bench, vice, tools, sawhorse,plank bearers, chairs and chest stay inside the original two-cell plot.It has no flue or smoke emitter. Furniture uses the same chair and chestgeometry in the work yard and on delivery carts.@@ -17,7 +17,7 @@ balcony, dormers and guild banners. The city hall has lower wings, cornerpavilions, a columned portico, ceremonial stair and large ribbed dome witha lantern. Compare all three civic stages at`/model-review.html?collection=milestones`, using one camera scale.-The original town hall remains unchanged. Civic surface bounds use their+Civic surface bounds use theirown eave heights, and marker heights are cached from their actual geometry.The original town hall flag is hidden on the full civic upgrade models.@@ -26,14 +26,28 @@ shelter, and fire brigade pump and hose cart extend their existing models. The dovenworks additions turn with their road-facing work yards. The firebrigade equips the yard rather than adding a second floating bell.-The other original base buildings, market hall and church keep their existing-geometry and height. The new upgrade structures use that established-building scale. The earlier height adapters and house/walker reference-scenes were removed. A town-wide proportion pass is deferred.+The proportion pass is reviewed at `/proportion-review.html`. All 36 building+appearances and nine shared-prop examples have frozen originals from `a2845b4`+beside current geometry, with one unchanged walker and one camera for both views.+Filtering, shared rotation, elevation, zoom, a fixed town scale and PNG download+work on desktop and phone. The frozen data is a 505 KB gzip file under+`public/model-review/`; `scripts/snapshot-proportions.ts` records its provenance+and refuses to overwrite it.++Homes now have 20-unit timber doors and 22-unit floor spacing, with eaves at+24, 46 and 68. Public floors are generally 24–26 units. Larger shell volumes,+workshop shelters and flues have individual dimensions; no global mesh scaling+is applied. Towers, mine machinery and the civic dome retain their landmark+heights. The fire lookout gains standing clearance. Shared chairs and benches+have matching seat heights, tool rails are reachable, generic goods crates are+smaller, and scaffolds have full-height working bays and higher guard rails.+The mine model and shared chest were checked and retained. Plot sizes, walker+geometry, economy values and simulation rules are unchanged. The three home+height fields in content are drawing dimensions used by construction and effects.Construction uses `scaffoldAsset(size, height, share)` from`src/asset-lab/scaffolding.ts`. It has no building-kind branches or model-lookup. Modular timber bays, two working platforms, an access ladder,+lookup. Modular timber bays, up to two working platforms, an access ladder,canvas screens and supply piles fit inside the plot. Central bays on allfour sides remain clear at ground level. One generator covers everybuilding kind, with progress quantized into 24 steps in the live view.@@ -44,22 +58,25 @@ Repeated members use solid faces and economical outlines.The review map has an upgrade annex; temporaryconstruction examples were moved away from the carpenter's plot.-The Anatomy Asset skill was read as an external reference, without local+The [Anatomy Asset skill](https://github.com/Teddarific/skills/tree/main/skills/anatomy-asset) was read as an external reference, without localinstallation. Its solid parts, connected supports and purposeful detailinformed the models. Geometry remains native `Drawing` data.Validation commands are `pnpm typecheck`, `pnpm test`, `pnpm check`,-`pnpm assets:build`, and the browser workflows `check:models`,+`pnpm assets:build`, and the browser workflows `check:models`, `check:proportions`,`check:revisions`, `check:phone`, `check:effects`, `check:park`,`check:browser` and `look:upgrades`, with `GAME_BASE_URL` set to the server.The economy hand playtest and optional v8 save fixture from the originalhandoff are outside this model pass.-The current revision passes typecheck, build, all 115 tests, the model gallery-and revision browser checks, and export/reimport of all 236 GLBs.+The proportion pass passes typecheck, build, all 119 tests, `pnpm check`,+all 45 comparison pairs, model gallery and revision browser checks, and+export/reimport of all 236 GLBs. Geometry checks cover walker-sized home doors,+floor clearance, unchanged plots, marker clearance in every orientation and+the lookout route with full walker headroom.Both civic upgrades complete through the real upgrade command. The liveupgrade and phone menu/portrait checks also pass without-browser errors. Effects and park checks passed in the earlier model pass. The full game+browser errors. Effects and park checks also pass with the revised geometry. The full gamebrowser check still times out at `scripts/check-browser.ts:72`, waitingfor the first settlers. The identical timeout was reproduced on theuntouched PR head `e610f70`, with no browser errors and the precedingdiff --git a/docs/screenshots/sheet-buildings.webp b/docs/screenshots/sheet-buildings.webpindex b86d5ef..fade0c9 100644Binary files a/docs/screenshots/sheet-buildings.webp and b/docs/screenshots/sheet-buildings.webp differdiff --git a/docs/screenshots/sheet-civic.webp b/docs/screenshots/sheet-civic.webpindex b6f44e5..62e15f7 100644Binary files a/docs/screenshots/sheet-civic.webp and b/docs/screenshots/sheet-civic.webp differdiff --git a/docs/screenshots/sheet-upgrades.webp b/docs/screenshots/sheet-upgrades.webpindex 89daa66..f973ec8 100644Binary files a/docs/screenshots/sheet-upgrades.webp and b/docs/screenshots/sheet-upgrades.webp differdiff --git a/docs/screenshots/sheet-works.webp b/docs/screenshots/sheet-works.webpindex 7c87a20..7427572 100644Binary files a/docs/screenshots/sheet-works.webp and b/docs/screenshots/sheet-works.webp differdiff --git a/package.json b/package.jsonindex cf628f2..8396b17 100644--- a/package.json+++ b/package.json@@ -17,6 +17,7 @@"check:browser": "node scripts/check-browser.ts","check:phone": "node scripts/check-phone.ts","check:models": "node scripts/check-town-models.ts",+ "check:proportions": "node scripts/check-proportions.ts","check:effects": "node scripts/check-house-effects.ts","check:revisions": "node scripts/check-model-revisions.ts","check:park": "node scripts/check-park.ts",diff --git a/proportion-review.html b/proportion-review.htmlnew file mode 100644index 0000000..877520c--- /dev/null+++ b/proportion-review.html@@ -0,0 +1,2 @@+<!doctype html>+<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="icon" href="/favicon.svg" type="image/svg+xml"><title>Inkline Town · Proportion review</title></head><body><main id="proportions"></main><script type="module" src="/src/model-review/proportions.ts"></script></body></html>diff --git a/public/model-review/proportions-before.json.gz b/public/model-review/proportions-before.json.gznew file mode 100644index 0000000..37507c9Binary files /dev/null and b/public/model-review/proportions-before.json.gz differdiff --git a/scripts/check-proportions.ts b/scripts/check-proportions.tsnew file mode 100644index 0000000..26cdf49--- /dev/null+++ b/scripts/check-proportions.ts@@ -0,0 +1,61 @@+/** Same isolated Playwright review workflow as check-town-models.ts. */+import assert from "node:assert/strict"+import { existsSync } from "node:fs"+import { mkdir, writeFile } from "node:fs/promises"+import { chromium } from "playwright"++const executablePath=process.env.BROWSER_EXECUTABLE_PATH??["/Applications/Brave Browser.app/Contents/MacOS/Brave Browser","/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"].find(existsSync)+const browser=await chromium.launch({headless:true,...(executablePath?{executablePath}:{})})+const page=await browser.newPage({viewport:{width:1440,height:1100},deviceScaleFactor:1}),errors:string[]=[]+page.on("pageerror",e=>errors.push(e.message));page.on("console",e=>{if(e.type()==="error")errors.push(e.text())})+const output="output/inkline-3d/proportions"+await mkdir(output,{recursive:true})+try{+ await page.goto(`${process.env.GAME_BASE_URL??"http://127.0.0.1:5236"}/proportion-review.html`)+ await page.waitForFunction(()=>Boolean((window as any).proportionReview))+ const ids:string[]=await page.evaluate(()=>(window as any).proportionReview.ids)+ assert.equal(ids.length,45)+ const manifest:Array<{id:string;title:string;note:string;file:string}>=[]+ for(const id of ids){+ await page.getByLabel("Choose model",{exact:true}).selectOption(id)+ assert.equal(await page.evaluate(()=>(window as any).proportionReview.stats().pairs),2)+ const file=`${id}.png`+ await page.locator(".view").screenshot({path:`${output}/${file}`})+ manifest.push({id,title:await page.locator("h2").innerText(),note:await page.locator("#note").innerText(),file})+ await page.getByLabel("Model rotation",{exact:true}).fill("180")+ assert.equal(await page.evaluate(()=>(window as any).proportionReview.stats().yaw),180)+ if(["cottage","townhouse","hospital","chapel","smithy","firewatch","guildhall","cityhall","church","market-hall","scaffold-90"].includes(id))await page.locator(".view").screenshot({path:`${output}/${id}-rear.png`})+ await page.getByRole("button",{name:"Reset view",exact:true}).click()+ }+ await page.getByLabel("Choose model",{exact:true}).selectOption("citizen")+ await page.getByLabel("View elevation",{exact:true}).selectOption("0")+ await page.locator(".view").screenshot({path:`${output}/citizen-eye-level.png`})+ await page.getByRole("button",{name:"Reset view",exact:true}).click()+ await page.getByLabel("Choose model",{exact:true}).selectOption("cityhall")+ await page.getByLabel("One scale across all models",{exact:true}).check()+ await page.locator(".view").screenshot({path:`${output}/cityhall-town-scale.png`})+ const downloadEvent=page.waitForEvent("download")+ await page.getByRole("button",{name:"Save comparison",exact:true}).click()+ const download=await downloadEvent+ assert.equal(download.suggestedFilename(),"inkline-cityhall-before-after.png")+ await download.saveAs(`${output}/download.png`)+ await page.getByLabel("Model group",{exact:true}).selectOption("architecture")+ assert.equal(await page.getByLabel("Choose model",{exact:true}).locator("option").count(),36)+ await page.getByLabel("Find a model",{exact:true}).fill("hospital")+ assert.equal(await page.getByLabel("Choose model",{exact:true}).locator("option").count(),1)+ await page.getByLabel("Find a model",{exact:true}).fill("no-matches")+ assert.equal(await page.getByRole("button",{name:"Next model",exact:true}).isDisabled(),true)+ assert.equal(await page.locator("h2").innerText(),"No matching models")+ await page.getByLabel("Find a model",{exact:true}).fill("hospital")+ await page.reload();await page.waitForFunction(()=>Boolean((window as any).proportionReview))+ assert.equal(await page.getByLabel("Choose model",{exact:true}).inputValue(),"hospital")+ await page.setViewportSize({width:390,height:844})+ for(const id of ["cottage","townhouse","cityhall","scaffold-90"]){+ await page.getByLabel("Choose model",{exact:true}).selectOption(id)+ assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true,`${id}: phone overflow`)+ await page.locator(".view").screenshot({path:`${output}/${id}-phone.png`})+ }+ await writeFile(`${output}/manifest.json`,JSON.stringify(manifest,null,2))+ assert.deepEqual(errors,[])+ console.log(`Verified ${ids.length} frozen/live pairs, rotation, filtering, deep links, PNG download and phone layout; no browser errors`)+}finally{await browser.close()}diff --git a/scripts/snapshot-proportions.ts b/scripts/snapshot-proportions.tsnew file mode 100644index 0000000..a256765--- /dev/null+++ b/scripts/snapshot-proportions.ts@@ -0,0 +1,15 @@+/** Freeze the approved geometry once. The viewer reads this immutable baseline,+ * rather than importing a second, drifting copy of the old model generators. */+import { gzipSync } from "node:zlib"+import { mkdir, writeFile } from "node:fs/promises"+import { execFileSync } from "node:child_process"+import { proportionModels } from "../src/model-review/proportion-models.ts"+import { assetById } from "../src/asset-lab/assets.ts"++const revision = execFileSync("git", ["rev-parse", "HEAD"], {encoding: "utf8"}).trim()+if (revision !== "a2845b4f537dcb2998a58b7fae26783d7de4a1ec") throw new Error("Baseline must be captured from the approved a2845b4 revision")+const data = { revision, models: proportionModels(), walker: assetById.get("settler-cap")! }+await mkdir("public/model-review", {recursive: true})+const compressed = gzipSync(JSON.stringify(data), {level: 9})+await writeFile("public/model-review/proportions-before.json.gz", compressed, {flag: "wx"})+console.log(`Frozen ${data.models.length} models and the unchanged walker: ${Math.round(compressed.length / 1024)} KB`)diff --git a/src/asset-lab/buildings.ts b/src/asset-lab/buildings.tsindex 8871725..7e90e77 100644--- a/src/asset-lab/buildings.ts+++ b/src/asset-lab/buildings.ts@@ -6,6 +6,7 @@ import { isWorkshop, makeWorkshop, workshopSmokeOrigin, townHallEntrance } fromimport { isTradeYard, makeTradeYard, tradeSmokeOrigin, tradeEntrance, millHoist } from "./trades.ts"import { chapelPorch, hayBands, isRuralDoor, lumberRack, nursery, ruralEntrance, ruralNotes, sheepTrough } from "./rural.ts"import { makeCarpenter } from "./carpenter.ts"+import { human, shellDimensions } from "./dimensions.ts"const dresses: Record<KindId, { accent: number; roof?: number; glass?: number }> = {townhall: { accent: 0x8a58a8, glass: 0xf3dca6 },@@ -49,8 +50,8 @@ export function makeBuilding(id: KindId, options: BuildingOptions = {}) {if (id === "quarry") return makeQuarry(options)const fit = options.fit ?? 1const kind = kinds[id],- a = kind.half * U,- H = kind.roof === "gable" ? 20 : kind.stories * 32,+ a = (shellDimensions(id).half ?? kind.half) * U,+ H = shellDimensions(id).height,p = (kind.size * 8 - 1) * Uconst accent = dresses[id].accentconst glass = dresses[id].glass ?? palette.glass@@ -73,7 +74,7 @@ export function makeBuilding(id: KindId, options: BuildingOptions = {}) {for (const side of sides) {const door = options.doors ? !!options.doors[side] : side === "right" || side === "left"const pt = (s: number, z: number) => d.wall(side, a, s, z, 0.007)- if (kind.stories === 2) d.line([pt(-a, 32), pt(a, 32)], 1, palette.ink, 0.7)+ if (kind.stories === 2 && id !== "chapel") d.line([pt(-a, H/2), pt(a, H/2)], 1, palette.ink, 0.7)if (kind.roof === "flat" && fit > 0.3) {d.face([pt(-a, H - 3), pt(a, H - 3), pt(a, H), pt(-a, H)], pale(accent, 0.35), 0)d.line([pt(-a, H - 3), pt(a, H - 3)], 1, palette.ink, 0.6)@@ -84,12 +85,13 @@ export function makeBuilding(id: KindId, options: BuildingOptions = {}) {for (const s of positions) {if (id === "granary" && floor === 1) continueif (id === "chapel") {- const z = floor * 32 + 9,+ if (floor > 0) continue+ const z = 10,w = 1 / 16,p = (along: number, height: number) => d.wall(side, a, along, height)- d.face([p(s - w, z), p(s + w, z), p(s + w, z + 11), p(s, z + 14), p(s - w, z + 11)], glass, 1)+ d.face([p(s - w, z), p(s + w, z), p(s + w, z + 17), p(s, z + 21), p(s - w, z + 17)], glass, 1)d.line([p(s - w - 0.5 / 16, z), p(s + w + 0.5 / 16, z)])- } else d.window(side, a, s, floor * 32 + 12, 8, glass, true)+ } else d.window(side, a, s, floor * H / kind.stories + 10, 8, glass, true)}if (door && fit > 0.15) {if (id === "townhall") townHallEntrance(d, side, a, fit, options.open ?? 0)@@ -99,10 +101,10 @@ export function makeBuilding(id: KindId, options: BuildingOptions = {}) {institutionDoor(d,side,a,id,fit)if (id === "chapel") chapelPorch(d, side, a, fit)}- else d.door(side, a, Math.max(2, Math.round(Math.min(16, H - 8) * fit)), 5 * U, 6 * U, 2.5 * U, accent, true, options.open ?? 0)+ else d.door(side, a, Math.max(2, human.door * fit), 2.8 * U, 3.5 * U, 1.5 * U, accent, true, options.open ?? 0)}- if (kind.roof === "gable" && !door && fit > 0.4) d.window(side, a, 0, 6)- if (id === "townhall" && fit > 0.8) d.circle(side, a, 50, 5)+ if (kind.roof === "gable" && !door && fit > 0.4) d.window(side, a, 0, 9, 7)+ if (id === "townhall" && fit > 0.8) d.circle(side, a, 40, 4)}if (id === "mill") {if (fit > 0) d.pyramid(a, H, 16 * fit, pale(0x8a6a45, 0.7), pale(0x8a6a45, 0.52))@@ -116,7 +118,7 @@ export function makeBuilding(id: KindId, options: BuildingOptions = {}) {d.barrel(u!, v!, 1.1 * U, 0, 8, 0xf1e9d5)} else if (kind.roof === "gable") {const roof = dresses[id].roof ?? 0x8a6a45- if(fit>0)d.gable(a, H, 14 * fit, "x", pale(roof, 0.7), pale(roof, 0.52), false)+ if(fit>0)d.gable(a, H, 10 * fit, "x", pale(roof, 0.7), pale(roof, 0.52), false)for (const side of ["right", "left"] as const) {for (const seam of (options.doors?.[side] ?? true) ? [-(a - 4 * U), a - 4 * U] : [0])d.line([d.wall(side, a, seam, 0), d.wall(side, a, seam, H)], 1, palette.ink, 0.5)@@ -179,20 +181,20 @@ export function makeBuilding(id: KindId, options: BuildingOptions = {}) {d.line([[u!, v!, 0],- [u!, v!, 11]+ [u!, v!, 20]],1.5)- d.box(c, (v0 + v1) / 2, 1.2 * U, (v1 - v0) / 2, 0, 4, 0xe9c48a, 0xd5a86c, 0xc79a5b)+ d.box(c, (v0 + v1) / 2, 1.2 * U, (v1 - v0) / 2, 0, human.worktop, 0xe9c48a, 0xd5a86c, 0xc79a5b)for (let i = 0; i < 5; i++) {const s = v0 + ((v1 - v0) * i) / 5,e = v0 + ((v1 - v0) * (i + 1)) / 5d.face([- [u0, s, 12],- [u0, e, 12],- [u1, e, 9],- [u1, s, 9]+ [u0, s, 22],+ [u0, e, 22],+ [u1, e, 20],+ [u1, s, 20]],i % 2 === 0 ? 0xc4523f : 0xf7f3ea)@@ -212,8 +214,8 @@ export function buildingSmokeOrigin(id: KindId, doors?: BuildingOptions["doors"]if (isTradeYard(id)) return tradeSmokeOrigin(id, doors)const kind = kinds[id]if (kind.topper !== "chimney") return null- const a = kind.half * U, pitch = 2 * a / kind.bays- return [-a + pitch * 0.5, -a + pitch * 0.5, (kind.roof === "gable" ? 20 : kind.stories * 32) + 24.3]+ const a = (shellDimensions(id).half ?? kind.half) * U, pitch = 2 * a / kind.bays+ return [-a + pitch * 0.5, -a + pitch * 0.5, shellDimensions(id).height + 16.3]}/** Presentation dimensions stay separate from simulation footprints and content costs. */@@ -221,15 +223,15 @@ export function buildingDimensions(id: KindId) {if (id === "carpenter") return { half: 13.5 * U, height: 28, top: 38 }if (isTradeYard(id)) return {half: (id === "warehouse" ? 21 : 13.5) * U,- height: id === "fishery" ? 20 : id === "bakery" ? 28 : id === "weaver" ? 30 : 32,- top: id === "warehouse" ? 45 : id === "fishery" ? 30 : id === "bakery" ? 48.3 : 38+ height: id === "fishery" ? 24 : id === "warehouse" ? 28 : 26,+ top: id === "warehouse" ? 41 : id === "fishery" ? 34 : id === "bakery" ? 43.3 : 34}- const kind = kinds[id], height = kind.roof === "gable" ? 20 : kind.stories * 32- const topper = kind.topper === "chimney" || kind.topper === "flag" ? 24 : kind.topper === "cupola" ? 25 : kind.topper === "sails" ? 16 : 0+ const kind = kinds[id], height = shellDimensions(id).height+ const topper = kind.topper === "chimney" ? 16 : kind.topper === "flag" ? 24 : kind.topper === "cupola" ? 25 : kind.topper === "sails" ? 22 : 10return {- half: isWorkshop(id) ? 13.5 * U : kind.half * U,+ half: isWorkshop(id) ? 13.5 * U : (shellDimensions(id).half ?? kind.half) * U,height,- top: id === "quarry" ? 43 : id === "farm" ? 37 : id === "firewatch" ? 55 : id === "sawmill" ? 36.7 : id === "mine" || id === "smithy" ? 56 : height + topper+ top: id === "quarry" ? 43 : id === "farm" ? 37 : id === "firewatch" ? 64 : id === "sawmill" ? 30.7 : id === "mine" ? 56 : id === "smithy" ? 49.3 : height + topper}}@@ -240,8 +242,8 @@ function finishBuilding(d: Drawing, id: KindId, a: number, p: number, H: number,u = -a + pitch * 0.5,v = -a + pitch * 0.5if (kind.topper === "chimney" && fit > 0) {- d.box(u, v, 2 * U, 2 * U, H, 24 * fit)- d.face(square(u, v, 1.5 * U, H + 24 * fit + 0.035), 0x8b938c, 0)+ d.box(u, v, 1.6 * U, 1.6 * U, H, 16 * fit)+ d.face(square(u, v, 1.2 * U, H + 16 * fit + 0.035), 0x8b938c, 0)} else if (kind.topper === "cupola" && id !== "hospital" && fit > 0) {const half = 3 * U,top = H + 10 * fit,@@ -293,16 +295,16 @@ function finishBuilding(d: Drawing, id: KindId, a: number, p: number, H: number,])d.log("v", c + du! * U, a + 0.5 * U, p - 0.5 * U, z! + 1.5, 1.6, 0xb08a5e, 0xe9d2a8)const y = -a - 1.5 * U- d.cylinder(c, y, 1.3 * U, 0, 3, 0xb08a5e, 0xe9d2a8, 1.5)+ d.cylinder(c, y, 1.3 * U, 0, 5, 0xb08a5e, 0xe9d2a8, 1)d.line([- [c, y, 3],+ [c, y, 5],[c + 0.05, y, 10]],1.5,0x7d6140)- d.box(c + 0.075, y, U, U, 8, 3, 0xb3b9b0, 0x8f9891, 0x7b847d, 1)+ d.box(c + 0.075, y, .65*U, .4*U, 8.5, 2, 0xb3b9b0, 0x8f9891, 0x7b847d, .7)break}case "forester":diff --git a/src/asset-lab/carpenter.ts b/src/asset-lab/carpenter.tsindex a2bae9b..5ecc6dc 100644--- a/src/asset-lab/carpenter.ts+++ b/src/asset-lab/carpenter.ts@@ -34,10 +34,10 @@ export function makeCarpenter(options: BuildingOptions = {}) {block(d, -6 * U, -3 * U, 1.2 * U, 0.4 * U, 8.8, 0.7, iron, 0.5)block(d, -2 * U, -1.2 * U, 0.7 * U, 0.4 * U, 7, 2.3, iron, 0.5)beam(d, [-2 * U, -0.7 * U, 8], [-2 * U, 0.5 * U, 8], 0.6, iron)- beam(d, [-U, -10.3 * U, 18], [7 * U, -10.3 * U, 18], 0.7)+ beam(d, [-U, -10.3 * U, 14], [7 * U, -10.3 * U, 14], 0.7)for (const u of [1, 4, 6]) {- beam(d, [u * U, -10 * U, 14], [u * U, -10 * U, 20], 0.5)- block(d, u * U, -10 * U, 0.7 * U, 0.15 * U, 19.5, 0.7, iron, 0.4)+ beam(d, [u * U, -10 * U, 10], [u * U, -10 * U, 16], 0.5)+ block(d, u * U, -10 * U, 0.7 * U, 0.15 * U, 15.5, 0.7, iron, 0.4)}for (const v of [6, 10]) {beam(d, [-7 * U, v * U, 0.5], [-5 * U, v * U, 7.5], 0.85)diff --git a/src/asset-lab/civic.ts b/src/asset-lab/civic.tsindex d218e29..4f0e82d 100644--- a/src/asset-lab/civic.ts+++ b/src/asset-lab/civic.ts@@ -4,7 +4,7 @@ import { beam, block, orient, roof, stone } from "./workshops.ts"import type { BuildingOptions } from "./buildings.ts"const violet = 0x806397, blue = 0x66859e, gold = [0xe8d5a2, 0xc8ad6d, 0xa78b4e] as const-export const civicEave = (level: number) => level >= 2 ? 80 : 64+export const civicEave = (level: number) => level >= 2 ? 80 : 58function hip(d: Drawing, u: number, v: number, a: number, z: number, rise: number, color: number) {const ring: Vertex[] = [[u-a,v-a,z],[u+a,v-a,z],[u+a,v+a,z],[u-a,v+a,z]]@@ -60,21 +60,21 @@ function entrance(d: Drawing, v: number, half: number, height: number) {}function guildhall(d: Drawing) {- block(d,0,0,18*U,16*U,0,64,stone,1.4)+ block(d,0,0,18*U,16*U,0,58,stone,1.4)block(d,0,0,18.5*U,16.5*U,0,3,stone)// Broad roof ridges run along the hall, with a projecting clock tower.- roof(d,19*U,17*U,0,64,23,violet)+ roof(d,19*U,17*U,0,58,23,violet)for (const side of sides) {const a=(side==="left"||side==="backLeft"?16:18)*Ufor (const s of [-11*U,11*U]) {- window(d,side,a,s,12,1.8*U,15)- window(d,side,a,s,41,1.8*U,16)+ window(d,side,a,s,10,1.6*U,13)+ window(d,side,a,s,36,1.6*U,14)}const p=(s:number,z:number)=>d.wall(side,a,s,z,.04)- beam(d,p(-a,33),p(a,33),1.6,stone)- beam(d,p(-a,61),p(a,61),1.8,stone)+ beam(d,p(-a,28),p(a,28),1.3,stone)+ beam(d,p(-a,55),p(a,55),1.5,stone)}- for (const u of [-17*U,17*U]) for (const v of [-15*U,15*U]) block(d,u,v,.75*U,.75*U,0,64,stone)+ for (const u of [-17*U,17*U]) for (const v of [-15*U,15*U]) block(d,u,v,.75*U,.75*U,0,58,stone)// The tower has a foundation, an entrance and a sheltered balcony.const v=12.5*U,a=5*Ublock(d,0,v,a,a,0,108,stone,1.3)@@ -101,15 +101,15 @@ function guildhall(d: Drawing) {beam(d,[u,17.5*U,24],[u,20.5*U,31],1.2,stone)}block(d,0,19*U,6.3*U,2.2*U,31,1.8,stone)- for (const u of [-5.5,-3.3,-1.1,1.1,3.3,5.5]) block(d,u*U,21*U,.2*U,.2*U,33,6,stone,.55)- beam(d,[-6*U,21*U,39],[6*U,21*U,39],.9,stone)- window(d,"left",17.55*U,0,33,2.2*U,26)- banner(d,-7.5*U,16.1*U,55,violet)- banner(d,7.5*U,16.1*U,55,violet)+ for (const u of [-5.5,-3.3,-1.1,1.1,3.3,5.5]) block(d,u*U,21*U,.2*U,.2*U,33,8,stone,.55)+ beam(d,[-6*U,21*U,41],[6*U,21*U,41],.9,stone)+ window(d,"left",17.55*U,0,33,1.8*U,20)+ banner(d,-7.5*U,16.1*U,51,violet)+ banner(d,7.5*U,16.1*U,51,violet)// Roof dormers break up the rear ridge as well as the street silhouette.for (const sign of [-1,1]) for (const y of [-9*U,2*U]) {- block(d,sign*10*U,y,2*U,2*U,72,8,stone)- hip(d,sign*10*U,y,2.7*U,80,6,violet)+ block(d,sign*10*U,y,2*U,2*U,66,8,stone)+ hip(d,sign*10*U,y,2.7*U,74,6,violet)}}@@ -117,29 +117,29 @@ function cityhall(d: Drawing) {// A taller central hall and lower wings replace the single flat block.block(d,0,0,10*U,16*U,0,80,stone,1.4)for (const u of [-15*U,15*U]) {- block(d,u,0,5*U,15*U,0,50,stone,1.2)- block(d,u,0,5.5*U,15.5*U,47,3,stone)- roof(d,5.5*U,15.5*U,0,50,10,blue,u)+ block(d,u,0,5*U,15*U,0,46,stone,1.2)+ block(d,u,0,5.5*U,15.5*U,43,3,stone)+ roof(d,5.5*U,15.5*U,0,46,10,blue,u)for (const v of [-11*U,11*U]) {- block(d,u,v,4.2*U,4.2*U,0,60,stone,1.2)- block(d,u,v,4.7*U,4.7*U,58,2,stone)- hip(d,u,v,5*U,60,12,blue)- d.cylinder(u,v,.45*U,71.5,3.5,gold[1],gold[0],.5,10)+ block(d,u,v,4.2*U,4.2*U,0,54,stone,1.2)+ block(d,u,v,4.7*U,4.7*U,52,2,stone)+ hip(d,u,v,5*U,54,12,blue)+ d.cylinder(u,v,.45*U,65.5,3.5,gold[1],gold[0],.5,10)}}block(d,0,0,10.7*U,16.7*U,76,4,stone)for (const side of sides) {const front=side==="left"||side==="backLeft",a=(front?16:20)*U- for (const s of front?[-15*U,15*U]:[-10*U,0,10*U]) for (const z of [12,35]) window(d,side,front?15.2*U:a,s,z,1.4*U,11)+ for (const s of front?[-15*U,15*U]:[-10*U,0,10*U]) for (const z of [10,33]) window(d,side,front?15.2*U:a,s,z,1.4*U,10)if (front) {- for (const s of [-6*U,0,6*U]) window(d,side,a,s,53,1.5*U,17)+ for (const s of [-6*U,0,6*U]) window(d,side,a,s,60,1.5*U,13)const p=(s:number,z:number)=>d.wall(side,a,s,z,.04)- beam(d,p(-10*U,49),p(10*U,49),1.4,stone)+ beam(d,p(-10*U,52),p(10*U,52),1.2,stone)}}for (const u of [-9*U,9*U]) for (const v of [-15.5*U,15.5*U]) block(d,u,v,.65*U,.65*U,0,76,stone)// A wide ceremonial stair leads into the columned portico.- for (let i=0;i<4;i++) block(d,0,(21-i*.7)*U,(11-i*.45)*U,(1.5+i*.15)*U,i,1,stone)+ for (let i=0;i<5;i++) block(d,0,(21-i*.65)*U,(11-i*.35)*U,(1.5+i*.15)*U,i*.8,.8,stone)entrance(d,16*U,3.4*U,27)for (const u of [-8*U,-4*U,4*U,8*U]) {block(d,u,20*U,.85*U,.85*U,4,2,stone)diff --git a/src/asset-lab/construction.ts b/src/asset-lab/construction.tsindex bffd9bc..de81080 100644--- a/src/asset-lab/construction.ts+++ b/src/asset-lab/construction.ts@@ -43,7 +43,7 @@ export function makeSite(share: number, size = 2) {}export function makeConstruction(kindId: KindId, progress: number) {const kind = kinds[kindId],- a = kind.half * U,+ a = buildingDimensions(kindId).half,H = buildingDimensions(kindId).height,stage = buildStages(progress)const d = new Drawing(diff --git a/src/asset-lab/dimensions.ts b/src/asset-lab/dimensions.tsnew file mode 100644index 0000000..3e4f714--- /dev/null+++ b/src/asset-lab/dimensions.ts@@ -0,0 +1,18 @@+import type { KindId } from "../content.ts"++/** Authored vertical pixels. Walkers stay 17 units tall including their cap.+ * Floors, openings and furniture share a human reference; towers do not. */+export const human = { door: 20, floor: 22, publicFloor: 25, seat: 4.5, worktop: 8 } as const+export const residentialHeight = (tier: 1 | 2 | 3) => 24 + (tier - 1) * human.floor++/** Enclosed shells only. Plot sizes and simulation rules are independent. */+const heights: Partial<Record<KindId, number>> = {+ townhall: 52, granary: 48, chapel: 40, hospital: human.publicFloor*2, mill: 52,+ healer: human.publicFloor, watchhouse: 26, market: 26, smokehouse: 25,+ lumberjack: 24, forester: 24, farm: 25, sheep: 25, builder: 24, firewatch: 24,+ quarry: 25, mine: 32, smithy: 27, sawmill: 30+}+const halves: Partial<Record<KindId, number>> = { townhall: 18, chapel: 10, healer: 9, watchhouse: 9, market: 10 }+export function shellDimensions(id: KindId) {+ return { height: heights[id] ?? 28, half: halves[id] }+}diff --git a/src/asset-lab/furniture.ts b/src/asset-lab/furniture.tsindex 8bc5284..8012727 100644--- a/src/asset-lab/furniture.ts+++ b/src/asset-lab/furniture.ts@@ -1,13 +1,14 @@import { U } from "../iso.ts"import { Drawing } from "./primitives.ts"import { block, wood, iron } from "./workshops.ts"+import { human } from "./dimensions.ts"/** Furniture shares its dimensions in the work yard and on delivery carts. */export function chair(d: Drawing, u: number, v: number, z = 0) {for (const x of [-0.7, 0.7]) for (const y of [-0.7, 0.7])- block(d, u + x * U, v + y * U, 0.15 * U, 0.15 * U, z, y < 0 ? 8.5 : 3.5, wood, 0.45)- block(d, u, v, U, U, z + 3.5, 0.65, wood, 0.55)- for (const h of [6, 8]) block(d, u, v - 0.7 * U, 0.7 * U, 0.15 * U, z + h, 0.5, wood, 0.45)+ block(d, u + x * U, v + y * U, 0.15 * U, 0.15 * U, z, y < 0 ? 9.5 : human.seat, wood, 0.45)+ block(d, u, v, U, U, z + human.seat, 0.65, wood, 0.55)+ for (const h of [7, 9]) block(d, u, v - 0.7 * U, 0.7 * U, 0.15 * U, z + h, 0.5, wood, 0.45)}export function chest(d: Drawing, u: number, v: number, z = 0) {diff --git a/src/asset-lab/homes.ts b/src/asset-lab/homes.tsindex 60ef819..9026936 100644--- a/src/asset-lab/homes.ts+++ b/src/asset-lab/homes.ts@@ -2,6 +2,7 @@ import { home } from "../content.ts"import { homeVariant } from "../art.ts"import { U } from "../iso.ts"import { Drawing, palette, sides, type Side } from "./primitives.ts"+import { human, residentialHeight } from "./dimensions.ts"export function house(tier: 1 | 2 | 3,@@ -19,7 +20,7 @@ export function house()const variant = homeVariant(variantN)const a = (home.half + (tier >= 2 ? 1 : 0)) * U,- H = home.tiers[tier].height+ H = residentialHeight(tier)d.asset.category = "homes"d.asset.reference = { type: "house", tier, variant: variantN }d.asset.footprint = 1@@ -27,12 +28,18 @@ export function house(d.box(0, 0, a, a, 0, H)for (const side of sides) {const door = options.doors ? !!options.doors[side] : side === "right"- for (const z of tier === 3 ? [13, 25] : tier === 2 ? [13] : []) d.line([d.wall(side, a, -a, z), d.wall(side, a, a, z)], 1, palette.ink, 0.7)- if (door && fit > 0.15) d.door(side, a, Math.max(2, (tier===3?11:9) * fit), 2 * U, 2.5 * U, 0.8 * U, variant.roof.shade)- for (const floor of fit > 0.4 ? (tier === 3 ? [0, 12, 24] : tier === 2 ? [0, 12] : [0]) : []) {+ for (let floor = 1; floor < tier; floor++) d.line([d.wall(side, a, -a, floor * human.floor + 1), d.wall(side, a, a, floor * human.floor + 1)], 1, palette.ink, 0.7)+ if (door && fit > 0.15) {+ const p = (s: number, z: number, out = .015) => d.wall(side, a, s, z, out)+ d.face([p(-1.45*U,0),p(1.45*U,0),p(1.45*U,human.door*fit),p(-1.45*U,human.door*fit)],0xb59b77,.8)+ for (const x of [-.5,.5]) d.line([p(x*U,0,.02),p(x*U,human.door*fit,.02)],.4,0x8a6a45)+ d.line([p(.9*U,8*fit,.025),p(.9*U,10*fit,.025)],.7)+ d.face([p(-2*U,21*fit),p(2*U,21*fit),p(2*U,20.5*fit,.8*U),p(-2*U,20.5*fit,.8*U)],variant.roof.shade,.7)+ }+ for (const floor of fit > 0.4 ? Array.from({length:tier},(_,i)=>i*human.floor) : []) {if (tier >= 2) {- for (const along of [-3 * U, 3 * U]) if (!(door && floor === 0)) d.window(side, a, along, floor + 5)- } else if (!door) d.window(side, a, 0, 5)+ for (const along of [-3 * U, 3 * U]) if (!(door && floor === 0)) d.window(side, a, along, floor + 9, 7)+ } else if (!door) d.window(side, a, 0, 9, 7)}}if (fit > 0)diff --git a/src/asset-lab/people.ts b/src/asset-lab/people.tsindex 0126708..7c7746a 100644--- a/src/asset-lab/people.ts+++ b/src/asset-lab/people.ts@@ -377,6 +377,6 @@ export function makeCrate(good: GoodId) {d.asset.category = "cargo"d.asset.reference = { type: "crate", good }d.asset.footprint = 1- d.crate(0, 0, 0, goods[good].color, 3 * U, 12)+ d.crate(0, 0, 0, goods[good].color, 1.8 * U, 6)return d.asset}diff --git a/src/asset-lab/rural.ts b/src/asset-lab/rural.tsindex 7d48af3..9b138aa 100644--- a/src/asset-lab/rural.ts+++ b/src/asset-lab/rural.ts@@ -2,6 +2,7 @@ import { type KindId } from "../content.ts"import { U } from "../iso.ts"import { Drawing, palette, pale, type Side, type Vertex } from "./primitives.ts"import { beam, block, iron, post, stone, wood } from "./workshops.ts"+import { human } from "./dimensions.ts"export const ruralIds = ["firewatch", "lumberjack", "forester", "farm", "sheep", "smokehouse", "builder", "chapel", "granary"] as constexport const ruralDoorIds = ["lumberjack", "forester", "farm", "sheep", "smokehouse", "builder", "granary"] as const@@ -28,7 +29,7 @@ function wallBlock(d: Drawing, side: Side, a: number, along: number, out: number/** Timber leaves open at their hinges; all planks and braces follow the leaf. */export function ruralEntrance(d: Drawing, id: RuralDoorId, side: Side, a: number, fit: number, open: number) {const half = (id === "farm" || id === "sheep" ? 4.5 : id === "granary" ? 4 : id === "forester" ? 2.5 : 3.2) * U- const bottom = id === "granary" ? 3 : 0.5, height = id === "granary" ? 24 : 18+ const bottom = id === "granary" ? 3 : 0.5, height = id === "granary" ? 22 : human.doorconst p = (s: number, z: number, out = 0.02) => d.wall(side, a, s, z * fit, out)d.face([p(-half, bottom), p(half, bottom), p(half, bottom + height), p(-half, bottom + height)], 0x68726c, 0.7)const single = id === "forester", angle = Math.max(0, Math.min(1, open)) * Math.PI / 9@@ -67,10 +68,10 @@ export function chapelPorch(d: Drawing, side: Side, a: number, fit: number) {export function granaryVents(d: Drawing, side: Side, a: number) {const p = (s: number, z: number, out = 0.025) => d.wall(side, a, s, z, out)for (const center of [-5 * U, 5 * U]) {- d.face([p(center - 2.2 * U, 44), p(center + 2.2 * U, 44), p(center + 2.2 * U, 56), p(center - 2.2 * U, 56)], 0x6f796d, 0.7)- for (const x of [-2.4 * U, 2.4 * U]) beam(d, p(center + x, 43.5, 0.04), p(center + x, 56.5, 0.04), 0.75)- for (const z of [44, 56]) beam(d, p(center - 2.4 * U, z, 0.04), p(center + 2.4 * U, z, 0.04), 0.75)- for (const z of [46, 48.5, 51, 53.5]) beam(d, p(center - 2.1 * U, z, 0.055), p(center + 2.1 * U, z, 0.055), 1.1)+ d.face([p(center - 2.2 * U, 33), p(center + 2.2 * U, 33), p(center + 2.2 * U, 43), p(center - 2.2 * U, 43)], 0x6f796d, 0.7)+ for (const x of [-2.4 * U, 2.4 * U]) beam(d, p(center + x, 32.5, 0.04), p(center + x, 43.5, 0.04), 0.75)+ for (const z of [33, 43]) beam(d, p(center - 2.4 * U, z, 0.04), p(center + 2.4 * U, z, 0.04), 0.75)+ for (const z of [35, 37.5, 40]) beam(d, p(center - 2.1 * U, z, 0.055), p(center + 2.1 * U, z, 0.055), 1.1)}}@@ -128,10 +129,10 @@ export function firewatchAccess(d: Drawing, a: number, p: number, H: number) {const point = (t: number, side: number, height: number): Vertex => [(11 - 7 * t) * U, (-4.5 + 2.7 * t + side * 1.2) * U, top + 6 * t + height]for (const side of [-1, 1]) {beam(d, point(0, side, -0.5), point(1, side, -0.5), 1.2)- beam(d, point(0, side, 5), point(1, side, 5), 0.8)- for (const t of [0, 0.5, 1]) beam(d, point(t, side, 0), point(t, side, 5), 0.8)- beam(d, [10 * U, v + side * 1.6 * U, top + 5], [12.5 * U, v + side * 1.6 * U, top + 5], 0.8)- for (const u of [10 * U, 12.5 * U]) beam(d, [u, v + side * 1.6 * U, top], [u, v + side * 1.6 * U, top + 5], 0.8)+ beam(d, point(0, side, 8), point(1, side, 8), 0.8)+ for (const t of [0, 0.5, 1]) beam(d, point(t, side, 0), point(t, side, 8), 0.8)+ beam(d, [10 * U, v + side * 1.6 * U, top + 8], [12.5 * U, v + side * 1.6 * U, top + 8], 0.8)+ for (const u of [10 * U, 12.5 * U]) beam(d, [u, v + side * 1.6 * U, top], [u, v + side * 1.6 * U, top + 8], 0.8)}for (let i = 0; i < 7; i++) {const t = (i + 0.5) / 7diff --git a/src/asset-lab/scaffolding.ts b/src/asset-lab/scaffolding.tsindex 8680960..66e3cc9 100644--- a/src/asset-lab/scaffolding.ts+++ b/src/asset-lab/scaffolding.ts@@ -1,6 +1,7 @@import { U } from "../iso.ts"import { Drawing, type Vertex } from "./primitives.ts"import { beam as solidBeam, block as solidBlock, stone, wood } from "./workshops.ts"+import { human } from "./dimensions.ts"// Repeated scaffold members retain solid faces, with one ink edge per edge.// Outlining every face separately would duplicate the same lines many times.@@ -31,8 +32,8 @@ export function scaffoldAsset(size: number, height: number, share: number) {const stations=Array.from({length:n+1},(_,i)=>-s+2*s*i/n).filter(x=>Math.abs(x)>U)const levels:number[]=[]const deck=Math.max(2,rise-6)- for(let z=8;z<deck-1;z+=12)levels.push(z)- if(!levels.length||deck-levels[levels.length-1]!>2)levels.push(deck)+ for(let z=deck-human.floor;z>=8;z-=human.floor)levels.unshift(z)+ levels.push(deck)const platformLevels=levels.slice(-2)for(let side=0;side<4;side++) {const p=(along:number,out:number,z:number):Vertex=>{@@ -57,7 +58,8 @@ export function scaffoldAsset(size: number, height: number, share: number) {const q=p((a+b)/2,inner+t*U,z+.15)block(d,q[0],q[1],(side%2?.18*U:(b-a)/2),(side%2?(b-a)/2:.18*U),z+.15,.5,wood,.45)}- if(z+5<rise)beam(d,p(a,s,z+5),p(b,s,z+5),.55)+ beam(d,p(a,s,z+8),p(b,s,z+8),.55)+ for(const x of [a,b])beam(d,p(x,s,z),p(x,s,z+8),.5)}}// Diagonal braces stay away from the entrances.@@ -69,10 +71,10 @@ export function scaffoldAsset(size: number, height: number, share: number) {}// The ladder rests on a rear bay and meets the highest working platform.const a=-s*.8,b=-s*.57- for(const offset of [-.45*U,.45*U])beam(d,[a+offset,-s,0],[b+offset,-s,deck+.8],.6)- for(let z=2;z<deck;z+=3) {+ for(const offset of [-.8*U,.8*U])beam(d,[a+offset,-s,0],[b+offset,-s,deck+.8],.6)+ for(let z=2;z<deck;z+=2.5) {const x=a+(b-a)*z/(deck+.8)- beam(d,[x-.45*U,-s,z],[x+.45*U,-s,z],.5)+ beam(d,[x-.8*U,-s,z],[x+.8*U,-s,z],.5)}// Compact corner piles work even when the building fills most of its plot.const c=s-1.4*Udiff --git a/src/asset-lab/service-upgrades.ts b/src/asset-lab/service-upgrades.tsindex 2baa5bc..08095fa 100644--- a/src/asset-lab/service-upgrades.ts+++ b/src/asset-lab/service-upgrades.ts@@ -27,8 +27,8 @@ export function serviceBuilding(kind: ServiceKind, tier: 1 | 2, options: Upgrade/** Each upgrade's height to its eaves and to its highest point, for markers and surface effects. */export const upgradeHeights: Readonly<Record<ServiceKind, { readonly eave: number; readonly top: number }>> = {- market: { eave: 44, top: 62 },- chapel: { eave: 52, top: 125 }+ market: { eave: 49, top: 63 },+ chapel: { eave: 44, top: 125 }}/** The sides each upgrade is drawn with its street fronts on: the market hall's arcades, the church's tower door. */@@ -136,8 +136,8 @@ function arch(d: Drawing, p: Wall, s: number, z: number, half: number, height: n}function churchDoor(d: Drawing, p: Wall) {- const half = 2.25 * U, bottom = 4, spring = 19- arch(d, p, 0, bottom, half, 18, 0xc6b18e, true, 3)+ const half = 2.25 * U, bottom = 4, spring = 21+ arch(d, p, 0, bottom, half, 20, 0xc6b18e, true, 3)for (const sign of [-1, 1]) {const inner = sign * half, outer = sign * (half + U)d.face([p(inner, bottom, 0.014), p(outer, bottom, 0.014), p(outer, spring, 0.014), p(inner, spring, 0.014)], stone.top, 0.65)@@ -145,27 +145,27 @@ function churchDoor(d: Drawing, p: Wall) {// Small vertical handles make the two leaves readable without extra ornament.d.line([p(sign * 0.6 * U, 10.5, 0.03), p(sign * 0.6 * U, 12, 0.03)], 0.8, 0x7d6140)}- d.line([p(0, bottom, 0.025), p(0, 22, 0.025)], 0.7, 0x7d6140)+ d.line([p(0, bottom, 0.025), p(0, 24, 0.025)], 0.7, 0x7d6140)}export function marketHall(options: UpgradeOptions = {}) {const d = base("market", "market-hall", "Market hall", "Tier 2 market. A pitched hall above a covered arcade, with the market's striped awnings, blue trim and goods crates. Same 2×2 plot.", options)const a = 9 * Ud.box(0, 0, 10 * U, 10 * U, 0, 3, stone.top, stone.left, stone.right)- d.box(0, 0, a, a, 3, 40)- d.box(0, 0, 9.4 * U, 9.4 * U, 28, 2, stone.top, stone.left, stone.right, 1)+ d.box(0, 0, a, a, 3, 45)+ d.box(0, 0, 9.4 * U, 9.4 * U, 27, 2, stone.top, stone.left, stone.right, 1)for (const side of sides) {const p = wall(side, a)- arch(d, p, 0, 3, 2.5 * U, 19, 0xc6b18e, true)+ arch(d, p, 0, 3, 2.5 * U, 20, 0xc6b18e, true)d.line([p(0, 3, 0.02), p(0, 18, 0.02)], 0.8, 0x7d6140)for (const s of [-5.5 * U, 0, 5.5 * U]) {- arch(d, p, s, 33, 1.15 * U, 7, palette.glass)- d.line([p(s, 33, 0.02), p(s, 38, 0.02)], 0.65)+ arch(d, p, s, 33, 1.15 * U, 10, palette.glass)+ d.line([p(s, 33, 0.02), p(s, 41, 0.02)], 0.65)d.line([p(s - 1.5 * U, 32), p(s + 1.5 * U, 32)], 1)}d.line([p(-a, 30), p(a, 30)], 1, pale(blue, 0.3))}- roof(d, 0, 0, 11 * U, 11 * U, 44, 18, 0x8a6a45)+ roof(d, 0, 0, 11 * U, 11 * U, 49, 14, 0x8a6a45)// A complete arcade on the two street faces. Narrow posts retain open space below the canopy.for (const side of ["right", "left"] as const) {const p = wall(side, 13 * U)@@ -207,8 +207,8 @@ export function marketHall(options: UpgradeOptions = {}) {// Blue gable plaques carry the service colour above the striped street fronts.for (const side of ["left", "backLeft"] as const) {const p = wall(side, 11 * U)- d.face([p(-2 * U, 47), p(2 * U, 47), p(2 * U, 51), p(-2 * U, 51)], pale(blue, 0.28), 1)- for (const s of [-U, 0, U]) d.line([p(s, 48, 0.02), p(s, 50, 0.02)], 0.7, 0xf7f3ea)+ d.face([p(-2 * U, 51), p(2 * U, 51), p(2 * U, 55), p(-2 * U, 55)], pale(blue, 0.28), 1)+ for (const s of [-U, 0, U]) d.line([p(s, 52, 0.02), p(s, 54, 0.02)], 0.7, 0xf7f3ea)}return turned(d.asset, quartersFor("market", options.doors))}@@ -217,25 +217,25 @@ export function church(options: UpgradeOptions = {}) {const d = base("chapel", "church", "Church", "Tier 2 chapel. A slate-blue nave, stone buttresses, arched glass and an open belfry with a bronze bell. Same 2×2 plot.", options)const a = 7 * U, b = 11 * Ud.box(0, 0, 8 * U, 12 * U, 0, 3, stone.top, stone.left, stone.right)- d.box(0, 0, a, b, 3, 48)- roof(d, 0, 0, 8.5 * U, 12 * U, 52, 24, blue)+ d.box(0, 0, a, b, 3, 40)+ roof(d, 0, 0, 8.5 * U, 12 * U, 44, 20, blue)for (const side of ["right", "backRight"] as const) {const p = wall(side, a)for (const s of [-7 * U, 0, 7 * U]) {- arch(d, p, s, 20, 1.4 * U, 21, 0xc9d6ee, true)- d.line([p(s, 20, 0.025), p(s, 38, 0.025)], 0.75)- d.line([p(s - 1.4 * U, 29, 0.025), p(s + 1.4 * U, 29, 0.025)], 0.75)- d.line([p(s - 2 * U, 19), p(s + 2 * U, 19)], 1)+ arch(d, p, s, 14, 1.4 * U, 22, 0xc9d6ee, true)+ d.line([p(s, 14, 0.025), p(s, 33, 0.025)], 0.75)+ d.line([p(s - 1.4 * U, 24, 0.025), p(s + 1.4 * U, 24, 0.025)], 0.75)+ d.line([p(s - 2 * U, 13), p(s + 2 * U, 13)], 1)}for (const s of [-10 * U, -3.5 * U, 3.5 * U, 10 * U]) {const [x, y] = p(s, 0, 1.2 * U)- d.box(x, y, 1.2 * U, 0.65 * U, 3, 28, stone.top, stone.left, stone.right, 1)- d.box(x, y, 0.65 * U, 0.65 * U, 31, 14, stone.top, stone.left, stone.right, 1)+ d.box(x, y, 1.2 * U, 0.65 * U, 3, 22, stone.top, stone.left, stone.right, 1)+ d.box(x, y, 0.65 * U, 0.65 * U, 25, 14, stone.top, stone.left, stone.right, 1)}}const rear = wall("backLeft", b)- arch(d, rear, 0, 24, 2.4 * U, 23, 0xc9d6ee, true)- d.line([rear(0, 24, 0.025), rear(0, 44, 0.025)], 0.8)+ arch(d, rear, 0, 17, 2.4 * U, 23, 0xc9d6ee, true)+ d.line([rear(0, 17, 0.025), rear(0, 37, 0.025)], 0.8)// Front tower grows from the nave's entrance, with a genuinely open four-sided bell chamber.const tv = 9 * U, ta = 3.4 * Ud.box(0, tv, ta + 0.8 * U, ta + 0.8 * U, 0, 4, stone.top, stone.left, stone.right)diff --git a/src/asset-lab/services.ts b/src/asset-lab/services.tsindex 9486e90..15ba1af 100644--- a/src/asset-lab/services.ts+++ b/src/asset-lab/services.ts@@ -17,25 +17,25 @@ export function institutionDoor(d: Drawing, side: Side, a: number, kind: "chapeld.line([p(-3*U,12,0.032),p(3*U,12,0.032)],1,0x6d7469)} else {d.face([p(-4*U,0),p(4*U,0),p(4*U,23),p(-4*U,23)],0xe3e6dd,1)- d.face([p(-3*U,0,0.025),p(3*U,0,0.025),p(3*U,18,0.025),p(-3*U,18,0.025)],0x839a89,1)+ d.face([p(-3*U,0,0.025),p(3*U,0,0.025),p(3*U,20,0.025),p(-3*U,20,0.025)],0x839a89,1)for(const x of [-1.6,1.6])d.face([p((x-0.8)*U,10,0.03),p((x+0.8)*U,10,0.03),p((x+0.8)*U,16,0.03),p((x-0.8)*U,16,0.03)],0xdbe9e7,0.75)d.face([p(-3*U,19,0.025),p(3*U,19,0.025),p(3*U,21.5,0.025),p(-3*U,21.5,0.025)],0xdbe9e7,0.75)- d.line([p(0,0,0.03),p(0,18,0.03)],1,0x596c60)+ d.line([p(0,0,0.03),p(0,20,0.03)],1,0x596c60)}for(const x of [-0.6,0.6])d.line([p(x*U,8,0.04),p(x*U,10,0.04)],1.2,0xceb887)d.line([p(-4*U,0.3,0.04),p(4*U,0.3,0.04)],1.5,0xb6bead)}export function makeQuarry(options: BuildingOptions = {}) {- const fit = options.fit ?? 1, p = 15*U, H = 32+ const fit = options.fit ?? 1, p = 15*U, H = 25const d = new Drawing("quarry", "Quarry", "A two-cell stonecutting yard with a stepped rock face, timber derrick, dressed blocks and a small workshop.")d.asset.category="buildings";d.asset.reference={type:"building",kind:"quarry"};d.asset.footprint=kinds.quarry.sizeif(options.plate!==false)d.plate(2)d.box(-9*U,-6*U,4*U,7*U,0,H)if(fit>0)d.box(-9*U,-6*U,4.3*U,7.3*U,H,1.5*fit,0xd1d7ca,0xb8c2b1,0xa6b49f,1)if(fit>0.4){- d.face([[-11*U,1*U+0.005,0],[-7*U,1*U+0.005,0],[-7*U,1*U+0.005,17],[-11*U,1*U+0.005,17]],0x8f9891,1)- d.line([[-9*U,1*U+0.01,1],[-9*U,1*U+0.01,16]],1)+ d.face([[-11*U,1*U+0.005,0],[-7*U,1*U+0.005,0],[-7*U,1*U+0.005,20],[-11*U,1*U+0.005,20]],0x8f9891,1)+ d.line([[-9*U,1*U+0.01,1],[-9*U,1*U+0.01,19]],1)d.face([[-4.9*U,-8*U,12],[-4.9*U,-4*U,12],[-4.9*U,-4*U,20],[-4.9*U,-8*U,20]],0xdbe6ea,1)}if(fit>0.75){@@ -77,16 +77,16 @@ export function finishTownBuilding(d: Drawing, id: KindId, a: number, p: number,for (const side of sides) {const at = (s: number, z: number) => d.wall(side, a, s, z, 0.015)for (const x of [-a + U, a - U]) d.line([at(x, 0), at(x, H)], 1.5, 0x9f8b69)- d.line([at(-a + U, 28), at(0, 40), at(a - U, 28)], 1, 0x9f8b69)+ d.line([at(-a + U, 25), at(0, 32), at(a - U, 25)], 1, 0x9f8b69)granaryVents(d, side, a)}- post(c, -a * 0.4, 43)- d.line([[c, -a * 0.4, 43], [c, a * 0.5, 43], [c, a * 0.5, 33]], 1.5, 0x8a6a45)- d.sack(c, a * 0.5, 27)+ post(c, -a * 0.4, 34)+ d.line([[c, -a * 0.4, 34], [c, a * 0.5, 34], [c, a * 0.5, 24]], 1.5, 0x8a6a45)+ d.sack(c, a * 0.5, 18)for (const y of [-a + U, -a + 4 * U, a - U]) d.sack(c, y)d.cylinder(-a - 2 * U, c, 1.5 * U, 0, 7, 0xc4b08b, 0xe9cf7c, 1, 12)} else if (id === "smokehouse") {- d.box(-a / 2, -a / 2, 2.1 * U, 2.1 * U, H + 20, 4, 0x8f988b, 0xb2b9a9, 0x9ea792, 1)+ d.box(-a / 2, -a / 2, 1.8 * U, 1.8 * U, H + 12, 4, 0x8f988b, 0xb2b9a9, 0x9ea792, 1)const y0 = -a - 2.5 * U, y1 = -a + 5 * Upost(c, y0, 14); post(c, y1, 14)d.line([[c, y0, 14], [c, y1, 14]], 1.5, 0x8a6a45)@@ -101,9 +101,9 @@ export function finishTownBuilding(d: Drawing, id: KindId, a: number, p: number,for (const [y,z] of [[-0.55,0],[0.55,0],[0,2.2]]) d.log("u", c + y!*U, -a + U, -a + 5 * U, z!, 1.3, 0xb08a5e, 0xe9d2a8)} else if (id === "firewatch") {const half = 3 * U, z = H + 13- for (const [u, v] of square(0, 0, half)) post(u, v, 15, z)+ for (const [u, v] of square(0, 0, half)) post(u, v, 20, z)d.box(0, 0, half + U, half + U, z, 1.5, 0xe9d2a8, 0xd0b58c, 0xb08a5e, 1)- d.pyramid(half + U, z + 15, 7, pale(0xc4523f, 0.7), pale(0xc4523f, 0.52))+ d.pyramid(half + U, z + 20, 7, pale(0xc4523f, 0.7), pale(0xc4523f, 0.52))d.cylinder(0, 0, 1.5 * U, z + 5, 1, 0xc2ac70, 0xe4d29a, 1, 12)d.ellipsoid(0, 0, z + 7, U, U, 2, 0xd3bd84, 1, undefined, 12)d.line([[0, 0, z + 9], [0, 0, z + 14]], 1)@@ -112,7 +112,7 @@ export function finishTownBuilding(d: Drawing, id: KindId, a: number, p: number,for (const y of [-2, 1]) d.cylinder(-a - 2 * U, c + y * U, U, 0, 4, 0xbda07a, 0xa9c5d0, 1, 12)} else if (id === "healer" || id === "hospital") {for (const side of sides) {- const at = (s: number, z: number): Vertex => d.wall(side, a, s, z, 0.02), z = id === "hospital" ? 49 : 22+ const at = (s: number, z: number): Vertex => d.wall(side, a, s, z, 0.02), z = id === "hospital" ? 37 : 18d.face([at(-2 * U, z), at(2 * U, z), at(2 * U, z + 7), at(-2 * U, z + 7)], 0xeef3e6, 1, 0x809b87)d.line([at(0, z + 1.5), at(0, z + 5.5)], 2, 0x719383)d.line([at(-U, z + 3.5), at(U, z + 3.5)], 2, 0x719383)@@ -140,8 +140,8 @@ export function finishTownBuilding(d: Drawing, id: KindId, a: number, p: number,} else if (id === "watchhouse") {for (const side of sides) {const at = (s: number, z: number) => d.wall(side, a, s, z, 0.02)- d.face([at(-2 * U, 28), at(2 * U, 28), at(2 * U, 23), at(0, 20), at(-2 * U, 23)], 0xa8bdd1, 1)- d.line([at(0, 22), at(0, 27)], 1, 0x3d6db5)+ d.face([at(-2 * U, 24), at(2 * U, 24), at(2 * U, 20), at(0, 17), at(-2 * U, 20)], 0xa8bdd1, 1)+ d.line([at(0, 19), at(0, 23)], 1, 0x3d6db5)for (const x of [-a / 2, a / 2]) for (const dx of [-0.5, 0.5]) d.line([at(x + dx * U, 12), at(x + dx * U, 20)], 0.75)}post(c, -a / 2, 20)diff --git a/src/asset-lab/town-props.ts b/src/asset-lab/town-props.tsindex 2acff64..a1a64c2 100644--- a/src/asset-lab/town-props.ts+++ b/src/asset-lab/town-props.ts@@ -9,6 +9,7 @@ import { props, type GroundId, type PropId } from "../content.ts"import { cellOf, DIRS, key } from "../grid.ts"import { U } from "../iso.ts"import { hash } from "./land.ts"+import { human } from "./dimensions.ts"import { Drawing, palette, square, type Vertex } from "./primitives.ts"const green = 0xd8e6c9@@ -25,9 +26,9 @@ export function flowerBed(d: Drawing, u: number, v: number, width = 3, color = 0}}export function bench(d: Drawing, u: number, v: number) {- for (const x of [-2.5, 2.5]) d.box(u + x * U, v, 0.4 * U, 1.2 * U, 0, 4, palette.ink, palette.ink, palette.ink, 0.75)- for (const y of [-0.7, 0.7]) d.box(u, v + y * U, 3.5 * U, 0.55 * U, 4, 1, 0xe9d2a8, 0xd0b58c, 0xb08a5e, 0.75)- for (const z of [6, 8]) d.box(u, v - 1.3 * U, 3.5 * U, 0.35 * U, z, 1, 0xe9d2a8, 0xd0b58c, 0xb08a5e, 0.75)+ for (const x of [-2.5, 2.5]) d.box(u + x * U, v, 0.4 * U, 1.2 * U, 0, human.seat, palette.ink, palette.ink, palette.ink, 0.75)+ for (const y of [-0.7, 0.7]) d.box(u, v + y * U, 3.5 * U, 0.55 * U, human.seat, .65, 0xe9d2a8, 0xd0b58c, 0xb08a5e, 0.75)+ for (const z of [7, 9]) d.box(u, v - 1.3 * U, 3.5 * U, 0.35 * U, z, .65, 0xe9d2a8, 0xd0b58c, 0xb08a5e, 0.75)}/** Raised staggered setts share a pitch across neighbouring road cells. */export function setts(d: Drawing, x: number, y: number, half: number, z: number) {diff --git a/src/asset-lab/trades.ts b/src/asset-lab/trades.tsindex d18c594..00e623a 100644--- a/src/asset-lab/trades.ts+++ b/src/asset-lab/trades.ts@@ -40,7 +40,7 @@ function loadingDoors(d: Drawing, p: Wall, half: number, bottom: number, height:export function tradeEntrance(d: Drawing, id: "mill" | "watchhouse", side: Side, a: number, fit: number, open: number) {const p: Wall = (s, z, out = 0.02) => d.wall(side, a, s, z * fit, out)- const half = (id === "mill" ? 3.5 : 3) * U, height = id === "mill" ? 26 : 22+ const half = (id === "mill" ? 3.5 : 3) * U, height = id === "mill" ? 23 : 20loadingDoors(d, p, half, 1, height, open * (id === "mill" ? 1 : 0.25), id === "watchhouse")for (const sign of [-1, 1]) beam(d, p(sign * (half + 0.6 * U), 0, 0.5 * U), p(sign * (half + 0.6 * U), height + 2, 0.5 * U), 1.6, id === "mill" ? wood : stone)beam(d, p(-half - 1.3 * U, height + 2, 0.5 * U), p(half + 1.3 * U, height + 2, 0.5 * U), 1.8, id === "mill" ? wood : stone)@@ -59,7 +59,7 @@ export function millHoist(d: Drawing, a: number) {}export function tradeSmokeOrigin(id: TradeYardId, doors?: BuildingOptions["doors"]): Vertex | null {- return id === "bakery" ? workshopPoint([-8 * U, -2 * U, 48.3], doors) : null+ return id === "bakery" ? workshopPoint([-8 * U, -2 * U, 43.3], doors) : null}export function makeTradeYard(id: TradeYardId, options: BuildingOptions = {}) {@@ -78,16 +78,16 @@ export function makeTradeYard(id: TradeYardId, options: BuildingOptions = {}) {}function warehouse(d: Drawing, fit: number, open: number) {- block(d, 0, -19 * U, 19 * U, 0.65 * U, 1, 31, stone)- for (const u of [-19 * U, 19 * U]) block(d, u, -7 * U, 0.65 * U, 12 * U, 1, 31, stone)- for (const u of [-13 * U, 13 * U]) block(d, u, 5 * U, 6 * U, 0.65 * U, 1, 31, stone)- block(d, 0, 5 * U, 6 * U, 0.65 * U, 28, 4, stone)- if (fit > 0) roof(d, 20.5 * U, 13.5 * U, -7 * U, 32, 9 * fit, 0x8a58a8)+ block(d, 0, -19 * U, 19 * U, 0.65 * U, 1, 27, stone)+ for (const u of [-19 * U, 19 * U]) block(d, u, -7 * U, 0.65 * U, 12 * U, 1, 27, stone)+ for (const u of [-13 * U, 13 * U]) block(d, u, 5 * U, 6 * U, 0.65 * U, 1, 27, stone)+ block(d, 0, 5 * U, 6 * U, 0.65 * U, 26, 2, stone)+ if (fit > 0) roof(d, 20.5 * U, 13.5 * U, -7 * U, 28, 9 * fit, 0x8a58a8)if (fit <= 0.4) returnconst p: Wall = (s, z, out = 0.02) => [s, 5.7 * U + out, z]- loadingDoors(d, p, 6 * U, 4, 24, open)- for (const u of [-6.7 * U, 6.7 * U]) beam(d, [u, 5.9 * U, 3], [u, 5.9 * U, 29], 1.7)- beam(d, [-11 * U, 5.9 * U, 29], [11 * U, 5.9 * U, 29], 1.4, iron)+ loadingDoors(d, p, 6 * U, 4, 22, open)+ for (const u of [-6.7 * U, 6.7 * U]) beam(d, [u, 5.9 * U, 3], [u, 5.9 * U, 27], 1.4)+ beam(d, [-11 * U, 5.9 * U, 27], [11 * U, 5.9 * U, 27], 1.2, iron)block(d, 0, 10.5 * U, 18 * U, 5 * U, 1, 3, stone)block(d, 0, 17 * U, 5 * U, 1.5 * U, 1, 1.5, stone)// A clear central approach, with cargo kept on the loading platform beside it.@@ -96,11 +96,11 @@ function warehouse(d: Drawing, fit: number, open: number) {d.crate(15 * U, 12 * U, 4, 0xd27a34, 1.5 * U, 6)d.barrel(-10 * U, 9 * U, 1.8 * U, 4, 8)d.crate(-10 * U, -9 * U, 1, 0x2f8c87, 2 * U, 7)- post(d, -15 * U, 9 * U, 44)- beam(d, [-15 * U, 9 * U, 43], [-15 * U, 17 * U, 43], 1.8)- beam(d, [-15 * U, 9 * U, 30], [-15 * U, 15 * U, 42], 1.5)- wheel(d, -15 * U, 15 * U, 41.5, 1.4)- d.line([[-15 * U, 16 * U, 41.5], [-15 * U, 16 * U, 13]], 0.75, 0x8a6a45)+ post(d, -15 * U, 9 * U, 40)+ beam(d, [-15 * U, 9 * U, 39], [-15 * U, 17 * U, 39], 1.4)+ beam(d, [-15 * U, 9 * U, 28], [-15 * U, 15 * U, 38], 1.2)+ wheel(d, -15 * U, 15 * U, 37.5, 1.4)+ d.line([[-15 * U, 16 * U, 37.5], [-15 * U, 16 * U, 13]], 0.75, 0x8a6a45)d.crate(-15 * U, 16 * U, 5, 0x2f8c87, 1.7 * U, 6)d.line([[-16.7 * U, 16 * U, 11], [-15 * U, 16 * U, 13], [-13.3 * U, 16 * U, 11]], 0.75, 0x8a6a45)}@@ -111,10 +111,10 @@ function bench(d: Drawing, u: number, v: number, a: number, b: number, z = 7) {}function fishery(d: Drawing, fit: number) {- block(d, -5 * U, -6 * U, 7 * U, 6 * U, 1, 19, stone)- if (fit > 0) roof(d, 8 * U, 7 * U, -6 * U, 20, 10 * fit, 0x2f8c87, -5 * U)+ block(d, -5 * U, -6 * U, 7 * U, 6 * U, 1, 23, stone)+ if (fit > 0) roof(d, 8 * U, 7 * U, -6 * U, 24, 10 * fit, 0x2f8c87, -5 * U)if (fit <= 0.4) return- loadingDoors(d, (s, z, out = 0.02) => [s - 5 * U, out, z], 2.5 * U, 1, 16, 0)+ loadingDoors(d, (s, z, out = 0.02) => [s - 5 * U, out, z], 2.5 * U, 1, 20, 0)d.face([[2.03 * U, -10 * U, 8], [2.03 * U, -5 * U, 8], [2.03 * U, -5 * U, 14], [2.03 * U, -10 * U, 14]], palette.glass, 0.8)for (const v of [-11 * U, U]) post(d, 10 * U, v, 21)beam(d, [10 * U, -11 * U, 20], [10 * U, U, 20], 1.5)@@ -152,42 +152,42 @@ function oven(d: Drawing, u: number, v: number, warm: boolean) {}function bakery(d: Drawing, fit: number, open: number) {- block(d, 0, -7 * U, 12 * U, 6 * U, 1, 27, stone)- if (fit > 0) roof(d, 13 * U, 7 * U, -7 * U, 28, 9 * fit, 0xc4523f)+ block(d, 0, -7 * U, 12 * U, 6 * U, 1, 25, stone)+ if (fit > 0) roof(d, 13 * U, 7 * U, -7 * U, 26, 9 * fit, 0xc4523f)if (fit <= 0.4) return- loadingDoors(d, (s, z, out = 0.02) => [s + 7 * U, -U + out, z], 2.5 * U, 1, 19, open * 0.5)+ loadingDoors(d, (s, z, out = 0.02) => [s + 7 * U, -U + out, z], 2.5 * U, 1, 20, open * 0.5)oven(d, -6 * U, 2 * U, open > 0.25)- const flueTop = 18 + 30 * fit- block(d, -8 * U, -2 * U, 1.6 * U, 1.6 * U, 18, 30 * fit, stone)+ const flueTop = 18 + 25 * fit+ block(d, -8 * U, -2 * U, 1.6 * U, 1.6 * U, 18, 25 * fit, stone)block(d, -8 * U, -2 * U, 2 * U, 2 * U, flueTop - 2, 2, stone)d.face([[-9.2 * U, -3.2 * U, flueTop + 0.02], [-6.8 * U, -3.2 * U, flueTop + 0.02], [-6.8 * U, -0.8 * U, flueTop + 0.02], [-9.2 * U, -0.8 * U, flueTop + 0.02]], 0x68726c, 0)if (fit <= 0.75) returnbench(d, 6 * U, 8 * U, 5.2 * U, 2.3 * U)- for (const u of [1 * U, 11 * U]) post(d, u, 10.8 * U, 18)- const top: Vertex[] = [[0, -0.8 * U, 22], [12 * U, -0.8 * U, 22], [12 * U, 11 * U, 18], [0, 11 * U, 18]]+ for (const u of [1 * U, 11 * U]) post(d, u, 10.8 * U, 21)+ const top: Vertex[] = [[0, -0.8 * U, 24], [12 * U, -0.8 * U, 24], [12 * U, 11 * U, 21], [0, 11 * U, 21]]d.face(top, pale(0xc4523f, 0.68), 0.8)- beam(d, [0, 11 * U, 18], [12 * U, 11 * U, 18], 1)+ beam(d, [0, 11 * U, 21], [12 * U, 11 * U, 21], 1)for (const u of [3, 6, 9]) for (const v of [7, 9]) {d.ellipsoid(u * U, v * U, 8.8, U, 0.65 * U, 0.9, 0xd0a369, 0.45, 0xebce96, 12)d.line([[(u - 0.3) * U, (v - 0.4) * U, 9.4], [(u + 0.3) * U, (v + 0.4) * U, 9.4]], 0.4, 0xa5804f)}d.barrel(-11 * U, 10 * U, U, 1, 7, 0xf1e9d5)d.barrel(-8 * U, 11 * U, U, 1, 6)- beam(d, [9 * U, -U, 26], [9 * U, 3 * U, 26], 0.9, iron)- d.line([[9 * U, 2.5 * U, 26], [9 * U, 2.5 * U, 24]], 0.55)- d.ellipsoid(9 * U, 2.5 * U, 23, 2 * U, 0.55 * U, 1.3, 0xc5985f, 0.65, 0xebce96, 16)- for (const u of [8, 9, 10]) d.line([[u * U, 2.95 * U, 23], [(u + 0.3) * U, 2.95 * U, 24]], 0.45, 0x9c7546)+ beam(d, [9 * U, -U, 29], [9 * U, 3 * U, 29], 0.9, iron)+ d.line([[9 * U, 2.5 * U, 29], [9 * U, 2.5 * U, 27]], 0.55)+ d.ellipsoid(9 * U, 2.5 * U, 26, 2 * U, 0.55 * U, 1.3, 0xc5985f, 0.65, 0xebce96, 16)+ for (const u of [8, 9, 10]) d.line([[u * U, 2.95 * U, 26], [(u + 0.3) * U, 2.95 * U, 27]], 0.45, 0x9c7546)}function weaver(d: Drawing, fit: number) {- block(d, 0, -12 * U, 12 * U, 0.65 * U, 1, 29, stone)- block(d, -12 * U, -6 * U, 0.65 * U, 6 * U, 1, 29, stone)- block(d, 6 * U, -9 * U, 6 * U, 3 * U, 1, 29, stone)- for (const u of [-12 * U, 12 * U]) post(d, u, U, 30)- beam(d, [-12 * U, U, 30], [12 * U, U, 30], 1.6)- if (fit > 0) roof(d, 13.5 * U, 7.5 * U, -6 * U, 30, 8 * fit, 0x8a58a8)+ block(d, 0, -12 * U, 12 * U, 0.65 * U, 1, 25, stone)+ block(d, -12 * U, -6 * U, 0.65 * U, 6 * U, 1, 25, stone)+ block(d, 6 * U, -9 * U, 6 * U, 3 * U, 1, 25, stone)+ for (const u of [-12 * U, 12 * U]) post(d, u, U, 26)+ beam(d, [-12 * U, U, 26], [12 * U, U, 26], 1.4)+ if (fit > 0) roof(d, 13.5 * U, 7.5 * U, -6 * U, 26, 8 * fit, 0x8a58a8)if (fit <= 0.4) return- loadingDoors(d, (s, z, out = 0.02) => [s + 6 * U, -6 * U + out, z], 2.5 * U, 1, 18, 0)+ loadingDoors(d, (s, z, out = 0.02) => [s + 6 * U, -6 * U + out, z], 2.5 * U, 1, 20, 0)for (const u of [-4 * U, 4 * U]) {post(d, u, 4 * U, 22)post(d, u, -U, 19)@@ -219,7 +219,7 @@ function weaver(d: Drawing, fit: number) {/** Early construction keeps the work apron open instead of filling the plot with a cube. */export function tradeConstruction(id: TradeYardId, build: number, share: number | null, doors: BuildingOptions["doors"]) {const d = new Drawing(id, `${kinds[id].title} · construction`, "Store walls and an open work apron."), stage = buildStages(build)- const half = (id === "warehouse" ? 21 : 13.5) * U, height = id === "fishery" ? 20 : id === "bakery" ? 28 : id === "weaver" ? 30 : 32+ const half = (id === "warehouse" ? 21 : 13.5) * U, height = id === "fishery" ? 24 : id === "warehouse" ? 28 : 26d.asset.footprint = kinds[id].sizeif (share !== null) for (let i = 0; i < Math.ceil(share * 3); i++) d.crate(half - 2 * U - i * 3 * U, half - 2 * U, 0, 0x8f9891)if (stage.walls > 0) {diff --git a/src/asset-lab/upgrade-catalogue.ts b/src/asset-lab/upgrade-catalogue.tsindex e6fac40..357c084 100644--- a/src/asset-lab/upgrade-catalogue.ts+++ b/src/asset-lab/upgrade-catalogue.ts@@ -1,6 +1,7 @@import { buildingDimensions, makeBuilding } from "./buildings.ts"import { dressedBuilding, scaffoldAsset } from "./upgrade-dress.ts"import type { InkAsset } from "./primitives.ts"+import { civicEave } from "./civic.ts"export function upgradeCatalogue(): InkAsset[] {const upgrades = ([@@ -26,7 +27,7 @@ export function upgradeCatalogue(): InkAsset[] {["farm",0,.75], ["townhall",1,.5], ["townhall",2,.9]] as const).map(([kind,level,share]) => {const base=level?upgrades.find(a=>a.id===(level===1?"guildhall":"cityhall"))!:makeBuilding(kind)- const height=kind==="townhall"&&level===2?80:buildingDimensions(kind).height+ const height=kind==="townhall"&&level>0?civicEave(level):buildingDimensions(kind).heightconst frame=scaffoldAsset(base.footprint!,height,share)return {...base,id:`works-${kind}-${level}`,title:`${base.title} · works`,note:"The same construction generator, using only plot size, height and delivered share.",reference:{type:"none"} as const,diff --git a/src/asset-lab/upgrade-dress.ts b/src/asset-lab/upgrade-dress.tsindex b44a17a..77c960c 100644--- a/src/asset-lab/upgrade-dress.ts+++ b/src/asset-lab/upgrade-dress.ts@@ -26,32 +26,32 @@ function dress(id: DressedKind, level: number, eave: number): InkAsset {case "warehouse": {// A gantry spans the loading apron. Cargo stays in the yard.for (const u of [-16 * U, 16 * U]) {- post(d, u, 18 * U, 52)- beam(d, [u, 18 * U, 40], [u * 0.72, 18 * U, 51], 1.4)+ post(d, u, 18 * U, 46)+ beam(d, [u, 18 * U, 35], [u * 0.72, 18 * U, 45], 1.2)}- beam(d, [-16 * U, 18 * U, 52], [16 * U, 18 * U, 52], 2)- block(d, 8 * U, 18 * U, 1.3 * U, 0.8 * U, 50.5, 1.5, iron)- wheel(d, 8 * U, 18 * U, 50, 1.5)- d.line([[8 * U, 18 * U, 49], [8 * U, 18 * U, 16]], 0.75, wood[2])+ beam(d, [-16 * U, 18 * U, 46], [16 * U, 18 * U, 46], 1.5)+ block(d, 8 * U, 18 * U, 1.3 * U, 0.8 * U, 44.5, 1.5, iron)+ wheel(d, 8 * U, 18 * U, 44, 1.5)+ d.line([[8 * U, 18 * U, 43], [8 * U, 18 * U, 16]], 0.75, wood[2])d.crate(8 * U, 18 * U, 8, 0x8a58a8, 1.8 * U, 6)d.line([[6.2 * U, 18 * U, 14], [8 * U, 18 * U, 16], [9.8 * U, 18 * U, 14]], 0.75)break}case "bakery": {- block(d, -3 * U, -3 * U, 1.8 * U, 1.8 * U, 1, 59, brick)- block(d, -3 * U, -3 * U, 2.2 * U, 2.2 * U, 59, 2, brick)- d.face(square(-3 * U, -3 * U, 1.4 * U, 61.02), 0x68726c, 0)- for (const z of [43, 49, 55]) d.line([[-4.8 * U, -1.18 * U, z], [-1.2 * U, -1.18 * U, z]], 0.45, 0x9a654f)+ block(d, -3 * U, -3 * U, 1.6 * U, 1.6 * U, 1, 49, brick)+ block(d, -3 * U, -3 * U, 2 * U, 2 * U, 50, 2, brick)+ d.face(square(-3 * U, -3 * U, 1.2 * U, 52.02), 0x68726c, 0)+ for (const z of [37, 43, 48]) d.line([[-4.6 * U, -1.38 * U, z], [-1.4 * U, -1.38 * U, z]], 0.45, 0x9a654f)break}case "quarry": {- post(d, 12 * U, 9 * U, 52)- beam(d, [12 * U, 9 * U, 45], [U, 3 * U, 42], 2)- beam(d, [12 * U, 9 * U, 23], [3 * U, 4 * U, 42], 1.5)- beam(d, [8 * U, 12 * U, 0], [12 * U, 9 * U, 28], 1.2)- d.line([[U, 3 * U, 42], [U, 3 * U, 32]], 0.75, wood[2])- block(d, U, 3 * U, 1.4 * U, 1.2 * U, 25, 6, stone)- d.line([[-0.4 * U, 3 * U, 31], [U, 3 * U, 32], [2.4 * U, 3 * U, 31]], 0.75)+ post(d, 12 * U, 9 * U, 46)+ beam(d, [12 * U, 9 * U, 40], [U, 3 * U, 37], 1.5)+ beam(d, [12 * U, 9 * U, 21], [3 * U, 4 * U, 37], 1.2)+ beam(d, [8 * U, 12 * U, 0], [12 * U, 9 * U, 25], 1)+ d.line([[U, 3 * U, 37], [U, 3 * U, 27]], 0.75, wood[2])+ block(d, U, 3 * U, 1.4 * U, 1.2 * U, 20, 6, stone)+ d.line([[-0.4 * U, 3 * U, 26], [U, 3 * U, 27], [2.4 * U, 3 * U, 26]], 0.75)for (const z of [0, 5]) block(d, 12 * U, -5 * U, 1.2 * U, 1.3 * U, z, 5, stone)break}@@ -64,8 +64,8 @@ function dress(id: DressedKind, level: number, eave: number): InkAsset {for (const dx of [-U, U]) d.face([[u + dx - 0.4 * U, v + 2.21 * U, 18], [u + dx + 0.4 * U, v + 2.21 * U, 18], [u + dx + 0.4 * U, v + 2.21 * U, 21], [u + dx - 0.4 * U, v + 2.21 * U, 21]], 0x68726c, 0.4)beam(d, [u - 2 * U, v + 3 * U, 17.5], [u + 2 * U, v + 3 * U, 17.5], 0.6)for (const dx of [-1.5 * U, 1.5 * U]) beam(d, [u + dx, v + 2.2 * U, 20], [u + dx, v + 3 * U, 17.5], 0.45)- for (const x of [-20, -14]) for (const y of [10, 19]) post(d, x * U, y * U, 16)- roof(d, 3.8 * U, 5.3 * U, 14.5 * U, 16, 5, 0x8a6a45, -17 * U)+ for (const x of [-20, -14]) for (const y of [10, 19]) post(d, x * U, y * U, 21)+ roof(d, 3.8 * U, 5.3 * U, 14.5 * U, 21, 5, 0x8a6a45, -17 * U)for (const y of [12, 17]) d.log("u", y * U, -19 * U, -15 * U, 1, 2, 0xe9cf7c, 0xf3e3a8)break}@@ -81,7 +81,7 @@ function dress(id: DressedKind, level: number, eave: number): InkAsset {block(d, x, y, 1.5 * U, 3 * U, 2.5, 1.2, wood)for (const dx of [-1.8 * U, 1.8 * U]) wheel(d, x + dx, y, 2.5, 2.3)beam(d, [x - 1.8 * U, y, 2.5], [x + 1.8 * U, y, 2.5], 0.7, iron)- for (const dx of [-U, U]) beam(d, [x + dx, y, 3.5], [x + dx, y + 5 * U, 4.5], 0.8)+ for (const dx of [-U, U]) beam(d, [x + dx, y, 3.5], [x + dx, y + 5 * U, 8.5], 0.8)for (let i = 0; i < 3; i++) d.cylinder(x, y, 1.25 * U, 3.7 + i * 0.7, 0.55, 0xb6a37a, 0xd4c8a7, 0.45, 16)break}diff --git a/src/asset-lab/workshops.ts b/src/asset-lab/workshops.tsindex 62ba8a2..44190dc 100644--- a/src/asset-lab/workshops.ts+++ b/src/asset-lab/workshops.ts@@ -26,7 +26,7 @@ export function workshopPoint(point: Vertex, doors?: BuildingOptions["doors"]):}export function workshopSmokeOrigin(id: WorkshopId, doors?: BuildingOptions["doors"]): Vertex | null {- return id === "smithy" ? workshopPoint([-6 * U, 2 * U, 56.3], doors) : null+ return id === "smithy" ? workshopPoint([-6 * U, 2 * U, 49.3], doors) : null}export function orient(asset: InkAsset, doors?: BuildingOptions["doors"]) {@@ -164,29 +164,29 @@ function mine(d: Drawing, fit: number) {}function smithy(d: Drawing, fit: number, open: number) {- block(d, -5.5 * U, -12 * U, 6.5 * U, 0.7 * U, 1, 31, stone)- block(d, -12 * U, -5.5 * U, 0.7 * U, 6.5 * U, 1, 31, stone)- for (const u of [-12 * U, U]) post(d, u, U, 32)- post(d, U, -12 * U, 32)- beam(d, [-12 * U, U, 31], [U, U, 31], 2)- beam(d, [-12 * U, U, 23], [-8 * U, U, 31], 1.7)- beam(d, [U, U, 23], [-3 * U, U, 31], 1.7)- if (fit > 0) roof(d, 8 * U, 8 * U, -5.5 * U, 32, 9 * fit, 0xb04a39, -5.5 * U)+ block(d, -5.5 * U, -12 * U, 6.5 * U, 0.7 * U, 1, 26, stone)+ block(d, -12 * U, -5.5 * U, 0.7 * U, 6.5 * U, 1, 26, stone)+ for (const u of [-12 * U, U]) post(d, u, U, 27)+ post(d, U, -12 * U, 27)+ beam(d, [-12 * U, U, 26], [U, U, 26], 1.6)+ beam(d, [-12 * U, U, 20], [-8 * U, U, 26], 1.3)+ beam(d, [U, U, 20], [-3 * U, U, 26], 1.3)+ if (fit > 0) roof(d, 8 * U, 8 * U, -5.5 * U, 27, 9 * fit, 0xb04a39, -5.5 * U)const u = -6 * U, v = 2 * Ublock(d, u, v, 4 * U, 4 * U, 1, 7, stone)- block(d, u, v - 3.2 * U, 4 * U, 0.8 * U, 8, 16, stone)- for (const x of [u - 3.3 * U, u + 3.3 * U]) block(d, x, v, 0.7 * U, 3 * U, 8, 16, stone)- d.face([[u - 2.6 * U, v - 2.3 * U, 8], [u + 2.6 * U, v - 2.3 * U, 8], [u + 2.6 * U, v - 2.3 * U, 20], [u - 2.6 * U, v - 2.3 * U, 20]], 0x4b524e, 0)+ block(d, u, v - 3.2 * U, 4 * U, 0.8 * U, 8, 13, stone)+ for (const x of [u - 3.3 * U, u + 3.3 * U]) block(d, x, v, 0.7 * U, 3 * U, 8, 13, stone)+ d.face([[u - 2.6 * U, v - 2.3 * U, 8], [u + 2.6 * U, v - 2.3 * U, 8], [u + 2.6 * U, v - 2.3 * U, 17], [u - 2.6 * U, v - 2.3 * U, 17]], 0x4b524e, 0)if (fit > 0.15) {const base = [[-4, -4], [4, -4], [4, 4], [-4, 4]], top = [[-2, -2], [2, -2], [2, 2], [-2, 2]]for (let i = 0; i < 4; i++) {const j = (i + 1) % 4const p = (xy: number[], z: number): Vertex => [u + xy[0]! * U, v + xy[1]! * U, z]- d.face([p(base[i]!, 24), p(base[j]!, 24), p(top[j]!, 33), p(top[i]!, 33)], i % 2 ? 0x9da69b : 0xc4cbc0, 0.8)+ d.face([p(base[i]!, 21), p(base[j]!, 21), p(top[j]!, 29), p(top[i]!, 29)], i % 2 ? 0x9da69b : 0xc4cbc0, 0.8)}- block(d, u, v, 2 * U, 2 * U, 33, 23 * fit, stone)- block(d, u, v, 2.4 * U, 2.4 * U, 33 + 23 * fit - 2, 2, stone)- d.face([[u - 1.5 * U, v - 1.5 * U, 33 + 23 * fit + 0.02], [u + 1.5 * U, v - 1.5 * U, 33 + 23 * fit + 0.02], [u + 1.5 * U, v + 1.5 * U, 33 + 23 * fit + 0.02], [u - 1.5 * U, v + 1.5 * U, 33 + 23 * fit + 0.02]], 0x68726c, 0)+ block(d, u, v, 1.7 * U, 1.7 * U, 29, 20 * fit, stone)+ block(d, u, v, 2 * U, 2 * U, 29 + 20 * fit - 2, 2, stone)+ d.face([[u - 1.2 * U, v - 1.2 * U, 29 + 20 * fit + 0.02], [u + 1.2 * U, v - 1.2 * U, 29 + 20 * fit + 0.02], [u + 1.2 * U, v + 1.2 * U, 29 + 20 * fit + 0.02], [u - 1.2 * U, v + 1.2 * U, 29 + 20 * fit + 0.02]], 0x68726c, 0)}if (fit <= 0.75) returnblock(d, u, v, 2.4 * U, 2.8 * U, 8, 0.4, [open > 0.25 ? 0xd8aa5e : 0x8a7860, 0x8a7860, 0x6d7469], 0)@@ -206,26 +206,26 @@ function smithy(d: Drawing, fit: number, open: number) {}function workbench(d: Drawing, u: number, v: number) {- for (const x of [-2.5 * U, 2.5 * U]) for (const y of [-U, U]) block(d, u + x, v + y, 0.35 * U, 0.35 * U, 1, 5)- block(d, u, v, 3.2 * U, 1.7 * U, 6, 1)+ for (const x of [-2.5 * U, 2.5 * U]) for (const y of [-U, U]) block(d, u + x, v + y, 0.35 * U, 0.35 * U, 1, 6)+ block(d, u, v, 3.2 * U, 1.7 * U, 7, 1)}function sawmill(d: Drawing, fit: number) {- block(d, 0, -12 * U, 12 * U, 0.6 * U, 1, 35, stone)+ block(d, 0, -12 * U, 12 * U, 0.6 * U, 1, 29, stone)for (const u of [-12 * U, 12 * U]) {- post(d, u, -12 * U, 36)- post(d, u, 4 * U, 32)- beam(d, [u, -12 * U, 36], [u, 4 * U, 32], 1.8)- beam(d, [u, 4 * U, 24], [u, -U, 33.25], 1.5)+ post(d, u, -12 * U, 30)+ post(d, u, 4 * U, 26)+ beam(d, [u, -12 * U, 30], [u, 4 * U, 26], 1.4)+ beam(d, [u, 4 * U, 20], [u, -U, 27.25], 1.2)}- beam(d, [-12 * U, 4 * U, 32], [12 * U, 4 * U, 32], 2)+ beam(d, [-12 * U, 4 * U, 26], [12 * U, 4 * U, 26], 1.5)if (fit > 0) {- const top: Vertex[] = [[-13.5 * U, -13 * U, 36.7], [13.5 * U, -13 * U, 36.7], [13.5 * U, 5 * U, 32.3], [-13.5 * U, 5 * U, 32.3]]+ const top: Vertex[] = [[-13.5 * U, -13 * U, 30.7], [13.5 * U, -13 * U, 30.7], [13.5 * U, 5 * U, 26.3], [-13.5 * U, 5 * U, 26.3]]const bottom = top.map(([u, v, z]): Vertex => [u, v, z - 0.8])d.face(top, pale(0x8a6a45, 0.76), 1)d.face([...bottom].reverse(), pale(0x8a6a45, 0.65), 0)for (let i = 0; i < 4; i++) d.face([bottom[i]!, bottom[(i + 1) % 4]!, top[(i + 1) % 4]!, top[i]!], pale(0x8a6a45, 0.58), 0.6)- block(d, 0, 4.8 * U, 13.5 * U, 0.35 * U, 31, 1.3, [pale(0xd27a34, 0.4), pale(0xd27a34, 0.4), pale(0xd27a34, 0.25)])+ block(d, 0, 4.8 * U, 13.5 * U, 0.35 * U, 25, 1.3, [pale(0xd27a34, 0.4), pale(0xd27a34, 0.4), pale(0xd27a34, 0.25)])}// The cutting frame stands in the open bay. Logs run through its centre.for (const u of [-4 * U, 4 * U]) {@@ -264,7 +264,7 @@ export function workshopConstruction(id: WorkshopId, build: number, share: numbe}if (stage.walls > 0) block(d, 0, 0, 13.5 * U, 13.5 * U, 0, Math.max(0.1, stage.walls), stone, 0)if (stage.frame > 0) {- const height = (id === "mine" ? 49 : 32) * stage.frame+ const height = (id === "mine" ? 49 : id === "smithy" ? 27 : 30) * stage.frameconst us = id === "mine" ? [-6 * U, 6 * U] : [-12 * U, id === "smithy" ? U : 12 * U]const vs = id === "mine" ? [-10 * U, -3 * U] : [-12 * U, id === "sawmill" ? 4 * U : U]for (const u of us) for (const v of vs) {@@ -273,7 +273,7 @@ export function workshopConstruction(id: WorkshopId, build: number, share: numbebeam(d, [us[0]!, vs[0]!, height], [us[1]!, vs[0]!, height], 1.4)}if (stage.walls > 0) {- const height = Math.max(0.1, 32 * stage.walls)+ const height = Math.max(0.1, (id === "mine" ? 27 : id === "smithy" ? 26 : 29) * stage.walls)block(d, id === "smithy" ? -5.5 * U : 0, -12 * U, (id === "smithy" ? 6.5 : 12) * U, 0.6 * U, 1, height, stone)if (id === "smithy") block(d, -12 * U, -5.5 * U, 0.6 * U, 6.5 * U, 1, height, stone)}diff --git a/src/content.ts b/src/content.tsindex eee4083..e589de4 100644--- a/src/content.ts+++ b/src/content.ts@@ -528,9 +528,9 @@ export const home = {half: 5,cost: { coins: 15, materials: { planks: 1 } } as Kind["cost"],tiers: {- 1: { title: "settlers", residents: 4, tax: 2.5, height: 14, needs: ["food"], appeal: -100, rise: { coins: 0, materials: {} } },- 2: { title: "citizens", residents: 8, tax: 5, height: 26, needs: ["bread", "cloth", "faith"], appeal: 5, rise: { coins: 35, materials: { planks: 4, stone: 2 } } },- 3: { title: "burghers", residents: 12, tax: 7, height: 38, needs: ["bread", "cloth", "faith", "furniture"], appeal: 12, rise: { coins: 45, materials: { planks: 4, stone: 4, tools: 1, furniture: 2 } } }+ 1: { title: "settlers", residents: 4, tax: 2.5, height: 24, needs: ["food"], appeal: -100, rise: { coins: 0, materials: {} } },+ 2: { title: "citizens", residents: 8, tax: 5, height: 46, needs: ["bread", "cloth", "faith"], appeal: 5, rise: { coins: 35, materials: { planks: 4, stone: 2 } } },+ 3: { title: "burghers", residents: 12, tax: 7, height: 68, needs: ["bread", "cloth", "faith", "furniture"], appeal: 12, rise: { coins: 45, materials: { planks: 4, stone: 4, tools: 1, furniture: 2 } } }} as Readonly<Record<Tier, {readonly title: stringreadonly residents: numberdiff --git a/src/model-review/main.ts b/src/model-review/main.tsindex 6a2ec2d..3b17e6c 100644--- a/src/model-review/main.ts+++ b/src/model-review/main.ts@@ -38,7 +38,7 @@ const root = document.querySelector<HTMLElement>("#review")!root.innerHTML = `<header><a href="/">Inkline Town</a><span>TOWN MODEL REVIEW</span><a href="/map-lab.html">Town map ↗</a></header><section class="intro"><div><p class="eyebrow">A town with a little more life</p><h1>New places.<br>The same ink.</h1><p>Inspect the models together, turn them around, then open any one for a closer look.</p></div><aside>7 buildings<br>3 park furnishings<br>3 home tiers<br><span>Plus people, hazards, paving,<br>snow and signs of wear.</span></aside></section><nav aria-label="Model collections"></nav><section class="camera"><label>Turn the models <input aria-label="Model rotation" type="range" min="-180" max="180" value="0"><output>0°</output></label><button id="rear">See the back</button><button id="reset">Reset view</button><button id="sheet">Save model sheet</button><a id="sheet-link" hidden download>Download sheet ↗</a><label>View <select aria-label="View elevation"><option value="30">Street angle</option><option value="50">From above</option><option value="15">Near the ground</option></select></label></section>- <section class="grid" aria-label="3D models"></section><footer><a href="/park-lab.html">Built park & running water ↗</a> · <a href="/effects-lab.html">Animated house effects ↗</a> · Drag a model to turn the collection · <a href="/asset-lab.html">Full asset catalogue ↗</a> · <a href="/">Play this town ↗</a></footer>`+ <section class="grid" aria-label="3D models"></section><footer><a href="/proportion-review.html">Before / after proportions ↗</a> · <a href="/park-lab.html">Built park & running water ↗</a> · <a href="/effects-lab.html">Animated house effects ↗</a> · Drag a model to turn the collection · <a href="/asset-lab.html">Full asset catalogue ↗</a> · <a href="/">Play this town ↗</a></footer>`const nav = root.querySelector("nav")!, grid = root.querySelector<HTMLElement>(".grid")!, rotation = root.querySelector<HTMLInputElement>("input")!, elevation = root.querySelector<HTMLSelectElement>("select")!const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true, preserveDrawingBuffer: true })renderer.setPixelRatio(Math.min(devicePixelRatio, 2)); renderer.outputColorSpace = THREE.SRGBColorSpacediff --git a/src/model-review/proportion-models.ts b/src/model-review/proportion-models.tsnew file mode 100644index 0000000..07d02b5--- /dev/null+++ b/src/model-review/proportion-models.ts@@ -0,0 +1,26 @@+import type { KindId } from "../content.ts"+import { assetById } from "../asset-lab/assets.ts"+import { Drawing, type InkAsset } from "../asset-lab/primitives.ts"+import { chair, chest } from "../asset-lab/furniture.ts"+import { bench } from "../asset-lab/town-props.ts"+import { scaffoldAsset } from "../asset-lab/scaffolding.ts"++// This review belongs to one approved revision. Future building kinds should+// not silently join a comparison whose frozen originals cannot contain them.+const reviewedKinds = ["townhall", "warehouse", "lumberjack", "forester", "quarry", "mine", "fishery", "sawmill", "smithy", "farm", "mill", "bakery", "sheep", "weaver", "market", "chapel", "granary", "smokehouse", "firewatch", "healer", "hospital", "watchhouse", "builder", "carpenter"] as const satisfies ReadonlyArray<KindId>+export const architectureIds = ["cottage", "citizen", "townhouse", ...reviewedKinds,+ "guildhall", "cityhall", "depot", "masonry", "estate", "ovenworks", "fire-brigade", "market-hall", "church"]++export function proportionModels(): InkAsset[] {+ const models = architectureIds.map(id => assetById.get(id)!)+ for (const [id, title, draw] of [["chair", "Chair", chair], ["chest", "Chest", chest], ["bench", "Bench", bench]] as const) {+ const d = new Drawing(id, title, "Shared furnishing, shown beside an unchanged walker.")+ draw(d, 0, 0); d.asset.footprint = 1; d.asset.category = "cargo"; models.push(d.asset)+ }+ for (const id of ["cart-furniture-4", "barrow-furniture-4", "crate-wood"]) models.push(assetById.get(id)!)+ for (const share of [.15, .5, .9]) {+ const a = scaffoldAsset(2, 28, share)+ models.push({...a, id: `scaffold-${share * 100}`, title: `Scaffold · ${share * 100}% delivered`})+ }+ return models+}diff --git a/src/model-review/proportions.css b/src/model-review/proportions.cssnew file mode 100644index 0000000..ca503ad--- /dev/null+++ b/src/model-review/proportions.css@@ -0,0 +1 @@+*{box-sizing:border-box}body{margin:0;background:#f0f2ec;color:#3d4943;font:15px Georgia,serif}#proportions{max-width:1440px;margin:auto;padding:30px}header{display:flex;justify-content:space-between;gap:24px;align-items:center;border-bottom:1px solid #bcc5b8;padding-bottom:20px}.eyebrow,.controls,label,button,select,input,nav,.meta{font:12px system-ui,sans-serif}h1{font-size:40px;line-height:1.05;font-weight:400;margin:10px 0}header p{max-width:640px;line-height:1.55}a{color:inherit}.layout{display:grid;grid-template-columns:230px minmax(0,1fr);gap:26px;margin-top:24px}aside{max-height:850px;overflow:auto}input[type=search],select,button{background:#f8f9f4;border:1px solid #b7c1b2;border-radius:4px;color:inherit;padding:8px}input[type=search],aside select{width:100%;margin-bottom:8px}nav{display:grid;gap:3px;margin-top:12px}nav button{text-align:left;background:transparent;border-color:transparent;padding:8px 9px}nav button[aria-current=true]{background:#dce4d5;border-color:#a6b69d}button{cursor:pointer}button:hover{background:#e0e7d9}.row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.controls{border-bottom:1px solid #bcc5b8;padding:12px 0;display:flex;flex-wrap:wrap;gap:16px;align-items:center}.controls label{display:flex;gap:8px;align-items:center}input[type=range]{width:120px}h2{font-size:27px;font-weight:400;margin:0}.meta{margin:8px 0;line-height:1.6;min-height:38px}.view{position:relative;min-height:490px;margin-top:10px}.view canvas{width:100%;height:490px;display:block}.captions{display:grid;grid-template-columns:1fr 1fr;text-align:center;position:absolute;top:12px;left:0;right:0;pointer-events:none;font:12px system-ui,sans-serif;letter-spacing:.08em;text-transform:uppercase}.captions span{background:#f8f9f4d9;justify-self:center;padding:6px 12px;border-radius:20px}.divider{position:absolute;left:50%;top:0;bottom:0;border-left:1px solid #c7cebf;pointer-events:none}.footer{font:12px system-ui,sans-serif;line-height:1.7;border-top:1px solid #bcc5b8;padding:14px 0}.status{font:12px system-ui,sans-serif;color:#61715b}.error{color:#9a443b}@media(max-width:760px){#proportions{padding:16px}header{display:block}h1{font-size:32px}.layout{grid-template-columns:1fr;gap:18px}aside{max-height:none}nav{display:none}.view,.view canvas{min-height:360px;height:360px}.controls{gap:12px}.controls input[type=range]{width:90px}}diff --git a/src/model-review/proportions.ts b/src/model-review/proportions.tsnew file mode 100644index 0000000..ae431bd--- /dev/null+++ b/src/model-review/proportions.ts@@ -0,0 +1,149 @@+import * as THREE from "three"+import { buildAsset, vertex3 } from "../asset-lab/renderer.ts"+import type { InkAsset } from "../asset-lab/primitives.ts"+import { proportionModels, architectureIds } from "./proportion-models.ts"+import "./proportions.css"++type Baseline = { revision: string; models: InkAsset[]; walker: InkAsset }+const notes: Record<string,string> = {+ cottage:"A person-sized timber door and taller walls; the one-cell footprint stays the same.",+ citizen:"Two floors share the same human clearance as the cottage, with windows above the new floor lines.",+ townhouse:"Three consistent residential floors and a proper entrance, within the original narrow plot.",+ townhall:"Closer floor spacing, smaller enclosed mass and a civic entrance with usable clearance.",+ guildhall:"Human-scaled windows and balcony details; the clock tower and steep roof remain landmarks.",+ cityhall:"More consistent wing windows and floor lines, finer steps and railings; the dome remains prominent.",+ warehouse:"Lower shed walls and loading equipment; the large cargo opening and yard remain.",+ depot:"The warehouse changes carry through; the gantry has clearance for the actual cargo.",+ granary:"Closer storey spacing, relocated ventilation and a hoist aligned with the upper loading level.",+ hospital:"Two public floors with consistent windows and entrances, retaining the ward footprint and lantern.",+ chapel:"A lower worship hall with tall lancet windows; the cupola retains its height above the roof.",+ healer:"A smaller surgery shell with its sign, jars and waiting bench placed at useful heights.",+ watchhouse:"A lower shell with viewing grilles and noticeboard aligned to the walker.",+ market:"A smaller shop shell, higher walk-under canopy and counter at working height.",+ "market-hall":"A usable upper floor above the arcade, with larger upper windows and consistent counter heights.",+ church:"Lower nave and lower-set lancet windows, with a taller entrance; the bell tower remains a landmark.",+ carpenter:"The 20-unit door stays; chairs now share the bench's seat height and tools remain within reach.",+ fishery:"A taller hut entrance and more clearance below its roof; the preparation bench stays at waist height.",+ bakery:"A lower bakehouse and shorter flue, a taller door and canopy, and a sign mounted clear of the canopy.",+ weaver:"A lower open shelter and a taller store door; the loom retains its working dimensions.",+ lumberjack:"More hut clearance above the timber door; smaller, reachable chopping tools.",+ forester:"More hut clearance above the door; the nursery bed and saplings keep their sizes.",+ farm:"A taller barn opening under a shallower roof; the silo and agricultural yard remain.",+ sheep:"A usable barn door, consistent fence and gate, and trough scaled to the sheep.",+ smokehouse:"Usable door clearance and a shorter flue; hanging fish and curing equipment remain accessible.",+ builder:"A usable shed entrance and adjusted workbench; the timber racks and open yard remain.",+ mill:"Closer floor spacing with a cargo entrance; the sails retain their own working clearance.",+ sawmill:"A lower shelter and reachable cutting mechanism, with clear space above the logs.",+ smithy:"A lower shelter, smaller forge opening and consistent workbench; the flue remains tall.",+ mine:"Headframe height retained; the tunnel, tools and cart are checked against the walker.",+ quarry:"A lower stonecutters' hut with a usable door; the rock face and lifting gear keep their height.",+ masonry:"The revised hut carries through, with finer crane members and consistent dressed blocks.",+ estate:"The revised barn carries through; a higher hay-shelter opening fits the same human reference.",+ ovenworks:"The revised bakehouse carries through; a shorter second flue preserves the upgrade's identity.",+ firewatch:"The lookout chamber is taller for standing headroom, with higher rails along the existing access route.",+ "fire-brigade":"The lookout gains standing headroom and higher rails; hose-cart handles rise to the firefighters' hands.",+ chair:"Seat height matches the shared bench, while the chair stays compact enough for furniture delivery.",+ chest:"Chest dimensions reviewed against the walker; compact storage and cargo remain appropriate.",+ bench:"Seat and back heights match the chair; the same generator supplies parks and waiting areas.",+ "cart-furniture-4":"The delivery cart keeps its walker-compatible handles; the load uses the revised shared furniture.",+ "barrow-furniture-4":"The barrow retains its own chassis; the load uses the revised shared furniture.",+ "crate-wood":"A smaller generic goods crate; the same change applies to every goods label. Large warehouse loads remain separate.",+}++const root=document.querySelector<HTMLElement>("#proportions")!+root.innerHTML=`<header><div><div class="eyebrow">INKLINE TOWN / PROPORTION STUDY</div><h1>One town. One human scale.</h1><p>Every building and upgrade, plus shared furnishings and construction. The walker is unchanged. Both sides always use the same camera, ground position and zoom.</p></div><div><a href="/model-review.html?collection=handoff">Model catalogue ↗</a><p class="status" id="status">Loading the approved originals…</p></div></header><div class="layout"><aside><input aria-label="Find a model" type="search" placeholder="Find a model…"><select aria-label="Model group"><option value="all">All models</option><option value="architecture">Buildings & homes</option><option value="props">Props & construction</option></select><select aria-label="Choose model"></select><nav aria-label="All comparison models"></nav></aside><section><div class="row"><button id="previous" aria-label="Previous model">←</button><h2></h2><button id="next" aria-label="Next model">→</button></div><p class="meta" id="note"></p><div class="controls"><label>Turn <input aria-label="Model rotation" type="range" min="-180" max="180" value="0"><output>0°</output></label><label>Elevation <select aria-label="View elevation"><option value="30">Game angle</option><option value="0">Eye level</option><option value="50">From above</option></select></label><label>Zoom <input aria-label="Zoom" type="range" min=".7" max="2" step=".1" value="1"></label><label><input type="checkbox" id="town-scale"> One scale across all models</label><button id="reset">Reset view</button><button id="save">Save comparison</button></div><div class="view"><div class="captions"><span>Before · approved</span><span>After · revised</span></div><div class="divider"></div></div><div class="footer"><span id="dimensions"></span><br>Drag to turn both views together. Arrow buttons move through every model. Switch on one town scale to compare building sizes across the catalogue.<br>Before geometry is frozen at <code>a2845b4</code>. Changes are model geometry, not camera scaling.</div></section></div>`+const renderer=new THREE.WebGLRenderer({antialias:true,preserveDrawingBuffer:true})+renderer.setPixelRatio(Math.min(devicePixelRatio,2));renderer.setClearColor(0xf0f2ec);renderer.setScissorTest(true)+const view=root.querySelector<HTMLElement>(".view")!;view.append(renderer.domElement)+const camera=new THREE.OrthographicCamera(-100,100,100,-100,.1,4000)+const search=root.querySelector<HTMLInputElement>("input[type=search]")!,group=root.querySelector<HTMLSelectElement>("select[aria-label='Model group']")!,picker=root.querySelector<HTMLSelectElement>("select[aria-label='Choose model']")!,nav=root.querySelector<HTMLElement>("nav")!+const rotation=root.querySelector<HTMLInputElement>("input[aria-label='Model rotation']")!,elevation=root.querySelector<HTMLSelectElement>("select[aria-label='View elevation']")!,zoom=root.querySelector<HTMLInputElement>("input[aria-label='Zoom']")!,townScale=root.querySelector<HTMLInputElement>("#town-scale")!+const geometryBounds=(a:InkAsset)=>new THREE.Box3().setFromPoints([...a.faces,...a.strokes].flatMap(f=>f.points.map(vertex3)))+let before:Baseline,after=proportionModels(),filtered=after,selected=0,yaw=0,pitch=30,drag:number|null=null+let pair:Array<{scene:THREE.Scene;built:ReturnType<typeof buildAsset>;person:ReturnType<typeof buildAsset>}>=[],bounds=new THREE.Box3()+const clean=(a:InkAsset):InkAsset=>{const {smokeEffect,fountains,effects,...geometry}=a;return geometry}++function render(){+ if(!pair.length)return+ const {width,height}=view.getBoundingClientRect(),w=width/2+ renderer.setSize(width,height,false)+ const heading=(45+yaw)*Math.PI/180,angle=pitch*Math.PI/180+ const box=townScale.checked?new THREE.Box3(new THREE.Vector3(-85,-1,-75),new THREE.Vector3(85,170,85)):bounds+ const center=box.getCenter(new THREE.Vector3()),size=box.getSize(new THREE.Vector3())+ const horizontal=Math.abs(Math.cos(heading))*size.x+Math.abs(Math.sin(heading))*size.z+ const vertical=Math.cos(angle)*size.y+Math.abs(Math.sin(angle))*(Math.abs(Math.sin(heading))*size.x+Math.abs(Math.cos(heading))*size.z)+ const extent=Math.max(vertical,horizontal/(w/height))*1.18/Number(zoom.value)+ camera.top=extent/2;camera.bottom=-extent/2;camera.left=-extent*w/height/2;camera.right=-camera.left+ camera.position.copy(center).add(new THREE.Vector3(Math.sin(heading)*Math.cos(angle),Math.sin(angle),Math.cos(heading)*Math.cos(angle)).multiplyScalar(1000))+ camera.lookAt(center);camera.updateProjectionMatrix();camera.updateMatrixWorld()+ pair.forEach(({scene,built,person},i)=>{+ renderer.setViewport(i*w,0,w,height);renderer.setScissor(i*w,0,w,height)+ for(const b of [built,person])b.updateContours(camera)+ renderer.render(scene,camera)+ })+ root.querySelector("output")!.textContent=`${yaw}°`+}+function select(id:string){+ const a=after.find(m=>m.id===id)!,b=before.models.find(m=>m.id===id)!+ if(!a||!b)return+ selected=filtered.findIndex(m=>m.id===id)+ pair.forEach(p=>{p.built.dispose();p.person.dispose()});pair=[];bounds=new THREE.Box3()+ const half=Math.max(a.footprint??1,b.footprint??1)/2*32*Math.SQRT2+ const personPosition=new THREE.Vector3(-half-6,0,half+3)+ for(const asset of [b,a]){+ const built=buildAsset(clean(asset),{batchFaces:true}),person=buildAsset(before.walker,{batchFaces:true}),scene=new THREE.Scene()+ person.group.position.copy(personPosition);scene.add(built.group,person.group)+ bounds.union(geometryBounds(asset));bounds.union(geometryBounds(before.walker).translate(personPosition))+ pair.push({scene,built,person})+ }+ root.querySelector("h2")!.textContent=a.title+ root.querySelector("#note")!.textContent=notes[id]??"Platform spacing, guard rails and ladder dimensions follow the same walker reference at every delivery stage."+ const top=(asset:InkAsset)=>Math.max(...[...asset.faces,...asset.strokes].flatMap(f=>f.points.map(p=>p[2])))+ const changed=JSON.stringify([a.faces,a.strokes])!==JSON.stringify([b.faces,b.strokes])+ root.querySelector("#dimensions")!.textContent=`${changed?"Updated":"Reviewed · retained"} · Geometry height ${top(b).toFixed(1)} → ${top(a).toFixed(1)} · Plot ${a.footprint??1} × ${a.footprint??1} cells · Walker 17.1, unchanged`+ picker.value=id;nav.querySelectorAll("button").forEach(el=>el.setAttribute("aria-current",String(el.dataset.id===id)))+ history.replaceState(null,"",`?model=${id}`);render()+}+function filter(){+ const q=search.value.toLowerCase()+ filtered=after.filter(a=>(group.value==="all"||(group.value==="architecture")===architectureIds.includes(a.id))&&`${a.title} ${a.id}`.toLowerCase().includes(q))+ picker.replaceChildren();nav.replaceChildren()+ for(const asset of filtered){+ const option=document.createElement("option");option.value=asset.id;option.textContent=asset.title;picker.append(option)+ const button=document.createElement("button");button.textContent=asset.title;button.dataset.id=asset.id;button.onclick=()=>select(asset.id);nav.append(button)+ }+ for(const id of ["previous","next"])root.querySelector<HTMLButtonElement>(`#${id}`)!.disabled=!filtered.length+ picker.disabled=!filtered.length+ if(filtered.length)select(filtered[0]!.id)+ else{+ pair.forEach(p=>{p.built.dispose();p.person.dispose()});pair=[]+ renderer.setScissorTest(false);renderer.clear();renderer.setScissorTest(true)+ root.querySelector("h2")!.textContent="No matching models"+ root.querySelector("#note")!.textContent="Try a different name or model group."+ root.querySelector("#dimensions")!.textContent=""+ }+}+rotation.oninput=()=>{yaw=Number(rotation.value);render()};elevation.onchange=()=>{pitch=Number(elevation.value);render()};zoom.oninput=render;townScale.onchange=render+search.oninput=filter;group.onchange=filter;picker.onchange=()=>select(picker.value)+root.querySelector<HTMLButtonElement>("#previous")!.onclick=()=>select(filtered[(selected-1+filtered.length)%filtered.length]!.id)+root.querySelector<HTMLButtonElement>("#next")!.onclick=()=>select(filtered[(selected+1)%filtered.length]!.id)+root.querySelector<HTMLButtonElement>("#reset")!.onclick=()=>{yaw=0;pitch=30;rotation.value="0";elevation.value="30";zoom.value="1";townScale.checked=false;render()}+root.querySelector<HTMLButtonElement>("#save")!.onclick=()=>{const a=document.createElement("a");a.download=`inkline-${picker.value}-before-after.png`;a.href=renderer.domElement.toDataURL();a.click()}+renderer.domElement.onpointerdown=e=>{drag=e.clientX;renderer.domElement.setPointerCapture(e.pointerId)}+renderer.domElement.onpointermove=e=>{if(drag===null)return;yaw=Math.max(-180,Math.min(180,Math.round(yaw+(e.clientX-drag)*.5)));drag=e.clientX;rotation.value=String(yaw);render()}+renderer.domElement.onpointerup=()=>drag=null+new ResizeObserver(render).observe(view)+async function start(){+ const requested=new URLSearchParams(location.search).get("model")+ const response=await fetch("/model-review/proportions-before.json.gz")+ if(!response.ok)throw new Error(`Baseline ${response.status}`)+ const bytes=await response.arrayBuffer()+ // Dev servers serve .gz verbatim. Some hosts decompress it automatically.+ const raw=new Uint8Array(bytes)+ before=JSON.parse(raw[0]===31&&raw[1]===139?await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip"))).text():new TextDecoder().decode(raw))+ if(before.models.length!==after.length||after.some(a=>!before.models.some(b=>b.id===a.id)))throw new Error("Comparison catalogue does not match the frozen baseline")+ filter();if(requested&&after.some(a=>a.id===requested))select(requested)+ root.querySelector("#status")!.textContent=`${architectureIds.length} building appearances · ${after.length-architectureIds.length} shared examples`+ Object.assign(window,{proportionReview:{ids:after.map(a=>a.id),select,render,capture:()=>renderer.domElement.toDataURL(),stats:()=>({id:picker.value,before:before.revision,yaw,pitch,pairs:pair.length})}})+}+start().catch(error=>{root.querySelector("#status")!.textContent=String(error);root.querySelector("#status")!.classList.add("error");console.error(error)})diff --git a/src/render3d/models.ts b/src/render3d/models.tsindex 13f6c96..7910118 100644--- a/src/render3d/models.ts+++ b/src/render3d/models.ts@@ -85,7 +85,7 @@ export function buildingAsset(id: KindId, build: number, share: number | null, d? workshopConstruction(id, build, share, doors): isTradeYard(id) ? tradeConstruction(id, build, share, doors): id === "carpenter" ? carpenterConstruction(build, share, doors)- : constructionAsset(kind.size, kind.half, buildingDimensions(id).height, build, share)+ : constructionAsset(kind.size, buildingDimensions(id).half / U, buildingDimensions(id).height, build, share)// Completed upgrades use their final model; works are drawn separately.if (upgraded && isUpgradable(id)) return withAppearance(serviceBuilding(id, 2, { plate: false, doors }), kind.half * U, buildingHeight(id, level), appearance)const dimensions = buildingDimensions(id)diff --git a/src/render3d/views.ts b/src/render3d/views.tsindex 690a323..ac96a2e 100644--- a/src/render3d/views.ts+++ b/src/render3d/views.ts@@ -168,7 +168,7 @@ export class BuildingView extends WorldView {if (kind.topper === "flag") {this.wave += dt * (look.working ? 6 : 3)this.motion.use("flag/" + this.kindId, () => makeFlag(this.kindId))- const a = kind.half * U,+ const a = buildingDimensions(this.kindId).half,pitch = (2 * a) / kind.baysthis.motion.root.position.copy(vertex3([-a + pitch * (kind.bays - 0.5), -a + pitch * 0.5, H + 24]))this.motion.root.rotation.y = Math.sin(this.wave) * 0.15diff --git a/test/proportions.test.ts b/test/proportions.test.tsnew file mode 100644index 0000000..763c46c--- /dev/null+++ b/test/proportions.test.ts@@ -0,0 +1,60 @@+import assert from "node:assert/strict"+import { test } from "node:test"+import { readFileSync } from "node:fs"+import { gunzipSync } from "node:zlib"+import { home, kindIds } from "../src/content.ts"+import { assetById } from "../src/asset-lab/assets.ts"+import { house } from "../src/asset-lab/homes.ts"+import { human, residentialHeight } from "../src/asset-lab/dimensions.ts"+import { sides, type InkAsset } from "../src/asset-lab/primitives.ts"+import { buildingAsset, buildingTop, noDoors } from "../src/render3d/models.ts"+import { architectureIds, proportionModels } from "../src/model-review/proportion-models.ts"+import { vertex3 } from "../src/asset-lab/renderer.ts"++const baseline=JSON.parse(gunzipSync(readFileSync(new URL("../public/model-review/proportions-before.json.gz",import.meta.url))).toString()) as {revision:string;models:InkAsset[];walker:InkAsset}+const points=(a:InkAsset)=>[...a.faces,...a.strokes].flatMap(f=>f.points)+const top=(a:InkAsset)=>Math.max(...points(a).map(p=>p[2]))+const walker=assetById.get("settler-cap")!++test("every comparison uses the approved frozen baseline and the exact unchanged walker",()=>{+ assert.equal(baseline.revision,"a2845b4f537dcb2998a58b7fae26783d7de4a1ec")+ const current=proportionModels()+ assert.equal(architectureIds.length,36)+ assert.equal(current.length,45)+ assert.deepEqual(new Set(current.map(a=>a.id)),new Set(baseline.models.map(a=>a.id)))+ for(const a of current)assert.equal(a.footprint,baseline.models.find(b=>a.id===b.id)!.footprint,`${a.id}: plot changed`)+ assert.deepEqual(walker.faces,baseline.walker.faces)+ assert.deepEqual(walker.strokes,baseline.walker.strokes)+})++test("all home tiers have door and floor clearance for a walker in every orientation",()=>{+ for(const tier of [1,2,3] as const){+ assert.equal(home.tiers[tier].height,residentialHeight(tier),"Construction and surface bounds must use the actual residential eave")+ assert.ok(human.floor>=top(walker)+4)+ for(const side of sides){+ const a=house(tier,.28,"home",{doors:{...noDoors,[side]:true}})+ const door=a.faces.find(f=>f.color===0xb59b77)!+ assert.ok(door)+ const height=Math.max(...door.points.map(p=>p[2]))-Math.min(...door.points.map(p=>p[2]))+ assert.ok(height>=top(walker)+2,`${tier}/${side}: person cannot pass through the door`)+ const width=vertex3(door.points[0]!).distanceTo(vertex3(door.points[1]!))+ assert.ok(width>6,`${tier}/${side}: door narrower than the walker`)+ assert.ok(top(a)>top(baseline.models.find(b=>b.id===({1:"cottage",2:"citizen",3:"townhouse"} as const)[tier])!))+ }+ }+})++test("markers clear revised roofs and tall machinery in every building orientation",()=>{+ for(const kind of kindIds)for(const side of sides)for(const level of kind==="townhall"?[0,1,2]:[0,1]){+ const a=buildingAsset(kind,1,null,{...noDoors,[side]:true},1,{},level)+ assert.ok(buildingTop(kind,level)+.1>=top(a),`${kind}/${side}/${level}: marker clips roof`)+ }+})++test("the generic goods crate is smaller than the person who handles it",()=>{+ const crate=assetById.get("crate-wood")!+ assert.ok(top(crate)<top(walker)/2)+ const world=points(crate).map(vertex3)+ const width=Math.max(...world.map(p=>p.x))-Math.min(...world.map(p=>p.x))+ assert.ok(width<top(walker)/Math.cos(Math.PI/6))+})diff --git a/test/render3d.test.ts b/test/render3d.test.tsindex 55cae9d..fccd0d3 100644--- a/test/render3d.test.ts+++ b/test/render3d.test.ts@@ -47,7 +47,7 @@ test("live service upgrades retain their taller models and material bounds besidassert.equal(upgraded.effects?.height, upgradeHeights[id].eave)assert.equal(upgraded.effects?.state.snow, 1)}- for (const [id, height] of [["bakery", 28], ["weaver", 30], ["fishery", 20], ["carpenter", 28]] as const)+ for (const [id, height] of [["bakery", 26], ["weaver", 26], ["fishery", 24], ["carpenter", 28]] as const)assert.equal(buildingHeight(id), height, `${id}: public height must follow the revised model`)})diff --git a/test/rural.test.ts b/test/rural.test.tsindex 7bed0c0..d89d8b8 100644--- a/test/rural.test.ts+++ b/test/rural.test.ts@@ -29,17 +29,18 @@ function verticalHits(asset: InkAsset, u: number, v: number, from: number, to: ntest("the fire-watch ladder landing and every roof tread connect to the lookout without roof obstruction", () => {const asset = makeBuilding("firewatch")+ const landing = buildingDimensions("firewatch").height + 8.5const stations = [- [12.3, -4.5, 28.5],+ [12.3, -4.5, landing],...Array.from({ length: 7 }, (_, i) => {const t = (i + 0.5) / 7- return [11 - 7 * t, -4.5 + 2.7 * t, 28.5 + 6 * (i + 1) / 7]+ return [11 - 7 * t, -4.5 + 2.7 * t, landing + 6 * (i + 1) / 7]}),- [3.9, -1.8, 34.5]+ [3.9, -1.8, landing + 6]]for (const [u, v, z] of stations) {assert.ok(verticalHits(asset, u!, v!, z! + 0.1, z! - 0.65).length > 0, `Unsupported route at ${u}/${v}/${z}`)- assert.equal(verticalHits(asset, u!, v!, z! + 0.1, z! + 4).length, 0, `Roof obstructs route at ${u}/${v}/${z}`)+ assert.equal(verticalHits(asset, u!, v!, z! + 0.1, z! + 17).length, 0, `Roof obstructs a walker at ${u}/${v}/${z}`)}const highest = Math.max(...asset.faces.flatMap(face => face.points.map(p => p[2])))assert.ok(buildingDimensions("firewatch").top >= highest, "Problem marker must sit above the lookout roof")diff --git a/test/trades.test.ts b/test/trades.test.tsindex 1b380ea..ff66ff5 100644--- a/test/trades.test.ts+++ b/test/trades.test.ts@@ -37,7 +37,7 @@ test("the bakery oven is recessed masonry, with smoke attached to its actual fluassert.ok(hits(asset, at(12), at(-2)).length > 0, `${side}: the oven needs a back`)const origin = buildingSmokeOrigin("bakery", doors)!assert.deepEqual(asset.smokeEffect?.origin, origin)- const mouth = asset.faces.find(face => face.points.every(p => Math.abs(p[2] - 48.02) < 0.0001))!+ const mouth = asset.faces.find(face => face.color === 0x68726c && face.points.every(p => p[2] > origin[2] - .5 && p[2] < origin[2]))!assert.ok(mouth)const center = mouth.points.reduce((sum, p) => [sum[0]! + p[0], sum[1]! + p[1]], [0, 0]).map(n => n / mouth.points.length)assert.ok(Math.abs(center[0]! - origin[0]) < 0.0001 && Math.abs(center[1]! - origin[1]) < 0.0001)diff --git a/test/workshops.test.ts b/test/workshops.test.tsindex eda00c9..e8df28a 100644--- a/test/workshops.test.ts+++ b/test/workshops.test.ts@@ -28,7 +28,7 @@ test("the working smithy emitter follows its flue and the other open yards do noconst doors = { ...noDoors, [side]: true }, asset = makeBuilding("smithy", { doors })const origin = buildingSmokeOrigin("smithy", doors)!assert.deepEqual(asset.smokeEffect?.origin, origin)- const mouth = asset.faces.find(face => face.color === 0x68726c && face.points.every(p => Math.abs(p[2] - 56.02) < 0.0001))!+ const mouth = asset.faces.find(face => face.color === 0x68726c && face.points.every(p => p[2] > origin[2] - .5 && p[2] < origin[2]))!assert.ok(mouth, `flue mouth missing for ${side}`)const center = mouth.points.reduce((sum, p) => [sum[0]! + p[0], sum[1]! + p[1], sum[2]! + p[2]], [0, 0, 0]).map(n => n / mouth.points.length)assert.ok(Math.abs(center[0]! - origin[0]) < 0.0001 && Math.abs(center[1]! - origin[1]) < 0.0001)@@ -36,5 +36,6 @@ test("the working smithy emitter follows its flue and the other open yards do noassert.equal(buildingAsset("smithy", 1, null, doors, 1).smokeEffect, undefined, "live view owns the working smoke, without a duplicate catalogue plume")}for (const id of ["mine", "sawmill"] as const) assert.equal(buildingSmokeOrigin(id), null)- assert.equal(buildingDimensions("sawmill").top, 36.7)+ const saw=makeBuilding("sawmill")+ assert.ok(buildingDimensions("sawmill").top >= Math.max(...saw.faces.flatMap(f=>f.points.map(p=>p[2]))))})diff --git a/vite.config.ts b/vite.config.tsindex 812cbf6..86d678e 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -15,6 +15,7 @@ export default defineConfig({assets: "asset-lab.html",map: "map-lab.html",models: "model-review.html",+ proportions: "proportion-review.html",effects: "effects-lab.html",parks: "park-lab.html",services: "service-upgrades.html"