@adatechnology/game-urban 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -198,6 +198,11 @@ const { networks, connections, surfaceAt, warnings } = generateNetworks({
198
198
  validateNetworks(networks, { connections, surfaceAt }) // [] for a plan the generator can lay
199
199
  ```
200
200
 
201
+ `distributionHardwareOf(spec, { mv, transformer, lamp, cables, cableGap })` gives the hardware of a distribution pole in its own frame (x toward
202
+ the road, z along the line) with every fixing point read from its `slots`, the same heights the generator hangs the conductors at;
203
+ `networkLampsOf({ networks, shares, isNight })` gives every `light` node with its lamp's state (`lampStateOf` by the seed and the node's place).
204
+ `game-urban-three`'s `drawNetworks` draws both.
205
+
201
206
  - **Poles** on one side of each street (the side with more lots; on a tie north or west), 0.4 m from the kerb, 30 to 40 m apart on lot
202
207
  boundaries when one is in reach, slid clear of `avoid` (else the next boundary in reach, never past 40 m); a guyed pole at each corner (the
203
208
  end of a street at another, a T, is a corner too) and each end of line, the corners of two streets joined by a span; an in-line pole at
@@ -205,9 +210,12 @@ validateNetworks(networks, { connections, surfaceAt }) // [] for a plan the gene
205
210
  stands farther back. Each street pole carries a lamp on its arm over the road (`light_feed` from its low voltage).
206
211
  - **Power**: one system per feed where a street leaves the map (no span over a river); circuits cut on the pole tree so that the line each way
207
212
  from the transformer stays within 200 m and the diversified demand (plus the lamps) within the largest rating; each transformer on its
208
- circuit's centre, sized by `pickTransformer`, a circuit over the largest rating split into more; medium voltage only from the feed to the
209
- transformers; a drop from the nearest pole to every lot.
213
+ circuit's centre, sized by `pickTransformer`, a circuit over the largest rating split into more; medium voltage on every street pole of the feeder
214
+ and to each transformer; a drop from the nearest pole to every lot.
210
215
  Lots of the periphery (`layout.periphery.kinds`) get a few hookups with no meter (`spec: 'unmetered'`), counted in the load.
216
+ - **Drops** follow the street's practice: from the pole in front of the lot, or straight across the street (within `power.dropMaxSkew`, 30°, of
217
+ its normal), never over another lot, at most `power.dropsPerPole` (4) on a pole; a lot no pole can feed so gets an in-line pole at its station.
218
+ `validateNetworks(..., { frontages })` checks it (`drop_skewed`, `drop_off_frontage`, `drop_over_other_lot`, `pole_too_many_drops`).
211
219
  - **Telecom** on every pole from its own feed, 1-2 cables in the centre and 3-5 in the periphery, a splice box with its reserve coil every 4 spans.
212
220
  - **Sewer**: DN 150 under the axis, a manhole at every crossing and at most 80 m apart, a cleanout at each dry head, falling at least 0.5 %
213
221
  to the river bank, then an interceptor along the bank to a `treatment` node where the river leaves the map (with no river, from the line's
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as LightAllowance, U as UrbanBuilder, D as DistrictKindDef, C as CityPlanInput, T as TowerPreset, F as FillBlockOptions, B as BlockBuilding, a as CityPlanDef, b as LayoutOptions, c as CityLayout, K as KindStats, d as Block, e as FillBlockCityOptions, f as ComposeOptions, g as UrbanKitCore, N as NeighbourhoodPattern, h as Composer, i as UrbanPlan, j as Locale, P as Point, R as Rect, k as TerrainOptions, l as TerrainGrid, m as PoleDef, n as PoleOptions, o as PoleShapeBuilder, p as TowerOptions, q as BuildingOptions, S as SilhouetteFactory, H as HouseProvider, r as PlantRequest, V as VehicleRequest, s as PlantProvider, t as VehicleProvider } from './types-CYeqw_58.js';
2
- export { u as BarSpec, v as BlockUse, w as CityScale, x as ColorRule, y as ComposeContext, z as ConePart, A as CrossarmSpec, E as CrownPart, G as DEFAULT_FACADES, I as DEFAULT_POLES, J as DEFAULT_STOREY_PRESETS, M as DEFAULT_TOWER_PRESETS, O as DistributionPoleDef, Q as DistributionSpec, W as DistrictKindText, X as DoubleArmSpec, Y as Flatten, Z as Flickering, _ as FloodTowerSpec, $ as ForestOptions, a0 as HouseRequest, a1 as ItemBox, a2 as LabelPart, a3 as Lake, a4 as LampLightSpec, a5 as LampSpec, a6 as LanternSpec, a7 as LensSpec, a8 as LightBudget, a9 as LightPart, aa as MastSpec, ab as POLE_SHAPES, ac as PartStyle, ad as PatternText, ae as PlacementPart, af as PlanDistrict, ag as PlanLandmark, ah as PlanLine, ai as PlanPoint, aj as PlanRect, ak as PlanePart, al as PoleSlotBand, am as PoleSlots, an as Providers, ao as Ramp, ap as ResolvedDistrict, aq as River, ar as RiverBed, as as SingleArmSpec, at as TOWER_DEFAULTS, au as TerrainLayer, av as TerrainPart, aw as TowerProvider, ax as TowerRequest, ay as Trig, az as UrbanBuilderOptions, aA as UrbanPart, aB as UrbanScene, aC as VaultPart, aD as Wave, aE as WorldFrame, aF as createTowerDrawer, aG as createUrbanBuilder, aH as drawBuilding, aI as drawTower, aJ as fillBlock, aK as pickTowerPreset, aL as towerPresetOf, aM as towerStoreys } from './types-CYeqw_58.js';
1
+ import { L as LightAllowance, U as UrbanBuilder, D as DistrictKindDef, C as CityPlanInput, T as TowerPreset, F as FillBlockOptions, B as BlockBuilding, a as CityPlanDef, b as LayoutOptions, c as CityLayout, K as KindStats, d as Block, e as FillBlockCityOptions, f as ComposeOptions, g as UrbanKitCore, N as NeighbourhoodPattern, h as Composer, i as UrbanPlan, j as Locale, P as Point, R as Rect, k as TerrainOptions, l as TerrainGrid, m as PoleDef, n as PoleOptions, o as PoleShapeBuilder, p as TowerOptions, q as BuildingOptions, S as SilhouetteFactory, H as HouseProvider, r as PlantRequest, V as VehicleRequest, s as PlantProvider, t as VehicleProvider } from './types-mY6VwZgN.js';
2
+ export { u as BarSpec, v as BlockUse, w as CityScale, x as ColorRule, y as ComposeContext, z as ConePart, A as CrossarmSpec, E as CrownPart, G as DEFAULT_FACADES, I as DEFAULT_POLES, J as DEFAULT_STOREY_PRESETS, M as DEFAULT_TOWER_PRESETS, O as DistributionPoleDef, Q as DistributionSpec, W as DistrictKindText, X as DoubleArmSpec, Y as Flatten, Z as Flickering, _ as FloodTowerSpec, $ as ForestOptions, a0 as HouseRequest, a1 as ItemBox, a2 as LabelPart, a3 as Lake, a4 as LampLightSpec, a5 as LampShares, a6 as LampSpec, a7 as LampState, a8 as LampStateParams, a9 as LanternSpec, aa as LensSpec, ab as LightBudget, ac as LightPart, ad as MastSpec, ae as POLE_SHAPES, af as PartStyle, ag as PatternText, ah as PlacementPart, ai as PlanDistrict, aj as PlanLandmark, ak as PlanLine, al as PlanPoint, am as PlanRect, an as PlanePart, ao as PoleSlotBand, ap as PoleSlots, aq as Providers, ar as Ramp, as as ResolvedDistrict, at as River, au as RiverBed, av as SingleArmSpec, aw as TOWER_DEFAULTS, ax as TerrainLayer, ay as TerrainPart, az as TowerProvider, aA as TowerRequest, aB as Trig, aC as UrbanBuilderOptions, aD as UrbanPart, aE as UrbanScene, aF as VaultPart, aG as Wave, aH as WorldFrame, aI as assertLampShares, aJ as createTowerDrawer, aK as createUrbanBuilder, aL as drawBuilding, aM as drawTower, aN as fillBlock, aO as flickerPhaseOf, aP as lampStateOf, aQ as pickTowerPreset, aR as towerPresetOf, aS as towerStoreys } from './types-mY6VwZgN.js';
3
3
  import { DeepPartial } from '@adatechnology/game-contracts';
4
4
  import { RandomSource } from '@adatechnology/game-floorplan';
5
5
  export { RandomSource, Silhouette, SilhouettePart, SilhouetteWindow } from '@adatechnology/game-floorplan';
@@ -10,32 +10,6 @@ declare function createLightAllowance(count: number): LightAllowance;
10
10
  /** @deprecated Renamed `createLightAllowance`: `LightBudget` is the name of the render budget of `@adatechnology/game-render-three`. Removed in the next major. */
11
11
  declare const createLightBudget: typeof createLightAllowance;
12
12
 
13
- /** How the lamps of a street are kept: `lit` is the share of lamps that work, `flicker` the share of all lamps that work badly (a part of `lit`). The rest are burnt out. */
14
- type LampShares = {
15
- readonly lit: number;
16
- readonly flicker: number;
17
- };
18
- /** One lamp: `on` for `PoleOptions.on`, `flicker` for `PoleOptions.flicker`. */
19
- type LampState = {
20
- readonly on: boolean;
21
- readonly flicker: boolean;
22
- };
23
- type LampStateParams = {
24
- readonly seed: number;
25
- readonly x: number;
26
- readonly z: number;
27
- readonly shares: LampShares;
28
- };
29
- /** The phase (radians, [0, 2π)) a failing lamp at `x, z` flickers on: its lens and its light share it. A drawer may round it: game-urban-three rounds it to 4 groups, so about a quarter of the failing lamps blink in step. */
30
- declare const flickerPhaseOf: (x: number, z: number) => number;
31
- /** Throws when the shares are not `0 <= flicker <= lit <= 1`. */
32
- declare function assertLampShares(shares: LampShares): void;
33
- /**
34
- * Whether the lamp standing at `x, z` works, flickers or is burnt out, by a hash of the seed and the spot: the same street with the same seed keeps the same dead and failing lamps,
35
- * and the choice does not draw from the builder's random, so the scene around it keeps its draw order.
36
- */
37
- declare function lampStateOf({ seed, x, z, shares }: LampStateParams): LampState;
38
-
39
13
  /** Look of the road surface and its centre line; the defaults are the Galeria's. */
40
14
  type RoadStyle = {
41
15
  color: number;
@@ -825,4 +799,4 @@ declare const TOWER_SAMPLE_CELLS: Readonly<Record<string, {
825
799
  z: number;
826
800
  }>>;
827
801
 
828
- export { Block, BlockBuilding, type BuilderOptions, BuildingOptions, COMPOSERS, type Cities, type CitiesOptions, CityLayout, CityPlanDef, CityPlanInput, ComposeOptions, Composer, DEFAULT_CITY_PLANS, DEFAULT_DISTRICT_KINDS, DEFAULT_LIGHT_ALLOWANCE, DEFAULT_LIGHT_BUDGET, DEFAULT_MAX_FLOORS, DEFAULT_PATTERNS, DEFAULT_PLANT_CONTEXTS, DEFAULT_PROP_COLORS, DEFAULT_ROAD_STYLE, DEFAULT_STREET, DEFAULT_URBAN_SEED, DEFAULT_WALK_STYLE, DistrictKindDef, type DowntownParams, FillBlockCityOptions, FillBlockOptions, type HistoricParams, HouseProvider, type IndustrialParams, KindStats, type LampShares, type LampState, type LampStateParams, LayoutOptions, LightAllowance, Locale, type MilitaryParams, type MountainParams, NeighbourhoodPattern, type Origin, PARKED_VEHICLE_IDS, PlantProvider, type PlantProviderOptions, PlantRequest, Point, type Pole, PoleDef, PoleOptions, PoleShapeBuilder, type PropColors, type RailwayParams, Rect, type RoadStyle, type RuralParams, SAMPLE_CELLS, SILHOUETTE_TYPOLOGIES, type SampleSheetOptions, SilhouetteFactory, type StiltParams, type StreetOptions, type SuburbParams, TOWER_PATTERNS, TOWER_SAMPLE_CELLS, type Terrain, TerrainGrid, TerrainOptions, TowerOptions, TowerPreset, UrbanBuilder, type UrbanKit, UrbanKitCore, type UrbanOptions, UrbanPlan, VehicleProvider, type VehicleProviderOptions, VehicleRequest, type WalkStyle, type WorkingClassParams, assertLampShares, clamp, composePattern, createCities, createLightAllowance, createLightBudget, createPlantProvider, createSilhouetteHouses, createTerrain, createUrban, createVehicleProvider, distanceToPolyline, drawContainer, drawFence, drawGround, drawPine, drawRoad, drawSandbags, drawStreetGrid, drawStripLabel, drawTent, drawTerrain, drawTree, drawWalk, drawWatchtower, drawWires, flickerPhaseOf, hash2, insideEllipse, insideRect, lampStateOf, lerp, patternMarker, smoothstep };
802
+ export { Block, BlockBuilding, type BuilderOptions, BuildingOptions, COMPOSERS, type Cities, type CitiesOptions, CityLayout, CityPlanDef, CityPlanInput, ComposeOptions, Composer, DEFAULT_CITY_PLANS, DEFAULT_DISTRICT_KINDS, DEFAULT_LIGHT_ALLOWANCE, DEFAULT_LIGHT_BUDGET, DEFAULT_MAX_FLOORS, DEFAULT_PATTERNS, DEFAULT_PLANT_CONTEXTS, DEFAULT_PROP_COLORS, DEFAULT_ROAD_STYLE, DEFAULT_STREET, DEFAULT_URBAN_SEED, DEFAULT_WALK_STYLE, DistrictKindDef, type DowntownParams, FillBlockCityOptions, FillBlockOptions, type HistoricParams, HouseProvider, type IndustrialParams, KindStats, LayoutOptions, LightAllowance, Locale, type MilitaryParams, type MountainParams, NeighbourhoodPattern, type Origin, PARKED_VEHICLE_IDS, PlantProvider, type PlantProviderOptions, PlantRequest, Point, type Pole, PoleDef, PoleOptions, PoleShapeBuilder, type PropColors, type RailwayParams, Rect, type RoadStyle, type RuralParams, SAMPLE_CELLS, SILHOUETTE_TYPOLOGIES, type SampleSheetOptions, SilhouetteFactory, type StiltParams, type StreetOptions, type SuburbParams, TOWER_PATTERNS, TOWER_SAMPLE_CELLS, type Terrain, TerrainGrid, TerrainOptions, TowerOptions, TowerPreset, UrbanBuilder, type UrbanKit, UrbanKitCore, type UrbanOptions, UrbanPlan, VehicleProvider, type VehicleProviderOptions, VehicleRequest, type WalkStyle, type WorkingClassParams, clamp, composePattern, createCities, createLightAllowance, createLightBudget, createPlantProvider, createSilhouetteHouses, createTerrain, createUrban, createVehicleProvider, distanceToPolyline, drawContainer, drawFence, drawGround, drawPine, drawRoad, drawSandbags, drawStreetGrid, drawStripLabel, drawTent, drawTerrain, drawTree, drawWalk, drawWatchtower, drawWires, hash2, insideEllipse, insideRect, lerp, patternMarker, smoothstep };
@@ -3071,7 +3071,13 @@ var GameUrban = (() => {
3071
3071
  lens: { lit: 16752704, unlit: 3815994 },
3072
3072
  light: { color: 16751168, intensity: 1.3, distance: 20, y: 6.4 },
3073
3073
  transformer: { offset: 0.45, y: 7.7, radius: 0.32, height: 1, color: 5922402, segments: 8 },
3074
- slots: DEFAULT_POLE_SLOTS
3074
+ slots: DEFAULT_POLE_SLOTS,
3075
+ crossarm: { reach: 0.3, width: 2, height: 0.1, depth: 0.09, color: 9211014 },
3076
+ insulators: { at: [-0.55, 0.35, 1.15], radius: 0.04, color: 14210248 },
3077
+ bushings: { spread: 0.16, radius: 0.025, height: 0.14, color: 11055288 },
3078
+ lowVoltage: { out: 0.2, color: 6185060 },
3079
+ telecom: { out: 0.18, color: 6185060 },
3080
+ guy: { reach: 3, color: 8027262 }
3075
3081
  };
3076
3082
 
3077
3083
  // src/poles.ts