@jgengine/core 0.26.0 → 0.28.0
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/CHANGELOG.md +174 -0
- package/dist/ai/policeResponse.d.ts +253 -0
- package/dist/ai/policeResponse.js +421 -0
- package/dist/anim/actionLayer.d.ts +47 -0
- package/dist/anim/actionLayer.js +63 -0
- package/dist/anim/ikSolver.d.ts +14 -0
- package/dist/anim/ikSolver.js +37 -0
- package/dist/anim/locomotionGraph.d.ts +58 -3
- package/dist/anim/locomotionGraph.js +142 -15
- package/dist/anim/ragdollRig.d.ts +53 -0
- package/dist/anim/ragdollRig.js +132 -0
- package/dist/anim/skeletonStandard.d.ts +140 -0
- package/dist/anim/skeletonStandard.js +326 -0
- package/dist/combat/damageRuntime.d.ts +14 -1
- package/dist/combat/damageRuntime.js +62 -4
- package/dist/combat/death.js +7 -3
- package/dist/combat/deathReason.d.ts +7 -1
- package/dist/combat/effects.d.ts +25 -0
- package/dist/combat/effects.js +16 -0
- package/dist/combat/statusRuntime.d.ts +2 -0
- package/dist/combat/statusRuntime.js +1 -0
- package/dist/economy/loanBook.d.ts +182 -0
- package/dist/economy/loanBook.js +303 -0
- package/dist/economy/market.d.ts +161 -0
- package/dist/economy/market.js +248 -0
- package/dist/economy/transactionLedger.d.ts +162 -0
- package/dist/economy/transactionLedger.js +301 -0
- package/dist/editor/creatorStorage.js +3 -1
- package/dist/editor/simulation.d.ts +5 -2
- package/dist/editor/simulation.js +29 -19
- package/dist/game/cameraConfig.d.ts +14 -0
- package/dist/game/clipRoles.d.ts +5 -4
- package/dist/game/clipRoles.js +34 -4
- package/dist/game/events.d.ts +27 -0
- package/dist/game/gameSave.d.ts +142 -0
- package/dist/game/gameSave.js +174 -0
- package/dist/game/playableGame.d.ts +74 -6
- package/dist/game/saveSlotIndex.d.ts +54 -0
- package/dist/game/saveSlotIndex.js +71 -0
- package/dist/game/saveSlots.d.ts +2 -0
- package/dist/game/saveSlots.js +1 -1
- package/dist/game/saveStore.d.ts +8 -0
- package/dist/game/saveStore.js +16 -0
- package/dist/gameplay.d.ts +17 -2
- package/dist/gameplay.js +15 -0
- package/dist/inventory/carryLoad.d.ts +48 -0
- package/dist/inventory/carryLoad.js +44 -0
- package/dist/inventory/equipment.d.ts +95 -0
- package/dist/inventory/equipment.js +169 -0
- package/dist/inventory/inventoryModel.d.ts +15 -6
- package/dist/inventory/inventoryModel.js +54 -5
- package/dist/inventory/shapedGrid.d.ts +26 -0
- package/dist/inventory/shapedGrid.js +47 -0
- package/dist/loot/lootGen.d.ts +186 -0
- package/dist/loot/lootGen.js +437 -0
- package/dist/loot/lootWeapon.d.ts +35 -0
- package/dist/loot/lootWeapon.js +70 -0
- package/dist/meta/changelog.d.ts +1 -1
- package/dist/meta/changelog.js +156 -1
- package/dist/mission/compositions.d.ts +85 -0
- package/dist/mission/compositions.js +130 -0
- package/dist/mission/mission.d.ts +435 -0
- package/dist/mission/mission.js +770 -0
- package/dist/mission/triggers.d.ts +61 -0
- package/dist/mission/triggers.js +108 -0
- package/dist/nav/laneGraph.d.ts +178 -0
- package/dist/nav/laneGraph.js +671 -0
- package/dist/nav/traffic.d.ts +222 -0
- package/dist/nav/traffic.js +918 -0
- package/dist/physics/kinematicVehicle.d.ts +36 -0
- package/dist/physics/kinematicVehicle.js +15 -1
- package/dist/physics/vehicleDamage.d.ts +136 -0
- package/dist/physics/vehicleDamage.js +214 -0
- package/dist/physics/vehicleParts.d.ts +62 -0
- package/dist/physics/vehicleParts.js +65 -0
- package/dist/progression/gearScore.d.ts +56 -0
- package/dist/progression/gearScore.js +59 -0
- package/dist/progression/skillTree.d.ts +129 -0
- package/dist/progression/skillTree.js +265 -0
- package/dist/progression/xpCurve.d.ts +60 -0
- package/dist/progression/xpCurve.js +141 -0
- package/dist/runtime/context/combat.js +11 -0
- package/dist/scene/builtinSceneKinds.js +2 -0
- package/dist/settings/accessibilitySettings.d.ts +81 -0
- package/dist/settings/accessibilitySettings.js +152 -0
- package/dist/settings/graphicsProfile.d.ts +3 -0
- package/dist/settings/graphicsProfile.js +4 -0
- package/dist/settings/settingsModel.d.ts +1 -1
- package/dist/settings/settingsModel.js +1 -0
- package/dist/sim/nearAgents.d.ts +8 -1
- package/dist/sim/nearAgents.js +34 -17
- package/dist/sim/offScreen.d.ts +2 -1
- package/dist/sim/offScreen.js +14 -3
- package/dist/sim/population.d.ts +147 -0
- package/dist/sim/population.js +182 -0
- package/dist/sim/queue.d.ts +90 -0
- package/dist/sim/queue.js +171 -0
- package/dist/sim/rides.d.ts +287 -0
- package/dist/sim/rides.js +471 -0
- package/dist/sim/routine.js +19 -11
- package/dist/ui/loadingTips.d.ts +41 -0
- package/dist/ui/loadingTips.js +64 -0
- package/dist/ui/menuNav.d.ts +79 -0
- package/dist/ui/menuNav.js +147 -0
- package/dist/ui/menuTransition.d.ts +50 -0
- package/dist/ui/menuTransition.js +67 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.js +2 -0
- package/dist/vfx/effectLibrary.d.ts +98 -0
- package/dist/vfx/effectLibrary.js +181 -0
- package/dist/vfx/particleBudget.d.ts +40 -0
- package/dist/vfx/particleBudget.js +39 -0
- package/dist/vfx/particleDirector.d.ts +16 -0
- package/dist/vfx/particleDirector.js +18 -0
- package/dist/world/authoredSimulation.js +7 -1
- package/dist/world/captureCamera.d.ts +30 -0
- package/dist/world/captureCamera.js +19 -0
- package/dist/world/decalKind.d.ts +48 -0
- package/dist/world/decalKind.js +86 -0
- package/dist/world/features.d.ts +18 -5
- package/dist/world/features.js +1 -0
- package/dist/world/grassKind.d.ts +5 -0
- package/dist/world/grassKind.js +3 -0
- package/dist/world/terraform.d.ts +8 -0
- package/dist/world/terrain.d.ts +1 -0
- package/dist/world/terrain.js +2 -0
- package/dist/world.d.ts +7 -2
- package/dist/world.js +5 -0
- package/package.json +1 -1
- package/skills/jgengine/api.md +2 -2
- package/skills/jgengine-combat/SKILL.md +9 -1
- package/skills/jgengine-combat/api.md +5 -4
- package/skills/jgengine-combat/reference.md +4 -0
- package/skills/jgengine-gameplay/SKILL.md +86 -0
- package/skills/jgengine-gameplay/api.md +485 -16
- package/skills/jgengine-gameplay/capabilities.md +131 -4
- package/skills/jgengine-gameplay/reference-systems.md +118 -0
- package/skills/jgengine-world/SKILL.md +8 -0
- package/skills/jgengine-world/api.md +243 -11
- package/skills/jgengine-world/capabilities.md +61 -1
- package/skills/jgengine-world/recipes/character-animation.md +25 -2
- package/skills/jgengine-world/recipes/vehicle-feel.md +5 -0
- package/skills/jgengine-world/reference.md +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Missions driven from authored scene markers. A designer places a marker (or volume) in the editor
|
|
3
|
+
* and sets one of the registered mission actions in the inspector — `mission_start`,
|
|
4
|
+
* `mission_objective` or `mission_fail` — and the runtime starts, advances or fails the mission when
|
|
5
|
+
* an actor trips it. Nothing about the marker is mission-specific code; it is the shared authored
|
|
6
|
+
* trigger vocabulary, plus the marker positions a positional objective reads.
|
|
7
|
+
*/
|
|
8
|
+
import { type AuthoredTrigger, type TriggerActionDefinition, type TriggerDispatchEvent } from "../scene/authoredTriggers.js";
|
|
9
|
+
import type { SceneDocumentLike, ScenePoint3 } from "../world/sceneShapes.js";
|
|
10
|
+
import type { MissionRuntime } from "./mission.js";
|
|
11
|
+
/**
|
|
12
|
+
* Marker positions from an authored scene, keyed by marker id — what a positional objective reads.
|
|
13
|
+
*
|
|
14
|
+
* @capability mission-triggers read authored scene marker positions for positional objectives
|
|
15
|
+
*/
|
|
16
|
+
export declare function missionMarkers(document: SceneDocumentLike): Record<string, ScenePoint3>;
|
|
17
|
+
/**
|
|
18
|
+
* The mission actions a game registers so the editor inspector can assign them to a marker or volume.
|
|
19
|
+
* Params land flat on the object's `meta` beside `on`/`action`, like any authored trigger.
|
|
20
|
+
*
|
|
21
|
+
* @capability mission-triggers start, advance and fail a mission from authored scene markers
|
|
22
|
+
*/
|
|
23
|
+
export declare const MISSION_TRIGGER_ACTIONS: readonly TriggerActionDefinition[];
|
|
24
|
+
/**
|
|
25
|
+
* Register {@link MISSION_TRIGGER_ACTIONS} so the editor lists them. Idempotent; call at module load
|
|
26
|
+
* next to the game's catalogs.
|
|
27
|
+
*
|
|
28
|
+
* @capability mission-triggers start, advance and fail a mission from authored scene markers
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerMissionTriggerActions(): void;
|
|
31
|
+
/** Watches a document's authored mission triggers against moving actors. */
|
|
32
|
+
export interface MissionTriggerBridge {
|
|
33
|
+
/** Advance one tick; fires the mission actions the actors tripped. */
|
|
34
|
+
step(input: {
|
|
35
|
+
actors: readonly {
|
|
36
|
+
id: string;
|
|
37
|
+
position: readonly [number, number, number] | {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
z: number;
|
|
41
|
+
};
|
|
42
|
+
}[];
|
|
43
|
+
interact?: readonly string[];
|
|
44
|
+
}): readonly TriggerDispatchEvent[];
|
|
45
|
+
/** The mission triggers this bridge was built from. */
|
|
46
|
+
triggers(): readonly AuthoredTrigger[];
|
|
47
|
+
/** Drop membership so the next step re-fires enters for still-inside actors. */
|
|
48
|
+
reset(): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Wire authored markers to a {@link MissionRuntime}: an actor entering a `mission_start` marker starts
|
|
52
|
+
* the named mission, `mission_objective` completes the named objective, and `mission_fail` lands the
|
|
53
|
+
* named fail state. Pure membership math over the document, exactly like any other authored trigger.
|
|
54
|
+
*
|
|
55
|
+
* @capability mission-triggers start, advance and fail a mission from authored scene markers
|
|
56
|
+
*/
|
|
57
|
+
export declare function createMissionTriggerBridge(options: {
|
|
58
|
+
runtime: MissionRuntime;
|
|
59
|
+
document: SceneDocumentLike;
|
|
60
|
+
triggers?: readonly AuthoredTrigger[];
|
|
61
|
+
}): MissionTriggerBridge;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Missions driven from authored scene markers. A designer places a marker (or volume) in the editor
|
|
3
|
+
* and sets one of the registered mission actions in the inspector — `mission_start`,
|
|
4
|
+
* `mission_objective` or `mission_fail` — and the runtime starts, advances or fails the mission when
|
|
5
|
+
* an actor trips it. Nothing about the marker is mission-specific code; it is the shared authored
|
|
6
|
+
* trigger vocabulary, plus the marker positions a positional objective reads.
|
|
7
|
+
*/
|
|
8
|
+
import { createAuthoredTriggerRuntime, registerTriggerAction, } from "../scene/authoredTriggers.js";
|
|
9
|
+
/**
|
|
10
|
+
* Marker positions from an authored scene, keyed by marker id — what a positional objective reads.
|
|
11
|
+
*
|
|
12
|
+
* @capability mission-triggers read authored scene marker positions for positional objectives
|
|
13
|
+
*/
|
|
14
|
+
export function missionMarkers(document) {
|
|
15
|
+
const out = {};
|
|
16
|
+
for (const marker of document.markers) {
|
|
17
|
+
out[marker.id] = { x: marker.position.x, y: marker.position.y, z: marker.position.z };
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The mission actions a game registers so the editor inspector can assign them to a marker or volume.
|
|
23
|
+
* Params land flat on the object's `meta` beside `on`/`action`, like any authored trigger.
|
|
24
|
+
*
|
|
25
|
+
* @capability mission-triggers start, advance and fail a mission from authored scene markers
|
|
26
|
+
*/
|
|
27
|
+
export const MISSION_TRIGGER_ACTIONS = [
|
|
28
|
+
{
|
|
29
|
+
id: "mission_start",
|
|
30
|
+
label: "Start mission",
|
|
31
|
+
schema: { fields: [{ type: "text", key: "mission", label: "Mission", default: "" }] },
|
|
32
|
+
events: ["enter"],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "mission_objective",
|
|
36
|
+
label: "Complete mission objective",
|
|
37
|
+
schema: {
|
|
38
|
+
fields: [
|
|
39
|
+
{ type: "text", key: "mission", label: "Mission", default: "" },
|
|
40
|
+
{ type: "text", key: "objective", label: "Objective", default: "" },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
events: ["enter", "interact"],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "mission_fail",
|
|
47
|
+
label: "Fail mission",
|
|
48
|
+
schema: {
|
|
49
|
+
fields: [
|
|
50
|
+
{ type: "text", key: "mission", label: "Mission", default: "" },
|
|
51
|
+
{ type: "text", key: "state", label: "Fail state", default: "" },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
events: ["enter", "interact"],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Register {@link MISSION_TRIGGER_ACTIONS} so the editor lists them. Idempotent; call at module load
|
|
59
|
+
* next to the game's catalogs.
|
|
60
|
+
*
|
|
61
|
+
* @capability mission-triggers start, advance and fail a mission from authored scene markers
|
|
62
|
+
*/
|
|
63
|
+
export function registerMissionTriggerActions() {
|
|
64
|
+
for (const action of MISSION_TRIGGER_ACTIONS)
|
|
65
|
+
registerTriggerAction(action);
|
|
66
|
+
}
|
|
67
|
+
function textParam(event, key) {
|
|
68
|
+
const value = event.params[key];
|
|
69
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Wire authored markers to a {@link MissionRuntime}: an actor entering a `mission_start` marker starts
|
|
73
|
+
* the named mission, `mission_objective` completes the named objective, and `mission_fail` lands the
|
|
74
|
+
* named fail state. Pure membership math over the document, exactly like any other authored trigger.
|
|
75
|
+
*
|
|
76
|
+
* @capability mission-triggers start, advance and fail a mission from authored scene markers
|
|
77
|
+
*/
|
|
78
|
+
export function createMissionTriggerBridge(options) {
|
|
79
|
+
const handlers = {
|
|
80
|
+
mission_start: (event) => {
|
|
81
|
+
const mission = textParam(event, "mission");
|
|
82
|
+
if (mission !== undefined)
|
|
83
|
+
options.runtime.start(mission);
|
|
84
|
+
},
|
|
85
|
+
mission_objective: (event) => {
|
|
86
|
+
const mission = textParam(event, "mission");
|
|
87
|
+
const objective = textParam(event, "objective");
|
|
88
|
+
if (mission !== undefined && objective !== undefined)
|
|
89
|
+
options.runtime.signal(mission, objective);
|
|
90
|
+
},
|
|
91
|
+
mission_fail: (event) => {
|
|
92
|
+
const mission = textParam(event, "mission");
|
|
93
|
+
const state = textParam(event, "state");
|
|
94
|
+
if (mission !== undefined && state !== undefined)
|
|
95
|
+
options.runtime.fail(mission, state);
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
const runtime = createAuthoredTriggerRuntime({
|
|
99
|
+
document: options.document,
|
|
100
|
+
handlers,
|
|
101
|
+
triggers: options.triggers,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
step: (input) => runtime.step(input),
|
|
105
|
+
triggers: () => runtime.triggers(),
|
|
106
|
+
reset: () => runtime.reset(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { EditorDocument } from "../editor/types.js";
|
|
2
|
+
import type { Waypoint } from "./pathFollow.js";
|
|
3
|
+
/** A junction where lane spans meet. */
|
|
4
|
+
export interface LaneNode {
|
|
5
|
+
id: string;
|
|
6
|
+
at: Waypoint;
|
|
7
|
+
}
|
|
8
|
+
/** One directed lane span to resolve into the graph. */
|
|
9
|
+
export interface LaneEdgeConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
/** World-space centerline, in travel order. */
|
|
12
|
+
points: readonly Waypoint[];
|
|
13
|
+
/** Junction ids; omitted endpoints are joined geometrically by {@link LaneGraphConfig.joinRadius}. */
|
|
14
|
+
from?: string;
|
|
15
|
+
to?: string;
|
|
16
|
+
/** Speed limit in world units per second. */
|
|
17
|
+
speed?: number;
|
|
18
|
+
width?: number;
|
|
19
|
+
/** Ids of the parallel lanes on either side, used for lane changes. */
|
|
20
|
+
left?: string;
|
|
21
|
+
right?: string;
|
|
22
|
+
/** Arc positions, in metres, of parking spots on this lane. */
|
|
23
|
+
parking?: readonly number[];
|
|
24
|
+
/** Allowed as a traffic spawn point. */
|
|
25
|
+
entry?: boolean;
|
|
26
|
+
/** Allowed as a traffic removal point. */
|
|
27
|
+
exit?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Signal timing for one intersection; phases list the in-lanes each green window serves. */
|
|
30
|
+
export interface LaneSignalProgram {
|
|
31
|
+
greenSeconds: number;
|
|
32
|
+
yellowSeconds: number;
|
|
33
|
+
/** Red-for-all interval between phases. Default 0. */
|
|
34
|
+
allRedSeconds?: number;
|
|
35
|
+
/**
|
|
36
|
+
* In-lane ids served by each green phase, in cycle order. Omitted lets the traffic runtime derive
|
|
37
|
+
* them: one green per line of travel, so opposite approaches share a window.
|
|
38
|
+
*/
|
|
39
|
+
phases?: readonly (readonly string[])[];
|
|
40
|
+
}
|
|
41
|
+
/** How an intersection resolves which approach may enter next. */
|
|
42
|
+
export type LaneRightOfWay = "signal" | "priority";
|
|
43
|
+
/** Right-of-way and signal timing for one authored crossing. */
|
|
44
|
+
export interface LaneIntersectionConfig {
|
|
45
|
+
node: string;
|
|
46
|
+
/** Default `"priority"` (first come, first served) unless a signal program is given. */
|
|
47
|
+
kind?: LaneRightOfWay;
|
|
48
|
+
signal?: LaneSignalProgram;
|
|
49
|
+
/** Metres before the lane end where a car holds at the stop line. Default 6. */
|
|
50
|
+
stopLine?: number;
|
|
51
|
+
/** Seconds the signal cycle is shifted, to unsynchronize a street of intersections. Default 0. */
|
|
52
|
+
offsetSeconds?: number;
|
|
53
|
+
}
|
|
54
|
+
/** A resolved lane span: centerline, arc lengths, limit and adjacency. */
|
|
55
|
+
export interface LaneSpan {
|
|
56
|
+
id: string;
|
|
57
|
+
from: string;
|
|
58
|
+
to: string;
|
|
59
|
+
points: readonly Waypoint[];
|
|
60
|
+
/** Per-segment lengths; one fewer than `points`. */
|
|
61
|
+
segmentLengths: readonly number[];
|
|
62
|
+
length: number;
|
|
63
|
+
speed: number;
|
|
64
|
+
width: number;
|
|
65
|
+
left: string | null;
|
|
66
|
+
right: string | null;
|
|
67
|
+
parking: readonly number[];
|
|
68
|
+
entry: boolean;
|
|
69
|
+
exit: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** A resolved crossing: the lanes that feed it, the lanes that leave it, and its right-of-way. */
|
|
72
|
+
export interface LaneIntersection {
|
|
73
|
+
node: string;
|
|
74
|
+
at: Waypoint;
|
|
75
|
+
kind: LaneRightOfWay;
|
|
76
|
+
inLanes: readonly string[];
|
|
77
|
+
outLanes: readonly string[];
|
|
78
|
+
stopLine: number;
|
|
79
|
+
signal: LaneSignalProgram | null;
|
|
80
|
+
offsetSeconds: number;
|
|
81
|
+
}
|
|
82
|
+
/** A parking spot projected onto one lane at an arc position. */
|
|
83
|
+
export interface LaneSpot {
|
|
84
|
+
id: string;
|
|
85
|
+
lane: string;
|
|
86
|
+
/** Arc, in metres, along the lane where a car stands parked. */
|
|
87
|
+
arc: number;
|
|
88
|
+
}
|
|
89
|
+
/** World pose of a lane at an arc position. */
|
|
90
|
+
export interface LanePose {
|
|
91
|
+
laneId: string;
|
|
92
|
+
arc: number;
|
|
93
|
+
position: Waypoint;
|
|
94
|
+
/** Yaw of travel, matching engine `rotationY`. */
|
|
95
|
+
heading: number;
|
|
96
|
+
}
|
|
97
|
+
/** The authored lane graph: junctions, directed spans, crossings and parking spots. */
|
|
98
|
+
export interface LaneGraphConfig {
|
|
99
|
+
/** Junction positions; lanes may name them in `from`/`to` instead of joining by geometry. */
|
|
100
|
+
nodes?: readonly LaneNode[];
|
|
101
|
+
lanes: readonly LaneEdgeConfig[];
|
|
102
|
+
intersections?: readonly LaneIntersectionConfig[];
|
|
103
|
+
spots?: readonly LaneSpot[];
|
|
104
|
+
/** Distance within which two lane endpoints are the same junction. Default 3. */
|
|
105
|
+
joinRadius?: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Authored lane topology: junctions, directed spans with speed limits and arc lengths, crossings with
|
|
109
|
+
* their right-of-way, and parking spots. Positions come from the spans themselves, so a traffic
|
|
110
|
+
* runtime never re-derives geometry or runs a path search per vehicle.
|
|
111
|
+
*/
|
|
112
|
+
export interface LaneGraph {
|
|
113
|
+
node(id: string): LaneNode | null;
|
|
114
|
+
lane(id: string): LaneSpan | null;
|
|
115
|
+
laneIds(): readonly string[];
|
|
116
|
+
nodeIds(): readonly string[];
|
|
117
|
+
outLanes(nodeId: string): readonly string[];
|
|
118
|
+
inLanes(nodeId: string): readonly string[];
|
|
119
|
+
intersection(nodeId: string): LaneIntersection | null;
|
|
120
|
+
intersections(): readonly LaneIntersection[];
|
|
121
|
+
spots(): readonly LaneSpot[];
|
|
122
|
+
spot(id: string): LaneSpot | null;
|
|
123
|
+
/** Lanes a car may spawn on: an authored entry, or a lane whose start has no inbound traffic. */
|
|
124
|
+
entries(): readonly string[];
|
|
125
|
+
/** Lanes that leave the graph: an authored exit, or a lane that ends where nothing continues. */
|
|
126
|
+
exits(): readonly string[];
|
|
127
|
+
/** World pose at `arc` metres, shifted `lateral` metres to the driver's left. */
|
|
128
|
+
pose(laneId: string, arc: number, lateral?: number): LanePose | null;
|
|
129
|
+
/** Arc on `laneId` nearest a world XZ point, clamped to the span. */
|
|
130
|
+
project(laneId: string, x: number, z: number): number;
|
|
131
|
+
/** Travel heading at `arc` along a lane, in radians. */
|
|
132
|
+
heading(laneId: string, arc: number): number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Write the world pose at `arc` along a lane into a caller-owned record — the allocation-free form
|
|
136
|
+
* {@link LaneGraph.pose} wraps, for a runtime that poses hundreds of cars per tick.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
export declare function lanePoseInto(lane: LaneSpan, arc: number, lateral: number, out: {
|
|
140
|
+
x: number;
|
|
141
|
+
y: number;
|
|
142
|
+
z: number;
|
|
143
|
+
heading: number;
|
|
144
|
+
}): void;
|
|
145
|
+
/**
|
|
146
|
+
* Read handle over the graph resolved once at construction. The build mutates its working set; this
|
|
147
|
+
* object never changes, so a save system rebuilds it from the scene document instead of serializing it.
|
|
148
|
+
*
|
|
149
|
+
* @capability lane-graph directed lane topology with junctions, signals and parking for vehicle traffic
|
|
150
|
+
*/
|
|
151
|
+
export declare function createLaneGraph(config: LaneGraphConfig): LaneGraph;
|
|
152
|
+
/** How the document reader recognizes authored lane content. */
|
|
153
|
+
export interface LaneGraphDocumentOptions {
|
|
154
|
+
/** Path kinds authored as one directed lane each. Default `["traffic_lane"]`. */
|
|
155
|
+
laneKinds?: readonly string[];
|
|
156
|
+
/** Path kinds authored as a two-way road centerline, expanded into a lane per direction. Default `["road"]`. */
|
|
157
|
+
roadKinds?: readonly string[];
|
|
158
|
+
/** Marker kinds that carry an intersection's right-of-way in `meta`. Default `["traffic_intersection"]`. */
|
|
159
|
+
intersectionKinds?: readonly string[];
|
|
160
|
+
/** Marker kinds that place a parking spot. Default `["traffic_parking"]`. */
|
|
161
|
+
parkingKinds?: readonly string[];
|
|
162
|
+
/** Distance within which lane endpoints and markers join a junction. Default 3. */
|
|
163
|
+
joinRadius?: number;
|
|
164
|
+
/** Speed limit, in world units per second, by authored `meta.level`. */
|
|
165
|
+
speedByLevel?: Readonly<Record<string, number>>;
|
|
166
|
+
/** Speed limit for a path with no recognized level. Default 13. */
|
|
167
|
+
defaultSpeed?: number;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Read a lane graph out of an authored scene document. `traffic_lane` paths are one directed lane each;
|
|
171
|
+
* `road` paths (the editor's street bake) become a lane per direction, offset onto their own side of
|
|
172
|
+
* the road; `traffic_intersection` markers carry a signal program and right-of-way in `meta`;
|
|
173
|
+
* `traffic_parking` markers place parking spots. Runtime positions come from the paths, so editing a
|
|
174
|
+
* road moves its traffic instead of leaving a duplicate lane behind.
|
|
175
|
+
*
|
|
176
|
+
* @capability lane-graph-from-scene read an authored lane graph, signals and parking out of the scene document
|
|
177
|
+
*/
|
|
178
|
+
export declare function laneGraphFromDocument(doc: Pick<EditorDocument, "paths" | "markers">, options?: LaneGraphDocumentOptions): LaneGraph;
|