@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,287 @@
|
|
|
1
|
+
import { type ResponseCurve, type UtilityBrainSnapshot, type UtilityCandidate, type UtilityOption } from "../ai/utilityBrain.js";
|
|
2
|
+
import { type QueueWait, type WaitQueue, type WaitQueueSnapshot } from "./queue.js";
|
|
3
|
+
import type { NeedSet } from "./needs.js";
|
|
4
|
+
/** Where a ride is in its cycle. */
|
|
5
|
+
export type RidePhase = "idle" | "loading" | "riding" | "unloading" | "broken";
|
|
6
|
+
/** What a ride is worth to a guest. All three come from the ride's own data. */
|
|
7
|
+
export interface RideRatings {
|
|
8
|
+
/** How good the ride is; a higher rating draws more guests. */
|
|
9
|
+
readonly excitement: number;
|
|
10
|
+
/** Physical force; a guest past their comfort loses interest. */
|
|
11
|
+
readonly intensity: number;
|
|
12
|
+
/** Motion sickness; a guest past their comfort loses interest. */
|
|
13
|
+
readonly nausea: number;
|
|
14
|
+
}
|
|
15
|
+
/** Breakdown curve and money for one ride. All data, so a park tunes its own economy. */
|
|
16
|
+
export interface RideBreakdown {
|
|
17
|
+
/** Chance one completed cycle breaks the ride at zero wear. */
|
|
18
|
+
readonly baseChance: number;
|
|
19
|
+
/** Added chance per cycle since the last service — the wear curve. */
|
|
20
|
+
readonly wearChance: number;
|
|
21
|
+
/** Seconds the ride is out while it is repaired. */
|
|
22
|
+
readonly repairSeconds: number;
|
|
23
|
+
/** Money charged when a breakdown is repaired. */
|
|
24
|
+
readonly repairCost: number;
|
|
25
|
+
/** Money charged when a mechanic services the ride before it breaks. */
|
|
26
|
+
readonly serviceCost: number;
|
|
27
|
+
}
|
|
28
|
+
/** Everything a ride is: its ratings, its cycle and its wear. Content, not code. */
|
|
29
|
+
export interface RideDefinition {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly ratings: RideRatings;
|
|
32
|
+
/** Guests one cycle carries; the line keeps the rest. */
|
|
33
|
+
readonly capacity: number;
|
|
34
|
+
readonly loadSeconds: number;
|
|
35
|
+
readonly rideSeconds: number;
|
|
36
|
+
readonly unloadSeconds: number;
|
|
37
|
+
/** Omit for a ride that never breaks down. */
|
|
38
|
+
readonly breakdown?: RideBreakdown;
|
|
39
|
+
}
|
|
40
|
+
/** A ride's line as a game or the devtools overlay reads it. */
|
|
41
|
+
export interface RideQueueView {
|
|
42
|
+
readonly size: number;
|
|
43
|
+
/** Wait facing a guest joining now, from the queue's own throughput. */
|
|
44
|
+
readonly wait: QueueWait;
|
|
45
|
+
}
|
|
46
|
+
/** One ride's live state. */
|
|
47
|
+
export interface RideView {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly ratings: RideRatings;
|
|
50
|
+
readonly capacity: number;
|
|
51
|
+
readonly phase: RidePhase;
|
|
52
|
+
/** Seconds left in the current phase; `0` while idle. */
|
|
53
|
+
readonly phaseSeconds: number;
|
|
54
|
+
/** Guests on board right now. */
|
|
55
|
+
readonly riders: number;
|
|
56
|
+
readonly queue: RideQueueView;
|
|
57
|
+
readonly cycles: number;
|
|
58
|
+
/** Completed cycles since the ride was last serviced — what the wear curve reads. */
|
|
59
|
+
readonly wear: number;
|
|
60
|
+
readonly breakdowns: number;
|
|
61
|
+
/** Money this ride has cost in repairs and services. */
|
|
62
|
+
readonly spend: number;
|
|
63
|
+
}
|
|
64
|
+
/** Counters a devtools probe or test reads. */
|
|
65
|
+
export interface RideStats {
|
|
66
|
+
rides: number;
|
|
67
|
+
broken: number;
|
|
68
|
+
riders: number;
|
|
69
|
+
queued: number;
|
|
70
|
+
boarded: number;
|
|
71
|
+
cycles: number;
|
|
72
|
+
breakdowns: number;
|
|
73
|
+
/** Money spent on repairs and services since creation. */
|
|
74
|
+
spend: number;
|
|
75
|
+
ticks: number;
|
|
76
|
+
/** Slowest single `tick` seen so far, in milliseconds. */
|
|
77
|
+
slowestTickMs: number;
|
|
78
|
+
}
|
|
79
|
+
/** Where a ride's boardings, alightings and breakdowns are announced. Every hook is optional. */
|
|
80
|
+
export interface RideTickSink {
|
|
81
|
+
onBoard?(rideId: string, guestId: string, at: number): void;
|
|
82
|
+
onAlight?(rideId: string, guestId: string, at: number): void;
|
|
83
|
+
onBreak?(rideId: string, at: number): void;
|
|
84
|
+
onRepaired?(rideId: string, cost: number, at: number): void;
|
|
85
|
+
}
|
|
86
|
+
/** In-play dials a ride accepts from {@link RideSystem.retune}. */
|
|
87
|
+
export interface RideRetune {
|
|
88
|
+
readonly ratings?: Partial<RideRatings>;
|
|
89
|
+
readonly capacity?: number;
|
|
90
|
+
readonly loadSeconds?: number;
|
|
91
|
+
readonly rideSeconds?: number;
|
|
92
|
+
readonly unloadSeconds?: number;
|
|
93
|
+
/** Merge into the breakdown curve, or `null` to make the ride reliable. */
|
|
94
|
+
readonly breakdown?: Partial<RideBreakdown> | null;
|
|
95
|
+
}
|
|
96
|
+
/** What a service cost the caller. */
|
|
97
|
+
export interface RideServiceResult {
|
|
98
|
+
readonly id: string;
|
|
99
|
+
/** Money to debit; `0` when the ride had no wear to clear. */
|
|
100
|
+
readonly cost: number;
|
|
101
|
+
/** Completed cycles the service cleared. */
|
|
102
|
+
readonly wear: number;
|
|
103
|
+
}
|
|
104
|
+
/** Serializable park state: the clock, each ride's cycle position, wear and line. */
|
|
105
|
+
export interface RideSystemSnapshot {
|
|
106
|
+
elapsed: number;
|
|
107
|
+
rides: {
|
|
108
|
+
definition: RideDefinition;
|
|
109
|
+
phase: RidePhase;
|
|
110
|
+
timer: number;
|
|
111
|
+
riders: string[];
|
|
112
|
+
cycles: number;
|
|
113
|
+
wear: number;
|
|
114
|
+
breakdowns: number;
|
|
115
|
+
repairSpend: number;
|
|
116
|
+
serviceSpend: number;
|
|
117
|
+
boarded: number;
|
|
118
|
+
queue: WaitQueueSnapshot;
|
|
119
|
+
}[];
|
|
120
|
+
}
|
|
121
|
+
/** Everything a ride system needs. */
|
|
122
|
+
export interface RideSystemConfig {
|
|
123
|
+
readonly rides: readonly RideDefinition[];
|
|
124
|
+
/** `[0,1)` source for breakdown rolls; pass `ctx.rng`. Only read when a ride has a breakdown curve. */
|
|
125
|
+
readonly rng?: () => number;
|
|
126
|
+
/** Seed seconds per guest for a line that has not boarded yet. Default 8. */
|
|
127
|
+
readonly queueSeedServiceSeconds?: number;
|
|
128
|
+
/** Register a devtools probe under this name so the perf overlay shows the park. */
|
|
129
|
+
readonly devtoolsName?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The park's rides: each runs its own load → ride → unload cycle at its own capacity, takes guests
|
|
133
|
+
* off its own line, wears out against its own breakdown curve, and reports its own repairs and
|
|
134
|
+
* services. The clock is internal and only `tick` moves it, so a replay, a save and a test read the
|
|
135
|
+
* same cycle.
|
|
136
|
+
*
|
|
137
|
+
* Cost per tick is bounded by the ride count plus the guests one cycle boards.
|
|
138
|
+
*/
|
|
139
|
+
export interface RideSystem {
|
|
140
|
+
/** Seconds this system has ticked. */
|
|
141
|
+
now(): number;
|
|
142
|
+
/** Bumped by `retune` and `restore`, so a chooser can rebuild stale options. */
|
|
143
|
+
revision(): number;
|
|
144
|
+
rideIds(): readonly string[];
|
|
145
|
+
/** Live definitions, including any retuning. */
|
|
146
|
+
definitions(): readonly RideDefinition[];
|
|
147
|
+
ride(id: string): RideView | null;
|
|
148
|
+
/** Every ride's live state. Allocates — debug and decision paths. */
|
|
149
|
+
rides(): readonly RideView[];
|
|
150
|
+
queue(id: string): WaitQueue | null;
|
|
151
|
+
/** Put a guest at the back of a ride's line; false on an unknown ride or a guest already waiting. */
|
|
152
|
+
join(id: string, guestId: string): boolean;
|
|
153
|
+
leave(id: string, guestId: string): boolean;
|
|
154
|
+
/** Seconds a guest joining now would wait; `0` on an unknown ride. */
|
|
155
|
+
waitSeconds(id: string): number;
|
|
156
|
+
/** Advance every ride's cycle by `dt` seconds. */
|
|
157
|
+
tick(dt: number, sink?: RideTickSink): void;
|
|
158
|
+
/** Pay a ride's maintenance cost and clear its wear; nothing to pay when it has none. */
|
|
159
|
+
service(id: string): RideServiceResult | null;
|
|
160
|
+
retune(id: string, patch: RideRetune): boolean;
|
|
161
|
+
stats(): RideStats;
|
|
162
|
+
snapshot(): RideSystemSnapshot;
|
|
163
|
+
restore(next: RideSystemSnapshot): void;
|
|
164
|
+
/** Drop the devtools probe registered by `devtoolsName`. Safe to call twice. */
|
|
165
|
+
dispose(): void;
|
|
166
|
+
}
|
|
167
|
+
/** A ride's breakdown curve a park starts from when it has none and retunes only part of one. */
|
|
168
|
+
export declare const DEFAULT_RIDE_BREAKDOWN: RideBreakdown;
|
|
169
|
+
/**
|
|
170
|
+
* Create the rides a park runs. Each ride cycles on its own data, boards from its own line up to its
|
|
171
|
+
* own capacity, wears against its own breakdown curve and reports its repairs through the sink, so
|
|
172
|
+
* the caller keeps the wallet, the bodies and the visuals.
|
|
173
|
+
*
|
|
174
|
+
* @capability ride-sim rides with capacity, cycles, queues, ratings, breakdowns and maintenance
|
|
175
|
+
*/
|
|
176
|
+
export declare function createRideSystem(config: RideSystemConfig): RideSystem;
|
|
177
|
+
/** The rating scale a park's taste curves are normalized against. */
|
|
178
|
+
export interface RideRatingRange {
|
|
179
|
+
readonly excitementMax: number;
|
|
180
|
+
readonly intensityMax: number;
|
|
181
|
+
readonly nauseaMax: number;
|
|
182
|
+
}
|
|
183
|
+
/** A 0–10 rating scale, the usual shape of a ride catalog. Override it when a park rates differently. */
|
|
184
|
+
export declare const DEFAULT_RIDE_RATING_RANGE: RideRatingRange;
|
|
185
|
+
/** How empty a bored guest's fun need has to be before a ride starts to pull, by default. */
|
|
186
|
+
export declare const DEFAULT_RIDE_FUN_CURVE: ResponseCurve;
|
|
187
|
+
/**
|
|
188
|
+
* What one guest wants from a ride: the intensity and nausea they are comfortable with, and how long
|
|
189
|
+
* they will stand in line. All three are the guest's own data.
|
|
190
|
+
*/
|
|
191
|
+
export interface RideTaste {
|
|
192
|
+
/** Intensity rating this guest is happy with; a harder ride loses appeal past it. */
|
|
193
|
+
readonly intensityComfort: number;
|
|
194
|
+
/** Nausea rating this guest tolerates. */
|
|
195
|
+
readonly nauseaComfort: number;
|
|
196
|
+
/** Seconds of queue this guest accepts; at that wait a ride's appeal is spent. */
|
|
197
|
+
readonly queueTolerance: number;
|
|
198
|
+
}
|
|
199
|
+
/** Policy a park might vary when it turns taste and ride data into utility options. */
|
|
200
|
+
export interface RideChoicePolicy {
|
|
201
|
+
/** Rating scale the taste curves normalize against. Default {@link DEFAULT_RIDE_RATING_RANGE}. */
|
|
202
|
+
readonly range?: RideRatingRange;
|
|
203
|
+
/** Declared need whose emptiness makes every ride more attractive — a bored guest. */
|
|
204
|
+
readonly funNeed?: string;
|
|
205
|
+
/** Curve sampling that need. Default {@link DEFAULT_RIDE_FUN_CURVE}. */
|
|
206
|
+
readonly funCurve?: ResponseCurve;
|
|
207
|
+
/** Weight on the fun term. Default `1`. */
|
|
208
|
+
readonly funWeight?: number;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* One ride's standing appeal to one guest, before queue cost. Excitement draws, force and nausea
|
|
212
|
+
* push back — what a guest's own card or thought bubble can show.
|
|
213
|
+
*
|
|
214
|
+
* @capability ride-appeal how much one guest likes one ride, from its ratings and their taste
|
|
215
|
+
*/
|
|
216
|
+
export declare function rideAppeal(ratings: RideRatings, taste: RideTaste, range?: RideRatingRange): number;
|
|
217
|
+
/**
|
|
218
|
+
* Compile a guest's taste and the park's ride data into utility options, so the guest's pick comes
|
|
219
|
+
* from `createUtilityBrain` like every other decision it makes. Ride choice is one more set of
|
|
220
|
+
* options a guest can score, not a separate scoring function.
|
|
221
|
+
*
|
|
222
|
+
* @capability ride-choice guests pick rides by taste and queue tolerance through the utility brain
|
|
223
|
+
*/
|
|
224
|
+
export declare function rideChoiceOptions(rides: readonly RideDefinition[], taste: RideTaste, policy?: RideChoicePolicy): UtilityOption[];
|
|
225
|
+
/** The live queue a ride-choice candidate is costed against. {@link RideSystem} satisfies this. */
|
|
226
|
+
export interface RideWaitSource {
|
|
227
|
+
rideIds(): readonly string[];
|
|
228
|
+
waitSeconds(id: string): number;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Cost each ride by the wait its own line reports, so a guest weighs a ride by seconds in line
|
|
232
|
+
* rather than by a fixed order. `out` is reused for the array; the candidate records are not.
|
|
233
|
+
*
|
|
234
|
+
* @capability ride-choice guests pick rides by taste and queue tolerance through the utility brain
|
|
235
|
+
*/
|
|
236
|
+
export declare function rideChoiceCandidates(source: RideWaitSource, out?: UtilityCandidate[]): UtilityCandidate[];
|
|
237
|
+
/**
|
|
238
|
+
* Score points per second of queue wait: a guest's own tolerance is the denominator. A guest who
|
|
239
|
+
* merges rides into a brain that also scores food and exits uses this as its `costWeight`.
|
|
240
|
+
*
|
|
241
|
+
* @capability ride-choice guests pick rides by taste and queue tolerance through the utility brain
|
|
242
|
+
*/
|
|
243
|
+
export declare function rideQueueCostWeight(taste: RideTaste): number;
|
|
244
|
+
/** Serializable chooser state: the guest's taste and the brain's held pick. */
|
|
245
|
+
export interface RideChooserSnapshot {
|
|
246
|
+
taste: RideTaste;
|
|
247
|
+
brain: UtilityBrainSnapshot;
|
|
248
|
+
}
|
|
249
|
+
/** Everything a ride chooser needs: the park, the guest's taste, and the guest's needs. */
|
|
250
|
+
export interface RideChooserConfig {
|
|
251
|
+
readonly system: RideSystem;
|
|
252
|
+
readonly taste: RideTaste;
|
|
253
|
+
readonly needs: NeedSet;
|
|
254
|
+
readonly policy?: RideChoicePolicy;
|
|
255
|
+
/** Score margin a rival ride must clear before the guest changes their mind. Default `0.05`. */
|
|
256
|
+
readonly switchMargin?: number;
|
|
257
|
+
/** Seconds a pick is held before a rival may replace it. Default `0`. */
|
|
258
|
+
readonly minHoldSeconds?: number;
|
|
259
|
+
readonly rng?: () => number;
|
|
260
|
+
readonly devtoolsName?: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* One guest's ride choice over one park: taste becomes utility options, each ride is costed by its
|
|
264
|
+
* own line's wait, and the pick comes from the shared utility brain — so the same brain that picks
|
|
265
|
+
* food picks rides, and a guest's queue tolerance is a weight rather than a rule.
|
|
266
|
+
*/
|
|
267
|
+
export interface RideChooser {
|
|
268
|
+
/** Pick a ride for this guest now, or `null` when the park has no rides. */
|
|
269
|
+
choose(): string | null;
|
|
270
|
+
/** Need-driven appeal of one ride for this guest, queue excluded. Throws on an unknown ride. */
|
|
271
|
+
scoreOf(rideId: string): number;
|
|
272
|
+
/** Decay needs and age the hold timer; call once per tick before `choose`. */
|
|
273
|
+
advance(dt: number): void;
|
|
274
|
+
/** Replace this guest's taste, keeping the held pick when that ride still exists. */
|
|
275
|
+
setTaste(taste: RideTaste): void;
|
|
276
|
+
snapshot(): RideChooserSnapshot;
|
|
277
|
+
restore(next: RideChooserSnapshot): void;
|
|
278
|
+
/** Drop the devtools probe registered by `devtoolsName`. Safe to call twice. */
|
|
279
|
+
dispose(): void;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Create one guest's ride choice over a park. Options are rebuilt when the park is retuned, so a
|
|
283
|
+
* coaster whose track changes its ratings is re-scored without rebuilding the guest.
|
|
284
|
+
*
|
|
285
|
+
* @capability ride-choice guests pick rides by taste and queue tolerance through the utility brain
|
|
286
|
+
*/
|
|
287
|
+
export declare function createRideChooser(config: RideChooserConfig): RideChooser;
|