@adatechnology/game-urban 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.
package/README.md CHANGED
@@ -47,7 +47,7 @@ createUrban({
47
47
 
48
48
  ## Streets, blocks and props
49
49
 
50
- - `streets.road(b, x, z, w, l, 'x' | 'z')`: a plane at 2 cm with a dash (1.8 x 0.16 m) every 5 m from 2 m after the start, as instances. `walk`, `ground` and `grid({ block, count, width })` (2n+1 roads each way and a sidewalk slab on each of the 2n x 2n blocks).
50
+ - `streets.road(b, x, z, w, l, 'x' | 'z')`: a plane at 2 cm (`road.plane: false` leaves it out, for a host whose terrain has a road layer a blast can dig) with a dash (1.8 x 0.16 m) every 5 m from 2 m after the start, as instances. `walk`, `ground` and `grid({ block, count, width })` (2n+1 roads each way and a sidewalk slab on each of the 2n x 2n blocks).
51
51
  - `block.fill(b, { cx, cz, size, minHeight, maxHeight, k, gap, lit, shop })`: a `k x k` split of the block less 2 m of street; a building a little smaller than its lot, as tall as `lerp(min, max, random^1.6)` (more low buildings than tall ones), drawn by `createCityBuilding` of game-floorplan with the shared generator. Returns the buildings for the game's bookkeeping. `block.building` places one.
52
52
  - `props`: `fence`, `tent`, `pine`, `tree`, `container`, `watchtower` (with a searchlight whose beam circles the ground), `sandbags` (instances), `label` (two lines on a 22 x 4.4 m board) and `wires`.
53
53
 
@@ -227,6 +227,19 @@ the road, z along the line) with every fixing point read from its `slots`, the s
227
227
  diameter 0) to the nearest inlet of its kerb.
228
228
  - **Water**: DN 75 under the sidewalk opposite the poles from a reservoir at the border, a valve and a pillar hydrant at every crossing, a
229
229
  DN 20 service from a tee to every lot.
230
+ - **What the validator asks of the street's plan** (`validateSurface`): a manhole wherever three mains meet or two turn (`pv_missing`), at most
231
+ `storm.inletSpacing` (60 m) between the inlets of a kerb (`inlet_spacing`), an inlet within `storm.cornerReach` of every corner of a crossing
232
+ (`inlet_at_corner`), and each house lateral and each inlet's lateral within `sewer.branchMaxSkew` (5°) of square to the street (`branch_skewed`).
233
+ - **What shows and what is under it** (`surfacePiecesOf`, `pipePiecesOf`): a piece at each node that has a face on the ground (the PV and
234
+ gallery box covers, cleanout and valve covers, the inlets' grates, hydrants, the outfalls' wing walls, and at every lot the inspection box
235
+ cover, the meter box and the downspout's mouth), each with the pit down to its pipe's bottom (`shaft`), and every pipe laid as a body in the
236
+ ground at the depths of the rules (`coverOf`). `surfaceAt` lifts the pieces on the road to the asphalt (`ROAD_SURFACE_LEVEL`, 2 cm). The materials
237
+ are ids of `game-destruction`; a cover and a grate are ground (`solid: false`), a hydrant, wing wall and meter box stand (`solid: true`).
238
+ - **A crater over them** (`breachOf(pieces, { x, z, radius, depth })`): the bowl is a paraboloid; a pipe whose top the bowl gets down to is
239
+ `reached`, one whose centre line it gets to is `severed` and says what leaks (`sewage`, `stormwater`, `water`); the covers inside the bowl are
240
+ listed to be thrown. Pure: the same answer for the same bowl.
241
+ - **What a break lets out and cuts** (`leaksOf`, `waterOutageOf`, `drainLeak`): a severed pipe is a `NetworkLeak` of its content at the break: water under pressure (6 l/s a main, 0.8 a service), sewage a slow run (0.5, 0.15), stormwater only when `isRaining`; each is finite (`rate` times `seconds` of `DEFAULT_LEAK_RULES`, patchable) and `drainLeak(startLeak(leak), dt)` gives what a step lets out until nothing is left. `waterOutageOf(networks, { before, after })` is the water a break cuts: the nodes the reservoir no longer reaches and the lots among them (a tree loses all downstream of the break), only what is new since `before`.
242
+ - **The hole and the cover** (`openingOf`, `coverBodyOf`): a cover thrown off leaves the square of its shaft dug to the shaft's floor (a `GroundExcavation` for `Terrain.open`), and is itself a plate of its material (cast iron) as a `DestructibleSpec`, with its mass, for the host to hand to the destruction world as a loose piece.
230
243
  - Limits: straight streets along x or z only (another stretch throws); the ground defaults to flat (`groundAt` for terrain). The pole tree
231
244
  and the line trees are plain Dijkstra (tens of nodes a system); the nearest pole and the crossings are found by 20-40 m cells.
232
245
 
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ declare const createLightBudget: typeof createLightAllowance;
13
13
  /** Look of the road surface and its centre line; the defaults are the Galeria's. */
14
14
  type RoadStyle = {
15
15
  color: number;
16
+ /** Lay the asphalt plane (default). Without it only the dashes are drawn and the ground under the road shows: a host whose terrain has a road layer (a blast digs it) leaves the plane out. */
17
+ plane: boolean;
16
18
  /** Painted dashes along the centre line. */
17
19
  dash: {
18
20
  color: number;
@@ -32,7 +34,7 @@ type WalkStyle = {
32
34
  declare const DEFAULT_ROAD_STYLE: RoadStyle;
33
35
  declare const DEFAULT_WALK_STYLE: WalkStyle;
34
36
  type StreetOptions = {
35
- road?: Partial<RoadStyle> & {
37
+ road?: Partial<Omit<RoadStyle, 'dash'>> & {
36
38
  dash?: Partial<RoadStyle['dash']>;
37
39
  };
38
40
  walk?: Partial<WalkStyle>;
@@ -3236,7 +3236,7 @@ var GameUrban = (() => {
3236
3236
  ];
3237
3237
 
3238
3238
  // src/streets.ts
3239
- 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 } };
3239
+ 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 } };
3240
3240
  var DEFAULT_WALK_STYLE = { color: 3816252, height: 0.15, castShadow: false };
3241
3241
  var ROAD_LEVEL = 0.02;
3242
3242
  var DEFAULT_GROUND_COLOR = 1382426;
@@ -3246,7 +3246,7 @@ var GameUrban = (() => {
3246
3246
  function drawRoad(b, x, z, w, l, along2, options) {
3247
3247
  const style = roadStyle(options);
3248
3248
  const alongX = along2 === "x";
3249
- b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
3249
+ if (style.plane) b.plane(x, ROAD_LEVEL, z, alongX ? l : w, alongX ? w : l, style.color);
3250
3250
  const { dash } = style;
3251
3251
  for (let u = -l / 2 + dash.first; u < l / 2; u += dash.every) {
3252
3252
  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);