@adatechnology/game-urban 0.6.0 → 0.7.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 +1 -1
- package/dist/index.global.js +4 -2
- package/dist/index.global.js.map +1 -1
- package/dist/networks/index.d.ts +4 -2
- package/dist/networks/index.js +11 -6
- package/dist/networks/index.js.map +1 -1
- package/package.json +4 -4
package/dist/networks/index.d.ts
CHANGED
|
@@ -849,7 +849,9 @@ type LeaksOptions = {
|
|
|
849
849
|
* The leaks a breach opens: one for each pipe the bowl severed, of its content, at the break. Water runs under pressure and comes up out of the crater; sewage runs slow; stormwater only runs
|
|
850
850
|
* when it rains. Each is finite (`rate` for `seconds`): `drainLeak` gives what a step lets out until nothing is left. Pure, in the order of the breach.
|
|
851
851
|
*/
|
|
852
|
-
declare function leaksOf(networks: Pick<UtilityNetworks, 'nodes' | 'edges'>, breach: Breach,
|
|
852
|
+
declare function leaksOf(networks: Pick<UtilityNetworks, 'nodes' | 'edges'>, breach: Breach, options: LeaksOptions): NetworkLeak[];
|
|
853
|
+
/** The leak of one pipe a breach reached (any buried pipe: a street's or a house's): none while it is not severed, nor for a drain when it does not rain. */
|
|
854
|
+
declare function leakOfPipe(pipe: PipePiece, reached: PipeBreach, { isRaining, rules }: LeaksOptions): NetworkLeak | undefined;
|
|
853
855
|
/** A leak being let out: what is left of it. */
|
|
854
856
|
type LeakState = {
|
|
855
857
|
readonly leak: NetworkLeak;
|
|
@@ -867,4 +869,4 @@ declare function waterOutageOf(networks: Pick<UtilityNetworks, 'nodes' | 'edges'
|
|
|
867
869
|
readonly after: readonly string[];
|
|
868
870
|
}): NetworkOutage | undefined;
|
|
869
871
|
|
|
870
|
-
export { type AerialClass, type AerialEdgeKind, type Breach, type BuriedEdgeKind, CONNECTION_NETWORK, COVER_PLATE_PART, type ClearanceRow, type CoverBody, type CoverRange, type Crater, DEFAULT_LEAK_RULES, DEFAULT_NETWORK_LAYOUT, DEFAULT_NETWORK_RULES, DEFAULT_POLE_SLOTS, DISTRIBUTION, type DefaultConnectionRules, DistributionSpec, type DiversityBand, type DropMisfit, EDGE_CLASS, EDGE_NETWORK, type GenerateNetworksParams, type GeneratedNetworks, type GroundAt, type HardwareBox, type HardwareCylinder, type HardwareRole, type LeakRule, type LeakRules, type LeakState, type LeaksOptions, type LotFrontage, NETWORK_ENDS, NETWORK_FLOW, NETWORK_VIOLATION, type NetworkBuilding, type NetworkClass, type NetworkCrown, type NetworkEdge, type NetworkEdgeKind, type NetworkEvent, type NetworkGraph, type NetworkKind, type NetworkLamp, type NetworkLampsParams, type NetworkLayoutRules, type NetworkLeak, type NetworkLot, type NetworkNode, type NetworkNodeKind, type NetworkOutage, type NetworkRules, type NetworkSurface, type NetworkViolation, type NetworkViolationCode, type NetworkWarning, POLE_SLOT_GAPS, POLE_SLOT_ORDER, type PipeBreach, type PipeContent, type PipePiece, type PoleAttachments, type PoleHardware, type PoleHardwareOptions, type PoleHeights, type PolePoint, PoleSlotBand, type PoleSlotViolation, PoleSlots, type PowerRules, ROAD_SURFACE_LEVEL, type RunEnd, type ServedLot, type Shaft, type StreetRun, type SurfaceKind, type SurfaceMaterial, type SurfacePiece, type SurfacePiecesOptions, type TransformerRating, type UtilityNetworks, type ValidateNetworksOptions, bowlDepthAt, breachOf, buildNetworkGraph, checkPoleSlots, circuitOf, connectedNodes, coverBodyOf, coverOf, coverThrowOf, defaultConnectionsOf, distributionHardwareOf, diversifiedDemand, drainLeak, dropMisfitOf, edgeLength, frontagesOf, generateNetworks, isAerialEdgeKind, leaksOf, lotUnderDrop, networkLampsOf, openingOf, pickTransformer, pipePiecesOf, poleHeightsOf, resolveNetworkRules, slotsOfPole, startLeak, surfaceOf, surfacePiecesOf, validateNetworks, waterOutageOf };
|
|
872
|
+
export { type AerialClass, type AerialEdgeKind, type Breach, type BuriedEdgeKind, CONNECTION_NETWORK, COVER_PLATE_PART, type ClearanceRow, type CoverBody, type CoverRange, type Crater, DEFAULT_LEAK_RULES, DEFAULT_NETWORK_LAYOUT, DEFAULT_NETWORK_RULES, DEFAULT_POLE_SLOTS, DISTRIBUTION, type DefaultConnectionRules, DistributionSpec, type DiversityBand, type DropMisfit, EDGE_CLASS, EDGE_NETWORK, type GenerateNetworksParams, type GeneratedNetworks, type GroundAt, type HardwareBox, type HardwareCylinder, type HardwareRole, type LeakRule, type LeakRules, type LeakState, type LeaksOptions, type LotFrontage, NETWORK_ENDS, NETWORK_FLOW, NETWORK_VIOLATION, type NetworkBuilding, type NetworkClass, type NetworkCrown, type NetworkEdge, type NetworkEdgeKind, type NetworkEvent, type NetworkGraph, type NetworkKind, type NetworkLamp, type NetworkLampsParams, type NetworkLayoutRules, type NetworkLeak, type NetworkLot, type NetworkNode, type NetworkNodeKind, type NetworkOutage, type NetworkRules, type NetworkSurface, type NetworkViolation, type NetworkViolationCode, type NetworkWarning, POLE_SLOT_GAPS, POLE_SLOT_ORDER, type PipeBreach, type PipeContent, type PipePiece, type PoleAttachments, type PoleHardware, type PoleHardwareOptions, type PoleHeights, type PolePoint, PoleSlotBand, type PoleSlotViolation, PoleSlots, type PowerRules, ROAD_SURFACE_LEVEL, type RunEnd, type ServedLot, type Shaft, type StreetRun, type SurfaceKind, type SurfaceMaterial, type SurfacePiece, type SurfacePiecesOptions, type TransformerRating, type UtilityNetworks, type ValidateNetworksOptions, bowlDepthAt, breachOf, buildNetworkGraph, checkPoleSlots, circuitOf, connectedNodes, coverBodyOf, coverOf, coverThrowOf, defaultConnectionsOf, distributionHardwareOf, diversifiedDemand, drainLeak, dropMisfitOf, edgeLength, frontagesOf, generateNetworks, isAerialEdgeKind, leakOfPipe, leaksOf, lotUnderDrop, networkLampsOf, openingOf, pickTransformer, pipePiecesOf, poleHeightsOf, resolveNetworkRules, slotsOfPole, startLeak, surfaceOf, surfacePiecesOf, validateNetworks, waterOutageOf };
|
package/dist/networks/index.js
CHANGED
|
@@ -2300,17 +2300,21 @@ var DEFAULT_LEAK_RULES = {
|
|
|
2300
2300
|
stormwater: { mainRate: 2, branchRate: 0.6, seconds: 240, isPressurised: false }
|
|
2301
2301
|
};
|
|
2302
2302
|
var BRANCH_KINDS = /* @__PURE__ */ new Set(["water_service", "sewer_lateral", "storm_lateral"]);
|
|
2303
|
-
function leaksOf(networks, breach,
|
|
2303
|
+
function leaksOf(networks, breach, options) {
|
|
2304
2304
|
const pipes = new Map(pipePiecesOf(networks).map((pipe) => [pipe.id, pipe]));
|
|
2305
2305
|
return breach.pipes.flatMap((reached) => {
|
|
2306
2306
|
const pipe = pipes.get(reached.id);
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
const rule = rules[reached.content];
|
|
2310
|
-
const rate = BRANCH_KINDS.has(pipe.kind) ? rule.branchRate : rule.mainRate;
|
|
2311
|
-
return [{ id: reached.id, content: reached.content, at: reached.at, diameter: pipe.diameter, rate, volume: rate * rule.seconds, isPressurised: rule.isPressurised }];
|
|
2307
|
+
const leak = pipe === void 0 ? void 0 : leakOfPipe(pipe, reached, options);
|
|
2308
|
+
return leak === void 0 ? [] : [leak];
|
|
2312
2309
|
});
|
|
2313
2310
|
}
|
|
2311
|
+
function leakOfPipe(pipe, reached, { isRaining, rules = DEFAULT_LEAK_RULES }) {
|
|
2312
|
+
if (!reached.severed) return void 0;
|
|
2313
|
+
if (reached.content === "stormwater" && !isRaining) return void 0;
|
|
2314
|
+
const rule = rules[reached.content];
|
|
2315
|
+
const rate = BRANCH_KINDS.has(pipe.kind) ? rule.branchRate : rule.mainRate;
|
|
2316
|
+
return { id: reached.id, content: reached.content, at: reached.at, diameter: pipe.diameter, rate, volume: rate * rule.seconds, isPressurised: rule.isPressurised };
|
|
2317
|
+
}
|
|
2314
2318
|
function startLeak(leak) {
|
|
2315
2319
|
return { leak, remaining: leak.volume };
|
|
2316
2320
|
}
|
|
@@ -2365,6 +2369,7 @@ export {
|
|
|
2365
2369
|
frontagesOf,
|
|
2366
2370
|
generateNetworks,
|
|
2367
2371
|
isAerialEdgeKind,
|
|
2372
|
+
leakOfPipe,
|
|
2368
2373
|
leaksOf,
|
|
2369
2374
|
lotUnderDrop,
|
|
2370
2375
|
networkLampsOf,
|