@adatechnology/game-urban-three 0.5.2 → 0.5.4

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.
@@ -135,6 +135,66 @@ var GameUrbanThree = (() => {
135
135
  node.userData[KIT_ORIGIN_KEY] = { ...origin };
136
136
  return object2;
137
137
  }
138
+ var NO_COVER = -Infinity;
139
+ function createGridRainCover(options) {
140
+ const [x0, z0, x1, z1] = options.bounds;
141
+ const cell = options.cellSize ?? 0.25;
142
+ const columns = Math.max(1, Math.ceil((x1 - x0) / cell));
143
+ const rows = Math.max(1, Math.ceil((z1 - z0) / cell));
144
+ const cells = new Float32Array(columns * rows);
145
+ let revision = 0;
146
+ let isCut = false;
147
+ const cut = () => {
148
+ for (let row = 0; row < rows; row++) {
149
+ for (let column = 0; column < columns; column++) {
150
+ const top = options.coverTopAt(x0 + (column + 0.5) * cell, z0 + (row + 0.5) * cell);
151
+ cells[row * columns + column] = top === void 0 ? NO_COVER : top;
152
+ }
153
+ }
154
+ isCut = true;
155
+ };
156
+ return {
157
+ bounds: () => options.bounds,
158
+ coverTopAt(x, z) {
159
+ if (!isCut) cut();
160
+ const column = Math.floor((x - x0) / cell);
161
+ const row = Math.floor((z - z0) / cell);
162
+ if (column < 0 || row < 0 || column >= columns || row >= rows) return void 0;
163
+ const top = cells[row * columns + column];
164
+ return top === NO_COVER ? void 0 : top;
165
+ },
166
+ version: () => revision,
167
+ invalidate() {
168
+ isCut = false;
169
+ revision++;
170
+ }
171
+ };
172
+ }
173
+ var prepare = (f) => ({ x: f.x, z: f.z, halfX: f.halfX, halfZ: f.halfZ, cos: Math.cos(f.yaw), sin: Math.sin(f.yaw), top: f.top });
174
+ var insideTurned = (f, x, z) => {
175
+ const dx = x - f.x;
176
+ const dz = z - f.z;
177
+ return Math.abs(dx * f.cos + dz * f.sin) <= f.halfX && Math.abs(-dx * f.sin + dz * f.cos) <= f.halfZ;
178
+ };
179
+ var FIXED_COVER_MAX_CELLS = 1e6;
180
+ function createFixedFootprintRainCover(footprints, cellSize = 0.5) {
181
+ const roofs = footprints.map(prepare);
182
+ if (roofs.length === 0) return { bounds: () => [0, 0, 0, 0], coverTopAt: () => void 0, version: () => 0 };
183
+ const x0 = Math.min(...roofs.map((r) => r.x - Math.abs(r.halfX * r.cos) - Math.abs(r.halfZ * r.sin)));
184
+ const x1 = Math.max(...roofs.map((r) => r.x + Math.abs(r.halfX * r.cos) + Math.abs(r.halfZ * r.sin)));
185
+ const z0 = Math.min(...roofs.map((r) => r.z - Math.abs(r.halfX * r.sin) - Math.abs(r.halfZ * r.cos)));
186
+ const z1 = Math.max(...roofs.map((r) => r.z + Math.abs(r.halfX * r.sin) + Math.abs(r.halfZ * r.cos)));
187
+ const cell = Math.max(cellSize, Math.sqrt((x1 - x0) * (z1 - z0) / FIXED_COVER_MAX_CELLS));
188
+ return createGridRainCover({
189
+ bounds: [x0, z0, x1, z1],
190
+ cellSize: cell,
191
+ coverTopAt(x, z) {
192
+ let top;
193
+ for (const roof of roofs) if ((top === void 0 || roof.top > top) && insideTurned(roof, x, z)) top = roof.top;
194
+ return top;
195
+ }
196
+ });
197
+ }
138
198
  var SURFACE_IDS = ["concrete", "asphalt", "wood", "tile", "dirt", "grass", "gravel", "sand", "metal", "water", "glass", "carpet"];
139
199
  var GAIT_IDS = ["walk", "run"];
140
200
  var LANDING_IDS = ["light", "heavy"];
@@ -4592,13 +4652,13 @@ var GameUrbanThree = (() => {
4592
4652
  });
4593
4653
  }
4594
4654
  function registerGroundItems() {
4595
- const flat = { category: "ground_cover", w: 1, d: 1, h: 0, decor: true, mount: "ground", flat: true };
4655
+ const flat2 = { category: "ground_cover", w: 1, d: 1, h: 0, decor: true, mount: "ground", flat: true };
4596
4656
  registerItems([
4597
- { type: "lawn", ...flat, color: { role: "lawn" } },
4598
- { type: "tile_floor", ...flat, color: { role: "exterior_floor" } },
4599
- { type: "concrete", ...flat, color: { role: "exterior_floor" } },
4600
- { type: "deck_floor", ...flat, color: { role: "deck_floor" } },
4601
- { type: "dirt", ...flat, color: { role: "dirt" } }
4657
+ { type: "lawn", ...flat2, color: { role: "lawn" } },
4658
+ { type: "tile_floor", ...flat2, color: { role: "exterior_floor" } },
4659
+ { type: "concrete", ...flat2, color: { role: "exterior_floor" } },
4660
+ { type: "deck_floor", ...flat2, color: { role: "deck_floor" } },
4661
+ { type: "dirt", ...flat2, color: { role: "dirt" } }
4602
4662
  ]);
4603
4663
  }
4604
4664
  var slotKit = {
@@ -9811,8 +9871,9 @@ var GameUrbanThree = (() => {
9811
9871
  c.rod(new V3(hx + 0.88, ih + 0.97, z - 0.05), new V3(hx + 0.78, ih + 1.12, z - 0.05), 0.012, MT.chrome);
9812
9872
  c.sphere(0.025, MT.plastic, hx + 0.78, ih + 1.12, z - 0.05);
9813
9873
  });
9814
- kit.seat(c, hx + 0.05, ih, 0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }) });
9815
- kit.seat(c, hx + 0.05, ih, -0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }) });
9874
+ kit.seat(c, hx + 0.05, ih, 0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }), role: "front_passenger" });
9875
+ kit.seat(c, hx + 0.05, ih, -0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }), id: "driver", role: "driver" });
9876
+ c.addDoor({ id: "cabin_door", widthMetres: 0.72, heightMetres: 1.65 });
9816
9877
  c.roundBox(0.45, 0.42, 1.9, 0.04, CM("#25282b", { roughness: 0.8 }), hx - 1.35, ih + 0.21, 0.1);
9817
9878
  c.seatTops.push({ x: hx - 1.35, y: ih + 0.44, z: 0.1, w: 1.8, l: 0.4 });
9818
9879
  c.roundBox(3, 0.02, 2, 0.01, CM("#3a3f44", { roughness: 0.9 }), hx, hy0 + hh - 0.06, 0).castShadow = false;
