@adatechnology/game-urban 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/budget.ts","../src/scene.ts","../src/poles.ts","../src/streets.ts","../src/block.ts","../src/tower.ts","../src/props.ts","../src/kit.ts","../src/neighbourhoods/houses.ts","../src/neighbourhoods/compose.ts","../src/neighbourhoods/composers.ts","../src/neighbourhoods/patterns.ts","../src/cities/cities.ts","../src/cities/kinds.ts","../src/cities/templates.ts","../src/terrain/math.ts","../src/terrain/terrain.ts","../src/neighbourhoods/providers.ts","../src/neighbourhoods/towers.ts"],"sourcesContent":["import type { LightBudget } from './types'\n\n/** The team's counter: `take()` is `left-- > 0`, so the count keeps falling after the budget is spent. */\nexport function createLightBudget(count: number): LightBudget {\n const budget: LightBudget = {\n left: count,\n take() {\n return budget.left-- > 0\n },\n }\n return budget\n}\n","import { boxRadius } from '@adatechnology/game-floorplan'\n\nimport { createLightBudget } from './budget'\nimport type { TerrainGrid } from './terrain/types'\nimport type { ItemBox, LightBudget, LightPart, PartStyle, PlacementPart, RandomSource, Silhouette, UrbanPart, UrbanScene } from './types'\n\nconst ROOT = -1\nconst DEFAULT_CYLINDER_SEGMENTS = 14\nconst DEFAULT_CONE_SEGMENTS = 6\nconst DEFAULT_FENCE_WIRE = 0x8a8c8e\nconst DEFAULT_FENCE_POST = 0x6a6c6e\nconst DEFAULT_LABEL_FONT = '700 56px \"Arial Narrow\", Arial, sans-serif'\n\ntype BoxOptions = { parent?: number; ry?: number; rz?: number; emissive?: boolean; style?: PartStyle }\n\nexport type UrbanBuilderOptions = {\n /** Lights the scene may spend; omitted means no limit. */\n budget?: LightBudget\n}\n\n/**\n * Collects the parts of an urban scene the way the team's page adds them to its root: every helper appends in call order, so a\n * scene drawn with the same seeded random has the same parts, the same instances and the same windows.\n * Heights follow the page: `y` is the base of a box, a cylinder, a cone and a prism, and the centre of a crown.\n */\nexport function createUrbanBuilder(random: RandomSource, options: UrbanBuilderOptions = {}) {\n const parts: UrbanPart[] = []\n const items: ItemBox[] = []\n const windows: UrbanScene['windows'] = { lit: [], dark: [] }\n const lights = options.budget ?? createLightBudget(Number.POSITIVE_INFINITY)\n const pick = <TEntry>(list: readonly TEntry[]): TEntry => list[Math.floor(random() * list.length)] as TEntry\n\n const group = (x: number, y: number, z: number, ry = 0, parent = ROOT): number => parts.push({ shape: 'group', parent, x, y, z, ry }) - 1\n const box = (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, o: BoxOptions = {}): void => {\n const part: UrbanPart = { shape: 'box', parent: o.parent ?? ROOT, x, y: y + height / 2, z, width, height, depth, color, emissive: o.emissive ?? false, ry: o.ry ?? 0, rz: o.rz ?? 0, radius: boxRadius(width, height, depth) }\n if (o.style) part.style = o.style\n parts.push(part)\n }\n const cylinder = (x: number, y: number, z: number, radiusTop: number, radiusBottom: number, height: number, color: number, parent = ROOT, segments = DEFAULT_CYLINDER_SEGMENTS, style?: PartStyle): void => {\n const part: UrbanPart = { shape: 'cylinder', parent, x, y: y + height / 2, z, radiusTop, radiusBottom, height, color, segments }\n if (style) part.style = style\n parts.push(part)\n }\n const cone = (x: number, y: number, z: number, radius: number, height: number, color: number, parent = ROOT, segments = DEFAULT_CONE_SEGMENTS): void => {\n parts.push({ shape: 'cone', parent, x, y: y + height / 2, z, radius, height, color, segments })\n }\n const prism = (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, parent = ROOT, ry = 0): void => {\n parts.push({ shape: 'prism', parent, x, y, z, width, height, depth, color, ry })\n }\n const plane = (x: number, y: number, z: number, width: number, depth: number, color: number, style?: PartStyle, parent = ROOT): void => {\n const part: UrbanPart = { shape: 'plane', parent, x, y, z, width, depth, color }\n if (style) part.style = style\n parts.push(part)\n }\n const vault = (part: Omit<Extract<UrbanPart, { shape: 'vault' }>, 'shape' | 'parent'> & { parent?: number }): void => {\n parts.push({ shape: 'vault', ...part, parent: part.parent ?? ROOT })\n }\n const terrain = (grid: TerrainGrid, parent = ROOT): void => {\n parts.push({ shape: 'terrain', parent, grid })\n }\n const crown = (x: number, y: number, z: number, radius: number, color: number, parent = ROOT): void => {\n parts.push({ shape: 'crown', parent, x, y, z, radius, color })\n }\n const line = (points: [number, number, number][], color: number, parent = ROOT): void => {\n parts.push({ shape: 'line', parent, points, color })\n }\n const label = (lines: string[], x: number, y: number, z: number, width: number, height: number, ry: number, o: { background: string; foreground: string; font?: string; canvas?: { width: number; height: number } }, parent = ROOT): void => {\n parts.push({ shape: 'label', parent, x, y, z, width, height, ry, lines, background: o.background, foreground: o.foreground, font: o.font ?? DEFAULT_LABEL_FONT, canvas: o.canvas ?? { width: 512, height: 128 } })\n }\n const light = (part: Omit<Extract<LightPart, { kind: 'point' }>, 'shape' | 'kind' | 'parent' | 'decay' | 'flicker'> & { flicker?: boolean; decay?: number }): void => {\n parts.push({ shape: 'light', kind: 'point', parent: ROOT, decay: 2, flicker: false, ...part })\n }\n const spot = (part: Omit<Extract<LightPart, { kind: 'spot' }>, 'shape' | 'kind' | 'parent'>): void => {\n parts.push({ shape: 'light', kind: 'spot', parent: ROOT, ...part })\n }\n /** Asks the drawer for a vehicle or a plant at a spot; the scene does not know how it is drawn. */\n const place = (kind: PlacementPart['kind'], id: string, x: number, z: number, o: { y?: number; ry?: number; scale?: number; color?: number; seed?: number | string; parent?: number } = {}): void => {\n const part: PlacementPart = { shape: 'placement', parent: o.parent ?? ROOT, kind, id, x, y: o.y ?? 0, z, ry: o.ry ?? 0, scale: o.scale ?? 1, seed: o.seed ?? `${id}:${x}:${z}` }\n if (o.color !== undefined) part.color = o.color\n parts.push(part)\n }\n const item = (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, ry = 0, rx = 0, rz = 0): void => {\n items.push({ x, y, z, width, height, depth, color, rx, ry, rz })\n }\n /** Cylinder posts every 3 m (at least two) and three wires, as the team's fence. */\n const fence = (x0: number, z0: number, x1: number, z1: number, height: number, color = DEFAULT_FENCE_POST): void => {\n const count = Math.ceil(Math.hypot(x1 - x0, z1 - z0) / 3)\n for (let index = 0; index <= count; index++) {\n const t = index / count\n cylinder(x0 + (x1 - x0) * t, 0, z0 + (z1 - z0) * t, 0.05, 0.05, height, color, ROOT, 5)\n }\n for (const level of [height * 0.35, height * 0.65, height * 0.98]) line([[x0, level, z0], [x1, level, z1]], DEFAULT_FENCE_WIRE)\n }\n /** Adds a silhouette of game-floorplan (a house far away, a city building): its parts keep their order and their groups are re-indexed, its windows join the scene's. */\n const add = (silhouette: Silhouette): void => {\n const offset = parts.length\n for (const part of silhouette.parts) parts.push(part.parent < 0 ? part : { ...part, parent: part.parent + offset })\n for (const window of silhouette.windows) (window.isLit ? windows.lit : windows.dark).push(window)\n }\n const scene = (): UrbanScene => ({ parts, items, windows })\n return { random, pick, lights, parts, items, windows, group, box, cylinder, cone, prism, plane, vault, terrain, crown, line, label, light, spot, place, item, fence, add, scene }\n}\n\nexport type UrbanBuilder = ReturnType<typeof createUrbanBuilder>\n","import type { UrbanBuilder } from './scene'\nimport type { PartStyle } from './types'\n\n/** The pole that carries the lamp: a tapered cylinder. */\nexport type MastSpec = { radiusTop: number; radiusBottom: number; height: number; color: number; segments?: number; style?: PartStyle }\n/** A bar or a box of the pole, placed by its base `y`. `reach` is how far from the mast its centre sits. */\nexport type BarSpec = { reach: number; y: number; width: number; height: number; depth: number; color: number }\n/** The box of a lamp head: its colour is the lens, lit or unlit. */\nexport type LampSpec = { reach: number; y: number; width: number; height: number; depth: number }\n/** Colour of the lamp lens when the lamp is on (it glows) and when it is off. */\nexport type LensSpec = { lit: number; unlit: number }\n/** The real light a lamp that is on may get from the budget. `reach` moves it along the arm. */\nexport type LampLightSpec = { color: number; intensity: number; distance: number; y: number; reach?: number; z?: number }\n\n/** Double arm with two LED heads (the avenue pole of the downtown pattern). */\nexport type DoubleArmSpec = { mast: MastSpec; arm: BarSpec; lamp: LampSpec; lens: LensSpec; light: LampLightSpec }\n/** Concrete pole with one arm and a sodium lamp, with an optional transformer drum. */\nexport type SingleArmSpec = {\n mast: MastSpec\n arm: BarSpec\n lamp: LampSpec\n lens: LensSpec\n light: LampLightSpec\n transformer: { offset: number; y: number; radius: number; height: number; color: number; segments: number }\n}\n/** Short iron post with a lantern box and a pointed cap. */\nexport type LanternSpec = { mast: MastSpec; lamp: LampSpec; cap: { y: number; radius: number; height: number; color: number; segments: number }; lens: LensSpec; light: LampLightSpec }\n/** Wooden pole with a crossarm and a hanging lamp. */\nexport type CrossarmSpec = { mast: MastSpec; arm: BarSpec; lamp: LampSpec; lens: LensSpec; light: LampLightSpec }\n/** Four-legged tower with a deck and a row of floodlights. */\nexport type FloodTowerSpec = {\n legs: { offset: number; height: number; size: number; color: number }\n deck: BarSpec\n heads: { count: number; start: number; spacing: number; y: number; z: number; width: number; height: number; depth: number }\n lens: LensSpec\n light: LampLightSpec\n}\n\n/** What a game says when it places a pole. */\nexport type PoleOptions = {\n x: number\n z: number\n /** Lit lamp (glowing lens and, while the budget lasts, a real light). Default true. */\n on?: boolean\n /** Turns the whole pole (the double arm only; the others are placed by their arm direction). */\n ry?: number\n /** The real light flickers (a failing lamp). */\n flicker?: boolean\n /** Which way the arm points, 1 or -1 (single arm). Default 1. */\n dir?: number\n /** Adds the transformer drum (single arm). */\n transformer?: boolean\n}\n\nexport type PoleShapeBuilder = (b: UrbanBuilder, spec: any, o: PoleOptions) => void\n\nexport type PoleDef = {\n id: string\n /** Key of the shape builder that reads `spec`. */\n shape: string\n spec: object\n}\n\nconst on = (o: PoleOptions): boolean => o.on ?? true\n\nfunction drawMast(b: UrbanBuilder, mast: MastSpec, x: number, z: number, parent = -1): void {\n b.cylinder(x, 0, z, mast.radiusTop, mast.radiusBottom, mast.height, mast.color, parent, mast.segments, mast.style)\n}\n\nfunction spendLight(b: UrbanBuilder, light: LampLightSpec, x: number, z: number, o: PoleOptions): void {\n if (on(o) && b.lights.take()) b.light({ x: x + (light.reach ?? 0), y: light.y, z: z + (light.z ?? 0), color: light.color, intensity: light.intensity, distance: light.distance, flicker: o.flicker ?? false })\n}\n\nconst doubleArm: PoleShapeBuilder = (b, spec: DoubleArmSpec, o) => {\n const group = b.group(o.x, 0, o.z, o.ry ?? 0)\n drawMast(b, spec.mast, 0, 0, group)\n for (const side of [-1, 1]) {\n b.box(side * spec.arm.reach, spec.arm.y, 0, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color, { parent: group })\n b.box(side * spec.lamp.reach, spec.lamp.y, 0, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { parent: group, emissive: on(o) })\n }\n spendLight(b, spec.light, o.x, o.z, o)\n}\n\nconst singleArm: PoleShapeBuilder = (b, spec: SingleArmSpec, o) => {\n const dir = o.dir ?? 1\n drawMast(b, spec.mast, o.x, o.z)\n b.box(o.x + dir * spec.arm.reach, spec.arm.y, o.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color)\n b.box(o.x + dir * spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n if (o.transformer) b.cylinder(o.x - dir * spec.transformer.offset, spec.transformer.y, o.z, spec.transformer.radius, spec.transformer.radius, spec.transformer.height, spec.transformer.color, -1, spec.transformer.segments)\n spendLight(b, { ...spec.light, reach: dir * (spec.light.reach ?? spec.lamp.reach) }, o.x, o.z, o)\n}\n\nconst lantern: PoleShapeBuilder = (b, spec: LanternSpec, o) => {\n drawMast(b, spec.mast, o.x, o.z)\n b.box(o.x + spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n b.cone(o.x, spec.cap.y, o.z, spec.cap.radius, spec.cap.height, spec.cap.color, -1, spec.cap.segments)\n spendLight(b, spec.light, o.x, o.z, o)\n}\n\nconst crossarm: PoleShapeBuilder = (b, spec: CrossarmSpec, o) => {\n drawMast(b, spec.mast, o.x, o.z)\n b.box(o.x + spec.arm.reach, spec.arm.y, o.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color)\n b.box(o.x + spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n spendLight(b, { ...spec.light, reach: spec.light.reach ?? spec.lamp.reach }, o.x, o.z, o)\n}\n\nconst floodTower: PoleShapeBuilder = (b, spec: FloodTowerSpec, o) => {\n for (const a of [-1, 1]) for (const c of [-1, 1]) b.box(o.x + a * spec.legs.offset, 0, o.z + c * spec.legs.offset, spec.legs.size, spec.legs.height, spec.legs.size, spec.legs.color)\n b.box(o.x + spec.deck.reach, spec.deck.y, o.z, spec.deck.width, spec.deck.height, spec.deck.depth, spec.deck.color)\n for (let index = 0; index < spec.heads.count; index++) {\n b.box(o.x + spec.heads.start + index * spec.heads.spacing, spec.heads.y, o.z + spec.heads.z, spec.heads.width, spec.heads.height, spec.heads.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n }\n spendLight(b, spec.light, o.x, o.z, o)\n}\n\n/** The shape builders the five default poles use; a game adds its own through `createUrban({ shapes })`. */\nexport const POLE_SHAPES: Readonly<Record<string, PoleShapeBuilder>> = { double_arm: doubleArm, single_arm: singleArm, lantern, crossarm, flood_tower: floodTower }\n\nconst LED: DoubleArmSpec = {\n mast: { radiusTop: 0.1, radiusBottom: 0.14, height: 9, color: 0x55595e, style: { metalness: 0.6, roughness: 0.5 } },\n arm: { reach: 0.8, y: 8.8, width: 1.6, height: 0.1, depth: 0.12, color: 0x55595e },\n lamp: { reach: 1.5, y: 8.6, width: 0.6, height: 0.12, depth: 0.3 },\n lens: { lit: 0xeef4ff, unlit: 0x3a3a3a },\n light: { color: 0xdfe8ff, intensity: 1.3, distance: 24, y: 8 },\n}\n\nconst CONCRETE: SingleArmSpec = {\n mast: { radiusTop: 0.12, radiusBottom: 0.2, height: 8, color: 0x8a8a84, segments: 4 },\n arm: { reach: 0.7, y: 7.6, width: 1.4, height: 0.1, depth: 0.1, color: 0x6a6a66 },\n lamp: { reach: 1.35, y: 7.45, width: 0.5, height: 0.16, depth: 0.3 },\n lens: { lit: 0xffa040, unlit: 0x3a3a3a },\n light: { color: 0xff9a40, intensity: 1.3, distance: 20, y: 7.2 },\n transformer: { offset: 0.35, y: 6.2, radius: 0.28, height: 0.7, color: 0x5a5e62, segments: 8 },\n}\n\nconst IRON: LanternSpec = {\n mast: { radiusTop: 0.06, radiusBottom: 0.12, height: 4, color: 0x1e2022, segments: 8 },\n lamp: { reach: 0, y: 4, width: 0.42, height: 0.5, depth: 0.42 },\n cap: { y: 4.5, radius: 0.36, height: 0.3, color: 0x1e2022, segments: 4 },\n lens: { lit: 0xffd090, unlit: 0x2a2a2a },\n light: { color: 0xffc880, intensity: 1, distance: 14, y: 3.9 },\n}\n\nconst WOOD: CrossarmSpec = {\n mast: { radiusTop: 0.11, radiusBottom: 0.14, height: 7, color: 0x5a4630, segments: 6 },\n arm: { reach: 0, y: 6.6, width: 1.2, height: 0.08, depth: 0.08, color: 0x4a3a28 },\n lamp: { reach: 0.5, y: 6.35, width: 0.16, height: 0.22, depth: 0.16 },\n lens: { lit: 0xffe08a, unlit: 0x3a3a3a },\n light: { color: 0xffd27a, intensity: 0.9, distance: 16, y: 6.2 },\n}\n\nconst FLOOD: FloodTowerSpec = {\n legs: { offset: 0.4, height: 12, size: 0.12, color: 0x6a6c6e },\n deck: { reach: 0, y: 12, width: 2, height: 0.15, depth: 1.2, color: 0x6a6c6e },\n heads: { count: 3, start: -0.6, spacing: 0.6, y: 12.2, z: 0.4, width: 0.45, height: 0.35, depth: 0.2 },\n lens: { lit: 0xfff2d8, unlit: 0x3a3a3a },\n light: { color: 0xfff0d0, intensity: 1.6, distance: 34, y: 11.5, z: 2 },\n}\n\n/**\n * The five poles of the neighbourhood patterns, with the numbers of the Galeria (heights, arms, lens colours, the colour,\n * strength and reach of the real light). A game patches a number by id or adds a pole with its own shape.\n */\nexport const DEFAULT_POLES: readonly PoleDef[] = [\n { id: 'led_double', shape: 'double_arm', spec: LED },\n { id: 'concrete_arm', shape: 'single_arm', spec: CONCRETE },\n { id: 'cast_iron', shape: 'lantern', spec: IRON },\n { id: 'wood_crossarm', shape: 'crossarm', spec: WOOD },\n { id: 'flood_tower', shape: 'flood_tower', spec: FLOOD },\n]\n","import type { UrbanBuilder } from './scene'\n\n/** Look of the road surface and its centre line; the defaults are the Galeria's. */\nexport type RoadStyle = {\n color: number\n /** Painted dashes along the centre line. */\n dash: { color: number; every: number; first: number; length: number; width: number; height: number; y: number }\n}\n\nexport type WalkStyle = { color: number; height: number; castShadow: boolean }\n\nexport const DEFAULT_ROAD_STYLE: RoadStyle = { color: 0x222428, dash: { color: 0x8f7f4f, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } }\nexport const DEFAULT_WALK_STYLE: WalkStyle = { color: 0x3a3b3c, height: 0.15, castShadow: false }\nconst ROAD_LEVEL = 0.02\nconst DEFAULT_GROUND_COLOR = 0x15181a\nconst DEFAULT_GROUND_SIZE = 600\n\nexport type StreetOptions = { road?: Partial<RoadStyle> & { dash?: Partial<RoadStyle['dash']> }; walk?: Partial<WalkStyle> }\n\nconst roadStyle = (o?: StreetOptions): RoadStyle => ({ ...DEFAULT_ROAD_STYLE, ...o?.road, dash: { ...DEFAULT_ROAD_STYLE.dash, ...o?.road?.dash } })\nconst walkStyle = (o?: StreetOptions): WalkStyle => ({ ...DEFAULT_WALK_STYLE, ...o?.walk })\n\n/** Road centred on (x, z), `w` wide and `l` long along `x` or `z`, with a dash every 5 m starting 2 m from its start. */\nexport function drawRoad(b: UrbanBuilder, x: number, z: number, w: number, l: number, along: 'x' | 'z', options?: StreetOptions): void {\n const style = roadStyle(options)\n const alongX = along === 'x'\n b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color)\n const { dash } = style\n for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {\n b.item(alongX ? x + u : x, dash.y, alongX ? z : z + u, alongX ? dash.length : dash.width, dash.height, alongX ? dash.width : dash.length, dash.color)\n }\n}\n\n/** Sidewalk slab centred on (x, z). */\nexport function drawWalk(b: UrbanBuilder, x: number, z: number, w: number, d: number, options?: StreetOptions): void {\n const style = walkStyle(options)\n b.box(x, 0, z, w, style.height, d, style.color, { style: { castShadow: style.castShadow } })\n}\n\n/** The big plane under the scene. */\nexport function drawGround(b: UrbanBuilder, color = DEFAULT_GROUND_COLOR, size = DEFAULT_GROUND_SIZE): void {\n b.plane(0, 0, 0, size, size, color)\n}\n\n/**\n * A grid of `2n + 1` roads each way, `block` apart and `width` wide, with a sidewalk slab on every one of the `2n x 2n` blocks.\n * Roads first (z then x for each line), then the walks, as the page.\n */\nexport function drawStreetGrid(b: UrbanBuilder, block: number, count: number, width: number, options?: StreetOptions): void {\n for (let k = -count; k <= count; k++) {\n drawRoad(b, k * block, 0, width, block * 2 * count + width, 'z', options)\n drawRoad(b, 0, k * block, width, block * 2 * count + width, 'x', options)\n }\n for (let i = -count; i < count; i++) for (let j = -count; j < count; j++) drawWalk(b, i * block + block / 2, j * block + block / 2, block - width, block - width, options)\n}\n","import { createCityBuilding } from '@adatechnology/game-floorplan'\n\nimport type { UrbanBuilder } from './scene'\nimport { DEFAULT_TOWER_PRESETS } from './tower'\nimport type { TowerPreset } from './tower'\n\n/** Facade colours of the city buildings (the Galeria's `FAC`). */\nexport const DEFAULT_FACADES: readonly number[] = [0x3b3f45, 0x4a4038, 0x35403d, 0x463a3a, 0x3f3b34, 0x2f3439, 0x51493f, 0x5a564e]\n\nconst DEFAULT_PARTITIONS = 2\nconst DEFAULT_GAP = 0.08\nconst STREET_MARGIN = 2\nconst FOOTPRINT_TRIM = 1.2\nconst FOOTPRINT_JITTER = 1.5\nconst HEIGHT_CURVE = 1.6\n\nexport type FillBlockOptions = {\n /** The block is split into `k x k` lots. Default 2. */\n k?: number\n /** Chance that a lot stays empty. Default 0.08. */\n gap?: number\n /** Chance that a window is lit. */\n lit?: number\n /** Chance of a ground-floor shop on a building. */\n shop?: number\n /** Facade colours. Default `DEFAULT_FACADES`. */\n palette?: readonly number[]\n /**\n * Storeys of each building, a number or `[min, max]` (the same name and shape as a city block's `building.floors`). Given, the height is storeys times the\n * storey height of the use's preset instead of `minHeight..maxHeight`; the random draws are the same.\n */\n floors?: number | readonly [number, number]\n /** Share of the buildings by use (`commercial`, `residential`, ...); each building picks one (one more random draw). Needs no `floors`. */\n uses?: Readonly<Record<string, number>>\n /** Which tower preset gives the storey height of a use. Default `{ commercial: 'office', residential: 'residential' }`. */\n storeyPresets?: Readonly<Record<string, string>>\n /** The presets whose storey heights are used (default `DEFAULT_TOWER_PRESETS`; the kit passes its `towers.presets`). */\n presets?: readonly TowerPreset[]\n /** Storey height when no preset applies, metres. Default the residential preset's. */\n storeyHeight?: number\n /** Draws each building (default `drawBuilding`): the kit passes its own to put towers on the tall lots. */\n draw?: (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, options: BuildingOptions) => BlockBuilding\n}\n\n/** A building a block ended up with, for the game's own bookkeeping (collisions, minimap). */\nexport type BlockBuilding = { x: number; z: number; width: number; depth: number; height: number; color: number }\n\nexport type BuildingOptions = {\n lit?: number\n shop?: number\n /** Use of the building (`commercial`, `residential`...), when the block gave `uses`. */\n use?: string\n /** Storeys of the building, when the block gave `floors`; the height is already storeys times the storey height. */\n storeys?: number\n /** Id of the tower preset the use maps to; a tower drawer with that preset uses it instead of picking at random. */\n preset?: string\n}\n\nexport const DEFAULT_STOREY_PRESETS: Readonly<Record<string, string>> = { commercial: 'office', residential: 'residential' }\n\n/** One city building: block, roof slab, maybe a vent on the roof, maybe a shop front on both long faces, windows on the four faces. Draws from the builder's random. */\nexport function drawBuilding(b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, options: BuildingOptions = {}): BlockBuilding {\n b.add(createCityBuilding({ x, z, width, depth, height, color, random: b.random, shopChance: options.shop, litChance: options.lit }))\n return { x, z, width, depth, height, color }\n}\n\n/** The use a building has: one pick by weight (draws once). */\nfunction pickUse(b: UrbanBuilder, uses: Readonly<Record<string, number>>): string | undefined {\n const entries = Object.entries(uses).filter(([, w]) => w > 0)\n const total = entries.reduce((sum, [, w]) => sum + w, 0)\n if (total <= 0) return undefined\n let r = b.random() * total\n for (const [use, w] of entries) { r -= w; if (r < 0) return use }\n return entries[entries.length - 1]![0]\n}\n\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n\n/**\n * Fills a square block with city buildings: a `k x k` split of the block less 2 m of street, each lot maybe empty, each building a\n * little smaller than its lot and as tall as `lerp(min, max, random^1.6)` (more low buildings than tall ones). Draws from the\n * builder's random in the page's order: gap, width, depth, height, facade, then the building's own.\n */\nexport function fillBlock(b: UrbanBuilder, cx: number, cz: number, size: number, minHeight: number, maxHeight: number, options: FillBlockOptions = {}): BlockBuilding[] {\n const placed: BlockBuilding[] = []\n const palette = options.palette ?? DEFAULT_FACADES\n const half = (size - STREET_MARGIN) / 2\n const k = options.k || DEFAULT_PARTITIONS\n const lot = (size - STREET_MARGIN) / k\n for (let i = 0; i < k; i++) {\n for (let j = 0; j < k; j++) {\n if (b.random() < (options.gap || DEFAULT_GAP)) continue\n const width = lot - FOOTPRINT_TRIM - b.random() * FOOTPRINT_JITTER\n const depth = lot - FOOTPRINT_TRIM - b.random() * FOOTPRINT_JITTER\n const t = Math.pow(b.random(), HEIGHT_CURVE)\n let height = lerp(minHeight, maxHeight, t)\n let extra: BuildingOptions | null = null\n if (options.floors !== undefined || options.uses) {\n const use = options.uses ? pickUse(b, options.uses) : undefined\n const presetId = use ? (options.storeyPresets ?? DEFAULT_STOREY_PRESETS)[use] : undefined\n const preset = presetId ? (options.presets ?? DEFAULT_TOWER_PRESETS).find((p) => p.id === presetId) : undefined\n extra = { use, preset: preset?.id }\n if (options.floors !== undefined) {\n const [lo, hi] = typeof options.floors === 'number' ? [options.floors, options.floors] : options.floors\n const storeys = Math.max(1, Math.round(lerp(lo, hi, t)))\n height = storeys * (preset?.storeyHeight ?? options.storeyHeight ?? DEFAULT_TOWER_PRESETS[DEFAULT_TOWER_PRESETS.length - 1]!.storeyHeight)\n extra.storeys = storeys\n }\n }\n const x = cx - half + lot * (i + 0.5)\n const z = cz - half + lot * (j + 0.5)\n const color = b.pick(palette)\n placed.push((options.draw ?? drawBuilding)(b, x, z, width, depth, height, color, extra ? { ...options, ...extra } : options))\n }\n }\n return placed\n}\n","import type { BlockBuilding, BuildingOptions } from './block'\nimport type { UrbanBuilder } from './scene'\n\n/**\n * One kind of tower the city can put on a tall lot: the numbers of a typology of `game-floorplan-commercial` (office) or `game-floorplan-residential`\n * (residential), which the tests keep equal to theirs. The city only draws the outside; the plan of the inside is the typology's.\n */\nexport type TowerPreset = {\n id: string\n /** Chance weight among the presets (the one the random picks). */\n weight: number\n /** Floor to floor in metres: the clear height of the typology plus its slab. */\n storeyHeight: number\n /** A plant floor (darker band, no windows) every this many storeys; `false` none. */\n mechanicalEvery: number | false\n /** A glass curtain wall (a ribbon of tall windows on a tinted skin) or a punched facade (a window in each bay of the masonry). */\n glass: boolean\n /** Fewest and most storeys this preset's towers have (the lot height is raised or cut to it); omitted: no minimum, and `TowerOptions.maxStoreys` for the top. */\n minStoreys?: number\n maxStoreys?: number\n /** Colour of the skin; omitted: the facade colour the block drew for the lot (glass: a blue tint of it). */\n color?: number\n}\n\n/** The two typologies: the office tower (4.0 m storeys: 3.6 clear and 0.4 slab, a plant floor every 20, glass) and the residential tower (3.1 m, every 25, masonry). */\nexport const DEFAULT_TOWER_PRESETS: readonly TowerPreset[] = [\n { id: 'office', weight: 0.6, storeyHeight: 4, mechanicalEvery: 20, glass: true, color: 0x3c5a73 },\n { id: 'residential', weight: 0.4, storeyHeight: 3.1, mechanicalEvery: 25, glass: false },\n]\n\n/**\n * A preset from the layout of a typology (`officeTowerLayout(opts)`, `residentialTowerLayout(opts)`), so the city draws the tower the game configured:\n * the storey pitch and the facade come from the layout, the storey range from its `range` when given.\n */\nexport const towerPresetOf = (\n id: string,\n weight: number,\n layout: { pitch: number; facade: 'curtain' | 'punched' },\n extra: Partial<Omit<TowerPreset, 'id' | 'weight' | 'storeyHeight' | 'glass'>> = {},\n): TowerPreset => ({ id, weight, storeyHeight: layout.pitch, mechanicalEvery: 20, glass: layout.facade === 'curtain', ...extra })\n\n/** What a game asks a tower provider to put on the ground: the lot, the height, the preset the random chose and the facade colour. */\nexport type TowerRequest = { x: number; z: number; width: number; depth: number; height: number; color: number; preset: TowerPreset; lit: number; use?: string; storeys?: number }\n/** Draws a tower in place of the default one (the game's own model, or the plan of the typology rendered by `game-floorplan-three`). */\nexport type TowerProvider = (request: TowerRequest, b: UrbanBuilder) => void\n\nexport type TowerOptions = {\n /** A building at least this tall (metres) is drawn as a tower. Default 60. */\n minHeight?: number\n /** Kinds of tower and their weights. Default `DEFAULT_TOWER_PRESETS`. */\n presets?: readonly TowerPreset[]\n /** Replaces the default drawing. */\n provider?: TowerProvider\n /** The crown: height of the mast over the roof as a share of the tower (default 0.06, at most 25 m), 0 for none. */\n mast?: number\n /** Most storeys a tower may have (default 60, the structural limit of the kit): a taller lot is drawn at this many storeys of its preset. */\n maxStoreys?: number\n /** Chance that a window is lit when the block did not say (default 0.12). */\n lit?: number\n}\n\nexport const TOWER_DEFAULTS = { minHeight: 60, maxStoreys: 60, mast: 0.06, lit: 0.12 } as const\n\nconst PODIUM = 1.5\nconst PLANT = 0x2c2f33\nconst PODIUM_COLOR = 0x2a2d31\nconst PARAPET = 0x2a2a2c\nconst MAST = 0x9aa0a6\nconst MAX_MAST = 25\nconst GLASS_COLUMN = 1.6\nconst MASONRY_COLUMN = 3\n\n/** The preset the random picks by weight; draws once. */\nexport function pickTowerPreset(b: UrbanBuilder, presets: readonly TowerPreset[]): TowerPreset {\n const total = presets.reduce((sum, p) => sum + p.weight, 0)\n let r = b.random() * total\n for (const preset of presets) {\n r -= preset.weight\n if (r < 0) return preset\n }\n return presets[presets.length - 1] as TowerPreset\n}\n\n/** Storeys of a tower of this height, the podium (a taller ground storey) included. */\nexport const towerStoreys = (height: number, preset: TowerPreset): number => Math.max(3, Math.round(height / preset.storeyHeight))\n\n/**\n * A tower: a podium with a taller ground storey, the shaft with a row of windows on every storey of its four faces, darker bands where the plant\n * floors are (no windows), the top plant floor set back, the parapet and the mast. Draws one random per window (lit or not), after the preset's.\n */\nexport function drawTower(b: UrbanBuilder, request: TowerRequest, options: Pick<TowerOptions, 'mast'> = {}): BlockBuilding {\n const { x, z, width: w, depth: d, preset } = request\n const storeys = towerStoreys(request.height, preset)\n const h = preset.storeyHeight\n const podium = h * PODIUM\n const skin = preset.color ?? request.color\n const mechanical = new Set<number>()\n if (preset.mechanicalEvery) for (let k = preset.mechanicalEvery; k < storeys - 1; k += preset.mechanicalEvery) if (storeys - 1 - k >= preset.mechanicalEvery / 2) mechanical.add(k)\n mechanical.add(storeys - 1)\n b.box(x, 0, z, w + 0.6, podium, d + 0.6, PODIUM_COLOR)\n const shaftTop = (storeys - 1) * h\n b.box(x, podium, z, w, shaftTop - podium + (podium - h), d, skin)\n for (const k of mechanical) {\n if (k === storeys - 1) b.box(x, k * h + (podium - h), z, w * 0.82, h, d * 0.82, PLANT)\n else b.box(x, k * h + (podium - h), z, w + 0.4, h, d + 0.4, PLANT)\n }\n const top = storeys * h + (podium - h)\n b.box(x, top, z, w * 0.82 + 0.3, 0.35, d * 0.82 + 0.3, PARAPET)\n const mast = Math.min(MAX_MAST, top * (options.mast ?? TOWER_DEFAULTS.mast))\n if (mast > 0.5) b.cylinder(x, top + 0.35, z, 0.12, 0.2, mast, MAST, -1, 6)\n // windows: a row a storey, on the four faces, none on the plant floors and the podium\n const column = preset.glass ? GLASS_COLUMN : MASONRY_COLUMN\n const winHeight = preset.glass ? h * 0.62 : 1.5\n const winWidth = preset.glass ? column * 0.86 : 1.3\n const faces: [number, number, number, number][] = [[0, d / 2 + 0.03, w, 0], [0, -d / 2 - 0.03, w, Math.PI], [w / 2 + 0.03, 0, d, Math.PI / 2], [-w / 2 - 0.03, 0, d, -Math.PI / 2]]\n for (const [ox, oz, faceWidth, ry] of faces) {\n const columns = Math.max(1, Math.floor(faceWidth / column))\n for (let storey = 1; storey < storeys; storey++) {\n if (mechanical.has(storey)) continue\n const y = storey * h + (podium - h) + h * (preset.glass ? 0.2 : 0.35)\n for (let c = 0; c < columns; c++) {\n const u = (c - (columns - 1) / 2) * column\n const lit = b.random() < request.lit\n ;(lit ? b.windows.lit : b.windows.dark).push({ x: ox ? x + ox : x + u, y, z: ox ? z + u : z + oz, ry, width: winWidth, height: winHeight, isLit: lit })\n }\n }\n }\n return { x, z, width: w, depth: d, height: top + 0.35 + (mast > 0.5 ? mast : 0), color: request.color }\n}\n\n/** The drawer a kit uses for a building of the block or the avenue: a tower from the minimum height up, the plain city building under it. */\nexport function createTowerDrawer(towers: TowerOptions, plain: (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions) => BlockBuilding) {\n const minHeight = towers.minHeight ?? TOWER_DEFAULTS.minHeight\n const presets = towers.presets ?? DEFAULT_TOWER_PRESETS\n return (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o: BuildingOptions = {}): BlockBuilding => {\n if (height < minHeight || presets.length === 0) return plain(b, x, z, width, depth, height, color, o)\n const preset = (o.preset ? presets.find((p) => p.id === o.preset) : undefined) ?? pickTowerPreset(b, presets)\n const top = (preset.maxStoreys ?? towers.maxStoreys ?? TOWER_DEFAULTS.maxStoreys) * preset.storeyHeight\n const bottom = (preset.minStoreys ?? 0) * preset.storeyHeight\n const request: TowerRequest = { x, z, width, depth, height: Math.min(Math.max(height, bottom), top), color, preset, lit: o.lit ?? towers.lit ?? TOWER_DEFAULTS.lit, ...(o.use ? { use: o.use } : {}), ...(o.storeys ? { storeys: o.storeys } : {}) }\n if (towers.provider) {\n towers.provider(request, b)\n return { x, z, width, depth, height: request.height, color }\n }\n return drawTower(b, request, towers)\n }\n}\n","import type { UrbanBuilder } from './scene'\n\n/** Colours of the props; a game replaces the ones it wants. */\nexport type PropColors = {\n tent: number\n trunk: number\n pines: readonly number[]\n crowns: readonly number[]\n sandbags: number\n fence: number\n wire: number\n label: { background: string; foreground: string }\n watchtower: { leg: number; cabin: number; deck: number }\n}\n\nexport const DEFAULT_PROP_COLORS: PropColors = {\n tent: 0x4f5638,\n trunk: 0x3a2a1c,\n pines: [0x1f3324, 0x24382a, 0x1b2d20],\n crowns: [0x34452a, 0x3d4a2c, 0x2f3d26],\n sandbags: 0x8a7a5a,\n fence: 0x6a6c6e,\n wire: 0x2a2a2a,\n label: { background: 'rgba(16,18,22,.9)', foreground: '#e8dfcf' },\n watchtower: { leg: 0x4a3a2a, cabin: 0x4f5638, deck: 0x3a3a2a },\n}\n\nconst LABEL_FONT = '700 44px \"Arial Narrow\", Arial, sans-serif'\nconst LABEL_CANVAS = { width: 1024, height: 200 }\nconst SANDBAG_LENGTH = 0.56\n\nconst colors = (c?: Partial<PropColors>): PropColors => ({ ...DEFAULT_PROP_COLORS, ...c })\n\n/** Fence along a line: posts every 3 m and three wires. */\nexport function drawFence(b: UrbanBuilder, x0: number, z0: number, x1: number, z1: number, height: number, color?: number): void {\n b.fence(x0, z0, x1, z1, height, color)\n}\n\n/** Tent: a triangular prism `w` wide, 0.7 w high and `d` long, turned by `ry`. */\nexport function drawTent(b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number, c?: Partial<PropColors>): void {\n b.prism(x, 0, z, w, w * 0.7, d, color ?? colors(c).tent, -1, ry)\n}\n\n/** Pine: a trunk and two cones of one of the greens (one draw from the random). */\nexport function drawPine(b: UrbanBuilder, x: number, z: number, scale = 1, y = 0, c?: Partial<PropColors>): void {\n const palette = colors(c)\n b.cylinder(x, y, z, 0.12 * scale, 0.16 * scale, 1 * scale, palette.trunk)\n const green = b.pick(palette.pines)\n b.cone(x, y + 0.8 * scale, z, 1.1 * scale, 2.2 * scale, green)\n b.cone(x, y + 2.1 * scale, z, 0.8 * scale, 1.8 * scale, green)\n}\n\n/** Tree: a trunk and a rough ball of leaves of one of the greens (one draw from the random). */\nexport function drawTree(b: UrbanBuilder, x: number, z: number, scale = 1, c?: Partial<PropColors>): void {\n const palette = colors(c)\n b.cylinder(x, 0, z, 0.12 * scale, 0.18 * scale, 1.8 * scale, palette.trunk)\n b.crown(x, 2.6 * scale, z, 1.3 * scale, b.pick(palette.crowns))\n}\n\n/** Shipping container (2.44 x 2.6 x 6.06 m) with five ribs on one end. */\nexport function drawContainer(b: UrbanBuilder, x: number, y: number, z: number, ry: number, color: number): void {\n const group = b.group(x, y, z, ry)\n b.box(0, 0, 0, 2.44, 2.6, 6.06, color, { parent: group, style: { roughness: 0.7, metalness: 0.3 } })\n for (let k = -2; k <= 2; k++) b.box(k * 0.5, 0, 3.04, 0.06, 2.6, 0.04, 0x1a1a1a, { parent: group })\n}\n\n/** Watch tower: four legs, a cabin, a roof deck and two posts; with a searchlight whose beam circles the ground. */\nexport function drawWatchtower(b: UrbanBuilder, x: number, z: number, searchlight = false, c?: Partial<PropColors>): void {\n const palette = colors(c).watchtower\n for (const a of [-1, 1]) for (const d of [-1, 1]) b.box(x + a * 1.2, 0, z + d * 1.2, 0.25, 7, 0.25, palette.leg)\n b.box(x, 7, z, 3.2, 1.2, 3.2, palette.cabin)\n b.box(x, 8.2, z, 3.6, 0.15, 3.6, palette.deck)\n for (const side of [-1.5, 1.5]) b.box(x + side, 8.2, z, 0.15, 1.6, 0.15, palette.deck)\n if (searchlight) b.spot({ x, y: 9, z, color: 0xe6eeff, intensity: 2.4, distance: 70, decay: 1.2, angle: 0.35, penumbra: 0.5, target: { x: x + 20, y: 0, z: z + 20 }, sweep: { speed: 0.5, radius: 25 } })\n}\n\n/** Rows of sandbags along `x` or `z`, each row shifted half a bag. Instances, no parts. */\nexport function drawSandbags(b: UrbanBuilder, x: number, z: number, length: number, along: 'x' | 'z', rows = 3, c?: Partial<PropColors>): void {\n const color = colors(c).sandbags\n for (let r = 0; r < rows; r++) {\n for (let i = 0; i < length / SANDBAG_LENGTH; i++) {\n const u = -length / 2 + 0.28 + i * SANDBAG_LENGTH + (r % 2) * 0.28\n b.item(along === 'x' ? x + u : x, r * 0.21, along === 'x' ? z : z + u, along === 'x' ? 0.55 : 0.32, 0.22, along === 'x' ? 0.32 : 0.55, color)\n }\n }\n}\n\n/** A big strip of text on the ground level (name of a street, caption of a cell): two lines on a 22 x 4.4 m board at 2.4 m. */\nexport function drawStripLabel(b: UrbanBuilder, x: number, z: number, title: string, subtitle: string, c?: Partial<PropColors>): void {\n const { background, foreground } = colors(c).label\n b.label([title, subtitle], x, 2.4, z, 22, 4.4, 0, { background, foreground, font: LABEL_FONT, canvas: LABEL_CANVAS })\n}\n\n/** Wires between poles: a polyline at one height. */\nexport function drawWires(b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number, c?: Partial<PropColors>): void {\n b.line(points.map(([px, pz]) => [px, y, pz] as [number, number, number]), color ?? colors(c).wire)\n}\n","import { applyPatches, mergeById, removeIds } from '@adatechnology/game-contracts'\nimport type { DeepPartial } from '@adatechnology/game-contracts'\nimport { createSilhouetteRandom } from '@adatechnology/game-floorplan'\n\nimport { drawBuilding, fillBlock, DEFAULT_FACADES } from './block'\nimport type { BlockBuilding, BuildingOptions, FillBlockOptions } from './block'\nimport { createLightBudget } from './budget'\nimport { createTowerDrawer, DEFAULT_TOWER_PRESETS } from './tower'\nimport type { TowerOptions } from './tower'\nimport { DEFAULT_POLES, POLE_SHAPES } from './poles'\nimport type { PoleDef, PoleOptions, PoleShapeBuilder } from './poles'\nimport { drawContainer, drawFence, drawPine, drawSandbags, drawStripLabel, drawTent, drawTree, drawWatchtower, drawWires, DEFAULT_PROP_COLORS } from './props'\nimport type { PropColors } from './props'\nimport { composePattern, patternMarker, SAMPLE_GROUND } from './neighbourhoods/compose'\nimport type { Origin, SampleSheetOptions } from './neighbourhoods/compose'\nimport { COMPOSERS } from './neighbourhoods/composers'\nimport { DEFAULT_PATTERNS, SAMPLE_CELLS } from './neighbourhoods/patterns'\nimport type { ComposeOptions, Composer, Locale, NeighbourhoodPattern, UrbanKitCore, UrbanPlan } from './neighbourhoods/types'\nimport { createCities } from './cities'\nimport type { CityPlanInput, DistrictKindDef } from './cities'\nimport { createUrbanBuilder } from './scene'\nimport { createTerrain, drawTerrain } from './terrain'\nimport type { Terrain, TerrainOptions } from './terrain'\nimport type { UrbanBuilder } from './scene'\nimport { drawGround, drawRoad, drawStreetGrid, drawWalk } from './streets'\nimport type { StreetOptions } from './streets'\nimport type { RandomSource } from './types'\n\n/** Lights a scene may spend: the Galeria spends 16 real point lights. */\nexport const DEFAULT_LIGHT_BUDGET = 16\n/** Seed of the Galeria's generator. */\nexport const DEFAULT_URBAN_SEED = 7\n\nexport type UrbanOptions = {\n /** Entries added to the catalogues (an entry with an existing id replaces it). */\n packs?: { poles?: readonly PoleDef[]; neighbourhoods?: readonly NeighbourhoodPattern<any>[]; districtKinds?: readonly DistrictKindDef[]; cityPlans?: readonly CityPlanInput[] }\n /** Numbers changed on shipped entries, by id (objects merge, arrays replace). */\n patch?: { poles?: Record<string, DeepPartial<PoleDef>>; neighbourhoods?: Record<string, DeepPartial<NeighbourhoodPattern<any>>>; districtKinds?: Record<string, DeepPartial<DistrictKindDef>>; cityPlans?: Record<string, DeepPartial<CityPlanInput>> }\n /** Ids taken out of the catalogues. */\n remove?: { poles?: readonly string[]; neighbourhoods?: readonly string[]; districtKinds?: readonly string[]; cityPlans?: readonly string[] }\n /** Shape builders for the poles a pack adds; the five of the Galeria are always there. */\n shapes?: Readonly<Record<string, PoleShapeBuilder>>\n /** Composers for the patterns a pack adds; the ten of the Galeria are always there. */\n composers?: Readonly<Record<string, Composer>>\n /** City plans (zoning): district kinds and plans are catalogues (`packs`, `patch` and `remove` above, under `districtKinds` and `cityPlans`). */\n cities?: { /** Most storeys a district may have. Default 60. */ maxFloors?: number }\n lights?: { budget?: number }\n streets?: StreetOptions\n /** Facade colours of the city buildings. */\n facades?: readonly number[]\n props?: Partial<PropColors>\n /**\n * Towers on the tall lots, off by default. `true` or an object turns them on: a building of the block or of an avenue at least `minHeight` (60 m) tall is drawn as\n * a tower of one of the `presets` (the office and residential typologies), not as a box; a `provider` replaces the drawing. See `TowerOptions`.\n */\n towers?: boolean | TowerOptions\n}\n\nexport type Pole = { readonly def: PoleDef; build(b: UrbanBuilder, options: PoleOptions): void }\n\nexport type BuilderOptions = {\n /** Seed of the generator when no `random` is given. Default 7. */\n seed?: number\n random?: RandomSource\n /** Lights this scene may spend; default the kit's budget. */\n budget?: number\n}\n\nexport type UrbanKit = ReturnType<typeof createUrban>\n\n/** The urban pattern as data: poles, streets, blocks and props that add parts to a builder. Knows nothing about three.js, a game or a place. */\nexport function createUrban(options: UrbanOptions = {}) {\n const entries = mergeById(DEFAULT_POLES, options.packs?.poles)\n applyPatches(entries, options.patch?.poles)\n removeIds(entries, options.remove?.poles)\n const shapes: Record<string, PoleShapeBuilder> = { ...POLE_SHAPES, ...options.shapes }\n const patterns = mergeById(DEFAULT_PATTERNS, options.packs?.neighbourhoods)\n applyPatches(patterns, options.patch?.neighbourhoods)\n removeIds(patterns, options.remove?.neighbourhoods)\n const composers: Record<string, Composer> = { ...COMPOSERS, ...options.composers }\n const lightBudget = options.lights?.budget ?? DEFAULT_LIGHT_BUDGET\n const facades = options.facades ?? DEFAULT_FACADES\n const propColors: PropColors = { ...DEFAULT_PROP_COLORS, ...options.props }\n\n const towers: TowerOptions | null = options.towers ? (options.towers === true ? {} : options.towers) : null\n const building = (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions): BlockBuilding => drawBuilding(b, x, z, width, depth, height, color, o)\n const drawBlockBuilding = towers ? createTowerDrawer(towers, building) : building\n\n const poles = {\n ids: (): string[] => [...entries.keys()],\n list: (): PoleDef[] => [...entries.values()],\n get(id: string): Pole {\n const def = entries.get(id)\n if (!def) throw new Error(`Unknown pole \"${id}\"`)\n const shape = shapes[def.shape]\n if (!shape) throw new Error(`Pole \"${id}\" needs the shape \"${def.shape}\", which is not registered`)\n return { def, build: (b, o) => shape(b, def.spec, o) }\n },\n }\n\n const core: UrbanKitCore = {\n poles,\n streets: {\n road: (b: UrbanBuilder, x: number, z: number, w: number, l: number, along: 'x' | 'z') => drawRoad(b, x, z, w, l, along, options.streets),\n walk: (b: UrbanBuilder, x: number, z: number, w: number, d: number) => drawWalk(b, x, z, w, d, options.streets),\n ground: drawGround,\n grid: (b: UrbanBuilder, g: { block: number; count: number; width: number }) => drawStreetGrid(b, g.block, g.count, g.width, options.streets),\n },\n block: {\n facades,\n building: drawBlockBuilding,\n fill: (b: UrbanBuilder, g: { cx: number; cz: number; size: number; minHeight: number; maxHeight: number } & FillBlockOptions): BlockBuilding[] =>\n fillBlock(b, g.cx, g.cz, g.size, g.minHeight, g.maxHeight, { palette: facades, draw: drawBlockBuilding, ...(towers?.presets ? { presets: towers.presets } : {}), ...g }),\n },\n props: {\n fence: drawFence,\n tent: (b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number) => drawTent(b, x, z, ry, w, d, color, propColors),\n pine: (b: UrbanBuilder, x: number, z: number, scale?: number, y?: number) => drawPine(b, x, z, scale, y, propColors),\n tree: (b: UrbanBuilder, x: number, z: number, scale?: number) => drawTree(b, x, z, scale, propColors),\n container: drawContainer,\n watchtower: (b: UrbanBuilder, x: number, z: number, searchlight?: boolean) => drawWatchtower(b, x, z, searchlight, propColors),\n sandbags: (b: UrbanBuilder, x: number, z: number, length: number, along: 'x' | 'z', rows?: number) => drawSandbags(b, x, z, length, along, rows, propColors),\n label: (b: UrbanBuilder, x: number, z: number, title: string, subtitle: string) => drawStripLabel(b, x, z, title, subtitle, propColors),\n wires: (b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number) => drawWires(b, points, y, color, propColors),\n },\n }\n /** A builder with its own seeded generator and light budget. */\n const builder = (o: BuilderOptions = {}): UrbanBuilder =>\n createUrbanBuilder(o.random ?? createSilhouetteRandom(o.seed ?? DEFAULT_URBAN_SEED), { budget: createLightBudget(o.budget ?? lightBudget) })\n const neighbourhoods = {\n ids: (): string[] => [...patterns.keys()],\n get(id: string) {\n const pattern = patterns.get(id)\n if (!pattern) throw new Error(`Unknown neighbourhood pattern \"${id}\"`)\n const composer = composers[pattern.compose]\n if (!composer) throw new Error(`Pattern \"${id}\" needs the composer \"${pattern.compose}\", which is not registered`)\n return {\n pattern,\n /** Draws the pattern at `origin` and gives back what it put there. */\n compose: (b: UrbanBuilder, origin: Origin, o?: ComposeOptions): UrbanPlan => composePattern(core, pattern, composer, b, origin, o),\n marker: (origin: Origin, locale?: Locale) => patternMarker(pattern, origin, locale),\n }\n },\n /** The Galeria's sample sheet: the ground, then each pattern in its cell, in the order the page builds them. */\n composeSampleSheet(b: UrbanBuilder, o: SampleSheetOptions = {}) {\n if (o.ground !== false) drawGround(b, (o.ground ?? SAMPLE_GROUND).color, (o.ground ?? SAMPLE_GROUND).size)\n const cells = { ...SAMPLE_CELLS, ...o.cells }\n const plans: UrbanPlan[] = []\n for (const id of o.ids ?? [...patterns.keys()]) {\n const cell = cells[id]\n if (!cell) throw new Error(`The sample sheet has no cell for \"${id}\"`)\n plans.push(neighbourhoods.get(id).compose(b, cell, o))\n }\n return { plans, markers: plans.map((plan) => neighbourhoods.get(plan.id).marker(plan.origin, o.locale)) }\n },\n }\n /** A ground from its layers (see TerrainOptions): the numbers of the place are the game's. */\n const terrain = (o: TerrainOptions): Terrain => createTerrain(o)\n const cities = createCities({\n maxFloors: options.cities?.maxFloors,\n packs: { kinds: options.packs?.districtKinds, plans: options.packs?.cityPlans },\n patch: { kinds: options.patch?.districtKinds, plans: options.patch?.cityPlans },\n remove: { kinds: options.remove?.districtKinds, plans: options.remove?.cityPlans },\n presets: towers?.presets ?? DEFAULT_TOWER_PRESETS,\n fill: core.block.fill,\n })\n return { ...core, poles, cities, builder, neighbourhoods, terrain, drawTerrain, towers: { enabled: towers !== null, options: towers } }\n}\n","import { createChalet, createColonialHouse, createCompanyHouse, createDetachedHouse, createFarmhouse, createSlabHouse, createStiltHouse, createTwoStoreyHouse } from '@adatechnology/game-floorplan'\n\nimport type { HouseProvider, HouseRequest, SilhouetteFactory } from './types'\nimport type { Silhouette } from '../types'\n\nconst DEFAULT_WIDTH = 8\nconst DEFAULT_DEPTH = 10\nconst DEFAULT_COLOR = 0xc8b898\n\n/** Turns the group a silhouette starts with (the page turns a colonial or company house after drawing it). */\nfunction turned(silhouette: Silhouette, ry: number | undefined): Silhouette {\n const first = silhouette.parts[0]\n if (ry === undefined || !first || first.shape !== 'group') return silhouette\n return { ...silhouette, parts: [{ ...first, ry }, ...silhouette.parts.slice(1)] }\n}\n\n/** The far-away silhouettes of game-floorplan as the typologies of the default house provider. */\nexport const SILHOUETTE_TYPOLOGIES: Readonly<Record<string, SilhouetteFactory>> = {\n two_storey: (r, random) => createTwoStoreyHouse({ x: r.x, z: r.z, width: r.width ?? DEFAULT_WIDTH, depth: r.depth ?? DEFAULT_DEPTH, color: r.color ?? DEFAULT_COLOR, roofColor: r.roofColor, ry: r.ry, random }),\n detached: (r, random) => createDetachedHouse({ x: r.x, z: r.z, width: r.width ?? DEFAULT_WIDTH, depth: r.depth ?? DEFAULT_DEPTH, color: r.color ?? DEFAULT_COLOR, roofColor: r.roofColor, ry: r.ry, isBoarded: r.isBoarded, random }),\n slab: (r, random) => createSlabHouse({ x: r.x, z: r.z, width: r.width ?? 7, depth: r.depth ?? 8, floors: r.floors ?? 1, color: r.color ?? 0xa8a49c, random }),\n colonial: (r, random) => turned(createColonialHouse({ x: r.x, z: r.z, width: r.width ?? 7, color: r.color ?? 0xd0c4a8, hasDoor: r.hasDoor ?? false, random }), r.ry),\n chalet: (r, random) => createChalet({ x: r.x, z: r.z, color: r.color, ry: r.ry, random }),\n company_house: (r, random) => turned(createCompanyHouse({ x: r.x, z: r.z, color: r.color, random }), r.ry),\n stilt: (r, random) => createStiltHouse({ x: r.x, z: r.z, color: r.color, random }),\n farmhouse: (r, random) => createFarmhouse({ x: r.x, z: r.z, random }),\n}\n\n/** The default provider: the silhouette of game-floorplan for the typology, added to the builder with its shared random. */\nexport function createSilhouetteHouses(typologies: Readonly<Record<string, SilhouetteFactory>> = SILHOUETTE_TYPOLOGIES): HouseProvider {\n return (typology, request: HouseRequest, b) => {\n const factory = typologies[typology]\n if (!factory) throw new Error(`The house provider has no typology \"${typology}\"`)\n b.add(factory(request, b.random))\n }\n}\n","import type { UrbanBuilder } from '../scene'\nimport { createSilhouetteHouses } from './houses'\nimport type { ComposeContext, ComposeOptions, Composer, Locale, NeighbourhoodPattern, Providers, UrbanKitCore, UrbanPlan } from './types'\n\nconst LABEL_OFFSET_Z = 28\nconst DEFAULT_LOCALE: Locale = 'pt-BR'\nconst SAMPLE_GROUND = { color: 0x1e2124, size: 500 }\n\nexport type Origin = { x: number; z: number }\n\n/** Draws one pattern at `origin`: its composer, then the board with the title and the caption. */\nexport function composePattern(kit: UrbanKitCore, pattern: NeighbourhoodPattern<any>, composer: Composer, b: UrbanBuilder, origin: Origin, options: ComposeOptions = {}): UrbanPlan {\n const locale = options.locale ?? DEFAULT_LOCALE\n const providers: Providers = options.providers ?? {}\n const house = providers.house ?? createSilhouetteHouses()\n const plan: UrbanPlan = { id: pattern.id, origin: { ...origin }, houses: [], buildings: [], poles: [], vehicles: [], plants: [] }\n const context: ComposeContext = {\n kit,\n b,\n pattern,\n params: pattern.params,\n x0: origin.x,\n z0: origin.z,\n plan,\n isLit: (share) => share >= 1 || b.random() < share,\n pole: ({ id, ...rest }) => {\n kit.poles.get(id ?? pattern.pole).build(b, rest)\n plan.poles.push({ pole: id ?? pattern.pole, x: rest.x, z: rest.z, on: rest.on ?? true })\n },\n house: (typology, request) => {\n house(typology, request, b)\n plan.houses.push({ typology, x: request.x, z: request.z, ry: request.ry ?? 0 })\n },\n vehicle: (request) => {\n providers.vehicle?.(request, b)\n plan.vehicles.push(request)\n },\n plant: (request) => {\n if (providers.plant) providers.plant(request, b)\n else if (request.kind === 'pine') kit.props.pine(b, request.x, request.z, request.scale)\n else kit.props.tree(b, request.x, request.z, request.scale)\n plan.plants.push(request)\n },\n building: (x, z, width, depth, height, color, o) => {\n plan.buildings.push(kit.block.building(b, x, z, width, depth, height, color, o))\n },\n }\n composer(context)\n const text = pattern.text[locale] ?? pattern.text[DEFAULT_LOCALE]\n kit.props.label(b, origin.x, origin.z + LABEL_OFFSET_Z, text.title, text.caption)\n return plan\n}\n\n/** The marker (map pin) of a pattern at an origin: where it stands, how high, and what it says. */\nexport function patternMarker(pattern: NeighbourhoodPattern<any>, origin: Origin, locale: Locale = DEFAULT_LOCALE): { x: number; y: number; z: number; label: string; detail: string } {\n const text = pattern.text[locale] ?? pattern.text[DEFAULT_LOCALE]\n return { x: origin.x, y: pattern.marker.height, z: origin.z + (pattern.marker.dz ?? 0), label: text.label, detail: text.detail }\n}\n\nexport type SampleSheetOptions = ComposeOptions & {\n /** Ids to draw, in this order. Default all of the kit's patterns in the page's order. */\n ids?: readonly string[]\n /** Where each pattern stands. Default the Galeria's grid. */\n cells?: Readonly<Record<string, Origin>>\n /** Colour and size of the ground under the sheet; false for none. */\n ground?: { color: number; size: number } | false\n}\n\nexport { SAMPLE_GROUND }\n","import type { Composer } from './types'\n\n/** Every composer reads its numbers from `pattern.params`; the defaults are in `patterns.ts`. */\n\nexport type DowntownParams = {\n roadLength: number\n roadColor: number\n median: { width: number; height: number; color: number }\n poles: { from: number; to: number }\n buildings: { perRow: number; first: number; pitch: number; rowOffset: number; size: number; north: { minHeight: number; range: number; lit: number }; south: { minHeight: number; range: number; lit: number } }\n walks: { offset: number; length: number }\n car: { dx: number; dz: number; ry: number; color: number }\n}\n\n/** Avenue: LED poles down the median, two rows of tall buildings, a walk each side and a parked car. */\nexport const composeDowntown: Composer<DowntownParams> = ({ b, kit, pattern, params, x0, z0, pole, building, vehicle }) => {\n b.plane(x0, 0.02, z0, params.roadLength, pattern.streetWidth, params.roadColor)\n b.box(x0, 0, z0, params.roadLength, params.median.height, params.median.width, params.median.color)\n for (let u = params.poles.from; u <= params.poles.to; u += pattern.spacing) pole({ x: x0 + u, z: z0, on: true })\n const { buildings } = params\n for (let i = 0; i < buildings.perRow; i++) {\n const x = x0 + buildings.first + i * buildings.pitch\n const northHeight = buildings.north.minHeight + b.random() * buildings.north.range\n building(x, z0 - buildings.rowOffset, buildings.size, buildings.size, northHeight, b.pick(kit.block.facades), { lit: buildings.north.lit })\n building(x, z0 + buildings.rowOffset, buildings.size, buildings.size, buildings.south.minHeight + b.random() * buildings.south.range, b.pick(kit.block.facades), { lit: buildings.south.lit })\n }\n kit.streets.walk(b, x0, z0 - params.walks.offset, params.walks.length, pattern.walkWidth)\n kit.streets.walk(b, x0, z0 + params.walks.offset, params.walks.length, pattern.walkWidth)\n vehicle({ x: x0 + params.car.dx, z: z0 + params.car.dz, ry: params.car.ry, color: params.car.color })\n}\n\nexport type SuburbParams = {\n roadLength: number\n walkOffset: number\n houses: { count: number; first: number; pitch: number; north: { z: number; typologies: readonly [string, string]; colors: readonly number[] }; south: { z: number; colors: readonly number[] }; roofColor: number; width: number; depth: number }\n walls: { color: number; height: number; thickness: number; offset: number; gateColor: number; gateWidth: number; gateHeight: number; gateOffset: number; gateInset: number; length: number }\n poles: { at: readonly number[]; z: number; transformerFrom: number }\n wires: { half: number; height: number }\n}\n\n/** Houses and two-storey houses behind low walls, concrete poles on the north side with the wires between them. */\nexport const composeSuburb: Composer<SuburbParams> = ({ b, kit, pattern, params, x0, z0, pole, house, isLit }) => {\n kit.streets.road(b, x0, z0, pattern.streetWidth, params.roadLength, 'x')\n kit.streets.walk(b, x0, z0 - params.walkOffset, params.roadLength, pattern.walkWidth)\n kit.streets.walk(b, x0, z0 + params.walkOffset, params.roadLength, pattern.walkWidth)\n const { houses, walls } = params\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house(houses.north.typologies[i % 2 ? 0 : 1], { x, z: z0 + houses.north.z, width: houses.width, depth: houses.depth, color: b.pick(houses.north.colors), roofColor: houses.roofColor, ry: 0 })\n b.box(x, 0, z0 - walls.offset, walls.length, walls.height, walls.thickness, walls.color)\n b.box(x + walls.gateOffset, 0, z0 - walls.gateInset, walls.gateWidth, walls.gateHeight, 0.06, walls.gateColor)\n b.box(x, 0, z0 + walls.offset, walls.length, walls.height, walls.thickness, walls.color)\n b.box(x - walls.gateOffset, 0, z0 + walls.gateInset, walls.gateWidth, walls.gateHeight, 0.06, walls.gateColor)\n }\n for (const u of params.poles.at) pole({ x: x0 + u, z: z0 + params.poles.z, dir: 1, on: isLit(pattern.lit), transformer: u > params.poles.transformerFrom })\n kit.props.wires(b, [[x0 - params.wires.half, z0 + params.poles.z], [x0 + params.wires.half, z0 + params.poles.z]], params.wires.height)\n for (let i = 0; i < houses.count; i++) {\n house('detached', { x: x0 + houses.first + i * houses.pitch, z: z0 + houses.south.z, width: houses.width, depth: houses.depth, color: b.pick(houses.south.colors), roofColor: houses.roofColor, ry: Math.PI })\n }\n}\n\nexport type WorkingClassParams = {\n houses: { count: number; first: number; pitch: number; width: number; depth: number; north: { z: number; colors: readonly number[] }; south: { z: number; colors: readonly number[] }; maxFloors: number }\n poles: { from: number; to: number; z: number; jitter: number }\n wires: { count: number; from: number; to: number; z: number; step: number; height: number; heightStep: number; sag: number; color: number }\n}\n\n/** Slab houses of one to three floors in two rows, concrete poles half burnt out and a tangle of wires. */\nexport const composeWorkingClass: Composer<WorkingClassParams> = ({ b, kit, pattern, params, x0, z0, pole, house, isLit }) => {\n kit.streets.road(b, x0, z0, pattern.streetWidth, 60, 'x')\n const { houses } = params\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house('slab', { x, z: z0 + houses.north.z, width: houses.width, depth: houses.depth, floors: 1 + Math.floor(b.random() * houses.maxFloors), color: b.pick(houses.north.colors) })\n house('slab', { x, z: z0 + houses.south.z, width: houses.width, depth: houses.depth, floors: 1 + Math.floor(b.random() * houses.maxFloors), color: b.pick(houses.south.colors) })\n }\n for (let u = params.poles.from; u <= params.poles.to; u += pattern.spacing + b.random() * params.poles.jitter) pole({ x: x0 + u, z: z0 + params.poles.z, dir: 1, on: isLit(pattern.lit), transformer: true })\n const { wires } = params\n for (let k = 0; k < wires.count; k++) {\n kit.props.wires(b, [[x0 + wires.from, z0 + wires.z + k * wires.step], [x0 + wires.to, z0 + wires.z + (b.random() - 0.5) * wires.sag]], wires.height + k * wires.heightStep, wires.color)\n }\n}\n\nexport type HistoricParams = {\n cobbles: { y: number; length: number; color: number; from: number; to: number; step: number; spread: number; sizes: readonly [number, number, number]; colors: readonly number[] }\n rows: { from: number; to: number; minWidth: number; widthSteps: number; north: { z: number; colors: readonly number[] }; south: { z: number; colors: readonly number[] } }\n poles: { from: number; to: number; step: number; z: number; sideOffset: number }\n}\n\n/** A cobbled street between rows of colonial houses wall to wall, with cast-iron lanterns. */\nexport const composeHistoricStreet: Composer<HistoricParams> = ({ b, pattern, params, x0, z0, pole, house, isLit }) => {\n const { cobbles, rows } = params\n b.plane(x0, cobbles.y, z0, cobbles.length, pattern.streetWidth, cobbles.color)\n for (let u = cobbles.from; u < cobbles.to; u += cobbles.step) b.item(x0 + u, cobbles.y, z0 + (b.random() - 0.5) * cobbles.spread, cobbles.sizes[0], cobbles.sizes[1], cobbles.sizes[2], b.pick(cobbles.colors))\n for (const side of [rows.north, rows.south] as const) {\n let x = x0 + rows.from\n while (x < x0 + rows.to) {\n const width = rows.minWidth + Math.floor(b.random() * rows.widthSteps)\n house('colonial', { x: x + width / 2, z: z0 + side.z, width, color: b.pick(side.colors), hasDoor: true, ry: side === rows.south ? Math.PI : undefined })\n x += width\n }\n }\n for (let u = params.poles.from; u <= params.poles.to; u += params.poles.step) {\n for (const s of [-1, 1]) pole({ x: x0 + u + (s > 0 ? params.poles.sideOffset : 0), z: z0 + s * params.poles.z, on: isLit(pattern.lit) })\n }\n}\n\nexport type IndustrialParams = {\n yard: { length: number; color: number }\n hangar: { x: number; z: number; width: number; height: number; depth: number; color: number; roofColor: number; roofRadius: number; roofY: number; doorColor: number; doorWidth: number; doorHeight: number; stripeColor: number }\n towers: readonly { dx: number; dz: number; on: boolean }[]\n container: { dx: number; dz: number; ry: number; color: number }\n}\n\n/** A paved yard with two hangars under barrel roofs, floodlight towers and a container. */\nexport const composeIndustrial: Composer<IndustrialParams> = ({ b, kit, pattern, params, x0, z0, pole }) => {\n b.plane(x0, 0.02, z0, params.yard.length, pattern.streetWidth, params.yard.color)\n const { hangar } = params\n for (const s of [-1, 1]) {\n const g = b.group(x0 + s * hangar.x, 0, z0 + hangar.z)\n b.box(0, 0, 0, hangar.width, hangar.height, hangar.depth, hangar.color, { parent: g })\n b.vault({ x: 0, y: hangar.roofY, z: 0, radius: hangar.roofRadius, length: hangar.depth, arc: Math.PI, segments: 16, color: hangar.roofColor, rotation: { x: Math.PI / 2, y: 0, z: Math.PI / 2 }, scale: { x: 1, y: 1, z: 0.25 }, parent: g })\n b.box(0, 0, hangar.depth / 2 + 0.05, hangar.doorWidth, hangar.doorHeight, 0.1, hangar.doorColor, { parent: g })\n b.box(0, 6, hangar.depth / 2 + 0.06, 10, 1.2, 0.05, hangar.stripeColor, { parent: g })\n }\n for (const tower of params.towers) pole({ x: x0 + tower.dx, z: z0 + tower.dz, on: tower.on })\n kit.props.container(b, x0 + params.container.dx, 0, z0 + params.container.dz, params.container.ry, params.container.color)\n}\n\nexport type RailwayParams = {\n houses: { count: number; first: number; pitch: number; north: { z: number; colors: readonly number[] }; south: { z: number; color: number } }\n poles: { at: readonly number[]; z: number; transformerFrom: number }\n wires: { half: number; height: number }\n}\n\n/** Company houses in a row, all alike, with residential poles and a single wire. */\nexport const composeRailwayVillage: Composer<RailwayParams> = ({ b, kit, pattern, params, x0, z0, pole, house, isLit }) => {\n kit.streets.road(b, x0, z0, pattern.streetWidth, 60, 'x')\n const { houses } = params\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house('company_house', { x, z: z0 + houses.north.z, color: b.pick(houses.north.colors) })\n house('company_house', { x, z: z0 + houses.south.z, color: houses.south.color, ry: Math.PI })\n }\n for (const u of params.poles.at) pole({ x: x0 + u, z: z0 + params.poles.z, dir: 1, on: isLit(pattern.lit), transformer: u > params.poles.transformerFrom })\n kit.props.wires(b, [[x0 - params.wires.half, z0 + params.poles.z], [x0 + params.wires.half, z0 + params.poles.z]], params.wires.height)\n}\n\nexport type MountainParams = {\n road: { y: number; length: number; color: number }\n chalets: { count: number; first: number; pitch: number; northZ: number; southZ: number; southShift: number; northColors: readonly number[]; southColors: readonly number[] }\n poles: { from: number; to: number; step: number; z: number; sideOffset: number }\n pines: { count: number; first: number; span: number; rowZ: number; minScale: number; scaleRange: number }\n}\n\n/** A mountain-resort street: wooden chalets, cast-iron lanterns and pines at both edges. */\nexport const composeMountainResort: Composer<MountainParams> = ({ b, pattern, params, x0, z0, pole, house, plant, isLit }) => {\n b.plane(x0, params.road.y, z0, params.road.length, pattern.streetWidth, params.road.color)\n const { chalets } = params\n for (let i = 0; i < chalets.count; i++) {\n house('chalet', { x: x0 + chalets.first + i * chalets.pitch, z: z0 + chalets.northZ, color: b.pick(chalets.northColors) })\n house('chalet', { x: x0 + chalets.first + i * chalets.pitch + chalets.southShift, z: z0 + chalets.southZ, color: b.pick(chalets.southColors), ry: Math.PI })\n }\n for (let u = params.poles.from; u <= params.poles.to; u += params.poles.step) {\n for (const s of [-1, 1]) pole({ x: x0 + u + (s > 0 ? params.poles.sideOffset : 0), z: z0 + s * params.poles.z, on: isLit(pattern.lit) })\n }\n const { pines } = params\n for (let i = 0; i < pines.count; i++) plant({ kind: 'pine', x: x0 + pines.first + b.random() * pines.span, z: z0 + (b.random() < 0.5 ? -pines.rowZ : pines.rowZ), scale: pines.minScale + b.random() * pines.scaleRange })\n}\n\nexport type StiltParams = {\n water: { y: number; z: number; length: number; depth: number; color: number; roughness: number; metalness: number }\n bank: { z: number; length: number; depth: number; color: number }\n boardwalk: { y: number; length: number; width: number; color: number; pilesFrom: number; pilesTo: number; pilesStep: number }\n houses: { count: number; first: number; pitch: number; z: number; colors: readonly number[]; lantern: { dx: number; y: number; dz: number; lit: number; unlit: number } }\n lamp: { dx: number; y: number; dz: number; color: number; intensity: number; distance: number }\n boat: { dx: number; dz: number; color: number }\n}\n\n/** Stilt houses over water along a boardwalk, with no public lighting: a lantern on each odd house and a lamp light. */\nexport const composeStiltVillage: Composer<StiltParams> = ({ b, params, x0, z0, house }) => {\n const { water, bank, boardwalk, houses } = params\n b.plane(x0, water.y, z0 + water.z, water.length, water.depth, water.color, { roughness: water.roughness, metalness: water.metalness })\n b.box(x0, 0, z0 + bank.z, bank.length, 0.2, bank.depth, bank.color)\n b.box(x0, boardwalk.y, z0, boardwalk.length, 0.2, boardwalk.width, boardwalk.color)\n for (let u = boardwalk.pilesFrom; u <= boardwalk.pilesTo; u += boardwalk.pilesStep) b.cylinder(x0 + u, -1.5, z0 + 0.9, 0.1, 0.1, 2.9, 0x3a2a1c, -1, 5)\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house('stilt', { x, z: z0 + houses.z, color: b.pick(houses.colors) })\n const lit = i % 2 === 1\n b.box(x + houses.lantern.dx, houses.lantern.y, z0 + houses.lantern.dz, 0.2, 0.28, 0.2, lit ? houses.lantern.lit : houses.lantern.unlit, { emissive: lit })\n }\n b.light({ x: x0 + params.lamp.dx, y: params.lamp.y, z: z0 + params.lamp.dz, color: params.lamp.color, intensity: params.lamp.intensity, distance: params.lamp.distance })\n b.box(x0 + params.boat.dx, -0.2, z0 + params.boat.dz, 1.6, 0.5, 4.6, params.boat.color)\n}\n\nexport type MilitaryParams = {\n yard: { length: number; color: number }\n fence: { from: number; to: number; step: number; z: number; height: number; color: number; wireColor: number }\n towers: { dx: readonly number[]; dz: number }\n alarm: { dz: number; color: number; intensity: number; distance: number; y: number; lampDz: number; lampY: number }\n sandbags: { dz: number; length: number; rows: number }\n tents: { count: number; first: number; pitch: number; dz: number; width: number; depth: number }\n}\n\n/** A military perimeter: a mesh fence, watch towers with searchlights, a red emergency lamp, sandbags and tents. */\nexport const composeMilitary: Composer<MilitaryParams> = ({ b, kit, pattern, params, x0, z0 }) => {\n b.plane(x0, 0.02, z0, params.yard.length, pattern.streetWidth, params.yard.color)\n const { fence } = params\n for (let u = fence.from; u <= fence.to; u += fence.step) b.cylinder(x0 + u, 0, z0 + fence.z, 0.06, 0.06, 3, fence.color, -1, 4)\n b.line([[x0 + fence.from, 2.9, z0 + fence.z], [x0 + fence.to, 2.9, z0 + fence.z]], fence.wireColor)\n for (const u of params.towers.dx) kit.props.watchtower(b, x0 + u, z0 + params.towers.dz, true)\n const { alarm } = params\n b.light({ x: x0, y: alarm.y, z: z0 + alarm.dz, color: alarm.color, intensity: alarm.intensity, distance: alarm.distance })\n b.box(x0, alarm.lampY, z0 + alarm.lampDz, 0.3, 0.3, 0.3, alarm.color, { emissive: true })\n kit.props.sandbags(b, x0, z0 + params.sandbags.dz, params.sandbags.length, 'x', params.sandbags.rows)\n for (let i = 0; i < params.tents.count; i++) kit.props.tent(b, x0 + params.tents.first + i * params.tents.pitch, z0 + params.tents.dz, 0, params.tents.width, params.tents.depth)\n}\n\nexport type RuralParams = {\n road: { length: number; color: number }\n field: { y: number; dz: number; length: number; depth: number; color: number }\n farmhouse: { dx: number; dz: number }\n pole: { dx: number; dz: number }\n fence: { dz: number; half: number; height: number; color: number }\n trees: { count: number; first: number; span: number; dz: number; spread: number; minScale: number; scaleRange: number }\n crops: { rows: number; perRow: number; first: number; pitch: number; dz: number; rowPitch: number; width: number; minHeight: number; heightRange: number; color: number }\n}\n\n/** A farm: dirt road, farmhouse with a veranda, one wooden pole at the junction, a fence, trees and rows of crops. */\nexport const composeRural: Composer<RuralParams> = ({ b, pattern, params, x0, z0, pole, house, plant }) => {\n b.plane(x0, 0.02, z0, params.road.length, pattern.streetWidth, params.road.color)\n b.plane(x0, params.field.y, z0 + params.field.dz, params.field.length, params.field.depth, params.field.color)\n house('farmhouse', { x: x0 + params.farmhouse.dx, z: z0 + params.farmhouse.dz })\n pole({ x: x0 + params.pole.dx, z: z0 + params.pole.dz, on: true })\n b.fence(x0 - params.fence.half, z0 + params.fence.dz, x0 + params.fence.half, z0 + params.fence.dz, params.fence.height, params.fence.color)\n const { trees, crops } = params\n for (let i = 0; i < trees.count; i++) plant({ kind: 'tree', x: x0 + trees.first + b.random() * trees.span, z: z0 + trees.dz + b.random() * trees.spread, scale: trees.minScale + b.random() * trees.scaleRange })\n for (let r = 0; r < crops.rows; r++) {\n for (let i = 0; i < crops.perRow; i++) b.item(x0 + crops.first + i * crops.pitch, 0, z0 + crops.dz + r * crops.rowPitch, crops.width, crops.minHeight + b.random() * crops.heightRange, crops.width, crops.color)\n }\n}\n\n/** The composers the ten default patterns use; a game adds its own through `createUrban({ composers })`. */\nexport const COMPOSERS: Readonly<Record<string, Composer>> = {\n downtown: composeDowntown,\n suburb: composeSuburb,\n working_class: composeWorkingClass,\n historic_street: composeHistoricStreet,\n industrial_port: composeIndustrial,\n railway_village: composeRailwayVillage,\n mountain_resort: composeMountainResort,\n stilt_village: composeStiltVillage,\n military: composeMilitary,\n rural: composeRural,\n}\n","import { COMPOSERS } from './composers'\nimport type { DowntownParams, HistoricParams, IndustrialParams, MilitaryParams, MountainParams, RailwayParams, RuralParams, StiltParams, SuburbParams, WorkingClassParams } from './composers'\nimport type { NeighbourhoodPattern } from './types'\n\nconst suburb: NeighbourhoodPattern<SuburbParams> = {\n id: 'suburb',\n streetWidth: 7,\n walkWidth: 2,\n typologies: ['detached', 'two_storey'],\n pole: 'concrete_arm',\n lightColor: 0xff9a40,\n spacing: 35,\n lit: 0.75,\n compose: 'suburb',\n marker: { height: 10 },\n text: {\n 'pt-BR': { label: 'Subúrbio', title: 'SUBÚRBIO', caption: 'casa térrea e sobrado · muro 1,8 m · sódio a cada 35 m', detail: 'Casa térrea e sobrado, muro de 1,8 m. Poste de concreto com sódio laranja.' },\n en: { label: 'Suburb', title: 'SUBURB', caption: 'one-storey and two-storey houses · 1.8 m wall · sodium every 35 m', detail: 'One-storey and two-storey houses behind a 1.8 m wall. Concrete pole with an orange sodium lamp.' },\n },\n params: {\n roadLength: 60,\n walkOffset: 4.5,\n houses: { count: 5, first: -24, pitch: 12, north: { z: -15, typologies: ['two_storey', 'detached'], colors: [0xc8b89a, 0xa8b0a0, 0xd0c0a0, 0xb8a890] }, south: { z: 15, colors: [0xc8b89a, 0xa8b0a0, 0xd0c0a0] }, roofColor: 0x6a3a2a, width: 8, depth: 10 },\n walls: { color: 0xbab2a0, height: 1.8, thickness: 0.2, offset: 5.8, gateColor: 0x3a3a3a, gateWidth: 2.4, gateHeight: 1.6, gateOffset: 3.5, gateInset: 5.7, length: 10 },\n poles: { at: [-26, 9], z: -4.8, transformerFrom: 0 },\n wires: { half: 28, height: 6.9 },\n },\n}\n\nconst downtown: NeighbourhoodPattern<DowntownParams> = {\n id: 'downtown',\n streetWidth: 14,\n walkWidth: 3,\n typologies: ['city_building'],\n pole: 'led_double',\n lightColor: 0xdfe8ff,\n spacing: 25,\n lit: 1,\n compose: 'downtown',\n marker: { height: 14 },\n text: {\n 'pt-BR': { label: 'Centro', title: 'CENTRO', caption: 'avenida 2 × 7 m · LED branco a cada 25 m', detail: 'Prédio residencial e comercial de 4 a 12 andares. Poste metálico duplo, LED branco.' },\n en: { label: 'Downtown', title: 'DOWNTOWN', caption: 'avenue 2 × 7 m · white LED every 25 m', detail: 'Residential and commercial buildings of 4 to 12 floors. Double steel pole, white LED.' },\n },\n params: {\n roadLength: 60,\n roadColor: 0x222428,\n median: { width: 1.6, height: 0.18, color: 0x3a4a2c },\n poles: { from: -26, to: 26 },\n buildings: { perRow: 4, first: -21, pitch: 14, rowOffset: 18, size: 12, north: { minHeight: 12, range: 24, lit: 0.1 }, south: { minHeight: 12, range: 18, lit: 0.08 } },\n walks: { offset: 10, length: 60 },\n car: { dx: -8, dz: -3, ry: 1.57, color: 0x6b6450 },\n },\n}\n\nconst workingClass: NeighbourhoodPattern<WorkingClassParams> = {\n id: 'working_class',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['slab'],\n pole: 'concrete_arm',\n lightColor: 0xff9a40,\n spacing: 36,\n lit: 0.5,\n compose: 'working_class',\n marker: { height: 10 },\n text: {\n 'pt-BR': { label: 'Bairro popular', title: 'BAIRRO POPULAR', caption: \"lajes de 1 a 3 · caixa d'água azul · metade das luzes queimadas\", detail: 'Casas geminadas de laje, fios emaranhados, metade das luzes queimadas.' },\n en: { label: 'Working-class quarter', title: 'WORKING-CLASS QUARTER', caption: 'slab houses of 1 to 3 floors · blue water tank · half the lamps burnt out', detail: 'Row slab houses, tangled wires, half the lamps burnt out.' },\n },\n params: {\n houses: { count: 10, first: -27, pitch: 6, width: 5.6, depth: 10, north: { z: -9, colors: [0xa0624a, 0x9a6a54, 0x8a5a44] }, south: { z: 9, colors: [0xa0624a, 0x9a6a54, 0xc8c0b0] }, maxFloors: 3 },\n poles: { from: -24, to: 26, z: -3.5, jitter: 8 },\n wires: { count: 4, from: -26, to: 26, z: -3.5, step: 0.15, height: 6.3, heightStep: 0.25, sag: 2, color: 0x1a1a1a },\n },\n}\n\nconst historicStreet: NeighbourhoodPattern<HistoricParams> = {\n id: 'historic_street',\n streetWidth: 5,\n walkWidth: 0,\n typologies: ['colonial'],\n pole: 'cast_iron',\n lightColor: 0xffc880,\n spacing: 20,\n lit: 0.8,\n compose: 'historic_street',\n marker: { height: 8 },\n text: {\n 'pt-BR': { label: 'Rua histórica', title: 'RUA HISTÓRICA', caption: 'casas coloniais coladas · pedra 5 m · ferro fundido a cada 20 m', detail: 'Casas coloniais coladas, rua de pedra, luminária de ferro fundido.' },\n en: { label: 'Historic street', title: 'HISTORIC STREET', caption: 'colonial houses wall to wall · 5 m cobbles · cast iron every 20 m', detail: 'Colonial houses wall to wall, cobbled street, cast-iron lanterns.' },\n },\n params: {\n cobbles: { y: 0.03, length: 60, color: 0x4a4642, from: -28, to: 28, step: 0.9, spread: 4, sizes: [0.8, 0.04, 0.6], colors: [0x5a5650, 0x4e4a46, 0x625e58] },\n rows: { from: -28, to: 26, minWidth: 5, widthSteps: 3, north: { z: -8, colors: [0xd8c8a0, 0xa8c0c0, 0xe0b890, 0xc0a8b8, 0xd0d0c0] }, south: { z: 8, colors: [0xd8c8a0, 0xa8c0c0, 0xe0b890, 0xc0a8b8] } },\n poles: { from: -25, to: 25, step: 20, z: 2.9, sideOffset: 10 },\n },\n}\n\nconst industrialPort: NeighbourhoodPattern<IndustrialParams> = {\n id: 'industrial_port',\n streetWidth: 40,\n walkWidth: 0,\n typologies: ['hangar'],\n pole: 'flood_tower',\n lightColor: 0xfff0d0,\n spacing: 60,\n lit: 1,\n compose: 'industrial_port',\n marker: { height: 16 },\n text: {\n 'pt-BR': { label: 'Industrial e porto', title: 'INDUSTRIAL E PORTO', caption: 'galpão (amostra encurtada) · torre de refletor a cada 60 m', detail: 'Galpões e torres de refletor de 12 m.' },\n en: { label: 'Industrial and port', title: 'INDUSTRIAL AND PORT', caption: 'warehouse (shortened sample) · floodlight tower every 60 m', detail: 'Warehouses and 12 m floodlight towers.' },\n },\n params: {\n yard: { length: 60, color: 0x2a2b2c },\n hangar: { x: 15, z: -6, width: 26, height: 10, depth: 30, color: 0x6a6c68, roofColor: 0x5a5c58, roofRadius: 13, roofY: 10, doorColor: 0x3a3a3a, doorWidth: 6, doorHeight: 5, stripeColor: 0xd8b02a },\n towers: [{ dx: -30, dz: 14, on: true }, { dx: 30, dz: 14, on: false }],\n container: { dx: 20, dz: 14, ry: 0.2, color: 0x8a3a2a },\n },\n}\n\nconst railwayVillage: NeighbourhoodPattern<RailwayParams> = {\n id: 'railway_village',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['company_house'],\n pole: 'concrete_arm',\n lightColor: 0xff9a40,\n spacing: 35,\n lit: 0.7,\n compose: 'railway_village',\n marker: { height: 8 },\n text: {\n 'pt-BR': { label: 'Vila ferroviária', title: 'VILA FERROVIÁRIA', caption: 'casas da companhia, todas iguais · poste residencial a cada 35 m', detail: 'Casas da companhia em fila, todas iguais.' },\n en: { label: 'Railway village', title: 'RAILWAY VILLAGE', caption: 'company houses, all alike · residential pole every 35 m', detail: 'Company houses in a row, all alike.' },\n },\n params: {\n houses: { count: 6, first: -25, pitch: 10, north: { z: -12, colors: [0xd8d0c0, 0xd0c8b4] }, south: { z: 12, color: 0xd8d0c0 } },\n poles: { at: [-26, 9], z: -4, transformerFrom: 0 },\n wires: { half: 26, height: 6.9 },\n },\n}\n\nconst mountainResort: NeighbourhoodPattern<MountainParams> = {\n id: 'mountain_resort',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['chalet'],\n pole: 'cast_iron',\n lightColor: 0xffc880,\n spacing: 20,\n lit: 0.7,\n compose: 'mountain_resort',\n marker: { height: 10 },\n text: {\n 'pt-BR': { label: 'Serra', title: 'SERRA · RUA DAS POUSADAS', caption: 'chalé de madeira e pedra · telhado 45° · ferro fundido a cada 20 m', detail: 'Rua das Pousadas: chalés de madeira e pedra com telhado íngreme e luminária de ferro fundido. Na Encosta, sem iluminação.' },\n en: { label: 'Mountain', title: 'MOUNTAIN · INN STREET', caption: 'wood and stone chalets · 45° roof · cast iron every 20 m', detail: 'Inn Street: wood and stone chalets with a steep roof and cast-iron lanterns. Up the slope there is no lighting.' },\n },\n params: {\n road: { y: 0.02, length: 60, color: 0x2a2a28 },\n chalets: { count: 5, first: -24, pitch: 12, northZ: -12, southZ: 12, southShift: 6, northColors: [0x6b4a30, 0x5a3e28, 0x7a5a3a], southColors: [0x6b4a30, 0x5a3e28] },\n poles: { from: -25, to: 25, step: 20, z: 2.6, sideOffset: 10 },\n pines: { count: 10, first: -28, span: 56, rowZ: 22, minScale: 1.4, scaleRange: 1 },\n },\n}\n\nconst stiltVillage: NeighbourhoodPattern<StiltParams> = {\n id: 'stilt_village',\n streetWidth: 2,\n walkWidth: 0,\n typologies: ['stilt'],\n pole: '',\n lightColor: 0xffb060,\n spacing: 0,\n lit: 1,\n compose: 'stilt_village',\n marker: { height: 7 },\n text: {\n 'pt-BR': { label: 'Palafitas', title: 'PALAFITAS', caption: 'madeira sobre estacas · sem luz pública · lampião', detail: 'Vila dos Pescadores: sem iluminação pública, só lampião.' },\n en: { label: 'Stilt village', title: 'STILT VILLAGE', caption: 'timber on piles · no public lighting · lanterns', detail: 'Fishermen\\'s village: no public lighting, only lanterns.' },\n },\n params: {\n water: { y: 0.04, z: -2, length: 60, depth: 30, color: 0x22343e, roughness: 0.25, metalness: 0.3 },\n bank: { z: 14, length: 60, depth: 8, color: 0x4a4436 },\n boardwalk: { y: 1.3, length: 56, width: 2, color: 0x5a4630, pilesFrom: -26, pilesTo: 26, pilesStep: 4 },\n houses: { count: 5, first: -22, pitch: 11, z: -7, colors: [0x6a5a46, 0x5a6a6a, 0x7a5a46], lantern: { dx: 1.5, y: 3.2, dz: -3.4, lit: 0xffc070, unlit: 0x3a3a3a } },\n lamp: { dx: -11, y: 3, dz: -3, color: 0xffb060, intensity: 0.9, distance: 10 },\n boat: { dx: 14, dz: 6, color: 0x5a3a2a },\n },\n}\n\nconst military: NeighbourhoodPattern<MilitaryParams> = {\n id: 'military',\n streetWidth: 40,\n walkWidth: 0,\n typologies: ['tent'],\n pole: '',\n lightColor: 0xe6eeff,\n spacing: 40,\n lit: 1,\n compose: 'military',\n marker: { height: 12, dz: -14 },\n text: {\n 'pt-BR': { label: 'Militar', title: 'MILITAR', caption: 'torre de vigia e tripé · holofote branco · luz vermelha · a cada 40 m', detail: 'Base, bloqueio e penitenciária: torres com holofote branco e luz vermelha de emergência no perímetro.' },\n en: { label: 'Military', title: 'MILITARY', caption: 'watch tower and tripod · white searchlight · red lamp · every 40 m', detail: 'Base, roadblock and penitentiary: towers with a white searchlight and a red emergency lamp on the perimeter.' },\n },\n params: {\n yard: { length: 60, color: 0x3a3a30 },\n fence: { from: -28, to: 28, step: 4, z: -12, height: 3, color: 0x6a6c6e, wireColor: 0x9a9a9a },\n towers: { dx: [-20, 20], dz: -14 },\n alarm: { dz: -10, color: 0xff2a1a, intensity: 1.2, distance: 16, y: 3, lampDz: -11.7, lampY: 2.6 },\n sandbags: { dz: -6, length: 10, rows: 3 },\n tents: { count: 3, first: -14, pitch: 14, dz: 8, width: 6, depth: 8 },\n },\n}\n\nconst rural: NeighbourhoodPattern<RuralParams> = {\n id: 'rural',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['farmhouse'],\n pole: 'wood_crossarm',\n lightColor: 0xffd27a,\n spacing: 0,\n lit: 1,\n compose: 'rural',\n marker: { height: 7 },\n text: {\n 'pt-BR': { label: 'Rural', title: 'RURAL', caption: 'casa sede com varanda · poste de madeira só no cruzamento', detail: 'Casa sede com varanda. Luz só em cruzamentos e sedes.' },\n en: { label: 'Rural', title: 'RURAL', caption: 'farmhouse with a veranda · wooden pole only at the junction', detail: 'Farmhouse with a veranda. Light only at junctions and farmhouses.' },\n },\n params: {\n road: { length: 60, color: 0x4a3a2a },\n field: { y: 0.01, dz: 15, length: 60, depth: 22, color: 0x3a4a2a },\n farmhouse: { dx: -10, dz: -14 },\n pole: { dx: 6, dz: -4 },\n fence: { dz: -4, half: 28, height: 1.2, color: 0x5a4630 },\n trees: { count: 8, first: 8, span: 20, dz: -16, spread: 10, minScale: 1, scaleRange: 0.5 },\n crops: { rows: 6, perRow: 20, first: -26, pitch: 2.7, dz: 8, rowPitch: 2.2, width: 0.4, minHeight: 0.6, heightRange: 0.3, color: 0x4a5a2a },\n },\n}\n\n/** The ten patterns of the Galeria's sample sheet, in the order the page builds them. */\nexport const DEFAULT_PATTERNS: readonly NeighbourhoodPattern<any>[] = [downtown, suburb, workingClass, historicStreet, industrialPort, railwayVillage, mountainResort, stiltVillage, military, rural]\n\n/** Where the sample sheet puts each pattern: a 3 x 3 grid 80 by 56 m apart, and the military cell off to the east. */\nexport const SAMPLE_CELLS: Readonly<Record<string, { x: number; z: number }>> = {\n downtown: { x: -80, z: -56 },\n suburb: { x: 0, z: -56 },\n working_class: { x: 80, z: -56 },\n historic_street: { x: -80, z: 0 },\n industrial_port: { x: 0, z: 0 },\n railway_village: { x: 80, z: 0 },\n mountain_resort: { x: -80, z: 56 },\n stilt_village: { x: 0, z: 56 },\n rural: { x: 80, z: 56 },\n military: { x: 160, z: 0 },\n}\n\nexport { COMPOSERS }\n","import { applyPatches, mergeById, removeIds } from '@adatechnology/game-contracts'\nimport type { DeepPartial } from '@adatechnology/game-contracts'\n\nimport type { FillBlockOptions, BlockBuilding } from '../block'\nimport type { UrbanBuilder } from '../scene'\nimport type { TowerPreset } from '../tower'\nimport type { Locale } from '../neighbourhoods/types'\nimport { DEFAULT_DISTRICT_KINDS } from './kinds'\nimport { DEFAULT_CITY_PLANS } from './templates'\nimport type {\n Block,\n CityLayout,\n CityPlanDef,\n CityPlanInput,\n DistrictKindDef,\n FillBlockCityOptions,\n KindStats,\n LayoutOptions,\n PlanLandmark,\n ResolvedDistrict,\n} from './types'\n\n/** Highest storey count a district may have unless the game raises it. */\nexport const DEFAULT_MAX_FLOORS = 60\nexport const DEFAULT_STREET = 10\nconst DEFAULT_LOCALE: Locale = 'pt-BR'\nconst DEFAULT_STOREY_PRESETS: Readonly<Record<string, string>> = { commercial: 'office', residential: 'residential' }\n\nexport type CitiesOptions = {\n /** Most storeys any district may have, applied on top of the kinds and the districts' own numbers. Default 60. */\n maxFloors?: number\n packs?: { kinds?: readonly DistrictKindDef[]; plans?: readonly CityPlanInput[] }\n patch?: { kinds?: Record<string, DeepPartial<DistrictKindDef>>; plans?: Record<string, DeepPartial<CityPlanInput>> }\n remove?: { kinds?: readonly string[]; plans?: readonly string[] }\n /** Tower presets of the kit (storey heights by use). */\n presets: readonly TowerPreset[]\n fill(b: UrbanBuilder, g: { cx: number; cz: number; size: number; minHeight: number; maxHeight: number } & FillBlockOptions): BlockBuilding[]\n}\n\nconst text = <T>(by: Record<string, T>, locale: Locale): T => (by[locale] ?? by[DEFAULT_LOCALE]) as T\nconst named = (name: string | Partial<Record<Locale, string>> | undefined, locale: Locale): string | undefined =>\n typeof name === 'string' || name === undefined ? name : (name[locale] ?? name[DEFAULT_LOCALE])\n\nconst mergeLists = <T extends { id: string }>(parent: readonly T[], own: readonly T[]): T[] => {\n const list = [...parent]\n for (const item of own) {\n const at = list.findIndex((p) => p.id === item.id)\n if (at >= 0) list[at] = item\n else list.push(item)\n }\n return list\n}\n\n/** City plans as data: district kinds and plans are registries; a plan resolves to a layout with the district at a point and the grid of blocks of a district. */\nexport function createCities(o: CitiesOptions) {\n const maxFloors = o.maxFloors ?? DEFAULT_MAX_FLOORS\n const kindEntries = mergeById(DEFAULT_DISTRICT_KINDS, o.packs?.kinds)\n applyPatches(kindEntries, o.patch?.kinds)\n removeIds(kindEntries, o.remove?.kinds)\n const planEntries = mergeById<CityPlanInput>(DEFAULT_CITY_PLANS, o.packs?.plans)\n applyPatches(planEntries, o.patch?.plans)\n removeIds(planEntries, o.remove?.plans)\n\n const registry = <T extends { id: string }>(entries: Map<string, T>, label: string) => ({\n ids: (): string[] => [...entries.keys()],\n list: (): T[] => [...entries.values()],\n has: (id: string): boolean => entries.has(id),\n get(id: string): T {\n const entry = entries.get(id)\n if (!entry) throw new Error(`Unknown ${label} \"${id}\"`)\n return entry\n },\n })\n const kinds = registry(kindEntries, 'district kind')\n const rawPlans = registry(planEntries, 'city plan')\n\n /** A plan with `extends` followed to the end: every field present. */\n const resolvePlan = (plan: CityPlanInput, seen: readonly string[] = []): CityPlanDef => {\n if (seen.includes(plan.id)) throw new Error(`City plan \"${plan.id}\" extends itself (${[...seen, plan.id].join(' > ')})`)\n const parent = plan.extends ? resolvePlan(rawPlans.get(plan.extends), [...seen, plan.id]) : undefined\n const scale = plan.scale ?? parent?.scale\n const size = plan.size ?? parent?.size\n const planText = plan.text ?? parent?.text\n if (!scale || !size || !planText) throw new Error(`City plan \"${plan.id}\" has no ${!scale ? 'scale' : !size ? 'size' : 'text'}`)\n return {\n id: plan.id,\n scale,\n size,\n text: planText,\n extends: plan.extends,\n districts: mergeLists(parent?.districts ?? [], plan.districts ?? []),\n lines: mergeLists(parent?.lines ?? [], plan.lines ?? []),\n landmarks: [...(parent?.landmarks ?? []), ...(plan.landmarks ?? [])],\n }\n }\n const plans = {\n ...rawPlans,\n /** The plan with everything inherited from the plans it extends. */\n resolve: (id: string): CityPlanDef => resolvePlan(rawPlans.get(id)),\n }\n\n const layout = (planOrId: string | CityPlanInput, options: LayoutOptions = {}): CityLayout => {\n const plan = typeof planOrId === 'string' ? plans.resolve(planOrId) : resolvePlan(planOrId)\n const locale = options.locale ?? DEFAULT_LOCALE\n const cap = Math.max(0, options.maxFloors ?? maxFloors)\n const clamp = (n: number): number => Math.min(cap, Math.max(0, n))\n const districts: ResolvedDistrict[] = plan.districts.map((d) => {\n const kind = kinds.get(d.kind)\n const kindText = text(kind.text, locale)\n const [lo, hi] = d.floors ?? kind.floors\n return {\n id: d.id,\n kind: kind.id,\n rect: d.rect,\n name: named(d.name, locale) ?? kindText.name,\n description: kindText.description,\n color: kind.color,\n zone: kind.zone,\n pattern: kind.pattern,\n floors: [clamp(lo), clamp(hi)],\n uses: d.uses ?? kind.uses,\n block: kind.block,\n }\n })\n const inside = (d: ResolvedDistrict, x: number, z: number): boolean => x >= d.rect[0] && x <= d.rect[2] && z >= d.rect[1] && z <= d.rect[3]\n const districtAt = (x: number, z: number): ResolvedDistrict | undefined => {\n for (let i = districts.length - 1; i >= 0; i--) if (inside(districts[i] as ResolvedDistrict, x, z)) return districts[i]\n return undefined\n }\n const blocks = (districtId: string, bo: { street?: number } = {}): Block[] => {\n const d = districts.find((x) => x.id === districtId)\n if (!d) throw new Error(`City plan \"${plan.id}\" has no district \"${districtId}\"`)\n const street = bo.street ?? DEFAULT_STREET\n const cell = d.block\n const side = cell - street\n if (cell <= 0 || side <= 0) return []\n const [x0, z0, x1, z1] = d.rect\n const cols = Math.floor((x1 - x0) / cell)\n const rows = Math.floor((z1 - z0) / cell)\n const ox = x0 + (x1 - x0 - cols * cell) / 2\n const oz = z0 + (z1 - z0 - rows * cell) / 2\n const found: Block[] = []\n for (let i = 0; i < cols; i++) {\n for (let j = 0; j < rows; j++) {\n const x = ox + cell * (i + 0.5)\n const z = oz + cell * (j + 0.5)\n if (districtAt(x, z)?.id !== d.id) continue\n found.push({ x, z, size: [side, side], district: d.id, building: { floors: d.floors, uses: d.uses, zone: d.zone, pattern: d.pattern } })\n }\n }\n return found\n }\n const landmarks = plan.landmarks.map((l: PlanLandmark) => {\n const { name, ...rest } = l\n const label = named(name, locale)\n return label === undefined ? rest : { ...rest, name: label }\n })\n const planText = text(plan.text, locale)\n return { id: plan.id, scale: plan.scale, size: plan.size, name: planText.name, description: planText.description, districts, lines: [...plan.lines], landmarks, districtAt, blocks }\n }\n\n /** Area, share of the painted map and number of districts by kind; an inner district takes its area from the one under it. */\n const stats = (l: CityLayout): KindStats[] => {\n const xs = [...new Set(l.districts.flatMap((d) => [d.rect[0], d.rect[2]]))].sort((a, b) => a - b)\n const zs = [...new Set(l.districts.flatMap((d) => [d.rect[1], d.rect[3]]))].sort((a, b) => a - b)\n const area = new Map<string, number>()\n let total = 0\n for (let i = 0; i + 1 < xs.length; i++) {\n for (let j = 0; j + 1 < zs.length; j++) {\n const x0 = xs[i] as number\n const z0 = zs[j] as number\n const w = (xs[i + 1] as number) - x0\n const d = (zs[j + 1] as number) - z0\n // the centre of a cell is strictly inside or outside every rectangle, so the edges' rule does not matter\n const owner = l.districtAt(x0 + w / 2, z0 + d / 2)\n if (!owner) continue\n area.set(owner.kind, (area.get(owner.kind) ?? 0) + w * d)\n total += w * d\n }\n }\n const count = new Map<string, number>()\n for (const d of l.districts) count.set(d.kind, (count.get(d.kind) ?? 0) + 1)\n return [...count.keys()]\n .map((kind) => ({ kind, area: area.get(kind) ?? 0, share: total > 0 ? (area.get(kind) ?? 0) / total : 0, districts: count.get(kind) ?? 0 }))\n .sort((a, b) => b.area - a.area)\n }\n\n /**\n * Fills a block of a layout with city buildings through `block.fill`, passing the block's own `floors` and `uses` (and `storeyPresets` / `storeyHeight` when\n * given) so `block.fill` draws the heights, the use of each building and the towers. A ground-floor shop share comes from the commercial share unless\n * given. Nothing for blocks of a kind without storeys or without a pattern.\n */\n const fillBlock = (b: UrbanBuilder, block: Block, options: FillBlockCityOptions = {}): BlockBuilding[] => {\n const { floors, uses, pattern } = block.building\n if (floors[1] <= 0 || pattern === null) return []\n const { shop, ...rest } = options\n // `minHeight` / `maxHeight` are required by the signature but unused while `floors` is given; the residential preset's storey height keeps them sensible\n const storey = options.storeyHeight ?? o.presets.find((p) => p.id === DEFAULT_STOREY_PRESETS.residential)?.storeyHeight ?? (o.presets[0]?.storeyHeight as number)\n return o.fill(b, {\n cx: block.x,\n cz: block.z,\n size: Math.min(block.size[0], block.size[1]),\n minHeight: floors[0] * storey,\n maxHeight: floors[1] * storey,\n floors: [floors[0], floors[1]],\n uses,\n shop: shop ?? uses.commercial ?? 0,\n ...rest,\n })\n }\n\n return { maxFloors, kinds, plans, layout, stats, fillBlock }\n}\n\nexport type Cities = ReturnType<typeof createCities>\n","import type { DistrictKindDef } from './types'\n\n/** The district kinds of the city plans: colour on the map, zone of the floorplan packages, neighbourhood pattern, storeys, share of buildings by use and block size. */\nexport const DEFAULT_DISTRICT_KINDS: readonly DistrictKindDef[] = [\n { id: 'downtown', color: '#3b4f7a', zone: 'zt', pattern: 'financial_district', floors: [20, 60], uses: { commercial: 0.7, residential: 0.3 }, block: 90, text: { 'pt-BR': { name: 'Centro financeiro', description: 'Arranha-céus de escritório e torres residenciais, de 20 a 60 andares.' }, en: { name: 'Downtown core', description: 'Office and residential towers, 20 to 60 storeys.' } } },\n { id: 'commercial_center', color: '#5b6fa3', zone: 'zc', pattern: 'downtown', floors: [4, 15], uses: { commercial: 0.6, residential: 0.4 }, block: 70, text: { 'pt-BR': { name: 'Centro comercial', description: 'Loja no térreo e escritórios ou apartamentos em cima, de 4 a 15 andares.' }, en: { name: 'Commercial centre', description: 'Shops on the ground floor, offices or flats above, 4 to 15 storeys.' } } },\n { id: 'residential_high', color: '#7a68a6', zone: 'zt', pattern: 'downtown', floors: [8, 25], uses: { residential: 0.9, commercial: 0.1 }, block: 80, text: { 'pt-BR': { name: 'Bairro de prédios', description: 'Condomínios de prédios de 8 a 25 andares com área de lazer.' }, en: { name: 'High-rise residential', description: 'Apartment blocks, 8 to 25 storeys.' } } },\n { id: 'mixed', color: '#9c7fb8', zone: 'zr3_zm', pattern: 'downtown', floors: [2, 8], uses: { residential: 0.6, commercial: 0.4 }, block: 60, text: { 'pt-BR': { name: 'Uso misto', description: 'Sobrados, prédios baixos e comércio de rua, de 2 a 8 andares.' }, en: { name: 'Mixed use', description: 'Townhouses, low blocks and street shops, 2 to 8 storeys.' } } },\n { id: 'residential_mid', color: '#d9a35b', zone: 'zr2', pattern: 'suburb', floors: [1, 4], uses: { residential: 0.95, commercial: 0.05 }, block: 60, text: { 'pt-BR': { name: 'Residencial médio', description: 'Casas, sobrados e prédios pequenos de até 4 andares.' }, en: { name: 'Mid-density residential', description: 'Houses and small blocks up to 4 storeys.' } } },\n { id: 'residential_low', color: '#e8c477', zone: 'zr1', pattern: 'suburb', floors: [1, 2], uses: { residential: 1 }, block: 70, text: { 'pt-BR': { name: 'Residencial de casas', description: 'Casas térreas e sobrados com quintal e recuo.' }, en: { name: 'Low-density residential', description: 'Houses with yards and setbacks.' } } },\n { id: 'residential_gated', color: '#c9d27a', zone: 'zr_ap', pattern: 'suburb', floors: [1, 3], uses: { residential: 1 }, block: 110, text: { 'pt-BR': { name: 'Condomínio fechado', description: 'Casas grandes em lotes amplos, muro e portaria.' }, en: { name: 'Gated community', description: 'Large houses on big lots behind a wall and gate.' } } },\n { id: 'residential_popular', color: '#d97a5b', zone: 'zr2', pattern: 'working_class', floors: [1, 3], uses: { residential: 0.9, commercial: 0.1 }, block: 45, text: { 'pt-BR': { name: 'Bairro popular', description: 'Casas geminadas de laje, sem recuo, ruas estreitas.' }, en: { name: 'Working-class housing', description: 'Terraced self-built houses, narrow streets.' } } },\n { id: 'historic', color: '#b5835a', zone: 'zr3_zm', pattern: 'historic_street', floors: [1, 3], uses: { residential: 0.6, commercial: 0.4 }, block: 50, text: { 'pt-BR': { name: 'Centro histórico', description: 'Casario colonial colado, rua de pedra, igreja e praça.' }, en: { name: 'Historic quarter', description: 'Colonial row houses, cobbled streets, church and square.' } } },\n { id: 'institutional', color: '#5aa3a0', zone: 'zc', pattern: 'downtown', floors: [2, 8], uses: { institutional: 1 }, block: 120, text: { 'pt-BR': { name: 'Institucional', description: 'Hospital, escola, campus, prefeitura, delegacia e quartel de bombeiros.' }, en: { name: 'Institutional', description: 'Hospital, schools, campus, city hall, police and fire stations.' } } },\n { id: 'industrial', color: '#7d7d74', zone: 'zi', pattern: 'industrial_port', floors: [1, 1], uses: { industrial: 1 }, block: 140, text: { 'pt-BR': { name: 'Distrito industrial', description: 'Galpões de 8 a 12 m, pátios e chaminés.' }, en: { name: 'Industrial district', description: 'Sheds 8 to 12 m tall, yards and stacks.' } } },\n { id: 'logistics', color: '#96968a', zone: 'zi', pattern: 'industrial_port', floors: [1, 1], uses: { industrial: 0.8, commercial: 0.2 }, block: 160, text: { 'pt-BR': { name: 'Distrito logístico', description: 'Centros de distribuição, posto de caminhoneiro, pátio de carretas.' }, en: { name: 'Logistics', description: 'Distribution centres, truck stop, trailer yards.' } } },\n { id: 'port', color: '#5f7f8f', zone: 'zi', pattern: 'industrial_port', floors: [1, 1], uses: { industrial: 1 }, block: 150, text: { 'pt-BR': { name: 'Porto', description: 'Cais, guindastes, contêineres empilhados e armazéns.' }, en: { name: 'Port', description: 'Quays, cranes, stacked containers and warehouses.' } } },\n { id: 'rail_yard', color: '#6e6158', zone: 'zi', pattern: 'railway_village', floors: [1, 1], uses: { industrial: 1 }, block: 150, text: { 'pt-BR': { name: 'Pátio ferroviário', description: 'Linhas, rotunda, oficina e vagões parados.' }, en: { name: 'Rail yard', description: 'Tracks, roundhouse, workshop and parked wagons.' } } },\n { id: 'company_housing', color: '#cfae86', zone: 'zr1', pattern: 'railway_village', floors: [1, 1], uses: { residential: 1 }, block: 50, text: { 'pt-BR': { name: 'Vila operária', description: 'Casas iguais em fila, da ferrovia ou da fábrica.' }, en: { name: 'Company housing', description: 'Identical row houses of the railway or the mill.' } } },\n { id: 'hillside_resort', color: '#a3b58a', zone: 'zr1', pattern: 'mountain_resort', floors: [1, 2], uses: { residential: 0.7, commercial: 0.3 }, block: 60, text: { 'pt-BR': { name: 'Serra e pousadas', description: 'Chalés e pousadas na encosta, ruas em curva.' }, en: { name: 'Hillside resort', description: 'Chalets and inns on the slope.' } } },\n { id: 'stilt', color: '#7fa3b5', zone: 'zr1', pattern: 'stilt_village', floors: [1, 1], uses: { residential: 1 }, block: 40, text: { 'pt-BR': { name: 'Palafitas', description: 'Casas sobre estacas na beira da água, trapiches.' }, en: { name: 'Stilt village', description: 'Houses on stilts by the water, jetties.' } } },\n { id: 'park', color: '#6f9a5e', zone: null, pattern: null, floors: [0, 0], uses: { }, block: 0, text: { 'pt-BR': { name: 'Parque e praça', description: 'Área verde, praça, campo de futebol.' }, en: { name: 'Park', description: 'Green space, square, football pitch.' } } },\n { id: 'rural', color: '#a7b86d', zone: 'za', pattern: 'rural', floors: [1, 2], uses: { residential: 0.8, agricultural: 0.2 }, block: 250, text: { 'pt-BR': { name: 'Chácaras e sítios', description: 'Sítios com casa sede, horta e pomar.' }, en: { name: 'Smallholdings', description: 'Smallholdings with a farmhouse, garden and orchard.' } } },\n { id: 'farmland', color: '#c8c67e', zone: 'za', pattern: 'rural', floors: [0, 1], uses: { agricultural: 1 }, block: 400, text: { 'pt-BR': { name: 'Lavoura', description: 'Plantação, silos e estradas de terra.' }, en: { name: 'Farmland', description: 'Crops, silos and dirt roads.' } } },\n { id: 'airfield', color: '#b8b8a8', zone: 'za', pattern: 'rural', floors: [1, 1], uses: { industrial: 1 }, block: 300, text: { 'pt-BR': { name: 'Aeródromo', description: 'Pista, hangares e torre.' }, en: { name: 'Airfield', description: 'Runway, hangars and tower.' } } },\n { id: 'wild', color: '#4f7a4a', zone: null, pattern: null, floors: [0, 0], uses: { }, block: 0, text: { 'pt-BR': { name: 'Mata e morro', description: 'Mata, morro, área sem construção.' }, en: { name: 'Woods and hills', description: 'Woods and hills, unbuilt.' } } },\n]\n","import type { CityPlanDef } from './types'\n\n/** The six city plans (metropolis, regional city, port city, rail town, country town, mountain village). Districts are listed from the outer to the inner one. */\nexport const DEFAULT_CITY_PLANS: readonly CityPlanDef[] = [\n {\n id: 'metropolis',\n scale: 'metropolis',\n size: [6000, 6000],\n text: { 'pt-BR': { name: 'Metrópole', description: 'Centro financeiro de arranha-céus cercado de comércio, bairros de prédios, casas, periferia e indústria na ferrovia.' }, en: { name: 'Metropolis', description: 'Tower downtown ringed by commerce, high-rise and low-rise neighbourhoods, outskirts and industry on the railway.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-3000, -3000, 3000, 3000] },\n { id: 'suburbs_w', kind: 'residential_low', rect: [-2600, -2600, -600, 2600] },\n { id: 'suburbs_e', kind: 'residential_mid', rect: [600, -2600, 2600, 1000] },\n { id: 'periphery', kind: 'residential_popular', rect: [-3000, 1200, -800, 3000] },\n { id: 'gated', kind: 'residential_gated', rect: [1400, -3000, 3000, -1800] },\n { id: 'industry', kind: 'industrial', rect: [600, 1600, 3000, 3000] },\n { id: 'logistics', kind: 'logistics', rect: [2200, 400, 3000, 1600] },\n { id: 'mixed', kind: 'mixed', rect: [-1600, -1600, 1600, 1400] },\n { id: 'high', kind: 'residential_high', rect: [-1400, -1500, -300, -300] },\n { id: 'high2', kind: 'residential_high', rect: [300, -1500, 1400, -600] },\n { id: 'center', kind: 'commercial_center', rect: [-900, -700, 1100, 800] },\n { id: 'downtown', kind: 'downtown', rect: [-400, -400, 600, 400] },\n { id: 'hospital', kind: 'institutional', rect: [-1600, 500, -1000, 1100] },\n { id: 'campus', kind: 'institutional', rect: [1300, -500, 2000, 300] },\n { id: 'park', kind: 'park', rect: [-300, 500, 500, 1100] },\n { id: 'hills', kind: 'wild', rect: [-3000, -3000, -1800, -1800] },\n ],\n lines: [\n { id: 'ring', kind: 'avenue', width: 30, points: [[-1700, -1700], [1700, -1700], [1700, 1500], [-1700, 1500], [-1700, -1700]] },\n { id: 'main_ns', kind: 'avenue', width: 30, points: [[100, -3000], [100, 3000]] },\n { id: 'main_ew', kind: 'avenue', width: 30, points: [[-3000, 0], [3000, 0]] },\n { id: 'rail', kind: 'rail', width: 12, points: [[-3000, 1500], [0, 1500], [3000, 1300]] },\n { id: 'highway', kind: 'highway', width: 24, points: [[-3000, -2200], [3000, -2400]] },\n ],\n landmarks: [\n { kind: 'station', at: [0, 1500] },\n { kind: 'hospital', at: [-1300, 800] },\n { kind: 'stadium', at: [1700, -100] },\n { kind: 'cathedral', at: [100, 100] },\n { kind: 'mall', at: [800, 600] },\n { kind: 'police', at: [300, -300] },\n { kind: 'fire', at: [-500, 600] },\n { kind: 'gas_station', at: [2400, -2300] },\n ],\n },\n {\n id: 'regional_city',\n scale: 'city',\n size: [4000, 4000],\n text: { 'pt-BR': { name: 'Cidade média', description: 'Centro comercial com poucos prédios altos, bairros de casas e um distrito industrial.' }, en: { name: 'Regional city', description: 'Commercial centre with a few tall buildings, house neighbourhoods and an industrial district.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-2000, -2000, 2000, 2000] },\n { id: 'res_w', kind: 'residential_low', rect: [-1800, -1600, -300, 1600] },\n { id: 'res_e', kind: 'residential_mid', rect: [300, -1600, 1800, 600] },\n { id: 'popular', kind: 'residential_popular', rect: [-1800, 800, -500, 1800] },\n { id: 'industry', kind: 'industrial', rect: [500, 900, 2000, 2000] },\n { id: 'mixed', kind: 'mixed', rect: [-800, -800, 900, 700] },\n { id: 'center', kind: 'commercial_center', rect: [-400, -400, 500, 350] },\n { id: 'square', kind: 'park', rect: [-100, -100, 150, 100] },\n { id: 'hospital', kind: 'institutional', rect: [600, -900, 1000, -500] },\n ],\n lines: [\n { id: 'main_ns', kind: 'avenue', width: 24, points: [[0, -2000], [0, 2000]] },\n { id: 'main_ew', kind: 'avenue', width: 24, points: [[-2000, 0], [2000, 0]] },\n { id: 'highway', kind: 'highway', width: 24, points: [[-2000, 1600], [2000, 1500]] },\n ],\n landmarks: [\n { kind: 'church', at: [0, 0] },\n { kind: 'hospital', at: [800, -700] },\n { kind: 'school', at: [-600, 300] },\n { kind: 'police', at: [200, -200] },\n { kind: 'market', at: [300, 200] },\n { kind: 'gas_station', at: [1500, 1550] },\n ],\n },\n {\n id: 'port_city',\n scale: 'city',\n size: [4000, 3000],\n text: { 'pt-BR': { name: 'Cidade portuária', description: 'Cais e armazéns na margem, centro histórico atrás do porto e bairros subindo o morro.' }, en: { name: 'Port city', description: 'Quays and warehouses on the shore, old town behind the port and neighbourhoods up the hill.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-2000, -1500, 2000, 1500] },\n { id: 'hill', kind: 'residential_low', rect: [500, -1500, 2000, -200] },\n { id: 'res', kind: 'residential_mid', rect: [-300, -500, 1300, 900] },\n { id: 'industry', kind: 'industrial', rect: [800, 500, 2000, 1500] },\n { id: 'port', kind: 'port', rect: [-2000, -1300, -900, 1100] },\n { id: 'old_town', kind: 'historic', rect: [-900, -800, 200, 400] },\n { id: 'center', kind: 'commercial_center', rect: [-500, -400, 200, 100] },\n { id: 'stilts', kind: 'stilt', rect: [-2000, 1000, -1200, 1500] },\n ],\n lines: [\n { id: 'shore', kind: 'river', width: 60, points: [[-2000, -1500], [-1950, 0], [-1900, 1500]] },\n { id: 'main', kind: 'avenue', width: 20, points: [[-900, 0], [2000, 0]] },\n { id: 'rail', kind: 'rail', width: 12, points: [[-1200, -1500], [-1000, -400]] },\n ],\n landmarks: [\n { kind: 'harbour_office', at: [-1200, 0] },\n { kind: 'church', at: [-300, -200] },\n { kind: 'market', at: [-600, 200] },\n { kind: 'lighthouse', at: [1600, -1300] },\n { kind: 'hospital', at: [700, 200] },\n ],\n },\n {\n id: 'rail_town',\n scale: 'town',\n size: [3000, 3000],\n text: { 'pt-BR': { name: 'Cidade ferroviária', description: 'Cidade que cresceu em volta da estação: pátio, centro velho, vila da companhia.' }, en: { name: 'Rail town', description: 'A town grown around its station: rail yard, old centre, company village.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-1500, -1500, 1500, 1500] },\n { id: 'res', kind: 'residential_low', rect: [500, 500, 1500, 1500] },\n { id: 'logistics', kind: 'logistics', rect: [500, -700, 1500, 500] },\n { id: 'popular', kind: 'residential_popular', rect: [-1500, 600, -300, 1500] },\n { id: 'company', kind: 'company_housing', rect: [-1500, -800, -700, 500] },\n { id: 'yard', kind: 'rail_yard', rect: [-700, 0, 500, 500] },\n { id: 'old_center', kind: 'historic', rect: [-500, -700, 500, 0] },\n ],\n lines: [\n { id: 'rail', kind: 'rail', width: 12, points: [[-1500, 250], [1500, 250]] },\n { id: 'highway', kind: 'highway', width: 24, points: [[-1500, -100], [1500, -200]] },\n ],\n landmarks: [\n { kind: 'station', at: [0, 100] },\n { kind: 'church', at: [0, -400] },\n { kind: 'gas_station', at: [1000, -150] },\n ],\n },\n {\n id: 'country_town',\n scale: 'town',\n size: [2400, 2400],\n text: { 'pt-BR': { name: 'Cidade do interior', description: 'Praça da matriz no meio, comércio térreo em volta, casas, cooperativa e sítios em volta.' }, en: { name: 'Country town', description: 'Main square with the church, ground-floor shops around, houses, a co-op and smallholdings.' } },\n districts: [\n { id: 'farms', kind: 'farmland', rect: [-1200, -1200, 1200, 1200] },\n { id: 'chacaras', kind: 'rural', rect: [-900, -900, 900, 900] },\n { id: 'houses', kind: 'residential_low', rect: [-600, -600, 600, 500] },\n { id: 'company', kind: 'company_housing', rect: [-700, 350, -250, 700] },\n { id: 'coop', kind: 'farmland', rect: [350, 500, 900, 900], floors: [1, 1], uses: { agricultural: 0.5, industrial: 0.5 } },\n { id: 'center', kind: 'historic', rect: [-250, -250, 250, 250] },\n { id: 'square', kind: 'park', rect: [-60, -60, 60, 60] },\n ],\n lines: [\n { id: 'main', kind: 'street', width: 12, points: [[-1200, 0], [1200, 0]] },\n { id: 'road', kind: 'street', width: 8, points: [[0, -1200], [0, 1200]] },\n ],\n landmarks: [\n { kind: 'church', at: [0, -70] },\n { kind: 'market', at: [120, 80] },\n { kind: 'school', at: [-300, -200] },\n { kind: 'gas_station', at: [700, 0] },\n { kind: 'silo', at: [600, 700] },\n ],\n },\n {\n id: 'mountain_village',\n scale: 'village',\n size: [1600, 1200],\n text: { 'pt-BR': { name: 'Vila serrana', description: 'Largo da igreja, rua das pousadas subindo a serra e chalés espalhados na encosta.' }, en: { name: 'Mountain village', description: 'Church square, a street of inns up the slope and chalets scattered on the hill.' } },\n districts: [\n { id: 'wild', kind: 'wild', rect: [-800, -600, 800, 600] },\n { id: 'slope', kind: 'rural', rect: [-700, -500, 700, 500] },\n { id: 'resort', kind: 'hillside_resort', rect: [-400, -450, 500, 0] },\n { id: 'square', kind: 'historic', rect: [-250, 0, 250, 300] },\n { id: 'station', kind: 'rail_yard', rect: [300, 150, 700, 450] },\n ],\n lines: [\n { id: 'road', kind: 'street', width: 7, points: [[-800, 200], [0, 150], [800, 300]] },\n ],\n landmarks: [\n { kind: 'church', at: [0, 150] },\n { kind: 'inn', at: [100, -200] },\n { kind: 'station', at: [500, 300] },\n ],\n },\n]\n","import type { Point, Rect } from './types'\n\nexport const clamp = (v: number, a: number, b: number): number => (v < a ? a : v > b ? b : v)\nexport const lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n/** Smoothstep between `a` and `b`; with `a > b` it falls instead of rising. */\nexport const smoothstep = (a: number, b: number, x: number): number => {\n const t = clamp((x - a) / (b - a), 0, 1)\n return t * t * (3 - 2 * t)\n}\n/** The team's cheap hash of two numbers into [0, 1). */\nexport const hash2 = (a: number, b: number): number => {\n const n = Math.sin(a * 127.1 + b * 311.7) * 43758.5453\n return n - Math.floor(n)\n}\n/** Distance from a point to the nearest segment of a polyline. */\nexport function distanceToPolyline(px: number, py: number, points: readonly Point[]): number {\n let best = 1e9\n for (let index = 0; index < points.length - 1; index++) {\n const [ax, ay] = points[index] as Point\n const [bx, by] = points[index + 1] as Point\n const dx = bx - ax\n const dy = by - ay\n const t = clamp(((px - ax) * dx + (py - ay) * dy) / (dx * dx + dy * dy), 0, 1)\n const d = Math.hypot(px - ax - t * dx, py - ay - t * dy)\n if (d < best) best = d\n }\n return best\n}\n/** Inside the rectangle grown by `margin` on every side. */\nexport const insideRect = (px: number, py: number, r: Rect, margin: number): boolean => px > r[0] - margin && px < r[2] + margin && py > r[1] - margin && py < r[3] + margin\n/** Inside an ellipse given by its centre and radii. */\nexport const insideEllipse = (px: number, py: number, center: Point, radius: Point): boolean => Math.hypot((px - center[0]) / radius[0], (py - center[1]) / radius[1]) < 1\n","import type { UrbanBuilder } from '../scene'\nimport { distanceToPolyline, hash2, insideEllipse, insideRect, lerp, smoothstep } from './math'\nimport type { ColorRule, Ramp, TerrainGrid, TerrainOptions, Wave } from './types'\n\nconst TRIG = { sin: Math.sin, cos: Math.cos }\n\nfunction wave(w: Wave, px: number, py: number): number {\n return w.kind === 'product' ? TRIG[w.x[0]](px * w.x[1]) * TRIG[w.y[0]](py * w.y[1]) * w.amplitude : Math.sin(px * w.kx + py * w.ky) * w.amplitude\n}\n\nfunction ramp(r: Ramp, px: number, py: number): number {\n const v = r.axis === 'x' ? px : py\n return r.fullUntil !== undefined && v < r.fullUntil ? 1 : smoothstep(r.from, r.to, v)\n}\n\nfunction mask(ramps: readonly Ramp[], px: number, py: number): number {\n let m = 1\n for (const r of ramps) m *= ramp(r, px, py)\n return m\n}\n\nconst sum = (start: number, waves: readonly Wave[], px: number, py: number): number => {\n let total = start\n for (const w of waves) total += wave(w, px, py)\n return total\n}\n\n/**\n * A ground made of layers, as the team's Vale: a rolling base, masked relief (mountains, hills), cities levelled flat, rivers and lakes carved in,\n * a forest density, and a colour for every point. It answers questions about a point of the map and hands a drawer the grid of a square mesh.\n */\nexport function createTerrain(options: TerrainOptions) {\n const { world } = options\n const toWorld = (px: number, py: number): [number, number] => [px * world.scale + world.origin, py * world.scale + world.origin]\n const fromWorld = (x: number, z: number): [number, number] => [(x - world.origin) / world.scale, (z - world.origin) / world.scale]\n\n function heightAt(px: number, py: number): number {\n let h = sum(options.base.level, options.base.waves, px, py)\n for (const layer of options.layers) h += mask(layer.mask, px, py) * sum(layer.level, layer.waves, px, py)\n for (const f of options.flatten) {\n if (!insideRect(px, py, f.rect, f.margin)) continue\n const inside = Math.min(smoothstep(f.edge[0], f.edge[1], Math.min(px - f.rect[0], f.rect[2] - px, py - f.rect[1], f.rect[3] - py)), 1)\n h = lerp(h, f.level, inside)\n }\n const land = h\n for (const river of options.rivers) {\n const bed = 'fixed' in river.bed ? river.bed.fixed : Math.max(river.bed.floor, land - river.bed.below)\n h = lerp(bed, h, smoothstep(river.width[0], river.width[1], distanceToPolyline(px, py, river.points)))\n }\n for (const lake of options.lakes) {\n const d = Math.hypot((px - lake.center[0]) / lake.radius[0], (py - lake.center[1]) / lake.radius[1])\n if (d < lake.reach) h = lerp(lake.level, h, smoothstep(lake.edge[0], lake.edge[1], d))\n }\n return options.custom ? options.custom(px, py, h) : h\n }\n\n function forestAt(px: number, py: number): number {\n let density = 0\n for (const zone of options.forest.zones) density = Math.max(density, mask(zone.mask, px, py))\n const patch = options.forest.patch\n if (patch) density = Math.max(density, smoothstep(patch.edge[0], patch.edge[1], sum(0, patch.waves, px, py) * 0.5 + 0.5) * patch.weight)\n return density\n }\n\n const nearRiver = (px: number, py: number, margin: number): boolean => options.rivers.some((river) => distanceToPolyline(px, py, river.points) < margin)\n\n function matches(rule: ColorRule, px: number, py: number, h: number, forest: number): boolean {\n switch (rule.kind) {\n case 'below':\n return h < rule.height\n case 'above':\n return h > rule.height\n case 'ellipse':\n return insideEllipse(px, py, rule.center, rule.radius)\n case 'rects':\n return rule.rects.some((r) => insideRect(px, py, r, rule.margin))\n case 'forest':\n return forest > rule.above\n }\n }\n\n /** Colour of a point as 0xRRGGBB; `h` is the height there, which the grid already has. */\n function colorAt(px: number, py: number, h: number = heightAt(px, py)): number {\n const forest = forestAt(px, py)\n for (const rule of options.colors) if (matches(rule, px, py, h, forest)) return rule.color\n const { colors, cell } = options.fields\n return colors[Math.floor(hash2(Math.floor(px / cell[0]), Math.floor(py / cell[1])) * colors.length)] as number\n }\n\n /**\n * The vertices of the square mesh, the way a plane of `size` metres with `segments` cells a side lays them out (rows along z, the\n * coordinates rounded to 32 bits) with the height and the colour of each.\n */\n function grid(segments: number = world.segments): TerrainGrid {\n const count = (segments + 1) * (segments + 1)\n const x = new Float32Array(count)\n const z = new Float32Array(count)\n const heights = new Float32Array(count)\n const colors = new Uint32Array(count)\n const half = world.size / 2\n const step = world.size / segments\n for (let iy = 0; iy <= segments; iy++) {\n for (let ix = 0; ix <= segments; ix++) {\n const i = iy * (segments + 1) + ix\n x[i] = ix * step - half\n z[i] = iy * step - half\n const [px, py] = fromWorld(x[i] as number, z[i] as number)\n const h = heightAt(px, py)\n heights[i] = h\n colors[i] = colorAt(px, py, h)\n }\n }\n return { segments, size: world.size, x, z, heights, colors }\n }\n\n return { options, toWorld, fromWorld, heightAt, forestAt, nearRiver, colorAt, grid }\n}\n\nexport type Terrain = ReturnType<typeof createTerrain>\n\n/** Puts the ground and its water under it into a builder: the terrain mesh first, then the water plane, as the page's `buildWorld`. */\nexport function drawTerrain(b: UrbanBuilder, terrain: Terrain, segments?: number): void {\n b.terrain(terrain.grid(segments))\n const { water, world } = terrain.options\n b.plane(0, water.level, 0, world.size, world.size, water.color, { roughness: water.roughness, metalness: water.metalness })\n}\n","import { cars, pickups, suvs, vans } from '@adatechnology/game-vehicles-fleet'\nimport { pickForContext, regions } from '@adatechnology/game-vegetation-species'\nimport type { Region } from '@adatechnology/game-vegetation-species'\n\nimport type { PlantProvider, PlantRequest, VehicleProvider, VehicleRequest } from './types'\n\n/** The vehicles of the fleet that park on a street: cars, SUVs, pickups and vans. */\nexport const PARKED_VEHICLE_IDS: readonly string[] = [...cars, ...suvs, ...pickups.filter((id) => id !== 'monster_truck'), ...vans]\n\nexport type VehicleProviderOptions = {\n /** Ids of the fleet to choose from. Default `PARKED_VEHICLE_IDS`. */\n ids?: readonly string[]\n /** Replaces the choice: the id for a request. The default picks by the spot, so the same pattern parks the same cars every time. */\n pick?: (request: VehicleRequest, ids: readonly string[]) => string\n /** Paint of the car. Default the colour the pattern asks for. */\n paint?: (request: VehicleRequest) => number | undefined\n}\n\nconst hashSpot = (x: number, z: number, ry: number): number => {\n let h = 2166136261\n for (const value of [Math.round(x * 100), Math.round(z * 100), Math.round(ry * 100)]) {\n h ^= value & 0xffff\n h = Math.imul(h, 16777619)\n h ^= (value >> 16) & 0xffff\n h = Math.imul(h, 16777619)\n }\n return h >>> 0\n}\n\n/**\n * A vehicle provider that asks the drawer for a vehicle of the fleet where the pattern parks one. It chooses by the spot and not\n * by the scene's random, so the scene's draw order (and the golden of the Galeria, which parks nothing) does not move.\n */\nexport function createVehicleProvider(options: VehicleProviderOptions = {}): VehicleProvider {\n const ids = options.ids ?? PARKED_VEHICLE_IDS\n if (ids.length === 0) throw new Error('The vehicle provider needs at least one vehicle id')\n return (request, b) => {\n const id = options.pick ? options.pick(request, ids) : (ids[hashSpot(request.x, request.z, request.ry) % ids.length] as string)\n const color = options.paint ? options.paint(request) : request.color\n b.place('vehicle', id, request.x, request.z, { ry: request.ry, ...(color === undefined ? {} : { color }), seed: `${id}:${request.x}:${request.z}` })\n }\n}\n\nexport type PlantProviderOptions = {\n /** Planting table of a region. Default Brazil's. */\n region?: Region\n /** Context of the table for each kind the patterns plant. */\n contexts?: Partial<Record<PlantRequest['kind'], string>>\n /** Seed of the choice; the spot is added so each place gets its own species. */\n seed?: number | string\n /** Replaces the choice: the species id for a request. */\n pick?: (request: PlantRequest, context: string, seed: string) => string\n}\n\nexport const DEFAULT_PLANT_CONTEXTS: Readonly<Record<PlantRequest['kind'], string>> = { tree: 'sidewalk_tree', pine: 'square' }\n\n/** A plant provider that asks the drawer for a species of the pack, drawn from the region's table for the kind (a tree on the sidewalk, a pine in the square). */\nexport function createPlantProvider(options: PlantProviderOptions = {}): PlantProvider {\n const region = options.region ?? regions.br\n const contexts = { ...DEFAULT_PLANT_CONTEXTS, ...options.contexts }\n const seed = options.seed ?? 1\n return (request, b) => {\n const context = contexts[request.kind]\n const key = `${seed}:${request.kind}:${request.x}:${request.z}`\n const id = options.pick ? options.pick(request, context, key) : pickForContext(region, context, key)\n b.place('plant', id, request.x, request.z, { scale: request.scale, seed: key })\n }\n}\n","import type { DowntownParams } from './composers'\nimport type { NeighbourhoodPattern } from './types'\n\n/**\n * The financial district: the avenue of the downtown pattern with lots wide enough for a tower (20 m) and heights from 70 to 180 m. A pack for a game\n * to add (`createUrban({ packs: { neighbourhoods: TOWER_PATTERNS }, towers: true })`); with `towers` off the same numbers draw tall boxes. It is not\n * in `DEFAULT_PATTERNS`, so the Galeria's sample sheet is the one of the page.\n */\nconst financialDistrict: NeighbourhoodPattern<DowntownParams> = {\n id: 'financial_district',\n streetWidth: 16,\n walkWidth: 4,\n typologies: ['office_tower', 'residential_tower'],\n pole: 'led_double',\n lightColor: 0xdfe8ff,\n spacing: 25,\n lit: 1,\n compose: 'downtown',\n marker: { height: 40 },\n text: {\n 'pt-BR': { label: 'Distrito financeiro', title: 'DISTRITO FINANCEIRO', caption: 'avenida 2 × 8 m · torres de 70 a 180 m', detail: 'Torres de escritórios e residenciais de 70 a 180 m. Poste metálico duplo, LED branco.' },\n en: { label: 'Financial district', title: 'FINANCIAL DISTRICT', caption: 'avenue 2 × 8 m · towers of 70 to 180 m', detail: 'Office and residential towers of 70 to 180 m. Double steel pole, white LED.' },\n },\n params: {\n roadLength: 110,\n roadColor: 0x222428,\n median: { width: 1.6, height: 0.18, color: 0x3a4a2c },\n poles: { from: -50, to: 50 },\n buildings: { perRow: 4, first: -39, pitch: 26, rowOffset: 24, size: 20, north: { minHeight: 90, range: 90, lit: 0.12 }, south: { minHeight: 70, range: 80, lit: 0.1 } },\n walks: { offset: 14, length: 110 },\n car: { dx: -8, dz: -3, ry: 1.57, color: 0x6b6450 },\n },\n}\n\n/** The patterns of the tower pack. */\nexport const TOWER_PATTERNS: readonly NeighbourhoodPattern<any>[] = [financialDistrict]\n\n/** Where the sample sheet puts them (pass it as `cells`). */\nexport const TOWER_SAMPLE_CELLS: Readonly<Record<string, { x: number; z: number }>> = { financial_district: { x: 160, z: 56 } }\n"],"mappings":";AAGO,SAAS,kBAAkB,OAA4B;AAC5D,QAAM,SAAsB;AAAA,IAC1B,MAAM;AAAA,IACN,OAAO;AACL,aAAO,OAAO,SAAS;AAAA,IACzB;AAAA,EACF;AACA,SAAO;AACT;;;ACXA,SAAS,iBAAiB;AAM1B,IAAM,OAAO;AACb,IAAM,4BAA4B;AAClC,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAcpB,SAAS,mBAAmB,QAAsB,UAA+B,CAAC,GAAG;AAC1F,QAAM,QAAqB,CAAC;AAC5B,QAAM,QAAmB,CAAC;AAC1B,QAAM,UAAiC,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,EAAE;AAC3D,QAAM,SAAS,QAAQ,UAAU,kBAAkB,OAAO,iBAAiB;AAC3E,QAAM,OAAO,CAAS,SAAoC,KAAK,KAAK,MAAM,OAAO,IAAI,KAAK,MAAM,CAAC;AAEjG,QAAM,QAAQ,CAAC,GAAW,GAAW,GAAW,KAAK,GAAG,SAAS,SAAiB,MAAM,KAAK,EAAE,OAAO,SAAS,QAAQ,GAAG,GAAG,GAAG,GAAG,CAAC,IAAI;AACxI,QAAM,MAAM,CAAC,GAAW,GAAW,GAAW,OAAe,QAAgB,OAAe,OAAe,IAAgB,CAAC,MAAY;AACtI,UAAM,OAAkB,EAAE,OAAO,OAAO,QAAQ,EAAE,UAAU,MAAM,GAAG,GAAG,IAAI,SAAS,GAAG,GAAG,OAAO,QAAQ,OAAO,OAAO,UAAU,EAAE,Y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AAa;AAAA,EACb,WAAW;AAAA,EACX,YAAY,CAAC,gBAAgB,mBAAmB;AAAA,EAChD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,KAAK;AAAA,EACL,SAAS;AAAA,EACT,QAAQ,EAAE,QAAQ,GAAG;AAAA,EACrB,MAAM;AAAA,IACJ,SAAS,EAAE,OAAO,uBAAuB,OAAO,uBAAuB,SAAS,gDAA0C,QAAQ,8FAAwF;AAAA,IAC1N,IAAI,EAAE,OAAO,sBAAsB,OAAO,sBAAsB,SAAS,gDAA0C,QAAQ,8EAA8E;AAAA,EAC3M;AAAA,EACA,QAAQ;AAAA,IACN,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ,EAAE,OAAO,KAAK,QAAQ,MAAM,OAAO,QAAS;AAAA,IACpD,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG;AAAA,IAC3B,WAAW,EAAE,QAAQ,GAAG,OAAO,KAAK,OAAO,IAAI,WAAW,IAAI,MAAM,IAAI,OAAO,EAAE,WAAW,IAAI,OAAO,IAAI,KAAK,KAAK,GAAG,OAAO,EAAE,WAAW,IAAI,OAAO,IAAI,KAAK,IAAI,EAAE;AAAA,IACtK,OAAO,EAAE,QAAQ,IAAI,QAAQ,IAAI;AAAA,IACjC,KAAK,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,OAAO,QAAS;AAAA,EACnD;AACF;AAGO,IAAM,iBAAuD,CAAC,iBAAiB;AAG/E,IAAM,qBAAyE,EAAE,oBAAoB,EAAE,GAAG,KAAK,GAAG,GAAG,EAAE;","names":["sum","sum","applyPatches","mergeById","removeIds","text","DEFAULT_LOCALE","DEFAULT_STOREY_PRESETS","clamp","fillBlock","lerp","lerp","colors","mergeById","applyPatches","removeIds"]}
1
+ {"version":3,"sources":["../src/budget.ts","../src/scene.ts","../src/poles.ts","../src/streets.ts","../src/block.ts","../src/tower.ts","../src/props.ts","../src/kit.ts","../src/neighbourhoods/houses.ts","../src/neighbourhoods/compose.ts","../src/neighbourhoods/composers.ts","../src/neighbourhoods/patterns.ts","../src/cities/cities.ts","../src/cities/kinds.ts","../src/cities/templates.ts","../src/terrain/math.ts","../src/terrain/terrain.ts","../src/neighbourhoods/providers.ts","../src/neighbourhoods/towers.ts"],"sourcesContent":["import type { LightAllowance } from './types'\n\n/** The team's counter: `take()` is `left-- > 0`, so the count keeps falling after the allowance is spent. */\nexport function createLightAllowance(count: number): LightAllowance {\n const allowance: LightAllowance = {\n left: count,\n take() {\n return allowance.left-- > 0\n },\n }\n return allowance\n}\n\n/** @deprecated Renamed `createLightAllowance`: `LightBudget` is the name of the render budget of `@adatechnology/game-render-three`. Removed in the next major. */\nexport const createLightBudget = createLightAllowance\n","import { boxRadius } from '@adatechnology/game-floorplan'\n\nimport { createLightAllowance } from './budget'\nimport type { TerrainGrid } from './terrain/types'\nimport type { ItemBox, LightAllowance, LightPart, PartStyle, PlacementPart, RandomSource, Silhouette, UrbanPart, UrbanScene } from './types'\n\nconst ROOT = -1\nconst DEFAULT_CYLINDER_SEGMENTS = 14\nconst DEFAULT_CONE_SEGMENTS = 6\nconst DEFAULT_FENCE_WIRE = 0x8a8c8e\nconst DEFAULT_FENCE_POST = 0x6a6c6e\nconst DEFAULT_LABEL_FONT = '700 56px \"Arial Narrow\", Arial, sans-serif'\n\ntype BoxOptions = { parent?: number; ry?: number; rz?: number; emissive?: boolean; style?: PartStyle }\n\nexport type UrbanBuilderOptions = {\n /** Lights the scene may spend; omitted means no limit. */\n budget?: LightAllowance\n}\n\n/**\n * Collects the parts of an urban scene the way the team's page adds them to its root: every helper appends in call order, so a\n * scene drawn with the same seeded random has the same parts, the same instances and the same windows.\n * Heights follow the page: `y` is the base of a box, a cylinder, a cone and a prism, and the centre of a crown.\n */\nexport function createUrbanBuilder(random: RandomSource, options: UrbanBuilderOptions = {}) {\n const parts: UrbanPart[] = []\n const items: ItemBox[] = []\n const windows: UrbanScene['windows'] = { lit: [], dark: [] }\n const lights = options.budget ?? createLightAllowance(Number.POSITIVE_INFINITY)\n const pick = <TEntry>(list: readonly TEntry[]): TEntry => list[Math.floor(random() * list.length)] as TEntry\n\n const group = (x: number, y: number, z: number, ry = 0, parent = ROOT): number => parts.push({ shape: 'group', parent, x, y, z, ry }) - 1\n const box = (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, o: BoxOptions = {}): void => {\n const part: UrbanPart = { shape: 'box', parent: o.parent ?? ROOT, x, y: y + height / 2, z, width, height, depth, color, emissive: o.emissive ?? false, ry: o.ry ?? 0, rz: o.rz ?? 0, radius: boxRadius(width, height, depth) }\n if (o.style) part.style = o.style\n parts.push(part)\n }\n const cylinder = (x: number, y: number, z: number, radiusTop: number, radiusBottom: number, height: number, color: number, parent = ROOT, segments = DEFAULT_CYLINDER_SEGMENTS, style?: PartStyle): void => {\n const part: UrbanPart = { shape: 'cylinder', parent, x, y: y + height / 2, z, radiusTop, radiusBottom, height, color, segments }\n if (style) part.style = style\n parts.push(part)\n }\n const cone = (x: number, y: number, z: number, radius: number, height: number, color: number, parent = ROOT, segments = DEFAULT_CONE_SEGMENTS): void => {\n parts.push({ shape: 'cone', parent, x, y: y + height / 2, z, radius, height, color, segments })\n }\n const prism = (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, parent = ROOT, ry = 0): void => {\n parts.push({ shape: 'prism', parent, x, y, z, width, height, depth, color, ry })\n }\n const plane = (x: number, y: number, z: number, width: number, depth: number, color: number, style?: PartStyle, parent = ROOT): void => {\n const part: UrbanPart = { shape: 'plane', parent, x, y, z, width, depth, color }\n if (style) part.style = style\n parts.push(part)\n }\n const vault = (part: Omit<Extract<UrbanPart, { shape: 'vault' }>, 'shape' | 'parent'> & { parent?: number }): void => {\n parts.push({ shape: 'vault', ...part, parent: part.parent ?? ROOT })\n }\n const terrain = (grid: TerrainGrid, parent = ROOT): void => {\n parts.push({ shape: 'terrain', parent, grid })\n }\n const crown = (x: number, y: number, z: number, radius: number, color: number, parent = ROOT): void => {\n parts.push({ shape: 'crown', parent, x, y, z, radius, color })\n }\n const line = (points: [number, number, number][], color: number, parent = ROOT): void => {\n parts.push({ shape: 'line', parent, points, color })\n }\n const label = (lines: string[], x: number, y: number, z: number, width: number, height: number, ry: number, o: { background: string; foreground: string; font?: string; canvas?: { width: number; height: number } }, parent = ROOT): void => {\n parts.push({ shape: 'label', parent, x, y, z, width, height, ry, lines, background: o.background, foreground: o.foreground, font: o.font ?? DEFAULT_LABEL_FONT, canvas: o.canvas ?? { width: 512, height: 128 } })\n }\n const light = (part: Omit<Extract<LightPart, { kind: 'point' }>, 'shape' | 'kind' | 'parent' | 'decay' | 'flicker'> & { flicker?: boolean; decay?: number }): void => {\n parts.push({ shape: 'light', kind: 'point', parent: ROOT, decay: 2, flicker: false, ...part })\n }\n const spot = (part: Omit<Extract<LightPart, { kind: 'spot' }>, 'shape' | 'kind' | 'parent'>): void => {\n parts.push({ shape: 'light', kind: 'spot', parent: ROOT, ...part })\n }\n /** Asks the drawer for a vehicle or a plant at a spot; the scene does not know how it is drawn. */\n const place = (kind: PlacementPart['kind'], id: string, x: number, z: number, o: { y?: number; ry?: number; scale?: number; color?: number; seed?: number | string; parent?: number } = {}): void => {\n const part: PlacementPart = { shape: 'placement', parent: o.parent ?? ROOT, kind, id, x, y: o.y ?? 0, z, ry: o.ry ?? 0, scale: o.scale ?? 1, seed: o.seed ?? `${id}:${x}:${z}` }\n if (o.color !== undefined) part.color = o.color\n parts.push(part)\n }\n const item = (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, ry = 0, rx = 0, rz = 0): void => {\n items.push({ x, y, z, width, height, depth, color, rx, ry, rz })\n }\n /** Cylinder posts every 3 m (at least two) and three wires, as the team's fence. */\n const fence = (x0: number, z0: number, x1: number, z1: number, height: number, color = DEFAULT_FENCE_POST): void => {\n const count = Math.ceil(Math.hypot(x1 - x0, z1 - z0) / 3)\n for (let index = 0; index <= count; index++) {\n const t = index / count\n cylinder(x0 + (x1 - x0) * t, 0, z0 + (z1 - z0) * t, 0.05, 0.05, height, color, ROOT, 5)\n }\n for (const level of [height * 0.35, height * 0.65, height * 0.98]) line([[x0, level, z0], [x1, level, z1]], DEFAULT_FENCE_WIRE)\n }\n /** Adds a silhouette of game-floorplan (a house far away, a city building): its parts keep their order and their groups are re-indexed, its windows join the scene's. */\n const add = (silhouette: Silhouette): void => {\n const offset = parts.length\n for (const part of silhouette.parts) parts.push(part.parent < 0 ? part : { ...part, parent: part.parent + offset })\n for (const window of silhouette.windows) (window.isLit ? windows.lit : windows.dark).push(window)\n }\n const scene = (): UrbanScene => ({ parts, items, windows })\n return { random, pick, lights, parts, items, windows, group, box, cylinder, cone, prism, plane, vault, terrain, crown, line, label, light, spot, place, item, fence, add, scene }\n}\n\nexport type UrbanBuilder = ReturnType<typeof createUrbanBuilder>\n","import type { UrbanBuilder } from './scene'\nimport type { PartStyle } from './types'\n\n/** The pole that carries the lamp: a tapered cylinder. */\nexport type MastSpec = { radiusTop: number; radiusBottom: number; height: number; color: number; segments?: number; style?: PartStyle }\n/** A bar or a box of the pole, placed by its base `y`. `reach` is how far from the mast its centre sits. */\nexport type BarSpec = { reach: number; y: number; width: number; height: number; depth: number; color: number }\n/** The box of a lamp head: its colour is the lens, lit or unlit. */\nexport type LampSpec = { reach: number; y: number; width: number; height: number; depth: number }\n/** Colour of the lamp lens when the lamp is on (it glows) and when it is off. */\nexport type LensSpec = { lit: number; unlit: number }\n/** The real light a lamp that is on may get from the budget. `reach` moves it along the arm. */\nexport type LampLightSpec = { color: number; intensity: number; distance: number; y: number; reach?: number; z?: number }\n\n/** Double arm with two LED heads (the avenue pole of the downtown pattern). */\nexport type DoubleArmSpec = { mast: MastSpec; arm: BarSpec; lamp: LampSpec; lens: LensSpec; light: LampLightSpec }\n/** Concrete pole with one arm and a sodium lamp, with an optional transformer drum. */\nexport type SingleArmSpec = {\n mast: MastSpec\n arm: BarSpec\n lamp: LampSpec\n lens: LensSpec\n light: LampLightSpec\n transformer: { offset: number; y: number; radius: number; height: number; color: number; segments: number }\n}\n/** Short iron post with a lantern box and a pointed cap. */\nexport type LanternSpec = { mast: MastSpec; lamp: LampSpec; cap: { y: number; radius: number; height: number; color: number; segments: number }; lens: LensSpec; light: LampLightSpec }\n/** Wooden pole with a crossarm and a hanging lamp. */\nexport type CrossarmSpec = { mast: MastSpec; arm: BarSpec; lamp: LampSpec; lens: LensSpec; light: LampLightSpec }\n/** Four-legged tower with a deck and a row of floodlights. */\nexport type FloodTowerSpec = {\n legs: { offset: number; height: number; size: number; color: number }\n deck: BarSpec\n heads: { count: number; start: number; spacing: number; y: number; z: number; width: number; height: number; depth: number }\n lens: LensSpec\n light: LampLightSpec\n}\n\n/** What a game says when it places a pole. */\nexport type PoleOptions = {\n x: number\n z: number\n /** Lit lamp (glowing lens and, while the budget lasts, a real light). Default true. */\n on?: boolean\n /** Turns the whole pole (the double arm only; the others are placed by their arm direction). */\n ry?: number\n /** The real light flickers (a failing lamp). */\n flicker?: boolean\n /** Which way the arm points, 1 or -1 (single arm). Default 1. */\n dir?: number\n /** Adds the transformer drum (single arm). */\n transformer?: boolean\n}\n\n/** Draws a pole from its `spec`. Declared as a method so the registry can hold each builder with its own spec type (the `PoleDef` names the builder that reads its spec). */\nexport type PoleShapeBuilder<TSpec extends object = object> = { build(b: UrbanBuilder, spec: TSpec, o: PoleOptions): void }['build']\n\nexport type PoleDef = {\n id: string\n /** Key of the shape builder that reads `spec`. */\n shape: string\n spec: object\n}\n\nconst on = (o: PoleOptions): boolean => o.on ?? true\n\nfunction drawMast(b: UrbanBuilder, mast: MastSpec, x: number, z: number, parent = -1): void {\n b.cylinder(x, 0, z, mast.radiusTop, mast.radiusBottom, mast.height, mast.color, parent, mast.segments, mast.style)\n}\n\nfunction spendLight(b: UrbanBuilder, light: LampLightSpec, x: number, z: number, o: PoleOptions): void {\n if (on(o) && b.lights.take()) b.light({ x: x + (light.reach ?? 0), y: light.y, z: z + (light.z ?? 0), color: light.color, intensity: light.intensity, distance: light.distance, flicker: o.flicker ?? false })\n}\n\nconst doubleArm: PoleShapeBuilder = (b, spec: DoubleArmSpec, o) => {\n const group = b.group(o.x, 0, o.z, o.ry ?? 0)\n drawMast(b, spec.mast, 0, 0, group)\n for (const side of [-1, 1]) {\n b.box(side * spec.arm.reach, spec.arm.y, 0, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color, { parent: group })\n b.box(side * spec.lamp.reach, spec.lamp.y, 0, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { parent: group, emissive: on(o) })\n }\n spendLight(b, spec.light, o.x, o.z, o)\n}\n\nconst singleArm: PoleShapeBuilder = (b, spec: SingleArmSpec, o) => {\n const dir = o.dir ?? 1\n drawMast(b, spec.mast, o.x, o.z)\n b.box(o.x + dir * spec.arm.reach, spec.arm.y, o.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color)\n b.box(o.x + dir * spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n if (o.transformer) b.cylinder(o.x - dir * spec.transformer.offset, spec.transformer.y, o.z, spec.transformer.radius, spec.transformer.radius, spec.transformer.height, spec.transformer.color, -1, spec.transformer.segments)\n spendLight(b, { ...spec.light, reach: dir * (spec.light.reach ?? spec.lamp.reach) }, o.x, o.z, o)\n}\n\nconst lantern: PoleShapeBuilder = (b, spec: LanternSpec, o) => {\n drawMast(b, spec.mast, o.x, o.z)\n b.box(o.x + spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n b.cone(o.x, spec.cap.y, o.z, spec.cap.radius, spec.cap.height, spec.cap.color, -1, spec.cap.segments)\n spendLight(b, spec.light, o.x, o.z, o)\n}\n\nconst crossarm: PoleShapeBuilder = (b, spec: CrossarmSpec, o) => {\n drawMast(b, spec.mast, o.x, o.z)\n b.box(o.x + spec.arm.reach, spec.arm.y, o.z, spec.arm.width, spec.arm.height, spec.arm.depth, spec.arm.color)\n b.box(o.x + spec.lamp.reach, spec.lamp.y, o.z, spec.lamp.width, spec.lamp.height, spec.lamp.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n spendLight(b, { ...spec.light, reach: spec.light.reach ?? spec.lamp.reach }, o.x, o.z, o)\n}\n\nconst floodTower: PoleShapeBuilder = (b, spec: FloodTowerSpec, o) => {\n for (const a of [-1, 1]) for (const c of [-1, 1]) b.box(o.x + a * spec.legs.offset, 0, o.z + c * spec.legs.offset, spec.legs.size, spec.legs.height, spec.legs.size, spec.legs.color)\n b.box(o.x + spec.deck.reach, spec.deck.y, o.z, spec.deck.width, spec.deck.height, spec.deck.depth, spec.deck.color)\n for (let index = 0; index < spec.heads.count; index++) {\n b.box(o.x + spec.heads.start + index * spec.heads.spacing, spec.heads.y, o.z + spec.heads.z, spec.heads.width, spec.heads.height, spec.heads.depth, on(o) ? spec.lens.lit : spec.lens.unlit, { emissive: on(o) })\n }\n spendLight(b, spec.light, o.x, o.z, o)\n}\n\n/** The shape builders the five default poles use; a game adds its own through `createUrban({ shapes })`. */\nexport const POLE_SHAPES: Readonly<Record<string, PoleShapeBuilder>> = { double_arm: doubleArm, single_arm: singleArm, lantern, crossarm, flood_tower: floodTower }\n\nconst LED: DoubleArmSpec = {\n mast: { radiusTop: 0.1, radiusBottom: 0.14, height: 9, color: 0x55595e, style: { metalness: 0.6, roughness: 0.5 } },\n arm: { reach: 0.8, y: 8.8, width: 1.6, height: 0.1, depth: 0.12, color: 0x55595e },\n lamp: { reach: 1.5, y: 8.6, width: 0.6, height: 0.12, depth: 0.3 },\n lens: { lit: 0xeef4ff, unlit: 0x3a3a3a },\n light: { color: 0xdfe8ff, intensity: 1.3, distance: 24, y: 8 },\n}\n\nconst CONCRETE: SingleArmSpec = {\n mast: { radiusTop: 0.12, radiusBottom: 0.2, height: 8, color: 0x8a8a84, segments: 4 },\n arm: { reach: 0.7, y: 7.6, width: 1.4, height: 0.1, depth: 0.1, color: 0x6a6a66 },\n lamp: { reach: 1.35, y: 7.45, width: 0.5, height: 0.16, depth: 0.3 },\n lens: { lit: 0xffa040, unlit: 0x3a3a3a },\n light: { color: 0xff9a40, intensity: 1.3, distance: 20, y: 7.2 },\n transformer: { offset: 0.35, y: 6.2, radius: 0.28, height: 0.7, color: 0x5a5e62, segments: 8 },\n}\n\nconst IRON: LanternSpec = {\n mast: { radiusTop: 0.06, radiusBottom: 0.12, height: 4, color: 0x1e2022, segments: 8 },\n lamp: { reach: 0, y: 4, width: 0.42, height: 0.5, depth: 0.42 },\n cap: { y: 4.5, radius: 0.36, height: 0.3, color: 0x1e2022, segments: 4 },\n lens: { lit: 0xffd090, unlit: 0x2a2a2a },\n light: { color: 0xffc880, intensity: 1, distance: 14, y: 3.9 },\n}\n\nconst WOOD: CrossarmSpec = {\n mast: { radiusTop: 0.11, radiusBottom: 0.14, height: 7, color: 0x5a4630, segments: 6 },\n arm: { reach: 0, y: 6.6, width: 1.2, height: 0.08, depth: 0.08, color: 0x4a3a28 },\n lamp: { reach: 0.5, y: 6.35, width: 0.16, height: 0.22, depth: 0.16 },\n lens: { lit: 0xffe08a, unlit: 0x3a3a3a },\n light: { color: 0xffd27a, intensity: 0.9, distance: 16, y: 6.2 },\n}\n\nconst FLOOD: FloodTowerSpec = {\n legs: { offset: 0.4, height: 12, size: 0.12, color: 0x6a6c6e },\n deck: { reach: 0, y: 12, width: 2, height: 0.15, depth: 1.2, color: 0x6a6c6e },\n heads: { count: 3, start: -0.6, spacing: 0.6, y: 12.2, z: 0.4, width: 0.45, height: 0.35, depth: 0.2 },\n lens: { lit: 0xfff2d8, unlit: 0x3a3a3a },\n light: { color: 0xfff0d0, intensity: 1.6, distance: 34, y: 11.5, z: 2 },\n}\n\n/**\n * The five poles of the neighbourhood patterns, with the numbers of the Galeria (heights, arms, lens colours, the colour,\n * strength and reach of the real light). A game patches a number by id or adds a pole with its own shape.\n */\nexport const DEFAULT_POLES: readonly PoleDef[] = [\n { id: 'led_double', shape: 'double_arm', spec: LED },\n { id: 'concrete_arm', shape: 'single_arm', spec: CONCRETE },\n { id: 'cast_iron', shape: 'lantern', spec: IRON },\n { id: 'wood_crossarm', shape: 'crossarm', spec: WOOD },\n { id: 'flood_tower', shape: 'flood_tower', spec: FLOOD },\n]\n","import type { UrbanBuilder } from './scene'\n\n/** Look of the road surface and its centre line; the defaults are the Galeria's. */\nexport type RoadStyle = {\n color: number\n /** Painted dashes along the centre line. */\n dash: { color: number; every: number; first: number; length: number; width: number; height: number; y: number }\n}\n\nexport type WalkStyle = { color: number; height: number; castShadow: boolean }\n\nexport const DEFAULT_ROAD_STYLE: RoadStyle = { color: 0x222428, dash: { color: 0x8f7f4f, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } }\nexport const DEFAULT_WALK_STYLE: WalkStyle = { color: 0x3a3b3c, height: 0.15, castShadow: false }\nconst ROAD_LEVEL = 0.02\nconst DEFAULT_GROUND_COLOR = 0x15181a\nconst DEFAULT_GROUND_SIZE = 600\n\nexport type StreetOptions = { road?: Partial<RoadStyle> & { dash?: Partial<RoadStyle['dash']> }; walk?: Partial<WalkStyle> }\n\nconst roadStyle = (o?: StreetOptions): RoadStyle => ({ ...DEFAULT_ROAD_STYLE, ...o?.road, dash: { ...DEFAULT_ROAD_STYLE.dash, ...o?.road?.dash } })\nconst walkStyle = (o?: StreetOptions): WalkStyle => ({ ...DEFAULT_WALK_STYLE, ...o?.walk })\n\n/** Road centred on (x, z), `w` wide and `l` long along `x` or `z`, with a dash every 5 m starting 2 m from its start. */\nexport function drawRoad(b: UrbanBuilder, x: number, z: number, w: number, l: number, along: 'x' | 'z', options?: StreetOptions): void {\n const style = roadStyle(options)\n const alongX = along === 'x'\n b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color)\n const { dash } = style\n for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {\n b.item(alongX ? x + u : x, dash.y, alongX ? z : z + u, alongX ? dash.length : dash.width, dash.height, alongX ? dash.width : dash.length, dash.color)\n }\n}\n\n/** Sidewalk slab centred on (x, z). */\nexport function drawWalk(b: UrbanBuilder, x: number, z: number, w: number, d: number, options?: StreetOptions): void {\n const style = walkStyle(options)\n b.box(x, 0, z, w, style.height, d, style.color, { style: { castShadow: style.castShadow } })\n}\n\n/** The big plane under the scene. */\nexport function drawGround(b: UrbanBuilder, color = DEFAULT_GROUND_COLOR, size = DEFAULT_GROUND_SIZE): void {\n b.plane(0, 0, 0, size, size, color)\n}\n\n/**\n * A grid of `2n + 1` roads each way, `block` apart and `width` wide, with a sidewalk slab on every one of the `2n x 2n` blocks.\n * Roads first (z then x for each line), then the walks, as the page.\n */\nexport function drawStreetGrid(b: UrbanBuilder, block: number, count: number, width: number, options?: StreetOptions): void {\n for (let k = -count; k <= count; k++) {\n drawRoad(b, k * block, 0, width, block * 2 * count + width, 'z', options)\n drawRoad(b, 0, k * block, width, block * 2 * count + width, 'x', options)\n }\n for (let i = -count; i < count; i++) for (let j = -count; j < count; j++) drawWalk(b, i * block + block / 2, j * block + block / 2, block - width, block - width, options)\n}\n","import { createCityBuilding } from '@adatechnology/game-floorplan'\n\nimport type { UrbanBuilder } from './scene'\nimport { DEFAULT_TOWER_PRESETS } from './tower'\nimport type { TowerPreset } from './tower'\n\n/** Facade colours of the city buildings (the Galeria's `FAC`). */\nexport const DEFAULT_FACADES: readonly number[] = [0x3b3f45, 0x4a4038, 0x35403d, 0x463a3a, 0x3f3b34, 0x2f3439, 0x51493f, 0x5a564e]\n\nconst DEFAULT_PARTITIONS = 2\nconst DEFAULT_GAP = 0.08\nconst STREET_MARGIN = 2\nconst FOOTPRINT_TRIM = 1.2\nconst FOOTPRINT_JITTER = 1.5\nconst HEIGHT_CURVE = 1.6\n\nexport type FillBlockOptions = {\n /** The block is split into `k x k` lots. Default 2. */\n k?: number\n /** Chance that a lot stays empty. Default 0.08. */\n gap?: number\n /** Chance that a window is lit. */\n lit?: number\n /** Chance of a ground-floor shop on a building. */\n shop?: number\n /** Facade colours. Default `DEFAULT_FACADES`. */\n palette?: readonly number[]\n /**\n * Storeys of each building, a number or `[min, max]` (the same name and shape as a city block's `building.floors`). Given, the height is storeys times the\n * storey height of the use's preset instead of `minHeight..maxHeight`; the random draws are the same.\n */\n floors?: number | readonly [number, number]\n /** Share of the buildings by use (`commercial`, `residential`, ...); each building picks one (one more random draw). Needs no `floors`. */\n uses?: Readonly<Record<string, number>>\n /** Which tower preset gives the storey height of a use. Default `{ commercial: 'office', residential: 'residential' }`. */\n storeyPresets?: Readonly<Record<string, string>>\n /** The presets whose storey heights are used (default `DEFAULT_TOWER_PRESETS`; the kit passes its `towers.presets`). */\n presets?: readonly TowerPreset[]\n /** Storey height when no preset applies, metres. Default the residential preset's. */\n storeyHeight?: number\n /** Draws each building (default `drawBuilding`): the kit passes its own to put towers on the tall lots. */\n draw?: (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, options: BuildingOptions) => BlockBuilding\n}\n\n/** A building a block ended up with, for the game's own bookkeeping (collisions, minimap). */\nexport type BlockBuilding = { x: number; z: number; width: number; depth: number; height: number; color: number }\n\nexport type BuildingOptions = {\n lit?: number\n shop?: number\n /** Use of the building (`commercial`, `residential`...), when the block gave `uses`. */\n use?: string\n /** Storeys of the building, when the block gave `floors`; the height is already storeys times the storey height. */\n storeys?: number\n /** Id of the tower preset the use maps to; a tower drawer with that preset uses it instead of picking at random. */\n preset?: string\n}\n\nexport const DEFAULT_STOREY_PRESETS: Readonly<Record<string, string>> = { commercial: 'office', residential: 'residential' }\n\n/** One city building: block, roof slab, maybe a vent on the roof, maybe a shop front on both long faces, windows on the four faces. Draws from the builder's random. */\nexport function drawBuilding(b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, options: BuildingOptions = {}): BlockBuilding {\n b.add(createCityBuilding({ x, z, width, depth, height, color, random: b.random, shopChance: options.shop, litChance: options.lit }))\n return { x, z, width, depth, height, color }\n}\n\n/** The use a building has: one pick by weight (draws once). */\nfunction pickUse(b: UrbanBuilder, uses: Readonly<Record<string, number>>): string | undefined {\n const entries = Object.entries(uses).filter(([, w]) => w > 0)\n const total = entries.reduce((sum, [, w]) => sum + w, 0)\n if (total <= 0) return undefined\n let r = b.random() * total\n for (const [use, w] of entries) { r -= w; if (r < 0) return use }\n return entries[entries.length - 1]![0]\n}\n\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n\n/**\n * Fills a square block with city buildings: a `k x k` split of the block less 2 m of street, each lot maybe empty, each building a\n * little smaller than its lot and as tall as `lerp(min, max, random^1.6)` (more low buildings than tall ones). Draws from the\n * builder's random in the page's order: gap, width, depth, height, facade, then the building's own.\n */\nexport function fillBlock(b: UrbanBuilder, cx: number, cz: number, size: number, minHeight: number, maxHeight: number, options: FillBlockOptions = {}): BlockBuilding[] {\n const placed: BlockBuilding[] = []\n const palette = options.palette ?? DEFAULT_FACADES\n const half = (size - STREET_MARGIN) / 2\n const k = options.k || DEFAULT_PARTITIONS\n const lot = (size - STREET_MARGIN) / k\n for (let i = 0; i < k; i++) {\n for (let j = 0; j < k; j++) {\n if (b.random() < (options.gap || DEFAULT_GAP)) continue\n const width = lot - FOOTPRINT_TRIM - b.random() * FOOTPRINT_JITTER\n const depth = lot - FOOTPRINT_TRIM - b.random() * FOOTPRINT_JITTER\n const t = Math.pow(b.random(), HEIGHT_CURVE)\n let height = lerp(minHeight, maxHeight, t)\n let extra: BuildingOptions | null = null\n if (options.floors !== undefined || options.uses) {\n const use = options.uses ? pickUse(b, options.uses) : undefined\n const presetId = use ? (options.storeyPresets ?? DEFAULT_STOREY_PRESETS)[use] : undefined\n const preset = presetId ? (options.presets ?? DEFAULT_TOWER_PRESETS).find((p) => p.id === presetId) : undefined\n extra = { use, preset: preset?.id }\n if (options.floors !== undefined) {\n const [lo, hi] = typeof options.floors === 'number' ? [options.floors, options.floors] : options.floors\n const storeys = Math.max(1, Math.round(lerp(lo, hi, t)))\n height = storeys * (preset?.storeyHeight ?? options.storeyHeight ?? DEFAULT_TOWER_PRESETS[DEFAULT_TOWER_PRESETS.length - 1]!.storeyHeight)\n extra.storeys = storeys\n }\n }\n const x = cx - half + lot * (i + 0.5)\n const z = cz - half + lot * (j + 0.5)\n const color = b.pick(palette)\n placed.push((options.draw ?? drawBuilding)(b, x, z, width, depth, height, color, extra ? { ...options, ...extra } : options))\n }\n }\n return placed\n}\n","import type { BlockBuilding, BuildingOptions } from './block'\nimport type { UrbanBuilder } from './scene'\n\n/**\n * One kind of tower the city can put on a tall lot: the numbers of a typology of `game-floorplan-commercial` (office) or `game-floorplan-residential`\n * (residential), which the tests keep equal to theirs. The city only draws the outside; the plan of the inside is the typology's.\n */\nexport type TowerPreset = {\n id: string\n /** Chance weight among the presets (the one the random picks). */\n weight: number\n /** Floor to floor in metres: the clear height of the typology plus its slab. */\n storeyHeight: number\n /** A plant floor (darker band, no windows) every this many storeys; `false` none. */\n mechanicalEvery: number | false\n /** A glass curtain wall (a ribbon of tall windows on a tinted skin) or a punched facade (a window in each bay of the masonry). */\n glass: boolean\n /** Fewest and most storeys this preset's towers have (the lot height is raised or cut to it); omitted: no minimum, and `TowerOptions.maxStoreys` for the top. */\n minStoreys?: number\n maxStoreys?: number\n /** Colour of the skin; omitted: the facade colour the block drew for the lot (glass: a blue tint of it). */\n color?: number\n}\n\n/** The two typologies: the office tower (4.0 m storeys: 3.6 clear and 0.4 slab, a plant floor every 20, glass) and the residential tower (3.1 m, every 25, masonry). */\nexport const DEFAULT_TOWER_PRESETS: readonly TowerPreset[] = [\n { id: 'office', weight: 0.6, storeyHeight: 4, mechanicalEvery: 20, glass: true, color: 0x3c5a73 },\n { id: 'residential', weight: 0.4, storeyHeight: 3.1, mechanicalEvery: 25, glass: false },\n]\n\n/**\n * A preset from the layout of a typology (`officeTowerLayout(opts)`, `residentialTowerLayout(opts)`), so the city draws the tower the game configured:\n * the storey pitch and the facade come from the layout, the storey range from its `range` when given.\n */\nexport const towerPresetOf = (\n id: string,\n weight: number,\n layout: { pitch: number; facade: 'curtain' | 'punched' },\n extra: Partial<Omit<TowerPreset, 'id' | 'weight' | 'storeyHeight' | 'glass'>> = {},\n): TowerPreset => ({ id, weight, storeyHeight: layout.pitch, mechanicalEvery: 20, glass: layout.facade === 'curtain', ...extra })\n\n/** What a game asks a tower provider to put on the ground: the lot, the height, the preset the random chose and the facade colour. */\nexport type TowerRequest = { x: number; z: number; width: number; depth: number; height: number; color: number; preset: TowerPreset; lit: number; use?: string; storeys?: number }\n/** Draws a tower in place of the default one (the game's own model, or the plan of the typology rendered by `game-floorplan-three`). */\nexport type TowerProvider = (request: TowerRequest, b: UrbanBuilder) => void\n\nexport type TowerOptions = {\n /** A building at least this tall (metres) is drawn as a tower. Default 60. */\n minHeight?: number\n /** Kinds of tower and their weights. Default `DEFAULT_TOWER_PRESETS`. */\n presets?: readonly TowerPreset[]\n /** Replaces the default drawing. */\n provider?: TowerProvider\n /** The crown: height of the mast over the roof as a share of the tower (default 0.06, at most 25 m), 0 for none. */\n mast?: number\n /** Most storeys a tower may have (default 60, the structural limit of the kit): a taller lot is drawn at this many storeys of its preset. */\n maxStoreys?: number\n /** Chance that a window is lit when the block did not say (default 0.12). */\n lit?: number\n}\n\nexport const TOWER_DEFAULTS = { minHeight: 60, maxStoreys: 60, mast: 0.06, lit: 0.12 } as const\n\nconst PODIUM = 1.5\nconst PLANT = 0x2c2f33\nconst PODIUM_COLOR = 0x2a2d31\nconst PARAPET = 0x2a2a2c\nconst MAST = 0x9aa0a6\nconst MAX_MAST = 25\nconst GLASS_COLUMN = 1.6\nconst MASONRY_COLUMN = 3\n\n/** The preset the random picks by weight; draws once. */\nexport function pickTowerPreset(b: UrbanBuilder, presets: readonly TowerPreset[]): TowerPreset {\n const total = presets.reduce((sum, p) => sum + p.weight, 0)\n let r = b.random() * total\n for (const preset of presets) {\n r -= preset.weight\n if (r < 0) return preset\n }\n return presets[presets.length - 1] as TowerPreset\n}\n\n/** Storeys of a tower of this height, the podium (a taller ground storey) included. */\nexport const towerStoreys = (height: number, preset: TowerPreset): number => Math.max(3, Math.round(height / preset.storeyHeight))\n\n/**\n * A tower: a podium with a taller ground storey, the shaft with a row of windows on every storey of its four faces, darker bands where the plant\n * floors are (no windows), the top plant floor set back, the parapet and the mast. Draws one random per window (lit or not), after the preset's.\n */\nexport function drawTower(b: UrbanBuilder, request: TowerRequest, options: Pick<TowerOptions, 'mast'> = {}): BlockBuilding {\n const { x, z, width: w, depth: d, preset } = request\n const storeys = towerStoreys(request.height, preset)\n const h = preset.storeyHeight\n const podium = h * PODIUM\n const skin = preset.color ?? request.color\n const mechanical = new Set<number>()\n if (preset.mechanicalEvery) for (let k = preset.mechanicalEvery; k < storeys - 1; k += preset.mechanicalEvery) if (storeys - 1 - k >= preset.mechanicalEvery / 2) mechanical.add(k)\n mechanical.add(storeys - 1)\n b.box(x, 0, z, w + 0.6, podium, d + 0.6, PODIUM_COLOR)\n const shaftTop = (storeys - 1) * h\n b.box(x, podium, z, w, shaftTop - podium + (podium - h), d, skin)\n for (const k of mechanical) {\n if (k === storeys - 1) b.box(x, k * h + (podium - h), z, w * 0.82, h, d * 0.82, PLANT)\n else b.box(x, k * h + (podium - h), z, w + 0.4, h, d + 0.4, PLANT)\n }\n const top = storeys * h + (podium - h)\n b.box(x, top, z, w * 0.82 + 0.3, 0.35, d * 0.82 + 0.3, PARAPET)\n const mast = Math.min(MAX_MAST, top * (options.mast ?? TOWER_DEFAULTS.mast))\n if (mast > 0.5) b.cylinder(x, top + 0.35, z, 0.12, 0.2, mast, MAST, -1, 6)\n // windows: a row a storey, on the four faces, none on the plant floors and the podium\n const column = preset.glass ? GLASS_COLUMN : MASONRY_COLUMN\n const winHeight = preset.glass ? h * 0.62 : 1.5\n const winWidth = preset.glass ? column * 0.86 : 1.3\n const faces: [number, number, number, number][] = [[0, d / 2 + 0.03, w, 0], [0, -d / 2 - 0.03, w, Math.PI], [w / 2 + 0.03, 0, d, Math.PI / 2], [-w / 2 - 0.03, 0, d, -Math.PI / 2]]\n for (const [ox, oz, faceWidth, ry] of faces) {\n const columns = Math.max(1, Math.floor(faceWidth / column))\n for (let storey = 1; storey < storeys; storey++) {\n if (mechanical.has(storey)) continue\n const y = storey * h + (podium - h) + h * (preset.glass ? 0.2 : 0.35)\n for (let c = 0; c < columns; c++) {\n const u = (c - (columns - 1) / 2) * column\n const lit = b.random() < request.lit\n ;(lit ? b.windows.lit : b.windows.dark).push({ x: ox ? x + ox : x + u, y, z: ox ? z + u : z + oz, ry, width: winWidth, height: winHeight, isLit: lit })\n }\n }\n }\n return { x, z, width: w, depth: d, height: top + 0.35 + (mast > 0.5 ? mast : 0), color: request.color }\n}\n\n/** The drawer a kit uses for a building of the block or the avenue: a tower from the minimum height up, the plain city building under it. */\nexport function createTowerDrawer(towers: TowerOptions, plain: (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions) => BlockBuilding) {\n const minHeight = towers.minHeight ?? TOWER_DEFAULTS.minHeight\n const presets = towers.presets ?? DEFAULT_TOWER_PRESETS\n return (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o: BuildingOptions = {}): BlockBuilding => {\n if (height < minHeight || presets.length === 0) return plain(b, x, z, width, depth, height, color, o)\n const preset = (o.preset ? presets.find((p) => p.id === o.preset) : undefined) ?? pickTowerPreset(b, presets)\n const top = (preset.maxStoreys ?? towers.maxStoreys ?? TOWER_DEFAULTS.maxStoreys) * preset.storeyHeight\n const bottom = (preset.minStoreys ?? 0) * preset.storeyHeight\n const request: TowerRequest = { x, z, width, depth, height: Math.min(Math.max(height, bottom), top), color, preset, lit: o.lit ?? towers.lit ?? TOWER_DEFAULTS.lit, ...(o.use ? { use: o.use } : {}), ...(o.storeys ? { storeys: o.storeys } : {}) }\n if (towers.provider) {\n towers.provider(request, b)\n return { x, z, width, depth, height: request.height, color }\n }\n return drawTower(b, request, towers)\n }\n}\n","import type { UrbanBuilder } from './scene'\n\n/** Colours of the props; a game replaces the ones it wants. */\nexport type PropColors = {\n tent: number\n trunk: number\n pines: readonly number[]\n crowns: readonly number[]\n sandbags: number\n fence: number\n wire: number\n label: { background: string; foreground: string }\n watchtower: { leg: number; cabin: number; deck: number }\n}\n\nexport const DEFAULT_PROP_COLORS: PropColors = {\n tent: 0x4f5638,\n trunk: 0x3a2a1c,\n pines: [0x1f3324, 0x24382a, 0x1b2d20],\n crowns: [0x34452a, 0x3d4a2c, 0x2f3d26],\n sandbags: 0x8a7a5a,\n fence: 0x6a6c6e,\n wire: 0x2a2a2a,\n label: { background: 'rgba(16,18,22,.9)', foreground: '#e8dfcf' },\n watchtower: { leg: 0x4a3a2a, cabin: 0x4f5638, deck: 0x3a3a2a },\n}\n\nconst LABEL_FONT = '700 44px \"Arial Narrow\", Arial, sans-serif'\nconst LABEL_CANVAS = { width: 1024, height: 200 }\nconst SANDBAG_LENGTH = 0.56\n\nconst colors = (c?: Partial<PropColors>): PropColors => ({ ...DEFAULT_PROP_COLORS, ...c })\n\n/** Fence along a line: posts every 3 m and three wires. */\nexport function drawFence(b: UrbanBuilder, x0: number, z0: number, x1: number, z1: number, height: number, color?: number): void {\n b.fence(x0, z0, x1, z1, height, color)\n}\n\n/** Tent: a triangular prism `w` wide, 0.7 w high and `d` long, turned by `ry`. */\nexport function drawTent(b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number, c?: Partial<PropColors>): void {\n b.prism(x, 0, z, w, w * 0.7, d, color ?? colors(c).tent, -1, ry)\n}\n\n/** Pine: a trunk and two cones of one of the greens (one draw from the random). */\nexport function drawPine(b: UrbanBuilder, x: number, z: number, scale = 1, y = 0, c?: Partial<PropColors>): void {\n const palette = colors(c)\n b.cylinder(x, y, z, 0.12 * scale, 0.16 * scale, 1 * scale, palette.trunk)\n const green = b.pick(palette.pines)\n b.cone(x, y + 0.8 * scale, z, 1.1 * scale, 2.2 * scale, green)\n b.cone(x, y + 2.1 * scale, z, 0.8 * scale, 1.8 * scale, green)\n}\n\n/** Tree: a trunk and a rough ball of leaves of one of the greens (one draw from the random). */\nexport function drawTree(b: UrbanBuilder, x: number, z: number, scale = 1, c?: Partial<PropColors>): void {\n const palette = colors(c)\n b.cylinder(x, 0, z, 0.12 * scale, 0.18 * scale, 1.8 * scale, palette.trunk)\n b.crown(x, 2.6 * scale, z, 1.3 * scale, b.pick(palette.crowns))\n}\n\n/** Shipping container (2.44 x 2.6 x 6.06 m) with five ribs on one end. */\nexport function drawContainer(b: UrbanBuilder, x: number, y: number, z: number, ry: number, color: number): void {\n const group = b.group(x, y, z, ry)\n b.box(0, 0, 0, 2.44, 2.6, 6.06, color, { parent: group, style: { roughness: 0.7, metalness: 0.3 } })\n for (let k = -2; k <= 2; k++) b.box(k * 0.5, 0, 3.04, 0.06, 2.6, 0.04, 0x1a1a1a, { parent: group })\n}\n\n/** Watch tower: four legs, a cabin, a roof deck and two posts; with a searchlight whose beam circles the ground. */\nexport function drawWatchtower(b: UrbanBuilder, x: number, z: number, searchlight = false, c?: Partial<PropColors>): void {\n const palette = colors(c).watchtower\n for (const a of [-1, 1]) for (const d of [-1, 1]) b.box(x + a * 1.2, 0, z + d * 1.2, 0.25, 7, 0.25, palette.leg)\n b.box(x, 7, z, 3.2, 1.2, 3.2, palette.cabin)\n b.box(x, 8.2, z, 3.6, 0.15, 3.6, palette.deck)\n for (const side of [-1.5, 1.5]) b.box(x + side, 8.2, z, 0.15, 1.6, 0.15, palette.deck)\n if (searchlight) b.spot({ x, y: 9, z, color: 0xe6eeff, intensity: 2.4, distance: 70, decay: 1.2, angle: 0.35, penumbra: 0.5, target: { x: x + 20, y: 0, z: z + 20 }, sweep: { speed: 0.5, radius: 25 } })\n}\n\n/** Rows of sandbags along `x` or `z`, each row shifted half a bag. Instances, no parts. */\nexport function drawSandbags(b: UrbanBuilder, x: number, z: number, length: number, along: 'x' | 'z', rows = 3, c?: Partial<PropColors>): void {\n const color = colors(c).sandbags\n for (let r = 0; r < rows; r++) {\n for (let i = 0; i < length / SANDBAG_LENGTH; i++) {\n const u = -length / 2 + 0.28 + i * SANDBAG_LENGTH + (r % 2) * 0.28\n b.item(along === 'x' ? x + u : x, r * 0.21, along === 'x' ? z : z + u, along === 'x' ? 0.55 : 0.32, 0.22, along === 'x' ? 0.32 : 0.55, color)\n }\n }\n}\n\n/** A big strip of text on the ground level (name of a street, caption of a cell): two lines on a 22 x 4.4 m board at 2.4 m. */\nexport function drawStripLabel(b: UrbanBuilder, x: number, z: number, title: string, subtitle: string, c?: Partial<PropColors>): void {\n const { background, foreground } = colors(c).label\n b.label([title, subtitle], x, 2.4, z, 22, 4.4, 0, { background, foreground, font: LABEL_FONT, canvas: LABEL_CANVAS })\n}\n\n/** Wires between poles: a polyline at one height. */\nexport function drawWires(b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number, c?: Partial<PropColors>): void {\n b.line(points.map(([px, pz]) => [px, y, pz] as [number, number, number]), color ?? colors(c).wire)\n}\n","import { applyPatches, mergeById, removeIds } from '@adatechnology/game-contracts'\nimport type { DeepPartial } from '@adatechnology/game-contracts'\nimport { createSilhouetteRandom } from '@adatechnology/game-floorplan'\n\nimport { drawBuilding, fillBlock, DEFAULT_FACADES } from './block'\nimport type { BlockBuilding, BuildingOptions, FillBlockOptions } from './block'\nimport { createLightAllowance } from './budget'\nimport { createTowerDrawer, DEFAULT_TOWER_PRESETS } from './tower'\nimport type { TowerOptions } from './tower'\nimport { DEFAULT_POLES, POLE_SHAPES } from './poles'\nimport type { PoleDef, PoleOptions, PoleShapeBuilder } from './poles'\nimport { drawContainer, drawFence, drawPine, drawSandbags, drawStripLabel, drawTent, drawTree, drawWatchtower, drawWires, DEFAULT_PROP_COLORS } from './props'\nimport type { PropColors } from './props'\nimport { composePattern, patternMarker, SAMPLE_GROUND } from './neighbourhoods/compose'\nimport type { Origin, SampleSheetOptions } from './neighbourhoods/compose'\nimport { COMPOSERS } from './neighbourhoods/composers'\nimport { DEFAULT_PATTERNS, SAMPLE_CELLS } from './neighbourhoods/patterns'\nimport type { ComposeOptions, Composer, Locale, NeighbourhoodPattern, UrbanKitCore, UrbanPlan } from './neighbourhoods/types'\nimport { createCities } from './cities'\nimport type { CityPlanInput, DistrictKindDef } from './cities'\nimport { createUrbanBuilder } from './scene'\nimport { createTerrain, drawTerrain } from './terrain'\nimport type { Terrain, TerrainOptions } from './terrain'\nimport type { UrbanBuilder } from './scene'\nimport { drawGround, drawRoad, drawStreetGrid, drawWalk } from './streets'\nimport type { StreetOptions } from './streets'\nimport type { RandomSource } from './types'\n\n/** Lights a scene may spend: the Galeria spends 16 real point lights. */\nexport const DEFAULT_LIGHT_ALLOWANCE = 16\n/** @deprecated Renamed `DEFAULT_LIGHT_ALLOWANCE`. Removed in the next major. */\nexport const DEFAULT_LIGHT_BUDGET = DEFAULT_LIGHT_ALLOWANCE\n/** Seed of the Galeria's generator. */\nexport const DEFAULT_URBAN_SEED = 7\n\nexport type UrbanOptions = {\n /** Entries added to the catalogues (an entry with an existing id replaces it). */\n packs?: { poles?: readonly PoleDef[]; neighbourhoods?: readonly NeighbourhoodPattern[]; districtKinds?: readonly DistrictKindDef[]; cityPlans?: readonly CityPlanInput[] }\n /** Numbers changed on shipped entries, by id (objects merge, arrays replace). */\n patch?: { poles?: Record<string, DeepPartial<PoleDef>>; neighbourhoods?: Record<string, DeepPartial<NeighbourhoodPattern>>; districtKinds?: Record<string, DeepPartial<DistrictKindDef>>; cityPlans?: Record<string, DeepPartial<CityPlanInput>> }\n /** Ids taken out of the catalogues. */\n remove?: { poles?: readonly string[]; neighbourhoods?: readonly string[]; districtKinds?: readonly string[]; cityPlans?: readonly string[] }\n /** Shape builders for the poles a pack adds; the five of the Galeria are always there. */\n shapes?: Readonly<Record<string, PoleShapeBuilder>>\n /** Composers for the patterns a pack adds; the ten of the Galeria are always there. */\n composers?: Readonly<Record<string, Composer>>\n /** City plans (zoning): district kinds and plans are catalogues (`packs`, `patch` and `remove` above, under `districtKinds` and `cityPlans`). */\n cities?: { /** Most storeys a district may have. Default 60. */ maxFloors?: number }\n lights?: { budget?: number }\n streets?: StreetOptions\n /** Facade colours of the city buildings. */\n facades?: readonly number[]\n props?: Partial<PropColors>\n /**\n * Towers on the tall lots, off by default. `true` or an object turns them on: a building of the block or of an avenue at least `minHeight` (60 m) tall is drawn as\n * a tower of one of the `presets` (the office and residential typologies), not as a box; a `provider` replaces the drawing. See `TowerOptions`.\n */\n towers?: boolean | TowerOptions\n}\n\nexport type Pole = { readonly def: PoleDef; build(b: UrbanBuilder, options: PoleOptions): void }\n\nexport type BuilderOptions = {\n /** Seed of the generator when no `random` is given. Default 7. */\n seed?: number\n random?: RandomSource\n /** Lights this scene may spend; default the kit's budget. */\n budget?: number\n}\n\nexport type UrbanKit = ReturnType<typeof createUrban>\n\n/** The urban pattern as data: poles, streets, blocks and props that add parts to a builder. Knows nothing about three.js, a game or a place. */\nexport function createUrban(options: UrbanOptions = {}) {\n const entries = mergeById(DEFAULT_POLES, options.packs?.poles)\n applyPatches(entries, options.patch?.poles)\n removeIds(entries, options.remove?.poles)\n const shapes: Record<string, PoleShapeBuilder> = { ...POLE_SHAPES, ...options.shapes }\n const patterns = mergeById(DEFAULT_PATTERNS, options.packs?.neighbourhoods)\n applyPatches(patterns, options.patch?.neighbourhoods)\n removeIds(patterns, options.remove?.neighbourhoods)\n const composers: Record<string, Composer> = { ...COMPOSERS, ...options.composers }\n const lightBudget = options.lights?.budget ?? DEFAULT_LIGHT_ALLOWANCE\n const facades = options.facades ?? DEFAULT_FACADES\n const propColors: PropColors = { ...DEFAULT_PROP_COLORS, ...options.props }\n\n const towers: TowerOptions | null = options.towers ? (options.towers === true ? {} : options.towers) : null\n const building = (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions): BlockBuilding => drawBuilding(b, x, z, width, depth, height, color, o)\n const drawBlockBuilding = towers ? createTowerDrawer(towers, building) : building\n\n const poles = {\n ids: (): string[] => [...entries.keys()],\n list: (): PoleDef[] => [...entries.values()],\n get(id: string): Pole {\n const def = entries.get(id)\n if (!def) throw new Error(`Unknown pole \"${id}\"`)\n const shape = shapes[def.shape]\n if (!shape) throw new Error(`Pole \"${id}\" needs the shape \"${def.shape}\", which is not registered`)\n return { def, build: (b, o) => shape(b, def.spec, o) }\n },\n }\n\n const core: UrbanKitCore = {\n poles,\n streets: {\n road: (b: UrbanBuilder, x: number, z: number, w: number, l: number, along: 'x' | 'z') => drawRoad(b, x, z, w, l, along, options.streets),\n walk: (b: UrbanBuilder, x: number, z: number, w: number, d: number) => drawWalk(b, x, z, w, d, options.streets),\n ground: drawGround,\n grid: (b: UrbanBuilder, g: { block: number; count: number; width: number }) => drawStreetGrid(b, g.block, g.count, g.width, options.streets),\n },\n block: {\n facades,\n building: drawBlockBuilding,\n fill: (b: UrbanBuilder, g: { cx: number; cz: number; size: number; minHeight: number; maxHeight: number } & FillBlockOptions): BlockBuilding[] =>\n fillBlock(b, g.cx, g.cz, g.size, g.minHeight, g.maxHeight, { palette: facades, draw: drawBlockBuilding, ...(towers?.presets ? { presets: towers.presets } : {}), ...g }),\n },\n props: {\n fence: drawFence,\n tent: (b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number) => drawTent(b, x, z, ry, w, d, color, propColors),\n pine: (b: UrbanBuilder, x: number, z: number, scale?: number, y?: number) => drawPine(b, x, z, scale, y, propColors),\n tree: (b: UrbanBuilder, x: number, z: number, scale?: number) => drawTree(b, x, z, scale, propColors),\n container: drawContainer,\n watchtower: (b: UrbanBuilder, x: number, z: number, searchlight?: boolean) => drawWatchtower(b, x, z, searchlight, propColors),\n sandbags: (b: UrbanBuilder, x: number, z: number, length: number, along: 'x' | 'z', rows?: number) => drawSandbags(b, x, z, length, along, rows, propColors),\n label: (b: UrbanBuilder, x: number, z: number, title: string, subtitle: string) => drawStripLabel(b, x, z, title, subtitle, propColors),\n wires: (b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number) => drawWires(b, points, y, color, propColors),\n },\n }\n /** A builder with its own seeded generator and light budget. */\n const builder = (o: BuilderOptions = {}): UrbanBuilder =>\n createUrbanBuilder(o.random ?? createSilhouetteRandom(o.seed ?? DEFAULT_URBAN_SEED), { budget: createLightAllowance(o.budget ?? lightBudget) })\n const neighbourhoods = {\n ids: (): string[] => [...patterns.keys()],\n get(id: string) {\n const pattern = patterns.get(id)\n if (!pattern) throw new Error(`Unknown neighbourhood pattern \"${id}\"`)\n const composer = composers[pattern.compose]\n if (!composer) throw new Error(`Pattern \"${id}\" needs the composer \"${pattern.compose}\", which is not registered`)\n return {\n pattern,\n /** Draws the pattern at `origin` and gives back what it put there. */\n compose: (b: UrbanBuilder, origin: Origin, o?: ComposeOptions): UrbanPlan => composePattern(core, pattern, composer, b, origin, o),\n marker: (origin: Origin, locale?: Locale) => patternMarker(pattern, origin, locale),\n }\n },\n /** The Galeria's sample sheet: the ground, then each pattern in its cell, in the order the page builds them. */\n composeSampleSheet(b: UrbanBuilder, o: SampleSheetOptions = {}) {\n if (o.ground !== false) drawGround(b, (o.ground ?? SAMPLE_GROUND).color, (o.ground ?? SAMPLE_GROUND).size)\n const cells = { ...SAMPLE_CELLS, ...o.cells }\n const plans: UrbanPlan[] = []\n for (const id of o.ids ?? [...patterns.keys()]) {\n const cell = cells[id]\n if (!cell) throw new Error(`The sample sheet has no cell for \"${id}\"`)\n plans.push(neighbourhoods.get(id).compose(b, cell, o))\n }\n return { plans, markers: plans.map((plan) => neighbourhoods.get(plan.id).marker(plan.origin, o.locale)) }\n },\n }\n /** A ground from its layers (see TerrainOptions): the numbers of the place are the game's. */\n const terrain = (o: TerrainOptions): Terrain => createTerrain(o)\n const cities = createCities({\n maxFloors: options.cities?.maxFloors,\n packs: { kinds: options.packs?.districtKinds, plans: options.packs?.cityPlans },\n patch: { kinds: options.patch?.districtKinds, plans: options.patch?.cityPlans },\n remove: { kinds: options.remove?.districtKinds, plans: options.remove?.cityPlans },\n presets: towers?.presets ?? DEFAULT_TOWER_PRESETS,\n fill: core.block.fill,\n })\n return { ...core, poles, cities, builder, neighbourhoods, terrain, drawTerrain, towers: { enabled: towers !== null, options: towers } }\n}\n","import { createChalet, createColonialHouse, createCompanyHouse, createDetachedHouse, createFarmhouse, createSlabHouse, createStiltHouse, createTwoStoreyHouse } from '@adatechnology/game-floorplan'\n\nimport type { HouseProvider, HouseRequest, SilhouetteFactory } from './types'\nimport type { Silhouette } from '../types'\n\nconst DEFAULT_WIDTH = 8\nconst DEFAULT_DEPTH = 10\nconst DEFAULT_COLOR = 0xc8b898\n\n/** Turns the group a silhouette starts with (the page turns a colonial or company house after drawing it). */\nfunction turned(silhouette: Silhouette, ry: number | undefined): Silhouette {\n const first = silhouette.parts[0]\n if (ry === undefined || !first || first.shape !== 'group') return silhouette\n return { ...silhouette, parts: [{ ...first, ry }, ...silhouette.parts.slice(1)] }\n}\n\n/** The far-away silhouettes of game-floorplan as the typologies of the default house provider. */\nexport const SILHOUETTE_TYPOLOGIES: Readonly<Record<string, SilhouetteFactory>> = {\n two_storey: (r, random) => createTwoStoreyHouse({ x: r.x, z: r.z, width: r.width ?? DEFAULT_WIDTH, depth: r.depth ?? DEFAULT_DEPTH, color: r.color ?? DEFAULT_COLOR, roofColor: r.roofColor, ry: r.ry, random }),\n detached: (r, random) => createDetachedHouse({ x: r.x, z: r.z, width: r.width ?? DEFAULT_WIDTH, depth: r.depth ?? DEFAULT_DEPTH, color: r.color ?? DEFAULT_COLOR, roofColor: r.roofColor, ry: r.ry, isBoarded: r.isBoarded, random }),\n slab: (r, random) => createSlabHouse({ x: r.x, z: r.z, width: r.width ?? 7, depth: r.depth ?? 8, floors: r.floors ?? 1, color: r.color ?? 0xa8a49c, random }),\n colonial: (r, random) => turned(createColonialHouse({ x: r.x, z: r.z, width: r.width ?? 7, color: r.color ?? 0xd0c4a8, hasDoor: r.hasDoor ?? false, random }), r.ry),\n chalet: (r, random) => createChalet({ x: r.x, z: r.z, color: r.color, ry: r.ry, random }),\n company_house: (r, random) => turned(createCompanyHouse({ x: r.x, z: r.z, color: r.color, random }), r.ry),\n stilt: (r, random) => createStiltHouse({ x: r.x, z: r.z, color: r.color, random }),\n farmhouse: (r, random) => createFarmhouse({ x: r.x, z: r.z, random }),\n}\n\n/** The default provider: the silhouette of game-floorplan for the typology, added to the builder with its shared random. */\nexport function createSilhouetteHouses(typologies: Readonly<Record<string, SilhouetteFactory>> = SILHOUETTE_TYPOLOGIES): HouseProvider {\n return (typology, request: HouseRequest, b) => {\n const factory = typologies[typology]\n if (!factory) throw new Error(`The house provider has no typology \"${typology}\"`)\n b.add(factory(request, b.random))\n }\n}\n","import type { UrbanBuilder } from '../scene'\nimport { createSilhouetteHouses } from './houses'\nimport type { ComposeContext, ComposeOptions, Composer, Locale, NeighbourhoodPattern, Providers, UrbanKitCore, UrbanPlan } from './types'\n\nconst LABEL_OFFSET_Z = 28\nconst DEFAULT_LOCALE: Locale = 'pt-BR'\nconst SAMPLE_GROUND = { color: 0x1e2124, size: 500 }\n\nexport type Origin = { x: number; z: number }\n\n/** Draws one pattern at `origin`: its composer, then the board with the title and the caption. */\nexport function composePattern(kit: UrbanKitCore, pattern: NeighbourhoodPattern, composer: Composer, b: UrbanBuilder, origin: Origin, options: ComposeOptions = {}): UrbanPlan {\n const locale = options.locale ?? DEFAULT_LOCALE\n const providers: Providers = options.providers ?? {}\n const house = providers.house ?? createSilhouetteHouses()\n const plan: UrbanPlan = { id: pattern.id, origin: { ...origin }, houses: [], buildings: [], poles: [], vehicles: [], plants: [] }\n const context: ComposeContext = {\n kit,\n b,\n pattern,\n params: pattern.params,\n x0: origin.x,\n z0: origin.z,\n plan,\n isLit: (share) => share >= 1 || b.random() < share,\n pole: ({ id, ...rest }) => {\n kit.poles.get(id ?? pattern.pole).build(b, rest)\n plan.poles.push({ pole: id ?? pattern.pole, x: rest.x, z: rest.z, on: rest.on ?? true })\n },\n house: (typology, request) => {\n house(typology, request, b)\n plan.houses.push({ typology, x: request.x, z: request.z, ry: request.ry ?? 0 })\n },\n vehicle: (request) => {\n providers.vehicle?.(request, b)\n plan.vehicles.push(request)\n },\n plant: (request) => {\n if (providers.plant) providers.plant(request, b)\n else if (request.kind === 'pine') kit.props.pine(b, request.x, request.z, request.scale)\n else kit.props.tree(b, request.x, request.z, request.scale)\n plan.plants.push(request)\n },\n building: (x, z, width, depth, height, color, o) => {\n plan.buildings.push(kit.block.building(b, x, z, width, depth, height, color, o))\n },\n }\n composer(context)\n const text = pattern.text[locale] ?? pattern.text[DEFAULT_LOCALE]\n kit.props.label(b, origin.x, origin.z + LABEL_OFFSET_Z, text.title, text.caption)\n return plan\n}\n\n/** The marker (map pin) of a pattern at an origin: where it stands, how high, and what it says. */\nexport function patternMarker(pattern: NeighbourhoodPattern, origin: Origin, locale: Locale = DEFAULT_LOCALE): { x: number; y: number; z: number; label: string; detail: string } {\n const text = pattern.text[locale] ?? pattern.text[DEFAULT_LOCALE]\n return { x: origin.x, y: pattern.marker.height, z: origin.z + (pattern.marker.dz ?? 0), label: text.label, detail: text.detail }\n}\n\nexport type SampleSheetOptions = ComposeOptions & {\n /** Ids to draw, in this order. Default all of the kit's patterns in the page's order. */\n ids?: readonly string[]\n /** Where each pattern stands. Default the Galeria's grid. */\n cells?: Readonly<Record<string, Origin>>\n /** Colour and size of the ground under the sheet; false for none. */\n ground?: { color: number; size: number } | false\n}\n\nexport { SAMPLE_GROUND }\n","import type { Composer } from './types'\n\n/** Every composer reads its numbers from `pattern.params`; the defaults are in `patterns.ts`. */\n\nexport type DowntownParams = {\n roadLength: number\n roadColor: number\n median: { width: number; height: number; color: number }\n poles: { from: number; to: number }\n buildings: { perRow: number; first: number; pitch: number; rowOffset: number; size: number; north: { minHeight: number; range: number; lit: number }; south: { minHeight: number; range: number; lit: number } }\n walks: { offset: number; length: number }\n car: { dx: number; dz: number; ry: number; color: number }\n}\n\n/** Avenue: LED poles down the median, two rows of tall buildings, a walk each side and a parked car. */\nexport const composeDowntown: Composer<DowntownParams> = ({ b, kit, pattern, params, x0, z0, pole, building, vehicle }) => {\n b.plane(x0, 0.02, z0, params.roadLength, pattern.streetWidth, params.roadColor)\n b.box(x0, 0, z0, params.roadLength, params.median.height, params.median.width, params.median.color)\n for (let u = params.poles.from; u <= params.poles.to; u += pattern.spacing) pole({ x: x0 + u, z: z0, on: true })\n const { buildings } = params\n for (let i = 0; i < buildings.perRow; i++) {\n const x = x0 + buildings.first + i * buildings.pitch\n const northHeight = buildings.north.minHeight + b.random() * buildings.north.range\n building(x, z0 - buildings.rowOffset, buildings.size, buildings.size, northHeight, b.pick(kit.block.facades), { lit: buildings.north.lit })\n building(x, z0 + buildings.rowOffset, buildings.size, buildings.size, buildings.south.minHeight + b.random() * buildings.south.range, b.pick(kit.block.facades), { lit: buildings.south.lit })\n }\n kit.streets.walk(b, x0, z0 - params.walks.offset, params.walks.length, pattern.walkWidth)\n kit.streets.walk(b, x0, z0 + params.walks.offset, params.walks.length, pattern.walkWidth)\n vehicle({ x: x0 + params.car.dx, z: z0 + params.car.dz, ry: params.car.ry, color: params.car.color })\n}\n\nexport type SuburbParams = {\n roadLength: number\n walkOffset: number\n houses: { count: number; first: number; pitch: number; north: { z: number; typologies: readonly [string, string]; colors: readonly number[] }; south: { z: number; colors: readonly number[] }; roofColor: number; width: number; depth: number }\n walls: { color: number; height: number; thickness: number; offset: number; gateColor: number; gateWidth: number; gateHeight: number; gateOffset: number; gateInset: number; length: number }\n poles: { at: readonly number[]; z: number; transformerFrom: number }\n wires: { half: number; height: number }\n}\n\n/** Houses and two-storey houses behind low walls, concrete poles on the north side with the wires between them. */\nexport const composeSuburb: Composer<SuburbParams> = ({ b, kit, pattern, params, x0, z0, pole, house, isLit }) => {\n kit.streets.road(b, x0, z0, pattern.streetWidth, params.roadLength, 'x')\n kit.streets.walk(b, x0, z0 - params.walkOffset, params.roadLength, pattern.walkWidth)\n kit.streets.walk(b, x0, z0 + params.walkOffset, params.roadLength, pattern.walkWidth)\n const { houses, walls } = params\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house(houses.north.typologies[i % 2 ? 0 : 1], { x, z: z0 + houses.north.z, width: houses.width, depth: houses.depth, color: b.pick(houses.north.colors), roofColor: houses.roofColor, ry: 0 })\n b.box(x, 0, z0 - walls.offset, walls.length, walls.height, walls.thickness, walls.color)\n b.box(x + walls.gateOffset, 0, z0 - walls.gateInset, walls.gateWidth, walls.gateHeight, 0.06, walls.gateColor)\n b.box(x, 0, z0 + walls.offset, walls.length, walls.height, walls.thickness, walls.color)\n b.box(x - walls.gateOffset, 0, z0 + walls.gateInset, walls.gateWidth, walls.gateHeight, 0.06, walls.gateColor)\n }\n for (const u of params.poles.at) pole({ x: x0 + u, z: z0 + params.poles.z, dir: 1, on: isLit(pattern.lit), transformer: u > params.poles.transformerFrom })\n kit.props.wires(b, [[x0 - params.wires.half, z0 + params.poles.z], [x0 + params.wires.half, z0 + params.poles.z]], params.wires.height)\n for (let i = 0; i < houses.count; i++) {\n house('detached', { x: x0 + houses.first + i * houses.pitch, z: z0 + houses.south.z, width: houses.width, depth: houses.depth, color: b.pick(houses.south.colors), roofColor: houses.roofColor, ry: Math.PI })\n }\n}\n\nexport type WorkingClassParams = {\n houses: { count: number; first: number; pitch: number; width: number; depth: number; north: { z: number; colors: readonly number[] }; south: { z: number; colors: readonly number[] }; maxFloors: number }\n poles: { from: number; to: number; z: number; jitter: number }\n wires: { count: number; from: number; to: number; z: number; step: number; height: number; heightStep: number; sag: number; color: number }\n}\n\n/** Slab houses of one to three floors in two rows, concrete poles half burnt out and a tangle of wires. */\nexport const composeWorkingClass: Composer<WorkingClassParams> = ({ b, kit, pattern, params, x0, z0, pole, house, isLit }) => {\n kit.streets.road(b, x0, z0, pattern.streetWidth, 60, 'x')\n const { houses } = params\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house('slab', { x, z: z0 + houses.north.z, width: houses.width, depth: houses.depth, floors: 1 + Math.floor(b.random() * houses.maxFloors), color: b.pick(houses.north.colors) })\n house('slab', { x, z: z0 + houses.south.z, width: houses.width, depth: houses.depth, floors: 1 + Math.floor(b.random() * houses.maxFloors), color: b.pick(houses.south.colors) })\n }\n for (let u = params.poles.from; u <= params.poles.to; u += pattern.spacing + b.random() * params.poles.jitter) pole({ x: x0 + u, z: z0 + params.poles.z, dir: 1, on: isLit(pattern.lit), transformer: true })\n const { wires } = params\n for (let k = 0; k < wires.count; k++) {\n kit.props.wires(b, [[x0 + wires.from, z0 + wires.z + k * wires.step], [x0 + wires.to, z0 + wires.z + (b.random() - 0.5) * wires.sag]], wires.height + k * wires.heightStep, wires.color)\n }\n}\n\nexport type HistoricParams = {\n cobbles: { y: number; length: number; color: number; from: number; to: number; step: number; spread: number; sizes: readonly [number, number, number]; colors: readonly number[] }\n rows: { from: number; to: number; minWidth: number; widthSteps: number; north: { z: number; colors: readonly number[] }; south: { z: number; colors: readonly number[] } }\n poles: { from: number; to: number; step: number; z: number; sideOffset: number }\n}\n\n/** A cobbled street between rows of colonial houses wall to wall, with cast-iron lanterns. */\nexport const composeHistoricStreet: Composer<HistoricParams> = ({ b, pattern, params, x0, z0, pole, house, isLit }) => {\n const { cobbles, rows } = params\n b.plane(x0, cobbles.y, z0, cobbles.length, pattern.streetWidth, cobbles.color)\n for (let u = cobbles.from; u < cobbles.to; u += cobbles.step) b.item(x0 + u, cobbles.y, z0 + (b.random() - 0.5) * cobbles.spread, cobbles.sizes[0], cobbles.sizes[1], cobbles.sizes[2], b.pick(cobbles.colors))\n for (const side of [rows.north, rows.south] as const) {\n let x = x0 + rows.from\n while (x < x0 + rows.to) {\n const width = rows.minWidth + Math.floor(b.random() * rows.widthSteps)\n house('colonial', { x: x + width / 2, z: z0 + side.z, width, color: b.pick(side.colors), hasDoor: true, ry: side === rows.south ? Math.PI : undefined })\n x += width\n }\n }\n for (let u = params.poles.from; u <= params.poles.to; u += params.poles.step) {\n for (const s of [-1, 1]) pole({ x: x0 + u + (s > 0 ? params.poles.sideOffset : 0), z: z0 + s * params.poles.z, on: isLit(pattern.lit) })\n }\n}\n\nexport type IndustrialParams = {\n yard: { length: number; color: number }\n hangar: { x: number; z: number; width: number; height: number; depth: number; color: number; roofColor: number; roofRadius: number; roofY: number; doorColor: number; doorWidth: number; doorHeight: number; stripeColor: number }\n towers: readonly { dx: number; dz: number; on: boolean }[]\n container: { dx: number; dz: number; ry: number; color: number }\n}\n\n/** A paved yard with two hangars under barrel roofs, floodlight towers and a container. */\nexport const composeIndustrial: Composer<IndustrialParams> = ({ b, kit, pattern, params, x0, z0, pole }) => {\n b.plane(x0, 0.02, z0, params.yard.length, pattern.streetWidth, params.yard.color)\n const { hangar } = params\n for (const s of [-1, 1]) {\n const g = b.group(x0 + s * hangar.x, 0, z0 + hangar.z)\n b.box(0, 0, 0, hangar.width, hangar.height, hangar.depth, hangar.color, { parent: g })\n b.vault({ x: 0, y: hangar.roofY, z: 0, radius: hangar.roofRadius, length: hangar.depth, arc: Math.PI, segments: 16, color: hangar.roofColor, rotation: { x: Math.PI / 2, y: 0, z: Math.PI / 2 }, scale: { x: 1, y: 1, z: 0.25 }, parent: g })\n b.box(0, 0, hangar.depth / 2 + 0.05, hangar.doorWidth, hangar.doorHeight, 0.1, hangar.doorColor, { parent: g })\n b.box(0, 6, hangar.depth / 2 + 0.06, 10, 1.2, 0.05, hangar.stripeColor, { parent: g })\n }\n for (const tower of params.towers) pole({ x: x0 + tower.dx, z: z0 + tower.dz, on: tower.on })\n kit.props.container(b, x0 + params.container.dx, 0, z0 + params.container.dz, params.container.ry, params.container.color)\n}\n\nexport type RailwayParams = {\n houses: { count: number; first: number; pitch: number; north: { z: number; colors: readonly number[] }; south: { z: number; color: number } }\n poles: { at: readonly number[]; z: number; transformerFrom: number }\n wires: { half: number; height: number }\n}\n\n/** Company houses in a row, all alike, with residential poles and a single wire. */\nexport const composeRailwayVillage: Composer<RailwayParams> = ({ b, kit, pattern, params, x0, z0, pole, house, isLit }) => {\n kit.streets.road(b, x0, z0, pattern.streetWidth, 60, 'x')\n const { houses } = params\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house('company_house', { x, z: z0 + houses.north.z, color: b.pick(houses.north.colors) })\n house('company_house', { x, z: z0 + houses.south.z, color: houses.south.color, ry: Math.PI })\n }\n for (const u of params.poles.at) pole({ x: x0 + u, z: z0 + params.poles.z, dir: 1, on: isLit(pattern.lit), transformer: u > params.poles.transformerFrom })\n kit.props.wires(b, [[x0 - params.wires.half, z0 + params.poles.z], [x0 + params.wires.half, z0 + params.poles.z]], params.wires.height)\n}\n\nexport type MountainParams = {\n road: { y: number; length: number; color: number }\n chalets: { count: number; first: number; pitch: number; northZ: number; southZ: number; southShift: number; northColors: readonly number[]; southColors: readonly number[] }\n poles: { from: number; to: number; step: number; z: number; sideOffset: number }\n pines: { count: number; first: number; span: number; rowZ: number; minScale: number; scaleRange: number }\n}\n\n/** A mountain-resort street: wooden chalets, cast-iron lanterns and pines at both edges. */\nexport const composeMountainResort: Composer<MountainParams> = ({ b, pattern, params, x0, z0, pole, house, plant, isLit }) => {\n b.plane(x0, params.road.y, z0, params.road.length, pattern.streetWidth, params.road.color)\n const { chalets } = params\n for (let i = 0; i < chalets.count; i++) {\n house('chalet', { x: x0 + chalets.first + i * chalets.pitch, z: z0 + chalets.northZ, color: b.pick(chalets.northColors) })\n house('chalet', { x: x0 + chalets.first + i * chalets.pitch + chalets.southShift, z: z0 + chalets.southZ, color: b.pick(chalets.southColors), ry: Math.PI })\n }\n for (let u = params.poles.from; u <= params.poles.to; u += params.poles.step) {\n for (const s of [-1, 1]) pole({ x: x0 + u + (s > 0 ? params.poles.sideOffset : 0), z: z0 + s * params.poles.z, on: isLit(pattern.lit) })\n }\n const { pines } = params\n for (let i = 0; i < pines.count; i++) plant({ kind: 'pine', x: x0 + pines.first + b.random() * pines.span, z: z0 + (b.random() < 0.5 ? -pines.rowZ : pines.rowZ), scale: pines.minScale + b.random() * pines.scaleRange })\n}\n\nexport type StiltParams = {\n water: { y: number; z: number; length: number; depth: number; color: number; roughness: number; metalness: number }\n bank: { z: number; length: number; depth: number; color: number }\n boardwalk: { y: number; length: number; width: number; color: number; pilesFrom: number; pilesTo: number; pilesStep: number }\n houses: { count: number; first: number; pitch: number; z: number; colors: readonly number[]; lantern: { dx: number; y: number; dz: number; lit: number; unlit: number } }\n lamp: { dx: number; y: number; dz: number; color: number; intensity: number; distance: number }\n boat: { dx: number; dz: number; color: number }\n}\n\n/** Stilt houses over water along a boardwalk, with no public lighting: a lantern on each odd house and a lamp light. */\nexport const composeStiltVillage: Composer<StiltParams> = ({ b, params, x0, z0, house }) => {\n const { water, bank, boardwalk, houses } = params\n b.plane(x0, water.y, z0 + water.z, water.length, water.depth, water.color, { roughness: water.roughness, metalness: water.metalness })\n b.box(x0, 0, z0 + bank.z, bank.length, 0.2, bank.depth, bank.color)\n b.box(x0, boardwalk.y, z0, boardwalk.length, 0.2, boardwalk.width, boardwalk.color)\n for (let u = boardwalk.pilesFrom; u <= boardwalk.pilesTo; u += boardwalk.pilesStep) b.cylinder(x0 + u, -1.5, z0 + 0.9, 0.1, 0.1, 2.9, 0x3a2a1c, -1, 5)\n for (let i = 0; i < houses.count; i++) {\n const x = x0 + houses.first + i * houses.pitch\n house('stilt', { x, z: z0 + houses.z, color: b.pick(houses.colors) })\n const lit = i % 2 === 1\n b.box(x + houses.lantern.dx, houses.lantern.y, z0 + houses.lantern.dz, 0.2, 0.28, 0.2, lit ? houses.lantern.lit : houses.lantern.unlit, { emissive: lit })\n }\n b.light({ x: x0 + params.lamp.dx, y: params.lamp.y, z: z0 + params.lamp.dz, color: params.lamp.color, intensity: params.lamp.intensity, distance: params.lamp.distance })\n b.box(x0 + params.boat.dx, -0.2, z0 + params.boat.dz, 1.6, 0.5, 4.6, params.boat.color)\n}\n\nexport type MilitaryParams = {\n yard: { length: number; color: number }\n fence: { from: number; to: number; step: number; z: number; height: number; color: number; wireColor: number }\n towers: { dx: readonly number[]; dz: number }\n alarm: { dz: number; color: number; intensity: number; distance: number; y: number; lampDz: number; lampY: number }\n sandbags: { dz: number; length: number; rows: number }\n tents: { count: number; first: number; pitch: number; dz: number; width: number; depth: number }\n}\n\n/** A military perimeter: a mesh fence, watch towers with searchlights, a red emergency lamp, sandbags and tents. */\nexport const composeMilitary: Composer<MilitaryParams> = ({ b, kit, pattern, params, x0, z0 }) => {\n b.plane(x0, 0.02, z0, params.yard.length, pattern.streetWidth, params.yard.color)\n const { fence } = params\n for (let u = fence.from; u <= fence.to; u += fence.step) b.cylinder(x0 + u, 0, z0 + fence.z, 0.06, 0.06, 3, fence.color, -1, 4)\n b.line([[x0 + fence.from, 2.9, z0 + fence.z], [x0 + fence.to, 2.9, z0 + fence.z]], fence.wireColor)\n for (const u of params.towers.dx) kit.props.watchtower(b, x0 + u, z0 + params.towers.dz, true)\n const { alarm } = params\n b.light({ x: x0, y: alarm.y, z: z0 + alarm.dz, color: alarm.color, intensity: alarm.intensity, distance: alarm.distance })\n b.box(x0, alarm.lampY, z0 + alarm.lampDz, 0.3, 0.3, 0.3, alarm.color, { emissive: true })\n kit.props.sandbags(b, x0, z0 + params.sandbags.dz, params.sandbags.length, 'x', params.sandbags.rows)\n for (let i = 0; i < params.tents.count; i++) kit.props.tent(b, x0 + params.tents.first + i * params.tents.pitch, z0 + params.tents.dz, 0, params.tents.width, params.tents.depth)\n}\n\nexport type RuralParams = {\n road: { length: number; color: number }\n field: { y: number; dz: number; length: number; depth: number; color: number }\n farmhouse: { dx: number; dz: number }\n pole: { dx: number; dz: number }\n fence: { dz: number; half: number; height: number; color: number }\n trees: { count: number; first: number; span: number; dz: number; spread: number; minScale: number; scaleRange: number }\n crops: { rows: number; perRow: number; first: number; pitch: number; dz: number; rowPitch: number; width: number; minHeight: number; heightRange: number; color: number }\n}\n\n/** A farm: dirt road, farmhouse with a veranda, one wooden pole at the junction, a fence, trees and rows of crops. */\nexport const composeRural: Composer<RuralParams> = ({ b, pattern, params, x0, z0, pole, house, plant }) => {\n b.plane(x0, 0.02, z0, params.road.length, pattern.streetWidth, params.road.color)\n b.plane(x0, params.field.y, z0 + params.field.dz, params.field.length, params.field.depth, params.field.color)\n house('farmhouse', { x: x0 + params.farmhouse.dx, z: z0 + params.farmhouse.dz })\n pole({ x: x0 + params.pole.dx, z: z0 + params.pole.dz, on: true })\n b.fence(x0 - params.fence.half, z0 + params.fence.dz, x0 + params.fence.half, z0 + params.fence.dz, params.fence.height, params.fence.color)\n const { trees, crops } = params\n for (let i = 0; i < trees.count; i++) plant({ kind: 'tree', x: x0 + trees.first + b.random() * trees.span, z: z0 + trees.dz + b.random() * trees.spread, scale: trees.minScale + b.random() * trees.scaleRange })\n for (let r = 0; r < crops.rows; r++) {\n for (let i = 0; i < crops.perRow; i++) b.item(x0 + crops.first + i * crops.pitch, 0, z0 + crops.dz + r * crops.rowPitch, crops.width, crops.minHeight + b.random() * crops.heightRange, crops.width, crops.color)\n }\n}\n\n/** The composers the ten default patterns use; a game adds its own through `createUrban({ composers })`. */\nexport const COMPOSERS: Readonly<Record<string, Composer>> = {\n downtown: composeDowntown,\n suburb: composeSuburb,\n working_class: composeWorkingClass,\n historic_street: composeHistoricStreet,\n industrial_port: composeIndustrial,\n railway_village: composeRailwayVillage,\n mountain_resort: composeMountainResort,\n stilt_village: composeStiltVillage,\n military: composeMilitary,\n rural: composeRural,\n}\n","import { COMPOSERS } from './composers'\nimport type { DowntownParams, HistoricParams, IndustrialParams, MilitaryParams, MountainParams, RailwayParams, RuralParams, StiltParams, SuburbParams, WorkingClassParams } from './composers'\nimport type { NeighbourhoodPattern } from './types'\n\nconst suburb: NeighbourhoodPattern<SuburbParams> = {\n id: 'suburb',\n streetWidth: 7,\n walkWidth: 2,\n typologies: ['detached', 'two_storey'],\n pole: 'concrete_arm',\n lightColor: 0xff9a40,\n spacing: 35,\n lit: 0.75,\n compose: 'suburb',\n marker: { height: 10 },\n text: {\n 'pt-BR': { label: 'Subúrbio', title: 'SUBÚRBIO', caption: 'casa térrea e sobrado · muro 1,8 m · sódio a cada 35 m', detail: 'Casa térrea e sobrado, muro de 1,8 m. Poste de concreto com sódio laranja.' },\n en: { label: 'Suburb', title: 'SUBURB', caption: 'one-storey and two-storey houses · 1.8 m wall · sodium every 35 m', detail: 'One-storey and two-storey houses behind a 1.8 m wall. Concrete pole with an orange sodium lamp.' },\n },\n params: {\n roadLength: 60,\n walkOffset: 4.5,\n houses: { count: 5, first: -24, pitch: 12, north: { z: -15, typologies: ['two_storey', 'detached'], colors: [0xc8b89a, 0xa8b0a0, 0xd0c0a0, 0xb8a890] }, south: { z: 15, colors: [0xc8b89a, 0xa8b0a0, 0xd0c0a0] }, roofColor: 0x6a3a2a, width: 8, depth: 10 },\n walls: { color: 0xbab2a0, height: 1.8, thickness: 0.2, offset: 5.8, gateColor: 0x3a3a3a, gateWidth: 2.4, gateHeight: 1.6, gateOffset: 3.5, gateInset: 5.7, length: 10 },\n poles: { at: [-26, 9], z: -4.8, transformerFrom: 0 },\n wires: { half: 28, height: 6.9 },\n },\n}\n\nconst downtown: NeighbourhoodPattern<DowntownParams> = {\n id: 'downtown',\n streetWidth: 14,\n walkWidth: 3,\n typologies: ['city_building'],\n pole: 'led_double',\n lightColor: 0xdfe8ff,\n spacing: 25,\n lit: 1,\n compose: 'downtown',\n marker: { height: 14 },\n text: {\n 'pt-BR': { label: 'Centro', title: 'CENTRO', caption: 'avenida 2 × 7 m · LED branco a cada 25 m', detail: 'Prédio residencial e comercial de 4 a 12 andares. Poste metálico duplo, LED branco.' },\n en: { label: 'Downtown', title: 'DOWNTOWN', caption: 'avenue 2 × 7 m · white LED every 25 m', detail: 'Residential and commercial buildings of 4 to 12 floors. Double steel pole, white LED.' },\n },\n params: {\n roadLength: 60,\n roadColor: 0x222428,\n median: { width: 1.6, height: 0.18, color: 0x3a4a2c },\n poles: { from: -26, to: 26 },\n buildings: { perRow: 4, first: -21, pitch: 14, rowOffset: 18, size: 12, north: { minHeight: 12, range: 24, lit: 0.1 }, south: { minHeight: 12, range: 18, lit: 0.08 } },\n walks: { offset: 10, length: 60 },\n car: { dx: -8, dz: -3, ry: 1.57, color: 0x6b6450 },\n },\n}\n\nconst workingClass: NeighbourhoodPattern<WorkingClassParams> = {\n id: 'working_class',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['slab'],\n pole: 'concrete_arm',\n lightColor: 0xff9a40,\n spacing: 36,\n lit: 0.5,\n compose: 'working_class',\n marker: { height: 10 },\n text: {\n 'pt-BR': { label: 'Bairro popular', title: 'BAIRRO POPULAR', caption: \"lajes de 1 a 3 · caixa d'água azul · metade das luzes queimadas\", detail: 'Casas geminadas de laje, fios emaranhados, metade das luzes queimadas.' },\n en: { label: 'Working-class quarter', title: 'WORKING-CLASS QUARTER', caption: 'slab houses of 1 to 3 floors · blue water tank · half the lamps burnt out', detail: 'Row slab houses, tangled wires, half the lamps burnt out.' },\n },\n params: {\n houses: { count: 10, first: -27, pitch: 6, width: 5.6, depth: 10, north: { z: -9, colors: [0xa0624a, 0x9a6a54, 0x8a5a44] }, south: { z: 9, colors: [0xa0624a, 0x9a6a54, 0xc8c0b0] }, maxFloors: 3 },\n poles: { from: -24, to: 26, z: -3.5, jitter: 8 },\n wires: { count: 4, from: -26, to: 26, z: -3.5, step: 0.15, height: 6.3, heightStep: 0.25, sag: 2, color: 0x1a1a1a },\n },\n}\n\nconst historicStreet: NeighbourhoodPattern<HistoricParams> = {\n id: 'historic_street',\n streetWidth: 5,\n walkWidth: 0,\n typologies: ['colonial'],\n pole: 'cast_iron',\n lightColor: 0xffc880,\n spacing: 20,\n lit: 0.8,\n compose: 'historic_street',\n marker: { height: 8 },\n text: {\n 'pt-BR': { label: 'Rua histórica', title: 'RUA HISTÓRICA', caption: 'casas coloniais coladas · pedra 5 m · ferro fundido a cada 20 m', detail: 'Casas coloniais coladas, rua de pedra, luminária de ferro fundido.' },\n en: { label: 'Historic street', title: 'HISTORIC STREET', caption: 'colonial houses wall to wall · 5 m cobbles · cast iron every 20 m', detail: 'Colonial houses wall to wall, cobbled street, cast-iron lanterns.' },\n },\n params: {\n cobbles: { y: 0.03, length: 60, color: 0x4a4642, from: -28, to: 28, step: 0.9, spread: 4, sizes: [0.8, 0.04, 0.6], colors: [0x5a5650, 0x4e4a46, 0x625e58] },\n rows: { from: -28, to: 26, minWidth: 5, widthSteps: 3, north: { z: -8, colors: [0xd8c8a0, 0xa8c0c0, 0xe0b890, 0xc0a8b8, 0xd0d0c0] }, south: { z: 8, colors: [0xd8c8a0, 0xa8c0c0, 0xe0b890, 0xc0a8b8] } },\n poles: { from: -25, to: 25, step: 20, z: 2.9, sideOffset: 10 },\n },\n}\n\nconst industrialPort: NeighbourhoodPattern<IndustrialParams> = {\n id: 'industrial_port',\n streetWidth: 40,\n walkWidth: 0,\n typologies: ['hangar'],\n pole: 'flood_tower',\n lightColor: 0xfff0d0,\n spacing: 60,\n lit: 1,\n compose: 'industrial_port',\n marker: { height: 16 },\n text: {\n 'pt-BR': { label: 'Industrial e porto', title: 'INDUSTRIAL E PORTO', caption: 'galpão (amostra encurtada) · torre de refletor a cada 60 m', detail: 'Galpões e torres de refletor de 12 m.' },\n en: { label: 'Industrial and port', title: 'INDUSTRIAL AND PORT', caption: 'warehouse (shortened sample) · floodlight tower every 60 m', detail: 'Warehouses and 12 m floodlight towers.' },\n },\n params: {\n yard: { length: 60, color: 0x2a2b2c },\n hangar: { x: 15, z: -6, width: 26, height: 10, depth: 30, color: 0x6a6c68, roofColor: 0x5a5c58, roofRadius: 13, roofY: 10, doorColor: 0x3a3a3a, doorWidth: 6, doorHeight: 5, stripeColor: 0xd8b02a },\n towers: [{ dx: -30, dz: 14, on: true }, { dx: 30, dz: 14, on: false }],\n container: { dx: 20, dz: 14, ry: 0.2, color: 0x8a3a2a },\n },\n}\n\nconst railwayVillage: NeighbourhoodPattern<RailwayParams> = {\n id: 'railway_village',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['company_house'],\n pole: 'concrete_arm',\n lightColor: 0xff9a40,\n spacing: 35,\n lit: 0.7,\n compose: 'railway_village',\n marker: { height: 8 },\n text: {\n 'pt-BR': { label: 'Vila ferroviária', title: 'VILA FERROVIÁRIA', caption: 'casas da companhia, todas iguais · poste residencial a cada 35 m', detail: 'Casas da companhia em fila, todas iguais.' },\n en: { label: 'Railway village', title: 'RAILWAY VILLAGE', caption: 'company houses, all alike · residential pole every 35 m', detail: 'Company houses in a row, all alike.' },\n },\n params: {\n houses: { count: 6, first: -25, pitch: 10, north: { z: -12, colors: [0xd8d0c0, 0xd0c8b4] }, south: { z: 12, color: 0xd8d0c0 } },\n poles: { at: [-26, 9], z: -4, transformerFrom: 0 },\n wires: { half: 26, height: 6.9 },\n },\n}\n\nconst mountainResort: NeighbourhoodPattern<MountainParams> = {\n id: 'mountain_resort',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['chalet'],\n pole: 'cast_iron',\n lightColor: 0xffc880,\n spacing: 20,\n lit: 0.7,\n compose: 'mountain_resort',\n marker: { height: 10 },\n text: {\n 'pt-BR': { label: 'Serra', title: 'SERRA · RUA DAS POUSADAS', caption: 'chalé de madeira e pedra · telhado 45° · ferro fundido a cada 20 m', detail: 'Rua das Pousadas: chalés de madeira e pedra com telhado íngreme e luminária de ferro fundido. Na Encosta, sem iluminação.' },\n en: { label: 'Mountain', title: 'MOUNTAIN · INN STREET', caption: 'wood and stone chalets · 45° roof · cast iron every 20 m', detail: 'Inn Street: wood and stone chalets with a steep roof and cast-iron lanterns. Up the slope there is no lighting.' },\n },\n params: {\n road: { y: 0.02, length: 60, color: 0x2a2a28 },\n chalets: { count: 5, first: -24, pitch: 12, northZ: -12, southZ: 12, southShift: 6, northColors: [0x6b4a30, 0x5a3e28, 0x7a5a3a], southColors: [0x6b4a30, 0x5a3e28] },\n poles: { from: -25, to: 25, step: 20, z: 2.6, sideOffset: 10 },\n pines: { count: 10, first: -28, span: 56, rowZ: 22, minScale: 1.4, scaleRange: 1 },\n },\n}\n\nconst stiltVillage: NeighbourhoodPattern<StiltParams> = {\n id: 'stilt_village',\n streetWidth: 2,\n walkWidth: 0,\n typologies: ['stilt'],\n pole: '',\n lightColor: 0xffb060,\n spacing: 0,\n lit: 1,\n compose: 'stilt_village',\n marker: { height: 7 },\n text: {\n 'pt-BR': { label: 'Palafitas', title: 'PALAFITAS', caption: 'madeira sobre estacas · sem luz pública · lampião', detail: 'Vila dos Pescadores: sem iluminação pública, só lampião.' },\n en: { label: 'Stilt village', title: 'STILT VILLAGE', caption: 'timber on piles · no public lighting · lanterns', detail: 'Fishermen\\'s village: no public lighting, only lanterns.' },\n },\n params: {\n water: { y: 0.04, z: -2, length: 60, depth: 30, color: 0x22343e, roughness: 0.25, metalness: 0.3 },\n bank: { z: 14, length: 60, depth: 8, color: 0x4a4436 },\n boardwalk: { y: 1.3, length: 56, width: 2, color: 0x5a4630, pilesFrom: -26, pilesTo: 26, pilesStep: 4 },\n houses: { count: 5, first: -22, pitch: 11, z: -7, colors: [0x6a5a46, 0x5a6a6a, 0x7a5a46], lantern: { dx: 1.5, y: 3.2, dz: -3.4, lit: 0xffc070, unlit: 0x3a3a3a } },\n lamp: { dx: -11, y: 3, dz: -3, color: 0xffb060, intensity: 0.9, distance: 10 },\n boat: { dx: 14, dz: 6, color: 0x5a3a2a },\n },\n}\n\nconst military: NeighbourhoodPattern<MilitaryParams> = {\n id: 'military',\n streetWidth: 40,\n walkWidth: 0,\n typologies: ['tent'],\n pole: '',\n lightColor: 0xe6eeff,\n spacing: 40,\n lit: 1,\n compose: 'military',\n marker: { height: 12, dz: -14 },\n text: {\n 'pt-BR': { label: 'Militar', title: 'MILITAR', caption: 'torre de vigia e tripé · holofote branco · luz vermelha · a cada 40 m', detail: 'Base, bloqueio e penitenciária: torres com holofote branco e luz vermelha de emergência no perímetro.' },\n en: { label: 'Military', title: 'MILITARY', caption: 'watch tower and tripod · white searchlight · red lamp · every 40 m', detail: 'Base, roadblock and penitentiary: towers with a white searchlight and a red emergency lamp on the perimeter.' },\n },\n params: {\n yard: { length: 60, color: 0x3a3a30 },\n fence: { from: -28, to: 28, step: 4, z: -12, height: 3, color: 0x6a6c6e, wireColor: 0x9a9a9a },\n towers: { dx: [-20, 20], dz: -14 },\n alarm: { dz: -10, color: 0xff2a1a, intensity: 1.2, distance: 16, y: 3, lampDz: -11.7, lampY: 2.6 },\n sandbags: { dz: -6, length: 10, rows: 3 },\n tents: { count: 3, first: -14, pitch: 14, dz: 8, width: 6, depth: 8 },\n },\n}\n\nconst rural: NeighbourhoodPattern<RuralParams> = {\n id: 'rural',\n streetWidth: 6,\n walkWidth: 0,\n typologies: ['farmhouse'],\n pole: 'wood_crossarm',\n lightColor: 0xffd27a,\n spacing: 0,\n lit: 1,\n compose: 'rural',\n marker: { height: 7 },\n text: {\n 'pt-BR': { label: 'Rural', title: 'RURAL', caption: 'casa sede com varanda · poste de madeira só no cruzamento', detail: 'Casa sede com varanda. Luz só em cruzamentos e sedes.' },\n en: { label: 'Rural', title: 'RURAL', caption: 'farmhouse with a veranda · wooden pole only at the junction', detail: 'Farmhouse with a veranda. Light only at junctions and farmhouses.' },\n },\n params: {\n road: { length: 60, color: 0x4a3a2a },\n field: { y: 0.01, dz: 15, length: 60, depth: 22, color: 0x3a4a2a },\n farmhouse: { dx: -10, dz: -14 },\n pole: { dx: 6, dz: -4 },\n fence: { dz: -4, half: 28, height: 1.2, color: 0x5a4630 },\n trees: { count: 8, first: 8, span: 20, dz: -16, spread: 10, minScale: 1, scaleRange: 0.5 },\n crops: { rows: 6, perRow: 20, first: -26, pitch: 2.7, dz: 8, rowPitch: 2.2, width: 0.4, minHeight: 0.6, heightRange: 0.3, color: 0x4a5a2a },\n },\n}\n\n/** The ten patterns of the Galeria's sample sheet, in the order the page builds them. */\nexport const DEFAULT_PATTERNS: readonly NeighbourhoodPattern[] = [downtown, suburb, workingClass, historicStreet, industrialPort, railwayVillage, mountainResort, stiltVillage, military, rural]\n\n/** Where the sample sheet puts each pattern: a 3 x 3 grid 80 by 56 m apart, and the military cell off to the east. */\nexport const SAMPLE_CELLS: Readonly<Record<string, { x: number; z: number }>> = {\n downtown: { x: -80, z: -56 },\n suburb: { x: 0, z: -56 },\n working_class: { x: 80, z: -56 },\n historic_street: { x: -80, z: 0 },\n industrial_port: { x: 0, z: 0 },\n railway_village: { x: 80, z: 0 },\n mountain_resort: { x: -80, z: 56 },\n stilt_village: { x: 0, z: 56 },\n rural: { x: 80, z: 56 },\n military: { x: 160, z: 0 },\n}\n\nexport { COMPOSERS }\n","import { applyPatches, mergeById, removeIds } from '@adatechnology/game-contracts'\nimport type { DeepPartial } from '@adatechnology/game-contracts'\n\nimport type { FillBlockOptions, BlockBuilding } from '../block'\nimport type { UrbanBuilder } from '../scene'\nimport type { TowerPreset } from '../tower'\nimport type { Locale } from '../neighbourhoods/types'\nimport { DEFAULT_DISTRICT_KINDS } from './kinds'\nimport { DEFAULT_CITY_PLANS } from './templates'\nimport type {\n Block,\n CityLayout,\n CityPlanDef,\n CityPlanInput,\n DistrictKindDef,\n FillBlockCityOptions,\n KindStats,\n LayoutOptions,\n PlanLandmark,\n ResolvedDistrict,\n} from './types'\n\n/** Highest storey count a district may have unless the game raises it. */\nexport const DEFAULT_MAX_FLOORS = 60\nexport const DEFAULT_STREET = 10\nconst DEFAULT_LOCALE: Locale = 'pt-BR'\nconst DEFAULT_STOREY_PRESETS: Readonly<Record<string, string>> = { commercial: 'office', residential: 'residential' }\n\nexport type CitiesOptions = {\n /** Most storeys any district may have, applied on top of the kinds and the districts' own numbers. Default 60. */\n maxFloors?: number\n packs?: { kinds?: readonly DistrictKindDef[]; plans?: readonly CityPlanInput[] }\n patch?: { kinds?: Record<string, DeepPartial<DistrictKindDef>>; plans?: Record<string, DeepPartial<CityPlanInput>> }\n remove?: { kinds?: readonly string[]; plans?: readonly string[] }\n /** Tower presets of the kit (storey heights by use). */\n presets: readonly TowerPreset[]\n fill(b: UrbanBuilder, g: { cx: number; cz: number; size: number; minHeight: number; maxHeight: number } & FillBlockOptions): BlockBuilding[]\n}\n\nconst text = <T>(by: Record<string, T>, locale: Locale): T => (by[locale] ?? by[DEFAULT_LOCALE]) as T\nconst named = (name: string | Partial<Record<Locale, string>> | undefined, locale: Locale): string | undefined =>\n typeof name === 'string' || name === undefined ? name : (name[locale] ?? name[DEFAULT_LOCALE])\n\nconst mergeLists = <T extends { id: string }>(parent: readonly T[], own: readonly T[]): T[] => {\n const list = [...parent]\n for (const item of own) {\n const at = list.findIndex((p) => p.id === item.id)\n if (at >= 0) list[at] = item\n else list.push(item)\n }\n return list\n}\n\n/** City plans as data: district kinds and plans are registries; a plan resolves to a layout with the district at a point and the grid of blocks of a district. */\nexport function createCities(o: CitiesOptions) {\n const maxFloors = o.maxFloors ?? DEFAULT_MAX_FLOORS\n const kindEntries = mergeById(DEFAULT_DISTRICT_KINDS, o.packs?.kinds)\n applyPatches(kindEntries, o.patch?.kinds)\n removeIds(kindEntries, o.remove?.kinds)\n const planEntries = mergeById<CityPlanInput>(DEFAULT_CITY_PLANS, o.packs?.plans)\n applyPatches(planEntries, o.patch?.plans)\n removeIds(planEntries, o.remove?.plans)\n\n const registry = <T extends { id: string }>(entries: Map<string, T>, label: string) => ({\n ids: (): string[] => [...entries.keys()],\n list: (): T[] => [...entries.values()],\n has: (id: string): boolean => entries.has(id),\n get(id: string): T {\n const entry = entries.get(id)\n if (!entry) throw new Error(`Unknown ${label} \"${id}\"`)\n return entry\n },\n })\n const kinds = registry(kindEntries, 'district kind')\n const rawPlans = registry(planEntries, 'city plan')\n\n /** A plan with `extends` followed to the end: every field present. */\n const resolvePlan = (plan: CityPlanInput, seen: readonly string[] = []): CityPlanDef => {\n if (seen.includes(plan.id)) throw new Error(`City plan \"${plan.id}\" extends itself (${[...seen, plan.id].join(' > ')})`)\n const parent = plan.extends ? resolvePlan(rawPlans.get(plan.extends), [...seen, plan.id]) : undefined\n const scale = plan.scale ?? parent?.scale\n const size = plan.size ?? parent?.size\n const planText = plan.text ?? parent?.text\n if (!scale || !size || !planText) throw new Error(`City plan \"${plan.id}\" has no ${!scale ? 'scale' : !size ? 'size' : 'text'}`)\n return {\n id: plan.id,\n scale,\n size,\n text: planText,\n extends: plan.extends,\n districts: mergeLists(parent?.districts ?? [], plan.districts ?? []),\n lines: mergeLists(parent?.lines ?? [], plan.lines ?? []),\n landmarks: [...(parent?.landmarks ?? []), ...(plan.landmarks ?? [])],\n }\n }\n const plans = {\n ...rawPlans,\n /** The plan with everything inherited from the plans it extends. */\n resolve: (id: string): CityPlanDef => resolvePlan(rawPlans.get(id)),\n }\n\n const layout = (planOrId: string | CityPlanInput, options: LayoutOptions = {}): CityLayout => {\n const plan = typeof planOrId === 'string' ? plans.resolve(planOrId) : resolvePlan(planOrId)\n const locale = options.locale ?? DEFAULT_LOCALE\n const cap = Math.max(0, options.maxFloors ?? maxFloors)\n const clamp = (n: number): number => Math.min(cap, Math.max(0, n))\n const districts: ResolvedDistrict[] = plan.districts.map((d) => {\n const kind = kinds.get(d.kind)\n const kindText = text(kind.text, locale)\n const [lo, hi] = d.floors ?? kind.floors\n return {\n id: d.id,\n kind: kind.id,\n rect: d.rect,\n name: named(d.name, locale) ?? kindText.name,\n description: kindText.description,\n color: kind.color,\n zone: kind.zone,\n pattern: kind.pattern,\n floors: [clamp(lo), clamp(hi)],\n uses: d.uses ?? kind.uses,\n block: kind.block,\n }\n })\n const inside = (d: ResolvedDistrict, x: number, z: number): boolean => x >= d.rect[0] && x <= d.rect[2] && z >= d.rect[1] && z <= d.rect[3]\n const districtAt = (x: number, z: number): ResolvedDistrict | undefined => {\n for (let i = districts.length - 1; i >= 0; i--) if (inside(districts[i] as ResolvedDistrict, x, z)) return districts[i]\n return undefined\n }\n const blocks = (districtId: string, bo: { street?: number } = {}): Block[] => {\n const d = districts.find((x) => x.id === districtId)\n if (!d) throw new Error(`City plan \"${plan.id}\" has no district \"${districtId}\"`)\n const street = bo.street ?? DEFAULT_STREET\n const cell = d.block\n const side = cell - street\n if (cell <= 0 || side <= 0) return []\n const [x0, z0, x1, z1] = d.rect\n const cols = Math.floor((x1 - x0) / cell)\n const rows = Math.floor((z1 - z0) / cell)\n const ox = x0 + (x1 - x0 - cols * cell) / 2\n const oz = z0 + (z1 - z0 - rows * cell) / 2\n const found: Block[] = []\n for (let i = 0; i < cols; i++) {\n for (let j = 0; j < rows; j++) {\n const x = ox + cell * (i + 0.5)\n const z = oz + cell * (j + 0.5)\n if (districtAt(x, z)?.id !== d.id) continue\n found.push({ x, z, size: [side, side], district: d.id, building: { floors: d.floors, uses: d.uses, zone: d.zone, pattern: d.pattern } })\n }\n }\n return found\n }\n const landmarks = plan.landmarks.map((l: PlanLandmark) => {\n const { name, ...rest } = l\n const label = named(name, locale)\n return label === undefined ? rest : { ...rest, name: label }\n })\n const planText = text(plan.text, locale)\n return { id: plan.id, scale: plan.scale, size: plan.size, name: planText.name, description: planText.description, districts, lines: [...plan.lines], landmarks, districtAt, blocks }\n }\n\n /** Area, share of the painted map and number of districts by kind; an inner district takes its area from the one under it. */\n const stats = (l: CityLayout): KindStats[] => {\n const xs = [...new Set(l.districts.flatMap((d) => [d.rect[0], d.rect[2]]))].sort((a, b) => a - b)\n const zs = [...new Set(l.districts.flatMap((d) => [d.rect[1], d.rect[3]]))].sort((a, b) => a - b)\n const area = new Map<string, number>()\n let total = 0\n for (let i = 0; i + 1 < xs.length; i++) {\n for (let j = 0; j + 1 < zs.length; j++) {\n const x0 = xs[i] as number\n const z0 = zs[j] as number\n const w = (xs[i + 1] as number) - x0\n const d = (zs[j + 1] as number) - z0\n // the centre of a cell is strictly inside or outside every rectangle, so the edges' rule does not matter\n const owner = l.districtAt(x0 + w / 2, z0 + d / 2)\n if (!owner) continue\n area.set(owner.kind, (area.get(owner.kind) ?? 0) + w * d)\n total += w * d\n }\n }\n const count = new Map<string, number>()\n for (const d of l.districts) count.set(d.kind, (count.get(d.kind) ?? 0) + 1)\n return [...count.keys()]\n .map((kind) => ({ kind, area: area.get(kind) ?? 0, share: total > 0 ? (area.get(kind) ?? 0) / total : 0, districts: count.get(kind) ?? 0 }))\n .sort((a, b) => b.area - a.area)\n }\n\n /**\n * Fills a block of a layout with city buildings through `block.fill`, passing the block's own `floors` and `uses` (and `storeyPresets` / `storeyHeight` when\n * given) so `block.fill` draws the heights, the use of each building and the towers. A ground-floor shop share comes from the commercial share unless\n * given. Nothing for blocks of a kind without storeys or without a pattern.\n */\n const fillBlock = (b: UrbanBuilder, block: Block, options: FillBlockCityOptions = {}): BlockBuilding[] => {\n const { floors, uses, pattern } = block.building\n if (floors[1] <= 0 || pattern === null) return []\n const { shop, ...rest } = options\n // `minHeight` / `maxHeight` are required by the signature but unused while `floors` is given; the residential preset's storey height keeps them sensible\n const storey = options.storeyHeight ?? o.presets.find((p) => p.id === DEFAULT_STOREY_PRESETS.residential)?.storeyHeight ?? (o.presets[0]?.storeyHeight as number)\n return o.fill(b, {\n cx: block.x,\n cz: block.z,\n size: Math.min(block.size[0], block.size[1]),\n minHeight: floors[0] * storey,\n maxHeight: floors[1] * storey,\n floors: [floors[0], floors[1]],\n uses,\n shop: shop ?? uses.commercial ?? 0,\n ...rest,\n })\n }\n\n return { maxFloors, kinds, plans, layout, stats, fillBlock }\n}\n\nexport type Cities = ReturnType<typeof createCities>\n","import type { DistrictKindDef } from './types'\n\n/** The district kinds of the city plans: colour on the map, zone of the floorplan packages, neighbourhood pattern, storeys, share of buildings by use and block size. */\nexport const DEFAULT_DISTRICT_KINDS: readonly DistrictKindDef[] = [\n { id: 'downtown', color: '#3b4f7a', zone: 'zt', pattern: 'financial_district', floors: [20, 60], uses: { commercial: 0.7, residential: 0.3 }, block: 90, text: { 'pt-BR': { name: 'Centro financeiro', description: 'Arranha-céus de escritório e torres residenciais, de 20 a 60 andares.' }, en: { name: 'Downtown core', description: 'Office and residential towers, 20 to 60 storeys.' } } },\n { id: 'commercial_center', color: '#5b6fa3', zone: 'zc', pattern: 'downtown', floors: [4, 15], uses: { commercial: 0.6, residential: 0.4 }, block: 70, text: { 'pt-BR': { name: 'Centro comercial', description: 'Loja no térreo e escritórios ou apartamentos em cima, de 4 a 15 andares.' }, en: { name: 'Commercial centre', description: 'Shops on the ground floor, offices or flats above, 4 to 15 storeys.' } } },\n { id: 'residential_high', color: '#7a68a6', zone: 'zt', pattern: 'downtown', floors: [8, 25], uses: { residential: 0.9, commercial: 0.1 }, block: 80, text: { 'pt-BR': { name: 'Bairro de prédios', description: 'Condomínios de prédios de 8 a 25 andares com área de lazer.' }, en: { name: 'High-rise residential', description: 'Apartment blocks, 8 to 25 storeys.' } } },\n { id: 'mixed', color: '#9c7fb8', zone: 'zr3_zm', pattern: 'downtown', floors: [2, 8], uses: { residential: 0.6, commercial: 0.4 }, block: 60, text: { 'pt-BR': { name: 'Uso misto', description: 'Sobrados, prédios baixos e comércio de rua, de 2 a 8 andares.' }, en: { name: 'Mixed use', description: 'Townhouses, low blocks and street shops, 2 to 8 storeys.' } } },\n { id: 'residential_mid', color: '#d9a35b', zone: 'zr2', pattern: 'suburb', floors: [1, 4], uses: { residential: 0.95, commercial: 0.05 }, block: 60, text: { 'pt-BR': { name: 'Residencial médio', description: 'Casas, sobrados e prédios pequenos de até 4 andares.' }, en: { name: 'Mid-density residential', description: 'Houses and small blocks up to 4 storeys.' } } },\n { id: 'residential_low', color: '#e8c477', zone: 'zr1', pattern: 'suburb', floors: [1, 2], uses: { residential: 1 }, block: 70, text: { 'pt-BR': { name: 'Residencial de casas', description: 'Casas térreas e sobrados com quintal e recuo.' }, en: { name: 'Low-density residential', description: 'Houses with yards and setbacks.' } } },\n { id: 'residential_gated', color: '#c9d27a', zone: 'zr_ap', pattern: 'suburb', floors: [1, 3], uses: { residential: 1 }, block: 110, text: { 'pt-BR': { name: 'Condomínio fechado', description: 'Casas grandes em lotes amplos, muro e portaria.' }, en: { name: 'Gated community', description: 'Large houses on big lots behind a wall and gate.' } } },\n { id: 'residential_popular', color: '#d97a5b', zone: 'zr2', pattern: 'working_class', floors: [1, 3], uses: { residential: 0.9, commercial: 0.1 }, block: 45, text: { 'pt-BR': { name: 'Bairro popular', description: 'Casas geminadas de laje, sem recuo, ruas estreitas.' }, en: { name: 'Working-class housing', description: 'Terraced self-built houses, narrow streets.' } } },\n { id: 'historic', color: '#b5835a', zone: 'zr3_zm', pattern: 'historic_street', floors: [1, 3], uses: { residential: 0.6, commercial: 0.4 }, block: 50, text: { 'pt-BR': { name: 'Centro histórico', description: 'Casario colonial colado, rua de pedra, igreja e praça.' }, en: { name: 'Historic quarter', description: 'Colonial row houses, cobbled streets, church and square.' } } },\n { id: 'institutional', color: '#5aa3a0', zone: 'zc', pattern: 'downtown', floors: [2, 8], uses: { institutional: 1 }, block: 120, text: { 'pt-BR': { name: 'Institucional', description: 'Hospital, escola, campus, prefeitura, delegacia e quartel de bombeiros.' }, en: { name: 'Institutional', description: 'Hospital, schools, campus, city hall, police and fire stations.' } } },\n { id: 'industrial', color: '#7d7d74', zone: 'zi', pattern: 'industrial_port', floors: [1, 1], uses: { industrial: 1 }, block: 140, text: { 'pt-BR': { name: 'Distrito industrial', description: 'Galpões de 8 a 12 m, pátios e chaminés.' }, en: { name: 'Industrial district', description: 'Sheds 8 to 12 m tall, yards and stacks.' } } },\n { id: 'logistics', color: '#96968a', zone: 'zi', pattern: 'industrial_port', floors: [1, 1], uses: { industrial: 0.8, commercial: 0.2 }, block: 160, text: { 'pt-BR': { name: 'Distrito logístico', description: 'Centros de distribuição, posto de caminhoneiro, pátio de carretas.' }, en: { name: 'Logistics', description: 'Distribution centres, truck stop, trailer yards.' } } },\n { id: 'port', color: '#5f7f8f', zone: 'zi', pattern: 'industrial_port', floors: [1, 1], uses: { industrial: 1 }, block: 150, text: { 'pt-BR': { name: 'Porto', description: 'Cais, guindastes, contêineres empilhados e armazéns.' }, en: { name: 'Port', description: 'Quays, cranes, stacked containers and warehouses.' } } },\n { id: 'rail_yard', color: '#6e6158', zone: 'zi', pattern: 'railway_village', floors: [1, 1], uses: { industrial: 1 }, block: 150, text: { 'pt-BR': { name: 'Pátio ferroviário', description: 'Linhas, rotunda, oficina e vagões parados.' }, en: { name: 'Rail yard', description: 'Tracks, roundhouse, workshop and parked wagons.' } } },\n { id: 'company_housing', color: '#cfae86', zone: 'zr1', pattern: 'railway_village', floors: [1, 1], uses: { residential: 1 }, block: 50, text: { 'pt-BR': { name: 'Vila operária', description: 'Casas iguais em fila, da ferrovia ou da fábrica.' }, en: { name: 'Company housing', description: 'Identical row houses of the railway or the mill.' } } },\n { id: 'hillside_resort', color: '#a3b58a', zone: 'zr1', pattern: 'mountain_resort', floors: [1, 2], uses: { residential: 0.7, commercial: 0.3 }, block: 60, text: { 'pt-BR': { name: 'Serra e pousadas', description: 'Chalés e pousadas na encosta, ruas em curva.' }, en: { name: 'Hillside resort', description: 'Chalets and inns on the slope.' } } },\n { id: 'stilt', color: '#7fa3b5', zone: 'zr1', pattern: 'stilt_village', floors: [1, 1], uses: { residential: 1 }, block: 40, text: { 'pt-BR': { name: 'Palafitas', description: 'Casas sobre estacas na beira da água, trapiches.' }, en: { name: 'Stilt village', description: 'Houses on stilts by the water, jetties.' } } },\n { id: 'park', color: '#6f9a5e', zone: null, pattern: null, floors: [0, 0], uses: { }, block: 0, text: { 'pt-BR': { name: 'Parque e praça', description: 'Área verde, praça, campo de futebol.' }, en: { name: 'Park', description: 'Green space, square, football pitch.' } } },\n { id: 'rural', color: '#a7b86d', zone: 'za', pattern: 'rural', floors: [1, 2], uses: { residential: 0.8, agricultural: 0.2 }, block: 250, text: { 'pt-BR': { name: 'Chácaras e sítios', description: 'Sítios com casa sede, horta e pomar.' }, en: { name: 'Smallholdings', description: 'Smallholdings with a farmhouse, garden and orchard.' } } },\n { id: 'farmland', color: '#c8c67e', zone: 'za', pattern: 'rural', floors: [0, 1], uses: { agricultural: 1 }, block: 400, text: { 'pt-BR': { name: 'Lavoura', description: 'Plantação, silos e estradas de terra.' }, en: { name: 'Farmland', description: 'Crops, silos and dirt roads.' } } },\n { id: 'airfield', color: '#b8b8a8', zone: 'za', pattern: 'rural', floors: [1, 1], uses: { industrial: 1 }, block: 300, text: { 'pt-BR': { name: 'Aeródromo', description: 'Pista, hangares e torre.' }, en: { name: 'Airfield', description: 'Runway, hangars and tower.' } } },\n { id: 'wild', color: '#4f7a4a', zone: null, pattern: null, floors: [0, 0], uses: { }, block: 0, text: { 'pt-BR': { name: 'Mata e morro', description: 'Mata, morro, área sem construção.' }, en: { name: 'Woods and hills', description: 'Woods and hills, unbuilt.' } } },\n]\n","import type { CityPlanDef } from './types'\n\n/** The six city plans (metropolis, regional city, port city, rail town, country town, mountain village). Districts are listed from the outer to the inner one. */\nexport const DEFAULT_CITY_PLANS: readonly CityPlanDef[] = [\n {\n id: 'metropolis',\n scale: 'metropolis',\n size: [6000, 6000],\n text: { 'pt-BR': { name: 'Metrópole', description: 'Centro financeiro de arranha-céus cercado de comércio, bairros de prédios, casas, periferia e indústria na ferrovia.' }, en: { name: 'Metropolis', description: 'Tower downtown ringed by commerce, high-rise and low-rise neighbourhoods, outskirts and industry on the railway.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-3000, -3000, 3000, 3000] },\n { id: 'suburbs_w', kind: 'residential_low', rect: [-2600, -2600, -600, 2600] },\n { id: 'suburbs_e', kind: 'residential_mid', rect: [600, -2600, 2600, 1000] },\n { id: 'periphery', kind: 'residential_popular', rect: [-3000, 1200, -800, 3000] },\n { id: 'gated', kind: 'residential_gated', rect: [1400, -3000, 3000, -1800] },\n { id: 'industry', kind: 'industrial', rect: [600, 1600, 3000, 3000] },\n { id: 'logistics', kind: 'logistics', rect: [2200, 400, 3000, 1600] },\n { id: 'mixed', kind: 'mixed', rect: [-1600, -1600, 1600, 1400] },\n { id: 'high', kind: 'residential_high', rect: [-1400, -1500, -300, -300] },\n { id: 'high2', kind: 'residential_high', rect: [300, -1500, 1400, -600] },\n { id: 'center', kind: 'commercial_center', rect: [-900, -700, 1100, 800] },\n { id: 'downtown', kind: 'downtown', rect: [-400, -400, 600, 400] },\n { id: 'hospital', kind: 'institutional', rect: [-1600, 500, -1000, 1100] },\n { id: 'campus', kind: 'institutional', rect: [1300, -500, 2000, 300] },\n { id: 'park', kind: 'park', rect: [-300, 500, 500, 1100] },\n { id: 'hills', kind: 'wild', rect: [-3000, -3000, -1800, -1800] },\n ],\n lines: [\n { id: 'ring', kind: 'avenue', width: 30, points: [[-1700, -1700], [1700, -1700], [1700, 1500], [-1700, 1500], [-1700, -1700]] },\n { id: 'main_ns', kind: 'avenue', width: 30, points: [[100, -3000], [100, 3000]] },\n { id: 'main_ew', kind: 'avenue', width: 30, points: [[-3000, 0], [3000, 0]] },\n { id: 'rail', kind: 'rail', width: 12, points: [[-3000, 1500], [0, 1500], [3000, 1300]] },\n { id: 'highway', kind: 'highway', width: 24, points: [[-3000, -2200], [3000, -2400]] },\n ],\n landmarks: [\n { kind: 'station', at: [0, 1500] },\n { kind: 'hospital', at: [-1300, 800] },\n { kind: 'stadium', at: [1700, -100] },\n { kind: 'cathedral', at: [100, 100] },\n { kind: 'mall', at: [800, 600] },\n { kind: 'police', at: [300, -300] },\n { kind: 'fire', at: [-500, 600] },\n { kind: 'gas_station', at: [2400, -2300] },\n ],\n },\n {\n id: 'regional_city',\n scale: 'city',\n size: [4000, 4000],\n text: { 'pt-BR': { name: 'Cidade média', description: 'Centro comercial com poucos prédios altos, bairros de casas e um distrito industrial.' }, en: { name: 'Regional city', description: 'Commercial centre with a few tall buildings, house neighbourhoods and an industrial district.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-2000, -2000, 2000, 2000] },\n { id: 'res_w', kind: 'residential_low', rect: [-1800, -1600, -300, 1600] },\n { id: 'res_e', kind: 'residential_mid', rect: [300, -1600, 1800, 600] },\n { id: 'popular', kind: 'residential_popular', rect: [-1800, 800, -500, 1800] },\n { id: 'industry', kind: 'industrial', rect: [500, 900, 2000, 2000] },\n { id: 'mixed', kind: 'mixed', rect: [-800, -800, 900, 700] },\n { id: 'center', kind: 'commercial_center', rect: [-400, -400, 500, 350] },\n { id: 'square', kind: 'park', rect: [-100, -100, 150, 100] },\n { id: 'hospital', kind: 'institutional', rect: [600, -900, 1000, -500] },\n ],\n lines: [\n { id: 'main_ns', kind: 'avenue', width: 24, points: [[0, -2000], [0, 2000]] },\n { id: 'main_ew', kind: 'avenue', width: 24, points: [[-2000, 0], [2000, 0]] },\n { id: 'highway', kind: 'highway', width: 24, points: [[-2000, 1600], [2000, 1500]] },\n ],\n landmarks: [\n { kind: 'church', at: [0, 0] },\n { kind: 'hospital', at: [800, -700] },\n { kind: 'school', at: [-600, 300] },\n { kind: 'police', at: [200, -200] },\n { kind: 'market', at: [300, 200] },\n { kind: 'gas_station', at: [1500, 1550] },\n ],\n },\n {\n id: 'port_city',\n scale: 'city',\n size: [4000, 3000],\n text: { 'pt-BR': { name: 'Cidade portuária', description: 'Cais e armazéns na margem, centro histórico atrás do porto e bairros subindo o morro.' }, en: { name: 'Port city', description: 'Quays and warehouses on the shore, old town behind the port and neighbourhoods up the hill.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-2000, -1500, 2000, 1500] },\n { id: 'hill', kind: 'residential_low', rect: [500, -1500, 2000, -200] },\n { id: 'res', kind: 'residential_mid', rect: [-300, -500, 1300, 900] },\n { id: 'industry', kind: 'industrial', rect: [800, 500, 2000, 1500] },\n { id: 'port', kind: 'port', rect: [-2000, -1300, -900, 1100] },\n { id: 'old_town', kind: 'historic', rect: [-900, -800, 200, 400] },\n { id: 'center', kind: 'commercial_center', rect: [-500, -400, 200, 100] },\n { id: 'stilts', kind: 'stilt', rect: [-2000, 1000, -1200, 1500] },\n ],\n lines: [\n { id: 'shore', kind: 'river', width: 60, points: [[-2000, -1500], [-1950, 0], [-1900, 1500]] },\n { id: 'main', kind: 'avenue', width: 20, points: [[-900, 0], [2000, 0]] },\n { id: 'rail', kind: 'rail', width: 12, points: [[-1200, -1500], [-1000, -400]] },\n ],\n landmarks: [\n { kind: 'harbour_office', at: [-1200, 0] },\n { kind: 'church', at: [-300, -200] },\n { kind: 'market', at: [-600, 200] },\n { kind: 'lighthouse', at: [1600, -1300] },\n { kind: 'hospital', at: [700, 200] },\n ],\n },\n {\n id: 'rail_town',\n scale: 'town',\n size: [3000, 3000],\n text: { 'pt-BR': { name: 'Cidade ferroviária', description: 'Cidade que cresceu em volta da estação: pátio, centro velho, vila da companhia.' }, en: { name: 'Rail town', description: 'A town grown around its station: rail yard, old centre, company village.' } },\n districts: [\n { id: 'outskirts', kind: 'rural', rect: [-1500, -1500, 1500, 1500] },\n { id: 'res', kind: 'residential_low', rect: [500, 500, 1500, 1500] },\n { id: 'logistics', kind: 'logistics', rect: [500, -700, 1500, 500] },\n { id: 'popular', kind: 'residential_popular', rect: [-1500, 600, -300, 1500] },\n { id: 'company', kind: 'company_housing', rect: [-1500, -800, -700, 500] },\n { id: 'yard', kind: 'rail_yard', rect: [-700, 0, 500, 500] },\n { id: 'old_center', kind: 'historic', rect: [-500, -700, 500, 0] },\n ],\n lines: [\n { id: 'rail', kind: 'rail', width: 12, points: [[-1500, 250], [1500, 250]] },\n { id: 'highway', kind: 'highway', width: 24, points: [[-1500, -100], [1500, -200]] },\n ],\n landmarks: [\n { kind: 'station', at: [0, 100] },\n { kind: 'church', at: [0, -400] },\n { kind: 'gas_station', at: [1000, -150] },\n ],\n },\n {\n id: 'country_town',\n scale: 'town',\n size: [2400, 2400],\n text: { 'pt-BR': { name: 'Cidade do interior', description: 'Praça da matriz no meio, comércio térreo em volta, casas, cooperativa e sítios em volta.' }, en: { name: 'Country town', description: 'Main square with the church, ground-floor shops around, houses, a co-op and smallholdings.' } },\n districts: [\n { id: 'farms', kind: 'farmland', rect: [-1200, -1200, 1200, 1200] },\n { id: 'chacaras', kind: 'rural', rect: [-900, -900, 900, 900] },\n { id: 'houses', kind: 'residential_low', rect: [-600, -600, 600, 500] },\n { id: 'company', kind: 'company_housing', rect: [-700, 350, -250, 700] },\n { id: 'coop', kind: 'farmland', rect: [350, 500, 900, 900], floors: [1, 1], uses: { agricultural: 0.5, industrial: 0.5 } },\n { id: 'center', kind: 'historic', rect: [-250, -250, 250, 250] },\n { id: 'square', kind: 'park', rect: [-60, -60, 60, 60] },\n ],\n lines: [\n { id: 'main', kind: 'street', width: 12, points: [[-1200, 0], [1200, 0]] },\n { id: 'road', kind: 'street', width: 8, points: [[0, -1200], [0, 1200]] },\n ],\n landmarks: [\n { kind: 'church', at: [0, -70] },\n { kind: 'market', at: [120, 80] },\n { kind: 'school', at: [-300, -200] },\n { kind: 'gas_station', at: [700, 0] },\n { kind: 'silo', at: [600, 700] },\n ],\n },\n {\n id: 'mountain_village',\n scale: 'village',\n size: [1600, 1200],\n text: { 'pt-BR': { name: 'Vila serrana', description: 'Largo da igreja, rua das pousadas subindo a serra e chalés espalhados na encosta.' }, en: { name: 'Mountain village', description: 'Church square, a street of inns up the slope and chalets scattered on the hill.' } },\n districts: [\n { id: 'wild', kind: 'wild', rect: [-800, -600, 800, 600] },\n { id: 'slope', kind: 'rural', rect: [-700, -500, 700, 500] },\n { id: 'resort', kind: 'hillside_resort', rect: [-400, -450, 500, 0] },\n { id: 'square', kind: 'historic', rect: [-250, 0, 250, 300] },\n { id: 'station', kind: 'rail_yard', rect: [300, 150, 700, 450] },\n ],\n lines: [\n { id: 'road', kind: 'street', width: 7, points: [[-800, 200], [0, 150], [800, 300]] },\n ],\n landmarks: [\n { kind: 'church', at: [0, 150] },\n { kind: 'inn', at: [100, -200] },\n { kind: 'station', at: [500, 300] },\n ],\n },\n]\n","import type { Point, Rect } from './types'\n\nexport const clamp = (v: number, a: number, b: number): number => (v < a ? a : v > b ? b : v)\nexport const lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n/** Smoothstep between `a` and `b`; with `a > b` it falls instead of rising. */\nexport const smoothstep = (a: number, b: number, x: number): number => {\n const t = clamp((x - a) / (b - a), 0, 1)\n return t * t * (3 - 2 * t)\n}\n/** The team's cheap hash of two numbers into [0, 1). */\nexport const hash2 = (a: number, b: number): number => {\n const n = Math.sin(a * 127.1 + b * 311.7) * 43758.5453\n return n - Math.floor(n)\n}\n/** Distance from a point to the nearest segment of a polyline. */\nexport function distanceToPolyline(px: number, py: number, points: readonly Point[]): number {\n let best = 1e9\n for (let index = 0; index < points.length - 1; index++) {\n const [ax, ay] = points[index] as Point\n const [bx, by] = points[index + 1] as Point\n const dx = bx - ax\n const dy = by - ay\n const t = clamp(((px - ax) * dx + (py - ay) * dy) / (dx * dx + dy * dy), 0, 1)\n const d = Math.hypot(px - ax - t * dx, py - ay - t * dy)\n if (d < best) best = d\n }\n return best\n}\n/** Inside the rectangle grown by `margin` on every side. */\nexport const insideRect = (px: number, py: number, r: Rect, margin: number): boolean => px > r[0] - margin && px < r[2] + margin && py > r[1] - margin && py < r[3] + margin\n/** Inside an ellipse given by its centre and radii. */\nexport const insideEllipse = (px: number, py: number, center: Point, radius: Point): boolean => Math.hypot((px - center[0]) / radius[0], (py - center[1]) / radius[1]) < 1\n","import type { UrbanBuilder } from '../scene'\nimport { distanceToPolyline, hash2, insideEllipse, insideRect, lerp, smoothstep } from './math'\nimport type { ColorRule, Ramp, TerrainGrid, TerrainOptions, Wave } from './types'\n\nconst TRIG = { sin: Math.sin, cos: Math.cos }\n\nfunction wave(w: Wave, px: number, py: number): number {\n return w.kind === 'product' ? TRIG[w.x[0]](px * w.x[1]) * TRIG[w.y[0]](py * w.y[1]) * w.amplitude : Math.sin(px * w.kx + py * w.ky) * w.amplitude\n}\n\nfunction ramp(r: Ramp, px: number, py: number): number {\n const v = r.axis === 'x' ? px : py\n return r.fullUntil !== undefined && v < r.fullUntil ? 1 : smoothstep(r.from, r.to, v)\n}\n\nfunction mask(ramps: readonly Ramp[], px: number, py: number): number {\n let m = 1\n for (const r of ramps) m *= ramp(r, px, py)\n return m\n}\n\nconst sum = (start: number, waves: readonly Wave[], px: number, py: number): number => {\n let total = start\n for (const w of waves) total += wave(w, px, py)\n return total\n}\n\n/**\n * A ground made of layers, as the team's Vale: a rolling base, masked relief (mountains, hills), cities levelled flat, rivers and lakes carved in,\n * a forest density, and a colour for every point. It answers questions about a point of the map and hands a drawer the grid of a square mesh.\n */\nexport function createTerrain(options: TerrainOptions) {\n const { world } = options\n const toWorld = (px: number, py: number): [number, number] => [px * world.scale + world.origin, py * world.scale + world.origin]\n const fromWorld = (x: number, z: number): [number, number] => [(x - world.origin) / world.scale, (z - world.origin) / world.scale]\n\n function heightAt(px: number, py: number): number {\n let h = sum(options.base.level, options.base.waves, px, py)\n for (const layer of options.layers) h += mask(layer.mask, px, py) * sum(layer.level, layer.waves, px, py)\n for (const f of options.flatten) {\n if (!insideRect(px, py, f.rect, f.margin)) continue\n const inside = Math.min(smoothstep(f.edge[0], f.edge[1], Math.min(px - f.rect[0], f.rect[2] - px, py - f.rect[1], f.rect[3] - py)), 1)\n h = lerp(h, f.level, inside)\n }\n const land = h\n for (const river of options.rivers) {\n const bed = 'fixed' in river.bed ? river.bed.fixed : Math.max(river.bed.floor, land - river.bed.below)\n h = lerp(bed, h, smoothstep(river.width[0], river.width[1], distanceToPolyline(px, py, river.points)))\n }\n for (const lake of options.lakes) {\n const d = Math.hypot((px - lake.center[0]) / lake.radius[0], (py - lake.center[1]) / lake.radius[1])\n if (d < lake.reach) h = lerp(lake.level, h, smoothstep(lake.edge[0], lake.edge[1], d))\n }\n return options.custom ? options.custom(px, py, h) : h\n }\n\n function forestAt(px: number, py: number): number {\n let density = 0\n for (const zone of options.forest.zones) density = Math.max(density, mask(zone.mask, px, py))\n const patch = options.forest.patch\n if (patch) density = Math.max(density, smoothstep(patch.edge[0], patch.edge[1], sum(0, patch.waves, px, py) * 0.5 + 0.5) * patch.weight)\n return density\n }\n\n const nearRiver = (px: number, py: number, margin: number): boolean => options.rivers.some((river) => distanceToPolyline(px, py, river.points) < margin)\n\n function matches(rule: ColorRule, px: number, py: number, h: number, forest: number): boolean {\n switch (rule.kind) {\n case 'below':\n return h < rule.height\n case 'above':\n return h > rule.height\n case 'ellipse':\n return insideEllipse(px, py, rule.center, rule.radius)\n case 'rects':\n return rule.rects.some((r) => insideRect(px, py, r, rule.margin))\n case 'forest':\n return forest > rule.above\n }\n }\n\n /** Colour of a point as 0xRRGGBB; `h` is the height there, which the grid already has. */\n function colorAt(px: number, py: number, h: number = heightAt(px, py)): number {\n const forest = forestAt(px, py)\n for (const rule of options.colors) if (matches(rule, px, py, h, forest)) return rule.color\n const { colors, cell } = options.fields\n return colors[Math.floor(hash2(Math.floor(px / cell[0]), Math.floor(py / cell[1])) * colors.length)] as number\n }\n\n /**\n * The vertices of the square mesh, the way a plane of `size` metres with `segments` cells a side lays them out (rows along z, the\n * coordinates rounded to 32 bits) with the height and the colour of each.\n */\n function grid(segments: number = world.segments): TerrainGrid {\n const count = (segments + 1) * (segments + 1)\n const x = new Float32Array(count)\n const z = new Float32Array(count)\n const heights = new Float32Array(count)\n const colors = new Uint32Array(count)\n const half = world.size / 2\n const step = world.size / segments\n for (let iy = 0; iy <= segments; iy++) {\n for (let ix = 0; ix <= segments; ix++) {\n const i = iy * (segments + 1) + ix\n x[i] = ix * step - half\n z[i] = iy * step - half\n const [px, py] = fromWorld(x[i] as number, z[i] as number)\n const h = heightAt(px, py)\n heights[i] = h\n colors[i] = colorAt(px, py, h)\n }\n }\n return { segments, size: world.size, x, z, heights, colors }\n }\n\n return { options, toWorld, fromWorld, heightAt, forestAt, nearRiver, colorAt, grid }\n}\n\nexport type Terrain = ReturnType<typeof createTerrain>\n\n/** Puts the ground and its water under it into a builder: the terrain mesh first, then the water plane, as the page's `buildWorld`. */\nexport function drawTerrain(b: UrbanBuilder, terrain: Terrain, segments?: number): void {\n b.terrain(terrain.grid(segments))\n const { water, world } = terrain.options\n b.plane(0, water.level, 0, world.size, world.size, water.color, { roughness: water.roughness, metalness: water.metalness })\n}\n","import { cars, pickups, suvs, vans } from '@adatechnology/game-vehicles-fleet'\nimport { pickForContext, regions } from '@adatechnology/game-vegetation-species'\nimport type { Region } from '@adatechnology/game-vegetation-species'\n\nimport type { PlantProvider, PlantRequest, VehicleProvider, VehicleRequest } from './types'\n\n/**\n * The vehicles of the fleet that park on a street: cars, SUVs, pickups and vans.\n * @deprecated the fleet is content: pass `ids` to `createVehicleProvider` (`PARKED_VEHICLE_IDS` of `@adatechnology/game-kit-defaults` is the same list). The default is removed in the next major.\n */\nexport const PARKED_VEHICLE_IDS: readonly string[] = [...cars, ...suvs, ...pickups.filter((id) => id !== 'monster_truck'), ...vans]\n\nexport type VehicleProviderOptions = {\n /** Ids of the fleet to choose from. Default `PARKED_VEHICLE_IDS`, which is deprecated: pass the ids (`game-kit-defaults` has the same list). */\n ids?: readonly string[]\n /** Replaces the choice: the id for a request. The default picks by the spot, so the same pattern parks the same cars every time. */\n pick?: (request: VehicleRequest, ids: readonly string[]) => string\n /** Paint of the car. Default the colour the pattern asks for. */\n paint?: (request: VehicleRequest) => number | undefined\n}\n\nconst hashSpot = (x: number, z: number, ry: number): number => {\n let h = 2166136261\n for (const value of [Math.round(x * 100), Math.round(z * 100), Math.round(ry * 100)]) {\n h ^= value & 0xffff\n h = Math.imul(h, 16777619)\n h ^= (value >> 16) & 0xffff\n h = Math.imul(h, 16777619)\n }\n return h >>> 0\n}\n\n/**\n * A vehicle provider that asks the drawer for a vehicle of the fleet where the pattern parks one. It chooses by the spot and not\n * by the scene's random, so the scene's draw order (and the golden of the Galeria, which parks nothing) does not move.\n */\nexport function createVehicleProvider(options: VehicleProviderOptions = {}): VehicleProvider {\n const ids = options.ids ?? PARKED_VEHICLE_IDS\n if (ids.length === 0) throw new Error('The vehicle provider needs at least one vehicle id')\n return (request, b) => {\n const id = options.pick ? options.pick(request, ids) : (ids[hashSpot(request.x, request.z, request.ry) % ids.length] as string)\n const color = options.paint ? options.paint(request) : request.color\n b.place('vehicle', id, request.x, request.z, { ry: request.ry, ...(color === undefined ? {} : { color }), seed: `${id}:${request.x}:${request.z}` })\n }\n}\n\nexport type PlantProviderOptions = {\n /** Chooses the species id for a context of the planting table and a key (`defaultPlantPicker` of `game-kit-defaults`, or the game's own). Without it the species come from the `region` table (deprecated default). */\n pickSpecies?: (context: string, key: string) => string\n /**\n * Planting table of a region, used only when `pickSpecies` is absent. Default Brazil's.\n * @deprecated pass `pickSpecies`; the default is removed in the next major.\n */\n region?: Region\n /** Context of the table for each kind the patterns plant. */\n contexts?: Partial<Record<PlantRequest['kind'], string>>\n /** Seed of the choice; the spot is added so each place gets its own species. */\n seed?: number | string\n /** Replaces the choice: the species id for a request. */\n pick?: (request: PlantRequest, context: string, seed: string) => string\n}\n\nexport const DEFAULT_PLANT_CONTEXTS: Readonly<Record<PlantRequest['kind'], string>> = { tree: 'sidewalk_tree', pine: 'square' }\n\n/** A plant provider that asks the drawer for a species chosen by `pickSpecies`, from the table of the context for the kind (a tree on the sidewalk, a pine in the square). */\nexport function createPlantProvider(options: PlantProviderOptions = {}): PlantProvider {\n const region = options.region ?? regions.br\n const contexts = { ...DEFAULT_PLANT_CONTEXTS, ...options.contexts }\n const seed = options.seed ?? 1\n return (request, b) => {\n const context = contexts[request.kind]\n const key = `${seed}:${request.kind}:${request.x}:${request.z}`\n const id = options.pick ? options.pick(request, context, key) : (options.pickSpecies ?? ((table: string, spot: string) => pickForContext(region, table, spot)))(context, key)\n b.place('plant', id, request.x, request.z, { scale: request.scale, seed: key })\n }\n}\n","import type { DowntownParams } from './composers'\nimport type { NeighbourhoodPattern } from './types'\n\n/**\n * The financial district: the avenue of the downtown pattern with lots wide enough for a tower (20 m) and heights from 70 to 180 m. A pack for a game\n * to add (`createUrban({ packs: { neighbourhoods: TOWER_PATTERNS }, towers: true })`); with `towers` off the same numbers draw tall boxes. It is not\n * in `DEFAULT_PATTERNS`, so the Galeria's sample sheet is the one of the page.\n */\nconst financialDistrict: NeighbourhoodPattern<DowntownParams> = {\n id: 'financial_district',\n streetWidth: 16,\n walkWidth: 4,\n typologies: ['office_tower', 'residential_tower'],\n pole: 'led_double',\n lightColor: 0xdfe8ff,\n spacing: 25,\n lit: 1,\n compose: 'downtown',\n marker: { height: 40 },\n text: {\n 'pt-BR': { label: 'Distrito financeiro', title: 'DISTRITO FINANCEIRO', caption: 'avenida 2 × 8 m · torres de 70 a 180 m', detail: 'Torres de escritórios e residenciais de 70 a 180 m. Poste metálico duplo, LED branco.' },\n en: { label: 'Financial district', title: 'FINANCIAL DISTRICT', caption: 'avenue 2 × 8 m · towers of 70 to 180 m', detail: 'Office and residential towers of 70 to 180 m. Double steel pole, white LED.' },\n },\n params: {\n roadLength: 110,\n roadColor: 0x222428,\n median: { width: 1.6, height: 0.18, color: 0x3a4a2c },\n poles: { from: -50, to: 50 },\n buildings: { perRow: 4, first: -39, pitch: 26, rowOffset: 24, size: 20, north: { minHeight: 90, range: 90, lit: 0.12 }, south: { minHeight: 70, range: 80, lit: 0.1 } },\n walks: { offset: 14, length: 110 },\n car: { dx: -8, dz: -3, ry: 1.57, color: 0x6b6450 },\n },\n}\n\n/** The patterns of the tower pack. */\nexport const TOWER_PATTERNS: readonly NeighbourhoodPattern[] = [financialDistrict]\n\n/** Where the sample sheet puts them (pass it as `cells`). */\nexport const TOWER_SAMPLE_CELLS: Readonly<Record<string, { x: number; z: number }>> = { financial_district: { x: 160, z: 56 } }\n"],"mappings":";AAGO,SAAS,qBAAqB,OAA+B;AAClE,QAAM,YAA4B;AAAA,IAChC,MAAM;AAAA,IACN,OAAO;AACL,aAAO,UAAU,SAAS;AAAA,IAC5B;AAAA,EACF;AACA,SAAO;AACT;AAGO,IAAM,oBAAoB;;;ACdjC,SAAS,iBAAiB;AAM1B,IAAM,OAAO;AACb,IAAM,4BAA4B;AAClC,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAcpB,SAAS,mBAAmB,QAAsB,UAA+B,CAAC,GAAG;AAC1F,QAAM,QAAqB,CAAC;AAC5B,QAAM,QAAmB,CAAC;AAC1B,QAAM,UAAiC,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,EAAE;AAC3D,QAAM,SAAS,QAAQ,UAAU,qBAAqB,OAAO,iBAAiB;AAC9E,QAAM,OAAO,CAAS,SAAoC,KAA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