@@ -10753,8 +10814,9 @@ var GameUrbanThree = (() => {
10753
10814
  m.tumble = T;
10754
10815
  m.frontQuad = qf;
10755
10816
  if (intr && s.shelf) {
10756
- const sx0 = gh.rb + 0.03, sx1 = gh.rb + s.shelf;
10757
- c.roundBox(sx1 - sx0, 0.014, gh.Wg - 0.24, 6e-3, CM("#1b1c1e", { roughness: 0.92 }), (sx0 + sx1) / 2, gh.belt - 0.02, 0).castShadow = false;
10817
+ const sx0 = gh.rb + 0.03, sx1 = Math.min(gh.rb + s.shelf, gh.rb + 0.26);
10818
+ if (sx1 > sx0 + 0.04)
10819
+ c.roundBox(sx1 - sx0, 0.014, gh.Wg - 0.24, 6e-3, CM("#1b1c1e", { roughness: 0.92 }), (sx0 + sx1) / 2, gh.belt - 0.02, 0).castShadow = false;
10758
10820
  }
10759
10821
  if (intr)
10760
10822
  kit.interior(
@@ -10765,11 +10827,17 @@ var GameUrbanThree = (() => {
10765
10827
  ft: gh.ft,
10766
10828
  rb: gh.rb,
10767
10829
  rt: gh.rt,
10768
- roof: Math.min(gh.roof, roofR),
10830
+ roof: gh.roof + 0.02,
10769
10831
  belt: gh.belt,
10770
- floor: s.bottomY + 0.1,
10832
+ floor: s.bottomY + 0.02,
10833
+ seatH: 0.12,
10834
+ dashD: 0.32,
10835
+ dashH: 0.24,
10836
+ visorUp: true,
10771
10837
  zIn: gh.Wg / 2 - 0.09,
10772
10838
  zRoof: halfAt(gh.Wg, T, gh.roof) - 0.12,
10839
+ xFront: s.shelf ? gh.fb - 0.86 : void 0,
10840
+ rowPitch: s.shelf ? 0.72 : void 0,
10773
10841
  xRear: gh.rb + 0.06
10774
10842
  },
10775
10843
  intr
@@ -11317,7 +11385,7 @@ var GameUrbanThree = (() => {
11317
11385
  ]);
11318
11386
  c2.roundBox(0.03, 0.05, 0.16, 0.012, MT.trim, I.S.endX(-1, 0.84) - 0.01, 0.84, 0);
11319
11387
  },
11320
- interior: { rows: 2, col: "#4a4c52", trim: "#26272a" },
11388
+ interior: { rows: 2, col: "#4a4c52", trim: "#26272a", rowPitch: 0.72 },
11321
11389
  hood: { motor: "gasoline" },
11322
11390
  wheels: [
11323
11391
  [1.17, 0.2875, 0.175, wheelOpts("hubcap")],
@@ -12817,7 +12885,7 @@ var GameUrbanThree = (() => {
12817
12885
  const lip = K.grid(-1, 0, { z1: 0.7, y0: 0.88, y1: 0.97, du: 0.03, dv: 0.02 });
12818
12886
  K.skin(lip, GLOSS, { u0: 0.05, u1: 0.95, yb: 0.925, yt: 0.955, off: 0.016, thick: 0.02, nv: 2 });
12819
12887
  },
12820
- interior: { rows: 2, col: "#1c1d20", trim: "#121316" },
12888
+ interior: { rows: 2, col: "#1c1d20", trim: "#121316", xFront: -0.46, rowPitch: 0.62 },
12821
12889
  hood: { motor: "v8_na" },
12822
12890
  wheels: [
12823
12891
  [1.35, 0.3435, 0.255, { rim: ALLOYD, spokeMat: ALLOY, spokes: 10, rimR: 0.72 }],
@@ -13078,16 +13146,20 @@ var GameUrbanThree = (() => {
13078
13146
  x: xd - 0.07,
13079
13147
  y: belt + 0.02,
13080
13148
  w: zi * 2,
13081
- d: 0.48,
13082
- h: Math.min(0.55, belt - fl - 0.08),
13149
+ d: 0.34,
13150
+ h: Math.min(0.28, belt - fl - 0.16),
13083
13151
  drv: -zi * 0.52,
13084
13152
  mat: trim,
13085
13153
  top: fab
13086
13154
  });
13087
13155
  kit.steeringWheel(c, xd - 0.66, belt + 0.06, -zi * 0.52, { r: 0.22, tilt: 1.12, col: 0.5, mat: trim });
13088
13156
  const sx = Math.max(f - len2 + 0.62, xd - 1.08);
13089
- kit.seat(c, sx, fl, -zi * 0.52, { w: 0.5, mat: fab, h: 0.44, back: 0.64, lean: 0.18 });
13090
- kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.44, back: 0.6, lean: 0.18 });
13157
+ kit.seat(c, sx, fl, -zi * 0.52, { w: 0.52, mat: fab, h: 0.24, back: 0.64, lean: 0.18, id: "driver", role: "driver" });
13158
+ kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.24, back: 0.6, lean: 0.18, role: "front_passenger" });
13159
+ const doorW = Math.max(0.75, f - 0.1 - (xr - 0.06));
13160
+ const doorH = Math.max(1.05, ry - fl - 0.1);
13161
+ c.addDoor({ id: "door_front_left", widthMetres: Math.round(doorW * 1e3) / 1e3, heightMetres: Math.round(doorH * 1e3) / 1e3 });
13162
+ c.addDoor({ id: "door_front_right", widthMetres: Math.round(doorW * 1e3) / 1e3, heightMetres: Math.round(doorH * 1e3) / 1e3 });
13091
13163
  c.rod(new V3(sx + 0.55, fl, -0.05), new V3(sx + 0.5, fl + 0.48, -0.08), 0.014, MT.chrome);
13092
13164
  c.sphere(0.035, MT.plastic, sx + 0.5, fl + 0.5, -0.08);
13093
13165
  c.roundBox(0.03, ry - fl - 0.12, zi * 2, 0.01, trim, f - len2 + 0.07, (ry + fl) / 2, 0);
@@ -13346,16 +13418,16 @@ var GameUrbanThree = (() => {
13346
13418
  function boxBody(c, o) {
13347
13419
  const x0 = o.x0, x1 = o.x1, y0 = o.y0, y1 = o.y1, W = o.W, L = x0 - x1, H = y1 - y0, cx = (x0 + x1) / 2, cy = (y0 + y1) / 2;
13348
13420
  const body = c.roundBox(L, H, W, o.armored ? 0.1 : 0.05, c.paint(o.col), cx, cy, 0, { def: true, sub: 0.3 });
13349
- const rib = o.armored ? CM("#4a535a", { metalness: 0.35, roughness: 0.5 }) : CM("#c4c7c3", { metalness: 0.25, roughness: 0.42 });
13421
+ const rib2 = o.armored ? CM("#4a535a", { metalness: 0.35, roughness: 0.5 }) : CM("#c4c7c3", { metalness: 0.25, roughness: 0.42 });
13350
13422
  const doorM = o.armored ? c.paint(o.col) : CM("#d9dbd6", { metalness: 0.15, roughness: 0.45 });
13351
13423
  c.roundBox(L - 0.1, 0.12, 0.2, 0.02, MT.trim, cx, y0 - 0.07, 0.43);
13352
13424
  c.roundBox(L - 0.1, 0.12, 0.2, 0.02, MT.trim, cx, y0 - 0.07, -0.43);
13353
13425
  for (let xs = x1 + 0.2; xs < x0; xs += 0.6) c.roundBox(0.08, 0.1, W - 0.1, 0.02, MT.trim, xs, y0 - 0.05, 0);
13354
13426
  [1, -1].forEach(function(s) {
13355
13427
  const zs = s * (W / 2 + 0.012);
13356
- if (!o.armored) for (let x = x1 + 0.35; x < x0 - 0.2; x += 0.6) c.roundBox(0.055, H - 0.12, 0.025, 0.01, rib, x, cy, zs);
13357
- c.roundBox(L + 0.02, 0.09, 0.04, 0.015, rib, cx, y0 + 0.04, s * (W / 2 + 0.018));
13358
- c.roundBox(L + 0.02, 0.07, 0.04, 0.015, rib, cx, y1 - 0.035, s * (W / 2 + 0.018));
13428
+ if (!o.armored) for (let x = x1 + 0.35; x < x0 - 0.2; x += 0.6) c.roundBox(0.055, H - 0.12, 0.025, 0.01, rib2, x, cy, zs);
13429
+ c.roundBox(L + 0.02, 0.09, 0.04, 0.015, rib2, cx, y0 + 0.04, s * (W / 2 + 0.018));
13430
+ c.roundBox(L + 0.02, 0.07, 0.04, 0.015, rib2, cx, y1 - 0.035, s * (W / 2 + 0.018));
13359
13431
  [x0 - 0.15, cx, x1 + 0.2].forEach(function(xx) {
13360
13432
  c.roundBox(0.07, 0.06, 0.02, 0.01, MT.amber, xx, y0 + 0.16, s * (W / 2 + 0.03));
13361
13433
  });
@@ -13399,7 +13471,7 @@ var GameUrbanThree = (() => {
13399
13471
  c.roundBox(0.04, 0.1, 0.16, 0.01, MT.steel, rx - 0.03, y0 + H * t, s * (W / 2 - 0.08));
13400
13472
  });
13401
13473
  });
13402
- c.roundBox(0.06, 0.1, W - 0.1, 0.02, rib, rx - 0.02, y1 - 0.05, 0);
13474
+ c.roundBox(0.06, 0.1, W - 0.1, 0.02, rib2, rx - 0.02, y1 - 0.05, 0);
13403
13475
  [1, -1].forEach(function(s) {
13404
13476
  c.roundBox(0.03, 0.05, 0.08, 0.01, MT.tail, rx - 0.02, y1 - 0.06, s * 0.35);
13405
13477
  });
@@ -13864,7 +13936,8 @@ var GameUrbanThree = (() => {
13864
13936
  kit.busRows(c, { x0: dx0 - 0.15, x1: -4.15, pitch: 0.64, floor: fl, zIn: zi, aisle: 0.46, col: "#355a7a", ceil: 2.95, seatH: 0.4 });
13865
13937
  kit.dashboard(c, { x: f - 0.05, y: 1.42, w: zi * 2, d: 0.42, h: 0.4, drv: -0.7, mat: CM("#202124"), top: CM("#2a2b2e") });
13866
13938
  kit.steeringWheel(c, f - 0.6, 1.48, -0.7, { r: 0.25, tilt: 1.1, col: 0.45 });
13867
- kit.seat(c, f - 1.05, fl, -0.7, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.45 });
13939
+ kit.seat(c, f - 1.05, fl, -0.7, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.45, id: "driver", role: "driver" });
13940
+ c.addDoor({ id: "door_front_right", widthMetres: 0.85, heightMetres: 1.95 });
13868
13941
  c.roundBox(0.9, 0.38, 0.5, 0.08, CM("#2a2b2d"), f - 0.6, fl + 0.19, -0.05);
13869
13942
  c.rod(new V3(dx0 - 0.05, fl, zi - 0.35), new V3(dx0 - 0.05, 2.95, zi - 0.35), 0.02, MT.chrome);
13870
13943
  c.roundBox(L - 0.5, 0.02, zi * 2, 0.01, MT.headliner, 0, 2.98, 0).castShadow = false;
@@ -14198,9 +14271,11 @@ var GameUrbanThree = (() => {
14198
14271
  [1, 1.5, -2.2].forEach(function(x) {
14199
14272
  c.rod(new V3(x, fl, 0), new V3(x, 2.95, 0), 0.018, pole);
14200
14273
  });
14201
- kit.dashboard(c, { x: fx2(1.3) - 0.08, y: 1.3, w: 1.2, d: 0.5, h: 0.5, drv: -0.68, mat: CM("#1d1e20"), top: CM("#2a2b2e") });
14274
+ kit.dashboard(c, { x: fx2(1.3) - 0.08, y: 1.3, w: 1.2, d: 0.34, h: 0.28, drv: -0.68, mat: CM("#1d1e20"), top: CM("#2a2b2e") });
14202
14275
  kit.steeringWheel(c, f - 0.62, 1.38, -0.68, { r: 0.25, tilt: 1.15, col: 0.4 });
14203
- kit.seat(c, f - 1.15, 0.6, -0.68, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.46 });
14276
+ kit.seat(c, f - 1.15, 0.6, -0.68, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.46, id: "driver", role: "driver" });
14277
+ c.addDoor({ id: "door_front_right", widthMetres: 1, heightMetres: 2.05 });
14278
+ c.addDoor({ id: "door_rear_right", widthMetres: 1, heightMetres: 2.05 });
14204
14279
  c.roundBox(0.4, 0.95, 0.32, 0.05, CM("#9aa0a4", { metalness: 0.5 }), 3.95, fl + 0.48, -0.55);
14205
14280
  [0, 2.09, 4.19].forEach(function(a) {
14206
14281
  c.rod(
@@ -14538,7 +14613,9 @@ var GameUrbanThree = (() => {
14538
14613
  c.cylinder(0.05, 0.05, 0.012, MT.gauge, -0.165, 1.6, 0.1, "x");
14539
14614
  kit.steeringWheel(c, -0.38, 1.66, 0, { r: 0.2, tilt: 1, col: 0.42, mat: MT.trim });
14540
14615
  c.roundBox(1, 0.05, 0.94, 0.02, CM("#5c5f62", { metalness: 0.5 }), -0.7, 1.12, 0);
14541
- kit.seat(c, -1, 1.35, 0, { w: 0.5, h: 0.16, back: 0.44, lean: 0.12, mat: MT.seat, headrest: false });
14616
+ kit.seat(c, -1.08, 1.35, 0, { w: 0.54, h: 0.16, back: 0.44, lean: 0.12, mat: MT.seat, headrest: false, id: "driver", role: "driver" });
14617
+ c.addDoor({ id: "cab_entry_left", widthMetres: 0.85, heightMetres: 1.15 });
14618
+ c.addDoor({ id: "cab_entry_right", widthMetres: 0.85, heightMetres: 1.15 });
14542
14619
  c.roundBox(0.3, 0.2, 0.3, 0.04, dgray, -1, 1.28, 0);
14543
14620
  [
14544
14621
  [0.25, 1],
@@ -14888,7 +14965,11 @@ var GameUrbanThree = (() => {
14888
14965
  const fl = 0.6, fab = CM("#2f3136", { roughness: 0.9 });
14889
14966
  GH.liner(c, ST, -0.3, 1, fl, MT.carpet, { h: 0.03, maxW: 0.98 });
14890
14967
  [0.26, -0.26].forEach(function(z) {
14891
- kit.seat(c, 0.05, fl, z, { w: 0.44, h: 0.34, back: 0.6, lean: 0.12, mat: fab });
14968
+ kit.seat(c, 0.05, fl, z, { w: 0.48, h: 0.12, back: 0.6, lean: 0.12, mat: fab, role: "pilot" });
14969
+ if (z < 0) {
14970
+ c.addDoor({ id: "door_front_left", widthMetres: 0.68, heightMetres: 0.95 });
14971
+ c.addDoor({ id: "door_front_right", widthMetres: 0.68, heightMetres: 0.95 });
14972
+ }
14892
14973
  EA.pedals(c, 1.15, fl, z);
14893
14974
  });
14894
14975
  c.roundBox(0.35, 0.5, 0.24, 0.05, CM("#232427"), 0.95, fl + 0.28, 0, { rot: [0, 0, 0.35] });
@@ -15256,7 +15337,11 @@ var GameUrbanThree = (() => {
15256
15337
  const fl = 0.68, fab = CM("#4b4339", { roughness: 0.9 });
15257
15338
  GH.liner(c, ST, -0.6, 1.8, fl, MT.carpet, { h: 0.03, maxW: 1.15 });
15258
15339
  [0.3, -0.3].forEach(function(z) {
15259
- kit.seat(c, 1.05, fl, z, { w: 0.48, h: 0.36, back: 0.64, lean: 0.12, mat: fab });
15340
+ kit.seat(c, 1.05, fl, z, { w: 0.48, h: 0.28, back: 0.64, lean: 0.12, mat: fab, role: "pilot" });
15341
+ if (z < 0) {
15342
+ c.addDoor({ id: "door_front_left", widthMetres: 0.75, heightMetres: 1.05 });
15343
+ c.addDoor({ id: "door_front_right", widthMetres: 0.75, heightMetres: 1.05 });
15344
+ }
15260
15345
  EA.cyclic(c, 1.4, fl, z);
15261
15346
  EA.pedals(c, 2.1, fl, z);
15262
15347
  });
@@ -15660,7 +15745,11 @@ var GameUrbanThree = (() => {
15660
15745
  const fl = 0.7, fab = CM("#2c3540", { roughness: 0.9 });
15661
15746
  GH.liner(c, ST, -2.9, 2.5, fl, MT.carpet, { h: 0.03, maxW: 1.5 });
15662
15747
  [0.42, -0.42].forEach(function(z) {
15663
- kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.4, back: 0.7, lean: 0.12, mat: fab });
15748
+ kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.4, back: 0.7, lean: 0.12, mat: fab, role: "pilot" });
15749
+ if (z < 0) {
15750
+ c.addDoor({ id: "door_front_left", widthMetres: 0.78, heightMetres: 1.15 });
15751
+ c.addDoor({ id: "door_front_right", widthMetres: 0.78, heightMetres: 1.15 });
15752
+ }
15664
15753
  EA.cyclic(c, 1.95, fl, z);
15665
15754
  EA.pedals(c, 2.75, fl, z);
15666
15755
  });
@@ -16093,10 +16182,12 @@ var GameUrbanThree = (() => {
16093
16182
  kit.cutMesh(fus, [EA.sideCutP(tdP, 0.5)], 40, { sub: 0.12 });
16094
16183
  EA.colorize(fus.geometry, col);
16095
16184
  const fab = CM("#2e3328", { roughness: 0.85 });
16096
- kit.seat(c, 4.75, 1.55, 0, { w: 0.5, h: 0.32, back: 0.7, lean: 0.15, mat: fab });
16185
+ kit.seat(c, 4.75, 1.55, 0, { w: 0.5, h: 0.1, back: 0.7, lean: 0.15, mat: fab, role: "pilot" });
16097
16186
  c.roundBox(0.2, 0.3, 0.6, 0.04, CM("#232427"), 5.35, 1.98, 0, { rot: [0, 0, 0.3] });
16098
16187
  c.roundBox(0.2, 0.2, 0.15, 0.03, MT.plastic, 5.25, 2.15, 0);
16099
- kit.seat(c, 3.2, 2.12, 0, { w: 0.5, h: 0.32, back: 0.72, lean: 0.15, mat: fab });
16188
+ kit.seat(c, 3.2, 2.12, 0, { w: 0.5, h: 0.1, back: 0.72, lean: 0.15, mat: fab, role: "pilot" });
16189
+ c.addDoor({ id: "canopy_left", widthMetres: 0.72, heightMetres: 0.95 });
16190
+ c.addDoor({ id: "door_cargo_left", widthMetres: 0.9, heightMetres: 1.15 });
16100
16191
  EA.instPanel(c, 3.85, 2.62, 0.8, { gauges: 6, z0: -0.25, tilt: 0.3, screens: [[0.05, 0.2, 0.14, 0.18]] });
16101
16192
  EA.cyclic(c, 3.55, 2.12, 0);
16102
16193
  EA.collective(c, 3.3, 2.12, -0.38);
@@ -16906,6 +16997,10 @@ var GameUrbanThree = (() => {
16906
16997
  mirrorCol: "#22231d",
16907
16998
  wheels: []
16908
16999
  };
17000
+ s.interior = Object.assign(
17001
+ { floor: s.bottomY + 0.02, roof: s.gh.roof + 0.02, seatH: 0.14, dashD: 0.32, dashH: 0.24, visorUp: true },
17002
+ s.interior || {}
17003
+ );
16909
17004
  kit.car(c, s);
16910
17005
  [xf, xr].forEach(function(x) {
16911
17006
  ;
@@ -17170,8 +17265,8 @@ var GameUrbanThree = (() => {
17170
17265
  x: xd - 0.07,
17171
17266
  y: belt + 0.02,
17172
17267
  w: zi * 2,
17173
- d: 0.48,
17174
- h: Math.min(0.55, belt - fl - 0.08),
17268
+ d: 0.34,
17269
+ h: Math.min(0.28, belt - fl - 0.16),
17175
17270
  drv: -zi * 0.52,
17176
17271
  mat: trim,
17177
17272
  top: fab,
@@ -17179,8 +17274,12 @@ var GameUrbanThree = (() => {
17179
17274
  });
17180
17275
  kit.steeringWheel(c, xd - 0.66, belt + 0.06, -zi * 0.52, { r: 0.23, tilt: 1.12, col: 0.5, mat: trim });
17181
17276
  const sx = Math.max(f - len2 + 0.62, xd - 1.08);
17182
- kit.seat(c, sx, fl, -zi * 0.52, { w: 0.5, mat: fab, h: 0.44, back: 0.64, lean: 0.18 });
17183
- kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.44, back: 0.6, lean: 0.18 });
17277
+ kit.seat(c, sx, fl, -zi * 0.52, { w: 0.52, mat: fab, h: 0.24, back: 0.64, lean: 0.18, id: "driver", role: "driver" });
17278
+ kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.24, back: 0.6, lean: 0.18, role: "front_passenger" });
17279
+ const mDoorW = Math.max(0.75, f - 0.1 - (xr - 0.06));
17280
+ const mDoorH = Math.max(1.05, ry - fl - 0.1);
17281
+ c.addDoor({ id: "door_front_left", widthMetres: Math.round(mDoorW * 1e3) / 1e3, heightMetres: Math.round(mDoorH * 1e3) / 1e3 });
17282
+ c.addDoor({ id: "door_front_right", widthMetres: Math.round(mDoorW * 1e3) / 1e3, heightMetres: Math.round(mDoorH * 1e3) / 1e3 });
17184
17283
  c.rod(new V3(sx + 0.55, fl, -0.05), new V3(sx + 0.5, fl + 0.48, -0.08), 0.014, OLIVE_STEEL);
17185
17284
  c.sphere(0.035, BLACK, sx + 0.5, fl + 0.5, -0.08);
17186
17285
  c.roundBox(0.25, 0.16, 0.34, 0.02, CM("#3b402d", { roughness: 0.7 }), xd - 0.35, belt + 0.12, 0.1);
@@ -17722,7 +17821,9 @@ var GameUrbanThree = (() => {
17722
17821
  [-0.9, -2.2].forEach(function(x) {
17723
17822
  c.roundBox(0.3, 0.04, 0.1, 0.02, RED_LIGHT, x, roofY - 0.1, 0).castShadow = false;
17724
17823
  });
17725
- kit.seat(c, 0.95, fl + 0.1, -0.62, { w: 0.5, h: 0.42, back: 0.62, lean: 0.12, mat: CM("#2f3226", { roughness: 0.9 }) });
17824
+ kit.seat(c, 0.95, fl + 0.1, -0.62, { w: 0.5, h: 0.42, back: 0.62, lean: 0.12, mat: CM("#2f3226", { roughness: 0.9 }), id: "driver", role: "driver" });
17825
+ c.addDoor({ id: "hatch_driver", widthMetres: 0.58, heightMetres: 0.6 });
17826
+ c.addDoor({ id: "ramp_rear", widthMetres: 1.4, heightMetres: 1.35 });
17726
17827
  kit.steeringWheel(c, 1.5, 1.42, -0.62, { r: 0.2, tilt: 0.9, col: 0.35 });
17727
17828
  c.roundBox(0.35, 0.3, 0.7, 0.04, CM("#25261f"), 1.85, 1.45, -0.6);
17728
17829
  kit.seat(c, 0.15, fl, 0, { w: 0.5, h: 0.45, back: 0.62, lean: 0.12, mat: CM("#2f3226", { roughness: 0.9 }) });
@@ -18091,7 +18192,9 @@ var GameUrbanThree = (() => {
18091
18192
  });
18092
18193
  const fl = 0.72, fab = CM("#2f3226", { roughness: 0.9 });
18093
18194
  c.roundBox(3, 0.04, 1.6, 0.01, MT.carpet, 0.2, fl, 0);
18094
- kit.seat(c, 1, fl + 0.3, -0.55, { w: 0.46, h: 0.4, back: 0.5, lean: 0.25, mat: fab });
18195
+ kit.seat(c, 1, fl, -0.55, { w: 0.46, h: 0.14, back: 0.5, lean: 0.25, mat: fab, id: "driver", role: "driver" });
18196
+ c.addDoor({ id: "hatch_driver", widthMetres: 0.54, heightMetres: 0.58 });
18197
+ c.addDoor({ id: "hatch_commander", widthMetres: 0.6, heightMetres: 0.6 });
18095
18198
  kit.steeringWheel(c, 1.5, 1.38, -0.55, { r: 0.18, tilt: 0.9, col: 0.3 });
18096
18199
  c.roundBox(0.3, 0.26, 0.6, 0.04, CM("#25261f"), 1.75, 1.35, -0.5);
18097
18200
  const nT = c.vehicle.children.length;
@@ -18139,8 +18242,8 @@ var GameUrbanThree = (() => {
18139
18242
  for (let k = 0; k < 4; k++)
18140
18243
  c.rod(new V3(tx - 1.55, ty + 0.14, -0.6 + k * 0.4), new V3(tx - 1.55, ty + 0.4, -0.6 + k * 0.4), 0.015, OLIVE_STEEL);
18141
18244
  c.rod(new V3(tx - 1.55, ty + 0.4, -0.65), new V3(tx - 1.55, ty + 0.4, 0.65), 0.015, OLIVE_STEEL);
18142
- kit.seat(c, tx - 0.4, fl + 0.45, 0.42, { w: 0.42, h: 0.38, back: 0.45, lean: 0.1, mat: fab });
18143
- kit.seat(c, tx - 0.4, fl + 0.45, -0.42, { w: 0.42, h: 0.38, back: 0.45, lean: 0.1, mat: fab });
18245
+ kit.seat(c, tx - 0.4, fl + 0.12, 0.42, { w: 0.46, h: 0.16, back: 0.45, lean: 0.1, mat: fab, role: "crew" });
18246
+ kit.seat(c, tx - 0.4, fl + 0.12, -0.42, { w: 0.46, h: 0.16, back: 0.45, lean: 0.1, mat: fab, role: "crew" });
18144
18247
  c.roundBox(0.8, 0.3, 0.3, 0.05, BARREL, tx + 0.1, ty + 0.1, 0);
18145
18248
  c.roundBox(1.6, 0.02, 1.2, 0.01, MT.headliner, tx - 0.2, ty + 0.66, 0).castShadow = false;
18146
18249
  rigid(c, c.vehicle.children.slice(nT));
@@ -18333,7 +18436,18 @@ var GameUrbanThree = (() => {
18333
18436
  { rot: [0, 0, -0.18] }
18334
18437
  );
18335
18438
  hatch(c, 2.05, roofY - 0.1, -0.78, 0.28, 0, OLIVE_STEEL, { yaw: 0 });
18336
- kit.seat(c, 1.95, 0.62, -0.76, { w: 0.44, h: 0.34, back: 0.5, lean: 0.5, mat: CM("#2f3226", { roughness: 0.9 }) });
18439
+ kit.seat(c, 1.65, 0.3, -0.76, {
18440
+ w: 0.46,
18441
+ h: 0.14,
18442
+ back: 0.5,
18443
+ lean: 0.5,
18444
+ mat: CM("#2f3226", { roughness: 0.9 }),
18445
+ id: "driver",
18446
+ role: "driver",
18447
+ headroomMetres: 0.9
18448
+ });
18449
+ c.addDoor({ id: "hatch_driver", widthMetres: 0.56, heightMetres: 0.58 });
18450
+ c.addDoor({ id: "hatch_commander", widthMetres: 0.68, heightMetres: 0.68 });
18337
18451
  [-0.95, -0.78, -0.61].forEach(function(z, i) {
18338
18452
  periscope(c, 2.3, roofY - 0.08, z, 0.14, i === 1 ? lbl("driver_periscope") : null);
18339
18453
  });
@@ -18410,9 +18524,9 @@ var GameUrbanThree = (() => {
18410
18524
  });
18411
18525
  c.roundBox(0.25, 0.3, 1.6, 0.06, CANVAS2, bx + 0.12, ty + 0.4, 0);
18412
18526
  c.part("cargo", trl("labels.luggage_basket"), null, new V3(bx + 0.1, ty + 0.5, 0), 1);
18413
- kit.seat(c, tx - 0.55, ty - 0.45, 0.6, { w: 0.42, h: 0.38, back: 0.45, lean: 0.1, mat: fab });
18414
- kit.seat(c, tx + 0.2, ty - 0.55, 0.62, { w: 0.4, h: 0.36, back: 0.42, lean: 0.1, mat: fab });
18415
- kit.seat(c, tx - 0.3, ty - 0.55, -0.62, { w: 0.4, h: 0.36, back: 0.42, lean: 0.1, mat: fab });
18527
+ kit.seat(c, tx - 0.55, ty - 0.45, 0.6, { w: 0.46, h: 0.16, back: 0.45, lean: 0.1, mat: fab, role: "crew" });
18528
+ kit.seat(c, tx + 0.2, ty - 0.55, 0.62, { w: 0.46, h: 0.16, back: 0.42, lean: 0.1, mat: fab, role: "crew" });
18529
+ kit.seat(c, tx - 0.3, ty - 0.55, -0.62, { w: 0.46, h: 0.16, back: 0.42, lean: 0.1, mat: fab, role: "crew" });
18416
18530
  c.roundBox(1.1, 0.35, 0.4, 0.05, BARREL, tx + 0.6, ty + 0.35, 0.05);
18417
18531
  c.roundBox(2.2, 0.02, 1.6, 0.01, MT.headliner, tx - 0.3, tTop - 0.08, 0).castShadow = false;
18418
18532
  c.cylinder(0.05, 0.05, 0.03, RED_LIGHT, tx - 0.4, tTop - 0.1, 0.2);
@@ -18653,10 +18767,12 @@ var GameUrbanThree = (() => {
18653
18767
  const fl = 0.86, fab = CM("#2f3226", { roughness: 0.9 });
18654
18768
  c.roundBox(5.6, 0.04, 2.05, 0.01, MT.carpet, -0.4, fl, 0).castShadow = false;
18655
18769
  [0.5, -0.5].forEach(function(z) {
18656
- kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.42, back: 0.72, lean: 0.12, mat: fab });
18657
- c.rod(new V3(2, fl, z), new V3(1.95, fl + 0.55, z), 0.016, BLACK);
18658
- c.sphere(0.035, BLACK, 1.95, fl + 0.57, z);
18770
+ kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.42, back: 0.72, lean: 0.12, mat: fab, role: "pilot" });
18771
+ c.rod(new V3(2, fl, z), new V3(1.95, fl + 0.55, z), 0.016, BLACK).userData.noCabinRay = true;
18772
+ c.sphere(0.035, BLACK, 1.95, fl + 0.57, z).userData.noCabinRay = true;
18659
18773
  });
18774
+ c.addDoor({ id: "door_front_left", widthMetres: 0.75, heightMetres: 1.15 });
18775
+ c.addDoor({ id: "door_front_right", widthMetres: 0.75, heightMetres: 1.15 });
18660
18776
  c.roundBox(0.25, 0.45, 1.9, 0.05, CM("#232427"), 2.45, fl + 0.55, 0);
18661
18777
  c.roundBox(0.4, 0.05, 1.95, 0.02, CM("#1a1b1d"), 2.4, fl + 0.8, 0, { rot: [0, 0, 0.25] });
18662
18778
  [-0.75, -0.45, -0.15, 0.15, 0.45, 0.75].forEach(function(z) {
@@ -19791,9 +19907,13 @@ var GameUrbanThree = (() => {
19791
19907
  ft: gh.ft,
19792
19908
  rb: gh.rb,
19793
19909
  rt: gh.rt,
19794
- roof: Math.min(gh.roof, roofR),
19910
+ roof: gh.roof + 0.02,
19795
19911
  belt: gh.belt,
19796
- floor: s.bottomY + 0.1,
19912
+ floor: s.bottomY + 0.02,
19913
+ seatH: 0.12,
19914
+ dashD: 0.32,
19915
+ dashH: 0.24,
19916
+ visorUp: true,
19797
19917
  zIn: gh.Wg / 2 - 0.09,
19798
19918
  zRoof: halfAt(gh.Wg, T, gh.roof) - 0.12,
19799
19919
  xRear: gh.rb + 0.06
@@ -23266,7 +23386,7 @@ var GameUrbanThree = (() => {
23266
23386
  c.cylinder(0.025, 0.025, 0.2, EXH, -1.98, 0.3, z, "x");
23267
23387
  });
23268
23388
  c.part("engine", trl("labels.air_cooled_engine_rear"), null, new V3(-1.6, 0.55, 0), 1);
23269
- const fab = CM("#4b3a2e", { roughness: 0.85 }), fl = 0.36;
23389
+ const fab = CM("#4b3a2e", { roughness: 0.85 }), fl = 0.31;
23270
23390
  c.roundBox(1.7, 0.03, 0.62, 0.01, MT.carpet, -0.15, fl, 0).castShadow = false;
23271
23391
  c.roundBox(0.2, 0.24, 1.14, 0.04, col, 0.66, 0.92, 0);
23272
23392
  c.roundBox(0.16, 0.05, 1.12, 0.02, CM("#1b1c1e"), 0.6, 1.03, 0);
@@ -23277,9 +23397,18 @@ var GameUrbanThree = (() => {
23277
23397
  c.rod(new V3(0.12, fl, 0), new V3(0.02, fl + 0.42, 0), 0.01, MT.chrome);
23278
23398
  c.sphere(0.025, MT.plastic, 0.02, fl + 0.44, 0);
23279
23399
  [-1, 1].forEach(function(sd) {
23280
- kit.seat(c, -0.02, fl, sd * 0.27, { w: 0.44, mat: fab, back: 0.58, lean: 0.2, h: 0.28, headrest: false });
23400
+ kit.seat(c, -0.08, fl, sd * 0.27, {
23401
+ w: 0.44,
23402
+ mat: fab,
23403
+ back: 0.58,
23404
+ lean: 0.2,
23405
+ h: 0.14,
23406
+ headrest: false,
23407
+ id: sd < 0 ? "driver" : "front_right",
23408
+ role: sd < 0 ? "driver" : "front_passenger"
23409
+ });
23281
23410
  });
23282
- kit.seat(c, -0.66, fl, 0, { w: 0.94, n: 3, mat: fab, back: 0.44, lean: 0.14, h: 0.26, len: 0.42, headrest: false });
23411
+ kit.seat(c, -0.58, fl, 0, { w: 0.94, n: 3, mat: fab, back: 0.44, lean: 0.14, h: 0.11, len: 0.42, headrest: false, role: "rear" });
23283
23412
  [1, -1].forEach(function(sd) {
23284
23413
  for (let yk = 0.56; yk < 0.95; yk += 0.075) {
23285
23414
  const zf = Math.min(loftHalf(stS, -0.3, yk - 0.04), loftHalf(stS, 0.5, yk - 0.04)) - 0.045;
@@ -25336,11 +25465,12 @@ var GameUrbanThree = (() => {
25336
25465
  c.roundBox(0.012, 0.012, 0.06, 4e-3, MT.steel, 2.06, 0.62, 0, PG);
25337
25466
  const fl = -0.4, fab = CM("#3c3a35", { roughness: 0.9 });
25338
25467
  c.roundBox(2, 0.025, 0.6, 0.01, MT.carpet, 0.55, fl, 0, PG).castShadow = false;
25339
- kit.seat(c, 0.62, fl, 0, { w: 0.48, h: 0.3, back: 0.55, lean: 0.2, mat: fab, parent: grp, headrest: false });
25340
- kit.seat(c, -0.22, fl + 0.04, 0, { w: 0.5, h: 0.3, back: 0.58, lean: 0.2, mat: fab, parent: grp, headrest: false });
25468
+ kit.seat(c, 0.62, fl, 0, { w: 0.48, h: 0.16, back: 0.55, lean: 0.2, mat: fab, parent: grp, headrest: false, role: "pilot" });
25469
+ kit.seat(c, -0.22, fl + 0.04, 0, { w: 0.5, h: 0.16, back: 0.58, lean: 0.2, mat: fab, parent: grp, headrest: false, role: "crew" });
25470
+ c.addDoor({ id: "canopy_door", widthMetres: 0.7, heightMetres: 0.85 });
25341
25471
  [1.12, 0.3].forEach(function(x) {
25342
- c.rod(new V3(x, fl, 0), new V3(x - 0.05, fl + 0.5, 0), 0.012, MT.plastic, PG);
25343
- c.sphere(0.025, MT.plastic, x - 0.055, fl + 0.52, 0, 1, 1.4, 1, PG);
25472
+ c.rod(new V3(x, fl, 0), new V3(x - 0.05, fl + 0.5, 0), 0.012, MT.plastic, PG).userData.noCabinRay = true;
25473
+ c.sphere(0.025, MT.plastic, x - 0.055, fl + 0.52, 0, 1, 1.4, 1, PG).userData.noCabinRay = true;
25344
25474
  });
25345
25475
  c.roundBox(0.05, 0.22, 0.6, 0.02, CM("#2a2b2d", { roughness: 0.8 }), 1.75, 0.3, 0, PG);
25346
25476
  [-0.2, -0.08, 0.04, 0.16, -0.14].forEach(function(z, i) {
@@ -25694,7 +25824,8 @@ var GameUrbanThree = (() => {
25694
25824
  const fl = 0.98, fab = CM("#3d4552", { roughness: 0.9 });
25695
25825
  liner(c, ST, -4.6, 5.9, fl, MT.carpet, { h: 0.03 });
25696
25826
  [0.38, -0.38].forEach(function(z) {
25697
- kit.seat(c, 4.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: CM("#2a2c30", { roughness: 0.8 }) });
25827
+ kit.seat(c, 4.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: CM("#2a2c30", { roughness: 0.8 }), role: "pilot" });
25828
+ if (z < 0) c.addDoor({ id: "cabin_door_left", widthMetres: 0.78, heightMetres: 1.55 });
25698
25829
  kit.yoke(c, 5.5, 1.75, z);
25699
25830
  EA.pedals(c, 5.95, fl, z);
25700
25831
  });
@@ -26088,7 +26219,8 @@ var GameUrbanThree = (() => {
26088
26219
  const fl = 2.06, fab = CM("#4a4640", { roughness: 0.9 });
26089
26220
  liner(c, ST, -3.2, 2, fl, MT.carpet, { h: 0.03 });
26090
26221
  [0.38, -0.38].forEach(function(z) {
26091
- kit.seat(c, 0.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: fab });
26222
+ kit.seat(c, 0.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: fab, role: "pilot" });
26223
+ if (z < 0) c.addDoor({ id: "cabin_door_left", widthMetres: 0.78, heightMetres: 1.4 });
26092
26224
  kit.yoke(c, 1.5, 2.85, z);
26093
26225
  EA.pedals(c, 1.95, fl, z);
26094
26226
  });
@@ -26503,7 +26635,8 @@ var GameUrbanThree = (() => {
26503
26635
  const fl = 0.8, fab = CM("#c9bda6", { roughness: 0.75 });
26504
26636
  liner(c, ST, -2, 4, fl, MT.carpet, { h: 0.03 });
26505
26637
  [0.36, -0.36].forEach(function(z) {
26506
- kit.seat(c, 3.55, fl, z, { w: 0.48, h: 0.36, back: 0.66, lean: 0.14, mat: CM("#2a2c30") });
26638
+ kit.seat(c, 3.55, fl, z, { w: 0.48, h: 0.36, back: 0.66, lean: 0.14, mat: CM("#2a2c30"), role: "pilot" });
26639
+ if (z < 0) c.addDoor({ id: "cabin_door_left", widthMetres: 0.72, heightMetres: 1.35 });
26507
26640
  kit.yoke(c, 4.05, 1.55, z);
26508
26641
  });
26509
26642
  EA.instPanel(c, 4.3, 1.68, 1.35, {
@@ -26871,11 +27004,12 @@ var GameUrbanThree = (() => {
26871
27004
  [1.55, 1.24],
26872
27005
  [0.2, 1.46]
26873
27006
  ].forEach(function(q, i) {
26874
- kit.seat(c, q[0], q[1], 0, { w: 0.5, h: 0.32, back: 0.85, lean: 0.24, mat: fab, headrest: false });
27007
+ kit.seat(c, q[0], q[1], 0, { w: 0.5, h: 0.32, back: 0.85, lean: 0.24, mat: fab, headrest: false, role: i === 0 ? "pilot" : "crew" });
26875
27008
  c.roundBox(0.14, 0.3, 0.44, 0.04, CM("#202224"), q[0] - 0.42, q[1] + 1.05, 0, { rot: [0, 0, 0.24] });
26876
27009
  c.rod(new V3(q[0] - 0.38, q[1] + 1.25, -0.06), new V3(q[0] - 0.3, q[1] + 1.4, 0.06), 0.012, MT.yellow);
26877
- c.rod(new V3(q[0] + 0.35, q[1], 0), new V3(q[0] + 0.32, q[1] + 0.45, 0), 0.016, blk);
26878
- c.sphere(0.03, blk, q[0] + 0.31, q[1] + 0.48, 0, 1, 1.5, 1);
27010
+ c.rod(new V3(q[0] + 0.35, q[1], 0), new V3(q[0] + 0.32, q[1] + 0.45, 0), 0.016, blk).userData.noCabinRay = true;
27011
+ c.sphere(0.03, blk, q[0] + 0.31, q[1] + 0.48, 0, 1, 1.5, 1).userData.noCabinRay = true;
27012
+ if (i === 0) c.addDoor({ id: "canopy_door", widthMetres: 0.68, heightMetres: 0.85 });
26879
27013
  const px = q[0] + 0.75;
26880
27014
  c.roundBox(0.16, 0.3, 0.6, 0.04, CM("#232427"), px, q[1] + 0.65, 0, { rot: [0, 0, 0.2] });
26881
27015
  [-0.15, 0.15].forEach(function(z) {
@@ -27709,10 +27843,26 @@ var GameUrbanThree = (() => {
27709
27843
  roofLining(c, extra);
27710
27844
  if (!c.meta.damage) c.meta.damage = crashDamage;
27711
27845
  }
27846
+ function withCabinPackaging(s) {
27847
+ if (s.interior === false) return s;
27848
+ return Object.assign({}, s, {
27849
+ interior: Object.assign(
27850
+ {
27851
+ floor: s.bottomY + 0.02,
27852
+ roof: s.gh.roof + 0.02,
27853
+ seatH: 0.12,
27854
+ dashD: 0.32,
27855
+ dashH: 0.24,
27856
+ visorUp: true
27857
+ },
27858
+ s.interior || {}
27859
+ )
27860
+ });
27861
+ }
27712
27862
  function suvBuild(c, s, o) {
27713
27863
  o = o || {};
27714
27864
  const n0 = c.deform.length;
27715
- kit.car(c, s);
27865
+ kit.car(c, withCabinPackaging(s));
27716
27866
  const low = c.deform[n0], m = c.meta;
27717
27867
  let extra = [];
27718
27868
  if (o.flares !== false) extra = extra.concat(fenderFlares(c, s.arches, s.W, s.bottomY, o.flare));
@@ -28199,7 +28349,7 @@ var GameUrbanThree = (() => {
28199
28349
  );
28200
28350
  function pickupBuild(c, s, o) {
28201
28351
  const n0 = c.deform.length;
28202
- kit.car(c, s);
28352
+ kit.car(c, withCabinPackaging(s));
28203
28353
  const low = c.deform[n0], m = c.meta;
28204
28354
  let extra = [];
28205
28355
  cargoBed(c, { low, x0: m.rear + 0.06, x1: o.bedFront, floor: o.floor, top: s.gh.belt, W: s.W, arches: s.arches });
@@ -28595,7 +28745,7 @@ var GameUrbanThree = (() => {
28595
28745
  wheels: []
28596
28746
  };
28597
28747
  const n0 = c.deform.length;
28598
- kit.car(c, s);
28748
+ kit.car(c, withCabinPackaging(s));
28599
28749
  const low = c.deform[n0], m = c.meta;
28600
28750
  cargoBed(c, { low, x0: m.rear + 0.06, x1: -0.42, floor: 1.78, top: 2.25, W, arches: [] });
28601
28751
  c.roundBox(0.08, 0.08, W + 0.1, 0.03, MT.chrome, m.front + 0.06, 1.72, 0);
@@ -28915,7 +29065,10 @@ var GameUrbanThree = (() => {
28915
29065
  xRear: P.cabBack - 0.12,
28916
29066
  xFront: P.cabBack + 0.42,
28917
29067
  seatH: 0.42,
28918
- front: "bench"
29068
+ front: "bench",
29069
+ dashD: 0.32,
29070
+ dashH: 0.24,
29071
+ visorUp: true
28919
29072
  });
28920
29073
  c.roundBox(
28921
29074
  0.04,
@@ -29951,8 +30104,8 @@ var GameUrbanThree = (() => {
29951
30104
  });
29952
30105
  }
29953
30106
  function cyclic(c, x, fl, z) {
29954
- c.rod(new V3(x, fl, z), new V3(x - 0.04, fl + 0.55, z), 0.014, MT.plastic);
29955
- c.roundBox(0.04, 0.12, 0.04, 0.015, MT.plastic, x - 0.05, fl + 0.6, z);
30107
+ c.rod(new V3(x, fl, z), new V3(x - 0.04, fl + 0.55, z), 0.014, MT.plastic).userData.noCabinRay = true;
30108
+ c.roundBox(0.04, 0.12, 0.04, 0.015, MT.plastic, x - 0.05, fl + 0.6, z).userData.noCabinRay = true;
29956
30109
  }
29957
30110
  function collective(c, x, fl, z) {
29958
30111
  c.rod(new V3(x - 0.35, fl + 0.18, z), new V3(x + 0.05, fl + 0.32, z), 0.016, MT.plastic);
@@ -30483,8 +30636,8 @@ var GameUrbanThree = (() => {
30483
30636
  c.rod(new V3(0.62, cy + 0.72, 0.62), new V3(0.55, cy + 0.82, 0.62), 0.02, MT.chrome);
30484
30637
  c.rod(new V3(0.55, cy + 0.7, 0.98), new V3(0.42, cy + 0.88, 1), 0.015, MT.chrome);
30485
30638
  c.sphere(0.035, MT.plastic, 0.42, cy + 0.9, 1);
30486
- kit.seat(c, -0.1, cy + 2e-3, 0.72, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
30487
- kit.seat(c, -0.1, cy + 2e-3, -0.74, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
30639
+ kit.seat(c, -0.1, cy + 2e-3, 0.72, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false, open: true, role: "front_passenger" });
30640
+ kit.seat(c, -0.1, cy + 2e-3, -0.74, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false, open: true, id: "driver", role: "driver" });
30488
30641
  [1, -1].forEach(function(s) {
30489
30642
  const pts = [];
30490
30643
  for (let i = 0; i <= 8; i++) {
@@ -30795,7 +30948,8 @@ var GameUrbanThree = (() => {
30795
30948
  c.rod(new V3(0, 0, 0), new V3(0, Math.cos(a8) * 0.36, Math.sin(a8) * 0.36), 0.014, MT.wood, { parent: whl });
30796
30949
  }
30797
30950
  c.cylinder(0.05, 0.05, 0.14, MT.wood, 0.06, 0, 0, "x", { parent: whl });
30798
- kit.seat(c, hx - 0.05, hy0 + 2e-3, 0, { w: 0.5, h: 0.55, back: 0.45, mat: inner2, headrest: false });
30951
+ kit.seat(c, hx - 0.12, hy0 + 2e-3, 0, { w: 0.54, h: 0.55, back: 0.45, mat: inner2, headrest: false, id: "driver", role: "driver" });
30952
+ c.addDoor({ id: "cabin_door", widthMetres: 0.68, heightMetres: 1.55 });
30799
30953
  c.roundBox(1.8, 0.12, 0.65, 0.04, CM("#7c5a3b"), hx - 0.2, hy0 + 0.5, -0.72);
30800
30954
  c.roundBox(1.7, 0.08, 0.55, 0.04, CM("#6b7c8f", { roughness: 1 }), hx - 0.2, hy0 + 0.6, -0.72);
30801
30955
  c.roundBox(1.9, 0.02, 2.1, 0.01, inner2, hx, hy0 + hh - 0.06, 0).castShadow = false;
@@ -31011,11 +31165,13 @@ var GameUrbanThree = (() => {
31011
31165
  const fl = 0.74, fab = CM("#4a463f", { roughness: 0.9 });
31012
31166
  c.roundBox(2.2, 0.03, 0.98, 0.01, MT.carpet, 0.2, fl, 0).castShadow = false;
31013
31167
  [0.26, -0.26].forEach(function(z) {
31014
- kit.seat(c, 0.38, fl, z, { w: 0.44, h: 0.34, back: 0.62, lean: 0.18, mat: fab });
31168
+ kit.seat(c, 0.38, fl, z, { w: 0.48, h: 0.24, back: 0.62, lean: 0.18, mat: fab, role: "pilot" });
31015
31169
  EA.pedals(c, 1.18, fl, z);
31016
31170
  kit.yoke(c, 0.98, 1.47, z);
31017
31171
  });
31018
- kit.seat(c, -0.52, fl, 0, { w: 0.96, n: 2, h: 0.34, back: 0.58, lean: 0.2, mat: fab });
31172
+ kit.seat(c, -0.52, fl, 0, { w: 0.96, n: 2, h: 0.24, back: 0.58, lean: 0.2, mat: fab });
31173
+ c.addDoor({ id: "door_front_left", widthMetres: 0.75, heightMetres: 0.95 });
31174
+ c.addDoor({ id: "door_front_right", widthMetres: 0.75, heightMetres: 0.95 });
31019
31175
  EA.instPanel(c, 1.1, 1.52, 1, { gauges: 6, z0: -0.38, screens: [[0, 0.12, 0.14, 0.22]] });
31020
31176
  c.roundBox(0.1, 0.1, 0.1, 0.02, MT.plastic, 1, 1.32, 0);
31021
31177
  c.cylinder(0.018, 0.018, 0.1, MT.chrome, 0.93, 1.34, 0.02, "x");
@@ -31290,9 +31446,10 @@ var GameUrbanThree = (() => {
31290
31446
  );
31291
31447
  const fl = -0.36;
31292
31448
  c.roundBox(1.3, 0.03, 0.8, 0.01, MT.carpet, -0.4, fl, 0, { parent: grp }).castShadow = false;
31293
- kit.seat(c, -0.55, fl, 0, { w: 0.5, h: 0.32, back: 0.66, lean: 0.12, mat: CM("#3a3530", { roughness: 0.9 }), parent: grp });
31294
- c.rod(new V3(0, fl, 0), new V3(-0.06, fl + 0.55, 0), 0.016, MT.plastic, { parent: grp });
31295
- c.roundBox(0.04, 0.13, 0.05, 0.015, MT.plastic, -0.07, fl + 0.6, 0, { parent: grp });
31449
+ kit.seat(c, -0.55, fl, 0, { w: 0.5, h: 0.18, back: 0.66, lean: 0.12, mat: CM("#3a3530", { roughness: 0.9 }), parent: grp, role: "pilot" });
31450
+ c.addDoor({ id: "canopy_door", widthMetres: 0.7, heightMetres: 0.85 });
31451
+ c.rod(new V3(0, fl, 0), new V3(-0.06, fl + 0.55, 0), 0.016, MT.plastic, { parent: grp }).userData.noCabinRay = true;
31452
+ c.roundBox(0.04, 0.13, 0.05, 0.015, MT.plastic, -0.07, fl + 0.6, 0, { parent: grp }).userData.noCabinRay = true;
31296
31453
  c.roundBox(0.16, 0.3, 0.8, 0.04, CM("#232427"), 0.36, 0.5, 0, { parent: grp, rot: [0, 0, 0.2] });
31297
31454
  [-0.24, -0.12, 0, 0.12, 0.24].forEach(function(z, i) {
31298
31455
  c.cylinder(0.036, 0.036, 0.012, MT.gauge, 0.27, 0.55 - i % 2 * 0.09, z, "x", { seg: 16, parent: grp }).castShadow = false;
@@ -31702,10 +31859,12 @@ var GameUrbanThree = (() => {
31702
31859
  const fl = 0.72, fab = CM("#3b3a38", { roughness: 0.9 });
31703
31860
  c.roundBox(1.9, 0.03, 1.16, 0.01, MT.carpet, 0.2, fl, 0).castShadow = false;
31704
31861
  [0.3, -0.3].forEach(function(z) {
31705
- kit.seat(c, 0.35, fl, z, { w: 0.48, h: 0.36, back: 0.62, lean: 0.14, mat: fab });
31862
+ kit.seat(c, 0.35, fl, z, { w: 0.48, h: 0.2, back: 0.62, lean: 0.14, mat: fab, role: "pilot" });
31706
31863
  EA.pedals(c, 1.35, fl, z);
31707
31864
  });
31708
- kit.seat(c, -0.55, fl + 0.06, 0, { w: 1.06, n: 2, h: 0.36, back: 0.6, lean: 0.12, mat: fab });
31865
+ kit.seat(c, -0.55, fl + 0.06, 0, { w: 1.06, n: 2, h: 0.2, back: 0.6, lean: 0.12, mat: fab });
31866
+ c.addDoor({ id: "door_front_left", widthMetres: 0.72, heightMetres: 1.05 });
31867
+ c.addDoor({ id: "door_front_right", widthMetres: 0.72, heightMetres: 1.05 });
31709
31868
  c.roundBox(0.42, 0.62, 0.3, 0.06, CM("#232427"), 1.15, fl + 0.32, 0, { rot: [0, 0, 0.35] });
31710
31869
  c.roundBox(0.06, 0.3, 0.3, 0.02, CM("#1a1b1d"), 1.25, fl + 0.65, 0, { rot: [0, 0, 0.6] });
31711
31870
  [-0.07, 0.07].forEach(function(z) {
@@ -32036,6 +32195,8 @@ var GameUrbanThree = (() => {
32036
32195
  EA.collective(c, 1.3, fl, -0.72);
32037
32196
  EA.collective(c, 1.3, fl, 0.12);
32038
32197
  kit.seat(c, -0.35, fl + 0.04, 0, { w: 1.56, n: 4, h: 0.38, back: 0.62, lean: 0.1, mat: fab });
32198
+ c.addDoor({ id: "door_front_left", widthMetres: 0.78, heightMetres: 1.15 });
32199
+ c.addDoor({ id: "door_front_right", widthMetres: 0.78, heightMetres: 1.15 });
32039
32200
  EA.instPanel(c, 2.25, 1.55, 1.2, { gauges: 8, z0: -0.45, tilt: 0.3, screens: [[0.05, 0.25, 0.14, 0.2]] });
32040
32201
  c.roundBox(0.5, 0.45, 0.32, 0.06, CM("#232427"), 2.05, fl + 0.24, 0);
32041
32202
  c.roundBox(2.3, 0.02, 1.4, 0.01, MT.headliner, 0.45, 2.24, 0).castShadow = false;
@@ -35087,8 +35248,12 @@ var GameUrbanThree = (() => {
35087
35248
  for (const part of silhouette.parts) parts.push(part.parent < 0 ? part : { ...part, parent: part.parent + offset });
35088
35249
  for (const window of silhouette.windows) (window.isLit ? windows.lit : windows.dark).push(window);
35089
35250
  };
35251
+ const covers = [];
35252
+ const cover2 = (footprint) => {
35253
+ covers.push(footprint);
35254
+ };
35090
35255
  const scene = () => ({ parts, items, windows });
35091
- return { random, pick, lights, parts, items, windows, group, box: box2, cylinder: cylinder2, cone: cone2, prism, plane: plane2, vault, terrain, crown, line, label, light, spot, place, item, fence, add: add2, scene };
35256
+ return { random, pick, lights, parts, items, windows, covers, cover: cover2, group, box: box2, cylinder: cylinder2, cone: cone2, prism, plane: plane2, vault, terrain, crown, line, label, light, spot, place, item, fence, add: add2, scene };
35092
35257
  }
35093
35258
  var DEFAULT_POLE_SLOTS = {
35094
35259
  height: 11,
@@ -35216,7 +35381,7 @@ var GameUrbanThree = (() => {
35216
35381
  { id: "flood_tower", shape: "flood_tower", spec: FLOOD },
35217
35382
  { id: "concrete_distribution", shape: "distribution", spec: DISTRIBUTION }
35218
35383
  ];
35219
- var DEFAULT_ROAD_STYLE = { color: 2237480, dash: { color: 9404239, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } };
35384
+ var DEFAULT_ROAD_STYLE = { color: 2237480, plane: true, dash: { color: 9404239, every: 5, first: 2, length: 1.8, width: 0.16, height: 0.01, y: 0.025 } };
35220
35385
  var DEFAULT_WALK_STYLE = { color: 3816252, height: 0.15, castShadow: false };
35221
35386
  var ROAD_LEVEL = 0.02;
35222
35387
  var DEFAULT_GROUND_COLOR = 1382426;
@@ -35226,7 +35391,7 @@ var GameUrbanThree = (() => {
35226
35391
  function drawRoad(b, x, z, w, l, along2, options) {
35227
35392
  const style = roadStyle(options);
35228
35393
  const alongX = along2 === "x";
35229
- b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
35394
+ if (style.plane) b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
35230
35395
  const { dash } = style;
35231
35396
  for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {
35232
35397
  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);
@@ -35335,6 +35500,7 @@ var GameUrbanThree = (() => {
35335
35500
  var DEFAULT_STOREY_PRESETS = { commercial: "office", residential: "residential" };
35336
35501
  function drawBuilding(b, x, z, width, depth, height, color2, options = {}) {
35337
35502
  b.add(createCityBuilding({ x, z, width, depth, height, color: color2, random: b.random, shopChance: options.shop, litChance: options.lit }));
35503
+ b.cover({ x, z, halfX: width / 2, halfZ: depth / 2, yaw: 0, top: height });
35338
35504
  return { x, z, width, depth, height, color: color2 };
35339
35505
  }
35340
35506
  function pickUse(b, uses) {
@@ -35403,6 +35569,7 @@ var GameUrbanThree = (() => {
35403
35569
  }
35404
35570
  function drawTent(b, x, z, ry, w, d, color2, c) {
35405
35571
  b.prism(x, 0, z, w, w * 0.7, d, color2 ?? colors(c).tent, -1, ry);
35572
+ b.cover({ x, z, halfX: w / 2, halfZ: d / 2, yaw: -ry, top: w * 0.7 });
35406
35573
  }
35407
35574
  function drawPine(b, x, z, scale = 1, y = 0, c) {
35408
35575
  const palette2 = colors(c);
@@ -35420,12 +35587,14 @@ var GameUrbanThree = (() => {
35420
35587
  const group = b.group(x, y, z, ry);
35421
35588
  b.box(0, 0, 0, 2.44, 2.6, 6.06, color2, { parent: group, style: { roughness: 0.7, metalness: 0.3 } });
35422
35589
  for (let k = -2; k <= 2; k++) b.box(k * 0.5, 0, 3.04, 0.06, 2.6, 0.04, 1710618, { parent: group });
35590
+ b.cover({ x, z, halfX: 1.22, halfZ: 3.03, yaw: -ry, top: y + 2.6 });
35423
35591
  }
35424
35592
  function drawWatchtower(b, x, z, searchlight = false, c) {
35425
35593
  const palette2 = colors(c).watchtower;
35426
35594
  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, palette2.leg);
35427
35595
  b.box(x, 7, z, 3.2, 1.2, 3.2, palette2.cabin);
35428
35596
  b.box(x, 8.2, z, 3.6, 0.15, 3.6, palette2.deck);
35597
+ b.cover({ x, z, halfX: 1.8, halfZ: 1.8, yaw: 0, top: 8.35 });
35429
35598
  for (const side of [-1.5, 1.5]) b.box(x + side, 8.2, z, 0.15, 1.6, 0.15, palette2.deck);
35430
35599
  if (searchlight) b.spot({ x, y: 9, z, color: 15134463, 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 } });
35431
35600
  }
@@ -36403,7 +36572,12 @@ var GameUrbanThree = (() => {
36403
36572
  const propColors = { ...DEFAULT_PROP_COLORS, ...options.props };
36404
36573
  const towers = options.towers ? options.towers === true ? {} : options.towers : null;
36405
36574
  const building = (b, x, z, width, depth, height, color2, o) => drawBuilding(b, x, z, width, depth, height, color2, o);
36406
- const drawBlockBuilding = towers ? createTowerDrawer(towers, building) : building;
36575
+ const towerDrawer = towers ? createTowerDrawer(towers, building) : null;
36576
+ const drawBlockBuilding = towerDrawer ? (b, x, z, width, depth, height, color2, o) => {
36577
+ const built = towerDrawer(b, x, z, width, depth, height, color2, o);
36578
+ b.cover({ x, z, halfX: width / 2, halfZ: depth / 2, yaw: 0, top: built.height });
36579
+ return built;
36580
+ } : building;
36407
36581
  const poles = {
36408
36582
  ids: () => [...entries.keys()],
36409
36583
  list: () => [...entries.values()],
@@ -36513,6 +36687,50 @@ var GameUrbanThree = (() => {
36513
36687
  }
36514
36688
 
36515
36689
  // ../game-urban/dist/networks/index.js
36690
+ var EDGE_NETWORK = {
36691
+ mv_span: "power_mv",
36692
+ lv_span: "power_lv",
36693
+ service_drop: "power_lv",
36694
+ light_feed: "lighting",
36695
+ telecom_span: "telecom",
36696
+ telecom_drop: "telecom",
36697
+ sewer_main: "sewer",
36698
+ sewer_lateral: "sewer",
36699
+ storm_gallery: "storm",
36700
+ storm_lateral: "storm",
36701
+ storm_gutter: "storm",
36702
+ water_main: "water",
36703
+ water_service: "water"
36704
+ };
36705
+ var AERIAL = /* @__PURE__ */ new Set(["mv_span", "lv_span", "telecom_span", "service_drop", "telecom_drop", "light_feed"]);
36706
+ function isAerialEdgeKind(kind) {
36707
+ return AERIAL.has(kind);
36708
+ }
36709
+ var NONE = [];
36710
+ var ofNetwork = (edges, network) => {
36711
+ if (edges === void 0) return NONE;
36712
+ return network === void 0 ? edges : edges.filter((edge) => EDGE_NETWORK[edge.kind] === network);
36713
+ };
36714
+ function buildNetworkGraph(input) {
36715
+ const nodes = /* @__PURE__ */ new Map();
36716
+ for (const node of input.nodes) if (!nodes.has(node.id)) nodes.set(node.id, node);
36717
+ const edges = /* @__PURE__ */ new Map();
36718
+ const out = /* @__PURE__ */ new Map();
36719
+ const into = /* @__PURE__ */ new Map();
36720
+ for (const edge of input.edges) {
36721
+ if (edges.has(edge.id)) continue;
36722
+ edges.set(edge.id, edge);
36723
+ if (!nodes.has(edge.from) || !nodes.has(edge.to)) continue;
36724
+ out.set(edge.from, [...out.get(edge.from) ?? [], edge]);
36725
+ into.set(edge.to, [...into.get(edge.to) ?? [], edge]);
36726
+ }
36727
+ return {
36728
+ nodes,
36729
+ edges,
36730
+ outgoing: (nodeId, network) => ofNetwork(out.get(nodeId), network),
36731
+ incoming: (nodeId, network) => ofNetwork(into.get(nodeId), network)
36732
+ };
36733
+ }
36516
36734
  var DEFAULT_NETWORK_LAYOUT = {
36517
36735
  sidewalk: 2.5,
36518
36736
  edgeReach: 5,
@@ -36573,7 +36791,8 @@ var GameUrbanThree = (() => {
36573
36791
  storm_gutter: { min: 0 },
36574
36792
  sewer_main: { min: 0.9 }
36575
36793
  },
36576
- sewer: { maxDepth: 4.5, coverUnderGallery: 1.8, galleryReach: 3, lateralOverGallery: 0.85, manholeSpacing: 80 },
36794
+ sewer: { maxDepth: 4.5, coverUnderGallery: 1.8, galleryReach: 3, lateralOverGallery: 0.85, manholeSpacing: 80, turnTolerance: 5, branchMaxSkew: 5 },
36795
+ storm: { inletSpacing: 60, cornerReach: 15 },
36577
36796
  crossing: { separation: 0.2, rank: { storm_gutter: 0, water_main: 1, water_service: 1, sewer_lateral: 2, storm_lateral: 3, storm_gallery: 3, sewer_main: 4 } },
36578
36797
  connectionTolerance: 0.01,
36579
36798
  layout: DEFAULT_NETWORK_LAYOUT
@@ -36584,6 +36803,7 @@ var GameUrbanThree = (() => {
36584
36803
  return isPoleSlots(slots2) ? slots2 : void 0;
36585
36804
  }
36586
36805
  var UINT322 = 2 ** 32;
36806
+ var DEGREES = Math.PI / 180;
36587
36807
  function poleHeightsOf(slots2) {
36588
36808
  const { mv, transformer, lv, lighting, telecom } = slots2.bands;
36589
36809
  return { mv: mv[1], transformer: (transformer[0] + transformer[1]) / 2, transformerBottom: transformer[0], lv: lv[1] - 0.1, lamp: lighting[0] + 0.1, telecom: telecom[1] };
@@ -36680,10 +36900,108 @@ var GameUrbanThree = (() => {
36680
36900
  const attachments = { mv: mv.mv, lv: lvAt, telecom: telecomAt, guy: [0, spec.slots.bands.mv[0] - 0.15, 0], ...transformer ? { transformer: transformer.points } : {} };
36681
36901
  return { boxes, cylinders, ...lamp ? { lens: lamp.lens } : {}, attachments };
36682
36902
  }
36903
+ var COVER = 0.6;
36904
+ var SHAFT_PV = { shape: "round", width: 0.9, depth: 0.9, material: "concrete" };
36905
+ function specOf(node) {
36906
+ const network = node.carries[0];
36907
+ switch (node.kind) {
36908
+ case "manhole":
36909
+ return node.spec === "gallery_box" ? { kind: "manhole_cover", shape: "square", size: [COVER, 0.03, COVER], material: "cast_iron", solid: false, shaft: { shape: "square", width: 0.9, depth: 0.9, material: "concrete" } } : { kind: "manhole_cover", shape: "round", size: [COVER, 0.03, COVER], material: "cast_iron", solid: false, shaft: SHAFT_PV };
36910
+ case "pumping_station":
36911
+ return { kind: "manhole_cover", shape: "round", size: [0.9, 0.03, 0.9], material: "cast_iron", solid: false, shaft: { shape: "round", width: 1.5, depth: 1.5, material: "concrete" } };
36912
+ case "cleanout":
36913
+ return { kind: "cleanout_cover", shape: "round", size: [0.25, 0.03, 0.25], material: "cast_iron", solid: false, shaft: { shape: "round", width: 0.2, depth: 0.2, material: "plastic" } };
36914
+ case "inlet":
36915
+ return { kind: "inlet_grate", shape: "square", size: [0.9, 0.03, 0.5], material: "cast_iron", solid: false, shaft: { shape: "square", width: 0.8, depth: 0.5, material: "concrete" } };
36916
+ case "valve":
36917
+ return { kind: "valve_cover", shape: "round", size: [0.2, 0.03, 0.2], material: "cast_iron", solid: false, shaft: { shape: "round", width: 0.1, depth: 0.1, material: "cast_iron" } };
36918
+ case "hydrant":
36919
+ return { kind: "hydrant", shape: "round", size: [0.2, 0.8, 0.2], material: "cast_iron", solid: true, shaft: { shape: "round", width: 0.1, depth: 0.1, material: "cast_iron" } };
36920
+ case "outfall":
36921
+ return { kind: "wing_wall", shape: "square", size: [3, 0.8, 1.6], material: "concrete", solid: true };
36922
+ case "connection":
36923
+ if (network === "sewer") return { kind: "inspection_cover", shape: "square", size: [0.6, 0.03, 0.6], material: "concrete", solid: false, shaft: { shape: "square", width: 0.6, depth: 0.6, material: "concrete" } };
36924
+ if (network === "water") return { kind: "meter_box", shape: "square", size: [0.4, 0.3, 0.25], material: "concrete", solid: true, shaft: { shape: "round", width: 0.04, depth: 0.04, material: "plastic" } };
36925
+ return network === "storm" ? { kind: "downspout_mouth", shape: "square", size: [0.3, 0.02, 0.2], material: "concrete", solid: false } : void 0;
36926
+ default:
36927
+ return void 0;
36928
+ }
36929
+ }
36930
+ var unit2 = (dx, dz) => {
36931
+ const length2 = Math.hypot(dx, dz);
36932
+ return length2 === 0 ? [1, 0] : [dx / length2, dz / length2];
36933
+ };
36934
+ var planOf2 = (graph, id, from) => {
36935
+ const other = graph.nodes.get(id);
36936
+ return other === void 0 ? [0, 0] : [other.at[0] - from.at[0], other.at[2] - from.at[2]];
36937
+ };
36938
+ function alongOf(graph, node) {
36939
+ const edges = [...graph.outgoing(node.id), ...graph.incoming(node.id)];
36940
+ const square = edges.find((edge) => edge.kind === "storm_lateral" || edge.kind === "sewer_lateral" || edge.kind === "water_service");
36941
+ if (square !== void 0) {
36942
+ const [dx2, dz2] = planOf2(graph, square.from === node.id ? square.to : square.from, node);
36943
+ return unit2(-dz2, dx2);
36944
+ }
36945
+ const along2 = edges.find((edge) => edge.kind === "storm_gutter" || edge.kind === "storm_gallery" || edge.kind === "sewer_main");
36946
+ if (along2 === void 0) return [1, 0];
36947
+ const [dx, dz] = planOf2(graph, along2.from === node.id ? along2.to : along2.from, node);
36948
+ return unit2(dx, dz);
36949
+ }
36950
+ function headingOf(graph, node) {
36951
+ if (node.kind === "outfall") {
36952
+ const into = graph.incoming(node.id).find((edge) => edge.kind === "storm_gallery");
36953
+ const [bx, bz] = into === void 0 ? [0, -1] : planOf2(graph, into.from, node);
36954
+ const [fx, fz] = unit2(-bx, -bz);
36955
+ return Math.atan2(fx, fz);
36956
+ }
36957
+ const [dx, dz] = alongOf(graph, node);
36958
+ return Math.atan2(-dz, dx);
36959
+ }
36960
+ var ROAD_SURFACE_LEVEL = 0.02;
36961
+ function surfacePiecesOf(networks, options = {}) {
36962
+ const graph = buildNetworkGraph(networks);
36963
+ const lift = (node) => options.surfaceAt?.(node.at[0], node.at[2]) === "road" ? options.roadLevel ?? ROAD_SURFACE_LEVEL : 0;
36964
+ const taken = [];
36965
+ return networks.nodes.flatMap((node) => {
36966
+ const spec = specOf(node);
36967
+ if (spec === void 0) return [];
36968
+ const reach = spec.size[0] + 0.12;
36969
+ if (taken.some((other) => other.kind === spec.kind && Math.hypot(other.x - node.at[0], other.z - node.at[2]) < reach)) return [];
36970
+ taken.push({ kind: spec.kind, x: node.at[0], z: node.at[2] });
36971
+ const { shaft, ...piece } = spec;
36972
+ const bottom = node.invert;
36973
+ return [{ id: node.id, ...piece, at: [node.at[0], node.at[1] + lift(node), node.at[2]], ry: headingOf(graph, node), spec: node.spec, ...shaft === void 0 || bottom === void 0 ? {} : { shaft: { ...shaft, top: node.at[1] + lift(node), bottom } } }];
36974
+ });
36975
+ }
36976
+ var CONTENT = {
36977
+ sewer_main: "sewage",
36978
+ sewer_lateral: "sewage",
36979
+ storm_gallery: "stormwater",
36980
+ storm_lateral: "stormwater",
36981
+ water_main: "water",
36982
+ water_service: "water"
36983
+ };
36984
+ var MATERIAL_OF = { sewage: "plastic", water: "plastic", stormwater: "concrete" };
36985
+ var WALL_SHARE = 0.12;
36986
+ var HYDRANT_BRANCH_SHARE = 0.8;
36987
+ function pipePiecesOf(networks) {
36988
+ const nodes = new Map(networks.nodes.map((node) => [node.id, node]));
36989
+ return networks.edges.flatMap((edge) => {
36990
+ const content = isAerialEdgeKind(edge.kind) ? void 0 : CONTENT[edge.kind];
36991
+ const [from, to] = [nodes.get(edge.from), nodes.get(edge.to)];
36992
+ if (content === void 0 || from === void 0 || to === void 0 || edge.diameter === void 0) return [];
36993
+ const inverts = edge.inverts ?? (from.invert !== void 0 && to.invert !== void 0 ? [from.invert, to.invert] : void 0);
36994
+ if (inverts === void 0) return [];
36995
+ const diameter = edge.diameter * (1 + WALL_SHARE) * (to.kind === "hydrant" ? HYDRANT_BRANCH_SHARE : 1);
36996
+ const centre = (invert) => invert + edge.diameter / 2;
36997
+ return [{ id: edge.id, kind: edge.kind, content, from: [from.at[0], centre(inverts[0]), from.at[2]], to: [to.at[0], centre(inverts[1]), to.at[2]], diameter, material: MATERIAL_OF[content], ground: [from.at[1], to.at[1]] }];
36998
+ });
36999
+ }
37000
+ var COVER_PLATE_PART = "plate";
36683
37001
 
36684
37002
  // src/networks/draw-pieces.ts
36685
37003
  var CYLINDER_SEGMENTS = 10;
36686
- function drawPieces(THREE, { masts, boxes, cylinders, specOf }) {
37004
+ function drawPieces(THREE, { masts, boxes, cylinders, specOf: specOf2 }) {
36687
37005
  const T = shapeGeometries(THREE);
36688
37006
  const owned = [];
36689
37007
  const meshes = [];
@@ -36704,7 +37022,7 @@ var GameUrbanThree = (() => {
36704
37022
  return mesh2;
36705
37023
  };
36706
37024
  for (const specId of new Set(masts.map((mast) => mast.specId))) {
36707
- const { mast } = specOf(specId);
37025
+ const { mast } = specOf2(specId);
36708
37026
  const geometry = new T.CylinderGeometry(mast.radiusTop, mast.radiusBottom, mast.height, mast.segments ?? 4).rotateY(Math.PI / 4).translate(0, mast.height / 2, 0);
36709
37027
  const own = masts.filter((item) => item.specId === specId);
36710
37028
  const mesh2 = instanced(geometry, new THREE.MeshStandardMaterial({ color: mast.color, roughness: 0.9 }), own.length, `network:masts:${specId}`);
@@ -36836,10 +37154,10 @@ var GameUrbanThree = (() => {
36836
37154
  function cablesAt(index, pole) {
36837
37155
  return Math.max(0, ...(index.at.get(pole.id) ?? []).filter((edge) => edge.kind === "telecom_span").map((edge) => edge.conductors ?? 1));
36838
37156
  }
36839
- function poleFramesOf({ networks, index, specOf }) {
37157
+ function poleFramesOf({ networks, index, specOf: specOf2 }) {
36840
37158
  return networks.nodes.filter((node) => node.kind === "pole").map((node) => {
36841
37159
  const specId = node.spec ?? "concrete_distribution";
36842
- const spec = specOf(specId);
37160
+ const spec = specOf2(specId);
36843
37161
  const road = roadOf(index, node);
36844
37162
  const hardware = distributionHardwareOf(spec, {
36845
37163
  mv: node.carries.includes("power_mv"),
@@ -37061,13 +37379,13 @@ var GameUrbanThree = (() => {
37061
37379
  };
37062
37380
  function drawNetworks(THREE, { networks, options, budget, physicalLights }) {
37063
37381
  const root = markKitOrigin(options.root ?? new THREE.Group(), { owner: "game-urban-three", kind: "networks" });
37064
- const specOf = specResolver(options.poles);
37382
+ const specOf2 = specResolver(options.poles);
37065
37383
  const index = indexOf(networks);
37066
- const frames = new Map(poleFramesOf({ networks, index, specOf }).map((frame) => [frame.id, frame]));
37384
+ const frames = new Map(poleFramesOf({ networks, index, specOf: specOf2 }).map((frame) => [frame.id, frame]));
37067
37385
  const guys = guysOf({ index, frames, ...options.surfaceAt ? { surfaceAt: options.surfaceAt } : {} });
37068
37386
  const wires = drawWires2(THREE, { runs: wireRunsOf({ frames, index }, networks.edges), guys });
37069
37387
  const pieces = piecesOf({ frames, index, guys });
37070
- const drawn = drawPieces(THREE, { masts: pieces.masts, boxes: pieces.boxes, cylinders: pieces.cylinders, specOf });
37388
+ const drawn = drawPieces(THREE, { masts: pieces.masts, boxes: pieces.boxes, cylinders: pieces.cylinders, specOf: specOf2 });
37071
37389
  const lamps = networkLampsOf({ networks, shares: options.lamps ?? ALL_LAMPS_WORK, isNight: options.isNight ?? false });
37072
37390
  const byPole = new Map(lamps.map((lamp) => [lamp.pole, lamp]));
37073
37391
  const lensMaterial = new THREE.MeshBasicMaterial({ color: 16777215 });
@@ -37129,6 +37447,296 @@ var GameUrbanThree = (() => {
37129
37447
  };
37130
37448
  }
37131
37449
 
37450
+ // src/networks/draw-buried.ts
37451
+ var PIPE_COLOR = { sewage: 12090186, water: 3108014, stormwater: 9342343 };
37452
+ var SHAFT_COLOR = { concrete: 9342343, plastic: 12090186, cast_iron: 3882562 };
37453
+ var PIPE_SEGMENTS = 8;
37454
+ var SHAFT_SEGMENTS = 14;
37455
+ var BREAK_GAP = 1.2;
37456
+ var FLOOR = 0.1;
37457
+ var ROOF_DEPTH = 4e-3;
37458
+ function drawBuried(THREE, { networks, root, options }) {
37459
+ const T = shapeGeometries(THREE);
37460
+ const group = markKitOrigin(root ?? new THREE.Group(), { owner: "game-urban-three", kind: "network-buried" });
37461
+ const pipes = pipePiecesOf(networks);
37462
+ const shafts = surfacePiecesOf(networks, options).flatMap((piece) => piece.shaft === void 0 ? [] : [{ piece, shaft: piece.shaft }]);
37463
+ const round2 = shafts.filter(({ shaft }) => shaft.shape === "round");
37464
+ const square = shafts.filter(({ shaft }) => shaft.shape === "square");
37465
+ const material = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.85 });
37466
+ const openMaterial = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.85, side: THREE.DoubleSide });
37467
+ const geometries = [new T.CylinderGeometry(1, 1, 1, PIPE_SEGMENTS), new T.CylinderGeometry(1, 1, 1, SHAFT_SEGMENTS, 1, true), new T.BoxGeometry(1, 1, 1)];
37468
+ const make2 = (geometry, count, name, using) => {
37469
+ const mesh2 = new THREE.InstancedMesh(geometry, using, Math.max(count, 1));
37470
+ mesh2.name = name;
37471
+ mesh2.count = count;
37472
+ mesh2.frustumCulled = false;
37473
+ return mesh2;
37474
+ };
37475
+ const pipeMesh = make2(geometries[0], pipes.length * 2, "network:buried:pipes", material);
37476
+ const roundMesh = make2(geometries[1], round2.length, "network:buried:shafts", openMaterial);
37477
+ const squareMesh = make2(geometries[2], square.length, "network:buried:boxes", material);
37478
+ const up = new THREE.Vector3(0, 1, 0);
37479
+ const matrix = new THREE.Matrix4();
37480
+ const color2 = new THREE.Color();
37481
+ const place = (mesh2, slot, from, to, radius) => {
37482
+ const axis = new THREE.Vector3(to[0] - from[0], to[1] - from[1], to[2] - from[2]);
37483
+ const length = axis.length();
37484
+ const quaternion = new THREE.Quaternion().setFromUnitVectors(up, length === 0 ? up : axis.clone().normalize());
37485
+ mesh2.setMatrixAt(slot, matrix.compose(new THREE.Vector3((from[0] + to[0]) / 2, (from[1] + to[1]) / 2, (from[2] + to[2]) / 2), quaternion, new THREE.Vector3(radius, length, radius)));
37486
+ };
37487
+ const along2 = (pipe, share) => [pipe.from[0] + (pipe.to[0] - pipe.from[0]) * share, pipe.from[1] + (pipe.to[1] - pipe.from[1]) * share, pipe.from[2] + (pipe.to[2] - pipe.from[2]) * share];
37488
+ const trimmed = (pipe, index) => {
37489
+ const length = Math.hypot(pipe.to[0] - pipe.from[0], pipe.to[1] - pipe.from[1], pipe.to[2] - pipe.from[2]);
37490
+ if (length < 0.1) return pipe;
37491
+ const [start, end] = [(index % 7 + 1) * 3e-3, (index % 5 + 1) * 4e-3];
37492
+ const at = (share) => along2(pipe, share);
37493
+ return { ...pipe, from: at(start / length), to: at(1 - end / length) };
37494
+ };
37495
+ const halves = (whole, index, gap) => {
37496
+ const pipe = trimmed(whole, index);
37497
+ if (gap[0] === gap[1]) {
37498
+ place(pipeMesh, index * 2, pipe.from, pipe.to, pipe.diameter / 2);
37499
+ pipeMesh.setMatrixAt(index * 2 + 1, matrix.makeScale(0, 0, 0));
37500
+ return;
37501
+ }
37502
+ place(pipeMesh, index * 2, pipe.from, along2(pipe, gap[0]), pipe.diameter / 2);
37503
+ place(pipeMesh, index * 2 + 1, along2(pipe, gap[1]), pipe.to, pipe.diameter / 2);
37504
+ };
37505
+ const slotOf = new Map(pipes.map((pipe, index) => [pipe.id, index]));
37506
+ pipes.forEach((pipe, index) => {
37507
+ halves(pipe, index, [0.5, 0.5]);
37508
+ for (const slot of [index * 2, index * 2 + 1]) pipeMesh.setColorAt(slot, color2.set(PIPE_COLOR[pipe.content]));
37509
+ });
37510
+ round2.forEach(({ piece, shaft }, slot) => {
37511
+ const [x, , z] = piece.at;
37512
+ place(roundMesh, slot, [x, shaft.bottom - FLOOR, z], [x, shaft.top, z], shaft.width / 2);
37513
+ roundMesh.setColorAt(slot, color2.set(SHAFT_COLOR[shaft.material]));
37514
+ });
37515
+ square.forEach(({ piece, shaft }, slot) => {
37516
+ const height = shaft.top - ROOF_DEPTH - shaft.bottom + FLOOR;
37517
+ squareMesh.setMatrixAt(slot, matrix.compose(new THREE.Vector3(piece.at[0], shaft.top - ROOF_DEPTH - height / 2, piece.at[2]), new THREE.Quaternion().setFromAxisAngle(up, piece.ry), new THREE.Vector3(shaft.width, height, shaft.depth)));
37518
+ squareMesh.setColorAt(slot, color2.set(SHAFT_COLOR[shaft.material]));
37519
+ });
37520
+ group.add(pipeMesh, roundMesh, squareMesh);
37521
+ return {
37522
+ root: group,
37523
+ pipes,
37524
+ drawCalls: () => [pipeMesh, roundMesh, squareMesh].filter((mesh2) => mesh2.count > 0).length,
37525
+ sever(id, share) {
37526
+ const index = slotOf.get(id);
37527
+ const pipe = index === void 0 ? void 0 : pipes[index];
37528
+ if (index === void 0 || pipe === void 0) return;
37529
+ const length = Math.hypot(pipe.to[0] - pipe.from[0], pipe.to[1] - pipe.from[1], pipe.to[2] - pipe.from[2]);
37530
+ const half = Math.min(0.5, BREAK_GAP / 2 / Math.max(length, 1e-6));
37531
+ halves(pipe, index, [Math.max(0, share - half), Math.min(1, share + half)]);
37532
+ pipeMesh.instanceMatrix.needsUpdate = true;
37533
+ },
37534
+ mend(id) {
37535
+ const index = slotOf.get(id);
37536
+ const pipe = index === void 0 ? void 0 : pipes[index];
37537
+ if (index === void 0 || pipe === void 0) return;
37538
+ halves(pipe, index, [0.5, 0.5]);
37539
+ pipeMesh.instanceMatrix.needsUpdate = true;
37540
+ },
37541
+ dispose() {
37542
+ group.parent?.remove(group);
37543
+ for (const mesh2 of [pipeMesh, roundMesh, squareMesh]) mesh2.dispose();
37544
+ for (const item of [...geometries, material, openMaterial]) item.dispose();
37545
+ }
37546
+ };
37547
+ }
37548
+
37549
+ // src/networks/surface-parts.ts
37550
+ var IRON2 = 3882562;
37551
+ var IRON_WORN = 5593438;
37552
+ var CONCRETE2 = 10197652;
37553
+ var CONCRETE_LID = 11052960;
37554
+ var VOID = 723724;
37555
+ var HYDRANT_RED = 11545122;
37556
+ var FRAME_TOP = 2e-3;
37557
+ var LID_TOP = 4e-3;
37558
+ var RIB_TOP = 9e-3;
37559
+ var CROSS_RIB_TOP = 0.011;
37560
+ var THICK = 0.03;
37561
+ var flat = (shape, top, size, color2) => shape === "box" ? { shape, centre: [0, top - THICK / 2, 0], size: [size[0], THICK, size[1]], color: color2 } : { shape, centre: [0, top - THICK / 2, 0], size: [size[0], THICK, size[0]], color: color2 };
37562
+ var rib = (size, top, at) => ({ shape: "box", centre: [at[0], top - size[1] / 2, at[1]], size, color: IRON_WORN });
37563
+ function cover(piece) {
37564
+ const [width, , depth] = piece.size;
37565
+ const shape = piece.shape === "round" ? "cylinder" : "box";
37566
+ const [frame, lid] = piece.shape === "round" ? [(width + 0.12) / 2, width / 2] : [width + 0.12, width];
37567
+ const colors2 = piece.material === "concrete" ? [IRON2, CONCRETE_LID] : [IRON2, IRON_WORN];
37568
+ const parts = [flat(shape, FRAME_TOP, [frame, piece.shape === "round" ? frame : depth + 0.12], colors2[0]), flat(shape, LID_TOP, [lid, piece.shape === "round" ? lid : depth], colors2[1])];
37569
+ if (piece.kind === "inspection_cover") return [...parts, rib([0.14, 6e-3, 0.03], RIB_TOP, [0, 0])];
37570
+ if (piece.shape === "round") return [...parts, rib([lid * 1.7, 5e-3, 0.04], RIB_TOP, [0, 0]), rib([0.04, 5e-3, lid * 1.7], CROSS_RIB_TOP, [0, 0])];
37571
+ return [...parts, ...[-0.15, 0, 0.15].map((z) => rib([lid * 0.85, 5e-3, 0.03], RIB_TOP, [0, z]))];
37572
+ }
37573
+ function grate() {
37574
+ const bars = [-0.2, -0.1, 0, 0.1, 0.2].map((z) => ({ shape: "box", centre: [0, RIB_TOP - 6e-3, z], size: [0.9, 0.012, 0.025], color: IRON_WORN }));
37575
+ const brace = { shape: "box", centre: [0, 55e-4, 0], size: [0.03, 3e-3, 0.5], color: IRON2 };
37576
+ return [
37577
+ { shape: "box", centre: [0, FRAME_TOP - THICK / 2, 0], size: [1, THICK, 0.6], color: IRON2 },
37578
+ { shape: "box", centre: [0, 25e-4, 0], size: [0.9, 1e-3, 0.5], color: VOID },
37579
+ ...bars,
37580
+ brace
37581
+ ];
37582
+ }
37583
+ function hydrant() {
37584
+ const part = (y, radius, length, axis, at = [0, 0]) => ({ shape: "cylinder", centre: [at[0], y, at[1]], size: [radius, length, radius], axis, color: HYDRANT_RED });
37585
+ return [part(0.02, 0.1, 0.04, "y"), part(0.38, 0.065, 0.68, "y"), part(0.74, 0.085, 0.06, "y"), part(0.55, 0.032, 0.26, "x"), part(0.5, 0.045, 0.14, "z", [0, 0.1])];
37586
+ }
37587
+ function wingWall(piece) {
37588
+ const [width, height, depth] = piece.size;
37589
+ return [
37590
+ { shape: "box", centre: [0, (height - 0.4) / 2, 0], size: [width, height + 0.4, 0.25], color: CONCRETE2 },
37591
+ ...[-1, 1].map((side) => ({ shape: "box", centre: [side * (width / 2 - 0.135), (height - 0.2 - 0.4) / 2 + 0.01, depth / 2], size: [0.25, height - 0.2 + 0.4 - 0.02, depth], color: CONCRETE2 })),
37592
+ { shape: "box", centre: [0, 0.01 - 0.075, depth / 2], size: [width - 0.6, 0.15, depth - 0.1], color: CONCRETE_LID }
37593
+ ];
37594
+ }
37595
+ function meterBox(piece) {
37596
+ const [width, height, depth] = piece.size;
37597
+ return [
37598
+ { shape: "box", centre: [0, height / 2, 0], size: [width, height, depth], color: CONCRETE2 },
37599
+ { shape: "box", centre: [0, height, 0], size: [width - 0.06, 8e-3, depth - 0.06], color: IRON2 }
37600
+ ];
37601
+ }
37602
+ function mouth() {
37603
+ return [
37604
+ { shape: "box", centre: [0, FRAME_TOP - 0.01, 0], size: [0.3, 0.02, 0.2], color: CONCRETE2 },
37605
+ { shape: "box", centre: [0, 25e-4, 0], size: [0.2, 1e-3, 0.08], color: VOID }
37606
+ ];
37607
+ }
37608
+ function partsOf(piece) {
37609
+ switch (piece.kind) {
37610
+ case "inlet_grate":
37611
+ return grate();
37612
+ case "hydrant":
37613
+ return hydrant();
37614
+ case "wing_wall":
37615
+ return wingWall(piece);
37616
+ case "meter_box":
37617
+ return meterBox(piece);
37618
+ case "downspout_mouth":
37619
+ return mouth();
37620
+ default:
37621
+ return cover(piece);
37622
+ }
37623
+ }
37624
+
37625
+ // src/networks/draw-lid.ts
37626
+ var CYLINDER_SEGMENTS2 = 14;
37627
+ function drawLid(THREE, piece) {
37628
+ const T = shapeGeometries(THREE);
37629
+ const [frame, second, ...over] = partsOf(piece);
37630
+ const [lid, ...ribs] = piece.kind === "inlet_grate" ? [frame, ...over] : second === void 0 ? [] : [second, ...over];
37631
+ if (lid === void 0) throw new Error(`game-urban-three: "${piece.id}" has no lid to draw`);
37632
+ const lift = lid.size[1] / 2 - lid.centre[1];
37633
+ const group = markKitOrigin(new THREE.Group(), { owner: "game-urban-three", kind: "network-lid" });
37634
+ group.name = `network:lid:${piece.id}`;
37635
+ const geometries = { box: new T.BoxGeometry(1, 1, 1), cylinder: new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS2) };
37636
+ const materials = /* @__PURE__ */ new Map();
37637
+ const axisTurn = { x: [0, 0, Math.PI / 2], y: [0, 0, 0], z: [Math.PI / 2, 0, 0] };
37638
+ for (const part of [lid, ...ribs]) {
37639
+ let material = materials.get(part.color);
37640
+ if (material === void 0) materials.set(part.color, material = new THREE.MeshStandardMaterial({ color: part.color, roughness: 0.7, metalness: 0.2 }));
37641
+ const mesh2 = new THREE.Mesh(geometries[part.shape], material);
37642
+ mesh2.position.set(part.centre[0], part.centre[1] + lift, part.centre[2]);
37643
+ mesh2.scale.set(part.size[0], part.size[1], part.size[2]);
37644
+ const [turnX, turnY, turnZ] = axisTurn[part.axis ?? "y"];
37645
+ mesh2.rotation.set(turnX, turnY, turnZ);
37646
+ mesh2.userData.destructionPart = COVER_PLATE_PART;
37647
+ mesh2.castShadow = true;
37648
+ mesh2.receiveShadow = true;
37649
+ group.add(mesh2);
37650
+ }
37651
+ return {
37652
+ root: group,
37653
+ dispose() {
37654
+ group.parent?.remove(group);
37655
+ for (const geometry of Object.values(geometries)) geometry.dispose();
37656
+ for (const material of materials.values()) material.dispose();
37657
+ }
37658
+ };
37659
+ }
37660
+
37661
+ // src/networks/draw-surface.ts
37662
+ var CYLINDER_SEGMENTS3 = 14;
37663
+ function drawSurface(THREE, { networks, pieces, root, options }) {
37664
+ const list2 = pieces ?? surfacePiecesOf(networks ?? { nodes: [], edges: [] }, options);
37665
+ const T = shapeGeometries(THREE);
37666
+ const group = markKitOrigin(root ?? new THREE.Group(), { owner: "game-urban-three", kind: "network-surface" });
37667
+ const boxes = [];
37668
+ const cylinders = [];
37669
+ const ranges = /* @__PURE__ */ new Map();
37670
+ for (const piece of list2) {
37671
+ const parts = partsOf(piece);
37672
+ const range2 = { box: [boxes.length, 0], cylinder: [cylinders.length, 0] };
37673
+ for (const part of parts) (part.shape === "box" ? boxes : cylinders).push({ piece, part });
37674
+ range2.box[1] = boxes.length - range2.box[0];
37675
+ range2.cylinder[1] = cylinders.length - range2.cylinder[0];
37676
+ ranges.set(piece.id, range2);
37677
+ }
37678
+ const material = new THREE.MeshStandardMaterial({ color: 16777215, roughness: 0.7, metalness: 0.2 });
37679
+ const boxGeometry = new T.BoxGeometry(1, 1, 1);
37680
+ const cylinderGeometry = new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS3);
37681
+ const matrix = new THREE.Matrix4();
37682
+ const turn = new THREE.Quaternion();
37683
+ const spin = new THREE.Quaternion();
37684
+ const local = new THREE.Matrix4();
37685
+ const color2 = new THREE.Color();
37686
+ const axisTurn = { x: new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), Math.PI / 2), y: new THREE.Quaternion(), z: new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1, 0, 0), Math.PI / 2) };
37687
+ const fill2 = (mesh2, items, [start, count] = [0, items.length]) => {
37688
+ for (let slot = start; slot < start + count; slot++) {
37689
+ const { piece, part } = items[slot];
37690
+ turn.setFromAxisAngle(new THREE.Vector3(0, 1, 0), piece.ry);
37691
+ matrix.compose(new THREE.Vector3(piece.at[0], piece.at[1], piece.at[2]), turn, new THREE.Vector3(1, 1, 1));
37692
+ spin.copy(axisTurn[part.axis ?? "y"]);
37693
+ local.compose(new THREE.Vector3(...part.centre), spin, new THREE.Vector3(...part.size));
37694
+ mesh2.setMatrixAt(slot, matrix.multiply(local));
37695
+ mesh2.setColorAt(slot, color2.set(part.color));
37696
+ }
37697
+ };
37698
+ const make2 = (geometry, items, name) => {
37699
+ const mesh2 = new THREE.InstancedMesh(geometry, material, Math.max(items.length, 1));
37700
+ mesh2.name = name;
37701
+ mesh2.count = items.length;
37702
+ mesh2.receiveShadow = true;
37703
+ fill2(mesh2, items);
37704
+ return mesh2;
37705
+ };
37706
+ const boxMesh = make2(boxGeometry, boxes, "network:surface:boxes");
37707
+ const cylinderMesh = make2(cylinderGeometry, cylinders, "network:surface:cylinders");
37708
+ group.add(boxMesh, cylinderMesh);
37709
+ const hide = (mesh2, [start, count]) => {
37710
+ matrix.makeScale(0, 0, 0);
37711
+ for (let slot = start; slot < start + count; slot++) mesh2.setMatrixAt(slot, matrix);
37712
+ mesh2.instanceMatrix.needsUpdate = true;
37713
+ };
37714
+ return {
37715
+ root: group,
37716
+ pieces: list2,
37717
+ drawCalls: () => [boxMesh, cylinderMesh].filter((mesh2) => mesh2.count > 0).length,
37718
+ remove(id) {
37719
+ const range2 = ranges.get(id);
37720
+ if (range2 === void 0) return;
37721
+ hide(boxMesh, range2.box);
37722
+ hide(cylinderMesh, range2.cylinder);
37723
+ },
37724
+ restore(id) {
37725
+ const range2 = ranges.get(id);
37726
+ if (range2 === void 0) return;
37727
+ fill2(boxMesh, boxes, range2.box);
37728
+ fill2(cylinderMesh, cylinders, range2.cylinder);
37729
+ boxMesh.instanceMatrix.needsUpdate = true;
37730
+ cylinderMesh.instanceMatrix.needsUpdate = true;
37731
+ },
37732
+ dispose() {
37733
+ group.parent?.remove(group);
37734
+ for (const mesh2 of [boxMesh, cylinderMesh]) mesh2.dispose();
37735
+ for (const item of [boxGeometry, cylinderGeometry, material]) item.dispose();
37736
+ }
37737
+ };
37738
+ }
37739
+
37132
37740
  // src/draw.ts
37133
37741
  var DEFAULT_ROUGHNESS = 0.9;
37134
37742
  var DEFAULT_METALNESS = 0;
@@ -37143,13 +37751,13 @@ var GameUrbanThree = (() => {
37143
37751
  const geometries = /* @__PURE__ */ new Map();
37144
37752
  const materials = /* @__PURE__ */ new Map();
37145
37753
  const disposables = [];
37146
- const standard = (color2, style, flat = false) => {
37754
+ const standard = (color2, style, flat2 = false) => {
37147
37755
  const roughness = style?.roughness ?? DEFAULT_ROUGHNESS;
37148
37756
  const metalness = style?.metalness ?? DEFAULT_METALNESS;
37149
- const key = `s|${color2}|${roughness}|${metalness}|${flat ? 1 : 0}`;
37757
+ const key = `s|${color2}|${roughness}|${metalness}|${flat2 ? 1 : 0}`;
37150
37758
  let material = materials.get(key);
37151
37759
  if (!material) {
37152
- material = new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, flatShading: flat });
37760
+ material = new THREE.MeshStandardMaterial({ color: color2, roughness, metalness, flatShading: flat2 });
37153
37761
  materials.set(key, material);
37154
37762
  }
37155
37763
  return material;
@@ -37486,7 +38094,10 @@ var GameUrbanThree = (() => {
37486
38094
  };
37487
38095
  }
37488
38096
  const networks = (data, drawOptions = {}) => drawNetworks(THREE, { networks: data, options: drawOptions, ...options.lights ? { budget: options.lights } : {}, ...options.physicalLights ? { physicalLights: true } : {} });
37489
- return { THREE, draw, drawNetworks: networks };
38097
+ const networkSurface = (data, surfaceOptions) => drawSurface(THREE, { networks: data, ...surfaceOptions ? { options: surfaceOptions } : {} });
38098
+ const buriedNetworks = (data, surfaceOptions) => drawBuried(THREE, { networks: data, ...surfaceOptions ? { options: surfaceOptions } : {} });
38099
+ const coverLid = (piece) => drawLid(THREE, piece);
38100
+ return { THREE, draw, drawNetworks: networks, drawNetworkSurface: networkSurface, drawBuriedNetworks: buriedNetworks, drawCoverLid: coverLid };
37490
38101
  }
37491
38102
 
37492
38103
  // ../game-vegetation/dist/chunk-57VLOYXL.js
@@ -38188,15 +38799,15 @@ var GameUrbanThree = (() => {
38188
38799
  const ring2 = [];
38189
38800
  for (let i = 0; i < S; i++) {
38190
38801
  const ridge = i % 2 === 0;
38191
- const rib = i >> 1;
38802
+ const rib2 = i >> 1;
38192
38803
  const a = i / S * TAU;
38193
38804
  const dir = [f.n[0] * Math.cos(a) + f.b[0] * Math.sin(a), f.n[1] * Math.cos(a) + f.b[1] * Math.sin(a), f.n[2] * Math.cos(a) + f.b[2] * Math.sin(a)];
38194
- const wob = o.rough ? o.rough(k, rib) : 0;
38805
+ const wob = o.rough ? o.rough(k, rib2) : 0;
38195
38806
  const rr = radii[k] * (ridge ? 1 + wob : o.valley);
38196
38807
  const p = add(pts[k], mul(dir, rr));
38197
- const c = o.color(Math.min(1, k / (path.length - 1)), ridge, rib);
38808
+ const c = o.color(Math.min(1, k / (path.length - 1)), ridge, rib2);
38198
38809
  ring2.push({ p, nr: dir, c });
38199
- if (ridge && k < path.length) info.ridges.push({ p, n: dir, t: k / (path.length - 1), rib, ring: k });
38810
+ if (ridge && k < path.length) info.ridges.push({ p, n: dir, t: k / (path.length - 1), rib: rib2, ring: k });
38200
38811
  }
38201
38812
  rings.push(ring2);
38202
38813
  }
@@ -38232,8 +38843,8 @@ var GameUrbanThree = (() => {
38232
38843
  const lightTip = shade(base, 1.18);
38233
38844
  return (t, a) => {
38234
38845
  const band = 0.93 + 0.07 * Math.sin(t * (level === 0 ? 38 : 16) + seed);
38235
- const rib = 0.92 + 0.08 * Math.cos(a * Math.PI * 2 * 3 + seed * 1.7 + t * 2.2);
38236
- let k = band * rib;
38846
+ const rib2 = 0.92 + 0.08 * Math.cos(a * Math.PI * 2 * 3 + seed * 1.7 + t * 2.2);
38847
+ let k = band * rib2;
38237
38848
  if (level === 0) k *= 0.8 + 0.2 * clamp3(t * 7, 0, 1);
38238
38849
  const c = shade(base, k * 1.5);
38239
38850
  return level === 0 ? c : mix(c, lightTip, clamp3(t * 0.8, 0, 1) * 0.5);
@@ -40015,9 +40626,9 @@ var GameUrbanThree = (() => {
40015
40626
  const rings = ctx.pick(1, 0.7, 0.45);
40016
40627
  const domeSteps = ctx.pick(2, 1, 1);
40017
40628
  const spineOn = ctx.lod === 0 && ctx.condition !== "dead" ? 1 : ctx.lod === 0 ? 0.5 : 0;
40018
- const bodyColor = (t, ridge, rib) => {
40629
+ const bodyColor = (t, ridge, rib2) => {
40019
40630
  let k = ridge ? 1.05 : 0.7;
40020
- if (rib % 2 === 0) k *= 1.04;
40631
+ if (rib2 % 2 === 0) k *= 1.04;
40021
40632
  const c = shade(base, k * (0.78 + 0.28 * Math.min(1, t * 1.4)));
40022
40633
  return mix(c, lighten(base, 0.8), Math.max(0, t - 0.8) * 1.4 * (ridge ? 1 : 0.5));
40023
40634
  };
@@ -40029,9 +40640,9 @@ var GameUrbanThree = (() => {
40029
40640
  radii,
40030
40641
  valley: 0.74,
40031
40642
  dome: domeSteps,
40032
- color: (t, ridge, rib) => bodyColor(t, ridge, rib + seedK),
40643
+ color: (t, ridge, rib2) => bodyColor(t, ridge, rib2 + seedK),
40033
40644
  sway: () => 0,
40034
- rough: (ring2, rib) => Math.sin(ring2 * 1.7 + rib * 2.3 + seedK) * 0.03
40645
+ rough: (ring2, rib2) => Math.sin(ring2 * 1.7 + rib2 * 2.3 + seedK) * 0.03
40035
40646
  });
40036
40647
  const last = path[path.length - 1];
40037
40648
  const prev = path[path.length - 2];
@@ -40238,12 +40849,12 @@ var GameUrbanThree = (() => {
40238
40849
  radii,
40239
40850
  valley: 0.7,
40240
40851
  dome: ctx.pick(2, 1, 1),
40241
- color: (t, ridge, rib) => {
40242
- const k = (ridge ? 1.08 : 0.68) * (0.75 + 0.3 * t) * (rib % 2 ? 0.97 : 1.03);
40852
+ color: (t, ridge, rib2) => {
40853
+ const k = (ridge ? 1.08 : 0.68) * (0.75 + 0.3 * t) * (rib2 % 2 ? 0.97 : 1.03);
40243
40854
  return shade(base, k);
40244
40855
  },
40245
40856
  sway: () => 0,
40246
- rough: (ring2, rib) => Math.sin(ring2 * 2.1 + rib * 1.3) * 0.02
40857
+ rough: (ring2, rib2) => Math.sin(ring2 * 2.1 + rib2 * 1.3) * 0.02
40247
40858
  });
40248
40859
  if (ctx.lod === 0) {
40249
40860
  for (const rd of res.ridges) {
@@ -41497,7 +42108,7 @@ gl_Position = projectionMatrix * mvPosition;
41497
42108
  };
41498
42109
  m.customProgramCacheKey = () => "vegetation-sway-v1";
41499
42110
  };
41500
- const flat = opts.flatShading !== false;
42111
+ const flat2 = opts.flatShading !== false;
41501
42112
  const rough = typeof opts.roughness === "number" ? opts.roughness : 0.85;
41502
42113
  const make2 = (flatShading, double, roughness) => {
41503
42114
  const m = new THREE.MeshStandardMaterial({
@@ -41511,9 +42122,9 @@ gl_Position = projectionMatrix * mvPosition;
41511
42122
  return m;
41512
42123
  };
41513
42124
  const wood = make2(false, false, 0.95);
41514
- const foliage = make2(flat, true, rough);
41515
- const flowers = make2(flat, true, 0.7);
41516
- const fruit = make2(flat, false, 0.55);
42125
+ const foliage = make2(flat2, true, rough);
42126
+ const flowers = make2(flat2, true, 0.7);
42127
+ const fruit = make2(flat2, false, 0.55);
41517
42128
  const spines = make2(true, true, 0.8);
41518
42129
  const dir = uniforms.uWindDir.value;
41519
42130
  return {
@@ -42030,7 +42641,10 @@ gl_Position = projectionMatrix * mvPosition;
42030
42641
  return { name: id, tags: ["structure"], parts: [{ id: "ground", material: "concrete", shape: { kind: "box", size: [Math.max(size.x, 0.1), Math.max(size.y, 0.1), Math.max(size.z, 0.1)] }, position: [centre.x, centre.y, centre.z], anchored: true }] };
42031
42642
  }
42032
42643
  });
42644
+ let removeBenchCover = null;
42033
42645
  const clearBench = () => {
42646
+ removeBenchCover?.();
42647
+ removeBenchCover = null;
42034
42648
  if (!bench) return;
42035
42649
  bench.drawn.dispose();
42036
42650
  bench = null;
@@ -42052,6 +42666,7 @@ gl_Position = projectionMatrix * mvPosition;
42052
42666
  drawn.root.position.set(benchOrigin[0], FLOOR_Y, benchOrigin[1]);
42053
42667
  host.scene.add(drawn.root);
42054
42668
  bench = { root: drawn.root, drawn, plan: made };
42669
+ if (host.rainCover) removeBenchCover = host.rainCover.add(createFixedFootprintRainCover(b.covers.map((roof) => ({ ...roof, x: roof.x + benchOrigin[0], z: roof.z + benchOrigin[1], top: roof.top + FLOOR_Y }))));
42055
42670
  lightsLeft = b.lights.left;
42056
42671
  host.log(fill(text2.log.composed, settings.pattern, settings.seed, countObjects(drawn.root), drawn.lights.length), { pattern: settings.pattern, seed: settings.seed });
42057
42672
  helpersShown = "";